feat(agent_assets): 添加规则版本送审时的命名副本创建逻辑

当提交的版本与当前工作版本不同时,自动创建命名副本:
- 新增 _create_named_working_copy_for_review 方法处理送审时的版本复制
- 支持将工作版本快照复制为指定版本进行送审
- 新增 AgentAssetSpreadsheetChangeRecordRead schema
- API 端点新增 /rules/{id}/spreadsheet-versions/{version}/change-records 接口
This commit is contained in:
caoxiaozhu
2026-05-18 09:42:23 +00:00
parent 64ec27949f
commit 5106d286a1
7 changed files with 1039 additions and 72 deletions

View File

@@ -947,7 +947,7 @@ tbody tr.spotlight {
height: 100%;
align-self: stretch;
display: grid;
grid-template-rows: auto auto minmax(0, 1fr) auto;
grid-template-rows: auto minmax(0, 1fr) auto;
gap: 12px;
padding: 14px;
border: 1px solid #dbe4ee;
@@ -1101,6 +1101,10 @@ tbody tr.spotlight {
cursor: pointer;
}
.version-center-item > button:disabled {
cursor: default;
}
.version-center-item > button div {
display: flex;
align-items: center;
@@ -1115,7 +1119,8 @@ tbody tr.spotlight {
}
.version-center-item > button span,
.version-center-item > button p {
.version-center-item > button p,
.version-center-item > button small {
color: #64748b;
font-size: 11px;
}
@@ -1125,70 +1130,129 @@ tbody tr.spotlight {
line-height: 1.45;
}
.version-center-item footer {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.version-center-item footer button {
min-height: 24px;
padding: 0 9px;
border: 0;
border-radius: 999px;
background: #f1f5f9;
color: #475569;
.change-record-summary-empty {
color: #64748b;
font-size: 11px;
font-weight: 850;
line-height: 1.5;
}
.change-record-item {
gap: 10px;
width: 100%;
border: 1px solid #e2e8f0;
background: #fff;
color: inherit;
text-align: left;
cursor: pointer;
transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.version-center-item footer button:nth-child(2) {
background: #eef2ff;
color: #4f46e5;
.change-record-item:hover {
border-color: rgba(16, 185, 129, 0.35);
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
transform: translateY(-1px);
}
.version-center-item footer button:nth-child(3) {
background: #fff7ed;
color: #ea580c;
.change-record-item:focus-visible {
outline: 3px solid rgba(16, 185, 129, 0.18);
outline-offset: 1px;
}
.version-flow-preview {
.change-record-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 10px;
}
.change-record-head > div {
display: grid;
gap: 8px;
gap: 3px;
}
.version-flow-preview article {
display: grid;
grid-template-columns: 22px minmax(0, 1fr);
gap: 8px;
align-items: start;
}
.version-flow-preview i {
color: #2563eb;
font-size: 16px;
}
.version-flow-preview div {
display: grid;
gap: 2px;
}
.version-flow-preview strong {
.change-record-head strong {
color: #0f172a;
font-size: 12px;
font-size: 13px;
font-weight: 900;
}
.version-flow-preview span,
.version-flow-preview small,
.version-flow-empty {
.change-record-head span,
.change-record-item p,
.change-record-more {
color: #64748b;
font-size: 11px;
}
.version-flow-preview small {
grid-column: 2;
.change-record-head b {
min-height: 22px;
display: inline-flex;
align-items: center;
padding: 0 8px;
border-radius: 999px;
background: #eef2ff;
color: #4f46e5;
font-size: 11px;
font-weight: 850;
}
.change-record-item p {
margin: 0;
line-height: 1.5;
}
.change-record-preview {
display: grid;
gap: 6px;
}
.change-record-preview span {
display: block;
padding: 7px 8px;
border-radius: 10px;
background: #f8fafc;
color: #334155;
font-size: 11px;
line-height: 1.45;
overflow-wrap: anywhere;
}
.change-record-more {
font-weight: 800;
}
.change-detail-content {
gap: 14px;
}
.change-detail-meta {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 10px;
}
.change-detail-meta article {
display: grid;
gap: 4px;
min-height: 0;
padding: 10px 12px;
border-radius: 14px;
background: #f8fafc;
}
.change-detail-meta span {
color: #64748b;
font-size: 12px;
}
.change-detail-meta strong {
color: #0f172a;
font-size: 15px;
font-weight: 900;
}
.version-flow-empty {
color: #64748b;
font-size: 11px;
}
.rule-drawer-backdrop {
@@ -1381,6 +1445,13 @@ tbody tr.spotlight {
color: #94a3b8;
}
.compare-content {
min-height: 0;
display: grid;
grid-template-rows: auto auto minmax(0, 1fr);
gap: 18px;
}
.compare-summary-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
@@ -1390,8 +1461,9 @@ tbody tr.spotlight {
.compare-summary-grid article {
display: grid;
gap: 4px;
min-height: 76px;
padding: 12px;
align-content: center;
min-height: 0;
padding: 10px 12px;
border-radius: 14px;
background: #f8fafc;
}
@@ -1403,8 +1475,9 @@ tbody tr.spotlight {
.compare-summary-grid strong {
color: #0f172a;
font-size: 24px;
font-size: 22px;
font-weight: 950;
line-height: 1.1;
}
.compare-panel {
@@ -1412,6 +1485,11 @@ tbody tr.spotlight {
gap: 10px;
}
.compare-cell-panel {
min-height: 0;
grid-template-rows: auto minmax(0, 1fr);
}
.compare-panel header {
display: flex;
align-items: center;
@@ -1475,6 +1553,7 @@ tbody tr.spotlight {
}
.compare-table-wrap {
min-height: 0;
overflow: auto;
border: 1px solid #e2e8f0;
border-radius: 14px;
@@ -1528,6 +1607,51 @@ tbody tr.spotlight {
color: #dc2626;
}
.review-submit-form {
display: grid;
gap: 12px;
}
.review-submit-form label {
display: grid;
gap: 7px;
}
.review-submit-form label span {
color: #475569;
font-size: 12px;
font-weight: 850;
}
.review-submit-form input,
.review-submit-form select {
width: 100%;
min-height: 42px;
padding: 0 12px;
border: 1px solid #cbd5e1;
border-radius: 12px;
background: #fff;
color: #0f172a;
font-size: 14px;
}
.review-submit-form input:focus,
.review-submit-form select:focus {
outline: 0;
border-color: rgba(16, 185, 129, 0.5);
box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}
.review-submit-hint {
margin: 0;
padding: 10px 12px;
border-radius: 12px;
background: #fff7ed;
color: #c2410c;
font-size: 12px;
line-height: 1.6;
}
@media (max-width: 1280px) {
.spreadsheet-editor-body {
grid-template-columns: 1fr;
@@ -1543,6 +1667,10 @@ tbody tr.spotlight {
.compare-summary-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.change-detail-meta {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
.rule-spreadsheet-toolbar {
@@ -1924,8 +2052,8 @@ tbody tr.spotlight {
padding: 0 9px;
border: 0;
border-radius: 999px;
background: #eef2ff;
color: #4f46e5;
background: #fff7ed;
color: #ea580c;
font-size: 11px;
font-weight: 850;
cursor: pointer;