@svadmin/ui 0.130.0 → 0.131.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.css +301 -0
- package/dist/app.theme.css +301 -0
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/AccessRevocationMatrix.svelte +425 -0
- package/dist/components/AccessRevocationMatrix.svelte.d.ts +27 -0
- package/dist/components/AudioVisualInspector.svelte +458 -0
- package/dist/components/AudioVisualInspector.svelte.d.ts +53 -0
- package/dist/components/AuditSnapshotCapture.svelte +328 -0
- package/dist/components/AuditSnapshotCapture.svelte.d.ts +28 -0
- package/dist/components/CannedResponsePicker.svelte +257 -0
- package/dist/components/CannedResponsePicker.svelte.d.ts +22 -0
- package/dist/components/ContentModerationCenter.svelte +166 -0
- package/dist/components/ContentModerationCenter.svelte.d.ts +11 -0
- package/dist/components/ContractClauseDiffViewer.svelte +566 -0
- package/dist/components/ContractClauseDiffViewer.svelte.d.ts +53 -0
- package/dist/components/DataImportPipeline.svelte +577 -0
- package/dist/components/DataImportPipeline.svelte.d.ts +35 -0
- package/dist/components/DataRetentionPolicyEditor.svelte +455 -0
- package/dist/components/DataRetentionPolicyEditor.svelte.d.ts +10 -0
- package/dist/components/ElectronicSealInspector.svelte +450 -0
- package/dist/components/ElectronicSealInspector.svelte.d.ts +72 -0
- package/dist/components/EmployeeOffboardingAuditor.svelte +405 -0
- package/dist/components/EmployeeOffboardingAuditor.svelte.d.ts +39 -0
- package/dist/components/FieldMappingBuilder.svelte +393 -0
- package/dist/components/FieldMappingBuilder.svelte.d.ts +39 -0
- package/dist/components/GatewayRouteEditor.svelte +493 -0
- package/dist/components/GatewayRouteEditor.svelte.d.ts +34 -0
- package/dist/components/I18nStudio.svelte +635 -0
- package/dist/components/I18nStudio.svelte.d.ts +23 -0
- package/dist/components/IpAccessRuleEditor.svelte +290 -0
- package/dist/components/IpAccessRuleEditor.svelte.d.ts +19 -0
- package/dist/components/IpWhitelistDrawer.svelte +94 -0
- package/dist/components/IpWhitelistDrawer.svelte.d.ts +10 -0
- package/dist/components/MediaAuthenticityAuditCard.svelte +357 -0
- package/dist/components/MediaAuthenticityAuditCard.svelte.d.ts +64 -0
- package/dist/components/PrintDocument.svelte +95 -0
- package/dist/components/PrintDocument.svelte.d.ts +10 -0
- package/dist/components/PrintPreviewModal.svelte +52 -0
- package/dist/components/PrintPreviewModal.svelte.d.ts +11 -0
- package/dist/components/PrintTemplateDesigner.svelte +280 -0
- package/dist/components/PrintTemplateDesigner.svelte.d.ts +11 -0
- package/dist/components/RateLimitPolicyPanel.svelte +369 -0
- package/dist/components/RateLimitPolicyPanel.svelte.d.ts +29 -0
- package/dist/components/SensitiveWordAuditor.svelte +368 -0
- package/dist/components/SensitiveWordAuditor.svelte.d.ts +9 -0
- package/dist/components/ServiceDeskTicketCard.svelte +297 -0
- package/dist/components/ServiceDeskTicketCard.svelte.d.ts +52 -0
- package/dist/components/ShiftScheduler.svelte +490 -0
- package/dist/components/ShiftScheduler.svelte.d.ts +50 -0
- package/dist/components/SslCertificateMonitorCard.svelte +309 -0
- package/dist/components/SslCertificateMonitorCard.svelte.d.ts +30 -0
- package/dist/components/SsoConnectionStudio.svelte +784 -0
- package/dist/components/SsoConnectionStudio.svelte.d.ts +44 -0
- package/dist/components/SsoSpMetadataPanel.svelte +44 -0
- package/dist/components/SsoSpMetadataPanel.svelte.d.ts +8 -0
- package/dist/components/StepUpAuthModal.svelte +448 -0
- package/dist/components/StepUpAuthModal.svelte.d.ts +26 -0
- package/dist/components/TrafficTopologyInspector.svelte +361 -0
- package/dist/components/TrafficTopologyInspector.svelte.d.ts +43 -0
- package/dist/components/ip-access-rules.d.ts +24 -0
- package/dist/components/ip-access-rules.js +110 -0
- package/dist/components/moderation-utils.d.ts +45 -0
- package/dist/components/moderation-utils.js +74 -0
- package/dist/components/print-document.d.ts +3 -0
- package/dist/components/print-document.js +65 -0
- package/dist/components/print-utils.d.ts +44 -0
- package/dist/components/print-utils.js +68 -0
- package/dist/components/retention-utils.d.ts +31 -0
- package/dist/components/retention-utils.js +38 -0
- package/dist/components/sso-connection-presets.d.ts +2 -0
- package/dist/components/sso-connection-presets.js +59 -0
- package/dist/components/ui/sheet/sheet.svelte +3 -1
- package/dist/components/ui/sheet/sheet.svelte.d.ts +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +44 -0
- package/package.json +5 -4
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import {
|
|
4
|
+
FileText,
|
|
5
|
+
Check,
|
|
6
|
+
X,
|
|
7
|
+
MessageSquare,
|
|
8
|
+
Split,
|
|
9
|
+
Columns,
|
|
10
|
+
Filter,
|
|
11
|
+
Send
|
|
12
|
+
} from '@lucide/svelte';
|
|
13
|
+
import { cn } from '../utils.js';
|
|
14
|
+
|
|
15
|
+
export type ClauseChangeType = 'unchanged' | 'added' | 'removed' | 'modified';
|
|
16
|
+
export type ClauseRiskLevel = 'low' | 'medium' | 'high';
|
|
17
|
+
export type ClauseDecisionStatus = 'pending' | 'accepted' | 'rejected';
|
|
18
|
+
|
|
19
|
+
export interface ClauseAnnotation {
|
|
20
|
+
id: string;
|
|
21
|
+
author: string;
|
|
22
|
+
avatar?: string;
|
|
23
|
+
role?: string;
|
|
24
|
+
timestamp: string;
|
|
25
|
+
content: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ContractClause {
|
|
29
|
+
id: string;
|
|
30
|
+
clauseNumber: string;
|
|
31
|
+
title: string;
|
|
32
|
+
changeType: ClauseChangeType;
|
|
33
|
+
riskLevel?: ClauseRiskLevel;
|
|
34
|
+
originalContent?: string;
|
|
35
|
+
proposedContent?: string;
|
|
36
|
+
annotations?: ClauseAnnotation[];
|
|
37
|
+
decision?: ClauseDecisionStatus;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ContractClauseDiffViewerProps {
|
|
41
|
+
/** 原始版本标识,如 "v1.0 (基线版本)" */
|
|
42
|
+
originalVersionLabel?: string;
|
|
43
|
+
/** 修订版本标识,如 "v2.0 (法务修订版)" */
|
|
44
|
+
proposedVersionLabel?: string;
|
|
45
|
+
/** 条款列表 */
|
|
46
|
+
clauses: ContractClause[];
|
|
47
|
+
/** 对比视图模式:'split' (双侧对比) | 'unified' (单侧合并) */
|
|
48
|
+
viewMode?: 'split' | 'unified';
|
|
49
|
+
/** 过滤模式:'all' | 'changed' | 'high_risk' */
|
|
50
|
+
filter?: 'all' | 'changed' | 'high_risk';
|
|
51
|
+
/** 当前高亮选中的条款 ID */
|
|
52
|
+
selectedClauseId?: string;
|
|
53
|
+
/** 只读模式 */
|
|
54
|
+
readonly?: boolean;
|
|
55
|
+
/** 决策变更回调 */
|
|
56
|
+
onDecisionChange?: (clauseId: string, decision: ClauseDecisionStatus) => void;
|
|
57
|
+
/** 批量决策回调 */
|
|
58
|
+
onBatchDecision?: (decision: ClauseDecisionStatus) => void;
|
|
59
|
+
/** 新增批注回调 */
|
|
60
|
+
onAddAnnotation?: (clauseId: string, content: string) => void;
|
|
61
|
+
/** 选中条款变更回调 */
|
|
62
|
+
onSelectClause?: (clauseId: string) => void;
|
|
63
|
+
/** 自定义头部操作区插槽 */
|
|
64
|
+
actions?: Snippet | undefined;
|
|
65
|
+
class?: string | undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
let {
|
|
69
|
+
originalVersionLabel = '基线条款 (v1.0)',
|
|
70
|
+
proposedVersionLabel = '修订条款 (v2.0)',
|
|
71
|
+
clauses = [],
|
|
72
|
+
viewMode = $bindable('split'),
|
|
73
|
+
filter = $bindable('all'),
|
|
74
|
+
selectedClauseId = $bindable(''),
|
|
75
|
+
readonly = false,
|
|
76
|
+
onDecisionChange,
|
|
77
|
+
onBatchDecision,
|
|
78
|
+
onAddAnnotation,
|
|
79
|
+
onSelectClause,
|
|
80
|
+
actions,
|
|
81
|
+
class: className = ''
|
|
82
|
+
}: ContractClauseDiffViewerProps = $props();
|
|
83
|
+
|
|
84
|
+
// 临时批注输入内容字典
|
|
85
|
+
let newAnnotationInputs = $state<Record<string, string>>({});
|
|
86
|
+
// 展开批注列表的条款集合
|
|
87
|
+
let expandedAnnotations = $state<Record<string, boolean>>({});
|
|
88
|
+
|
|
89
|
+
const filteredClauses = $derived.by(() => {
|
|
90
|
+
return clauses.filter((clause) => {
|
|
91
|
+
if (filter === 'changed') {
|
|
92
|
+
return clause.changeType !== 'unchanged';
|
|
93
|
+
}
|
|
94
|
+
if (filter === 'high_risk') {
|
|
95
|
+
return clause.riskLevel === 'high';
|
|
96
|
+
}
|
|
97
|
+
return true;
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// 过滤或替换数据后,明细始终回退到可见条款。
|
|
102
|
+
const activeId = $derived(
|
|
103
|
+
filteredClauses.some((clause) => clause.id === selectedClauseId)
|
|
104
|
+
? selectedClauseId
|
|
105
|
+
: (filteredClauses[0]?.id ?? '')
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const statistics = $derived.by(() => {
|
|
109
|
+
let added = 0;
|
|
110
|
+
let removed = 0;
|
|
111
|
+
let modified = 0;
|
|
112
|
+
let unchanged = 0;
|
|
113
|
+
let pending = 0;
|
|
114
|
+
let accepted = 0;
|
|
115
|
+
let rejected = 0;
|
|
116
|
+
|
|
117
|
+
for (const c of clauses) {
|
|
118
|
+
if (c.changeType === 'added') added++;
|
|
119
|
+
else if (c.changeType === 'removed') removed++;
|
|
120
|
+
else if (c.changeType === 'modified') modified++;
|
|
121
|
+
else unchanged++;
|
|
122
|
+
|
|
123
|
+
const dec = c.decision ?? 'pending';
|
|
124
|
+
if (dec === 'accepted') accepted++;
|
|
125
|
+
else if (dec === 'rejected') rejected++;
|
|
126
|
+
else pending++;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return { added, removed, modified, unchanged, pending, accepted, rejected, total: clauses.length };
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
function handleSelect(id: string) {
|
|
133
|
+
selectedClauseId = id;
|
|
134
|
+
onSelectClause?.(id);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function handleDecision(id: string, decision: ClauseDecisionStatus) {
|
|
138
|
+
if (readonly) return;
|
|
139
|
+
onDecisionChange?.(id, decision);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function handleBatch(decision: ClauseDecisionStatus) {
|
|
143
|
+
if (readonly) return;
|
|
144
|
+
onBatchDecision?.(decision);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function toggleAnnotationSection(id: string) {
|
|
148
|
+
expandedAnnotations[id] = !expandedAnnotations[id];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function handleSendAnnotation(clauseId: string) {
|
|
152
|
+
const text = (newAnnotationInputs[clauseId] ?? '').trim();
|
|
153
|
+
if (!text) return;
|
|
154
|
+
onAddAnnotation?.(clauseId, text);
|
|
155
|
+
newAnnotationInputs[clauseId] = '';
|
|
156
|
+
expandedAnnotations[clauseId] = true;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function getChangeBadge(type: ClauseChangeType) {
|
|
160
|
+
switch (type) {
|
|
161
|
+
case 'added':
|
|
162
|
+
return { label: '新增', class: 'bg-success/15 text-success border-success/30' };
|
|
163
|
+
case 'removed':
|
|
164
|
+
return { label: '删除', class: 'bg-destructive/15 text-destructive border-destructive/30' };
|
|
165
|
+
case 'modified':
|
|
166
|
+
return { label: '修订', class: 'bg-warning/15 text-warning border-warning/30' };
|
|
167
|
+
default:
|
|
168
|
+
return { label: '未变更', class: 'bg-muted text-muted-foreground border-border' };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function getRiskBadge(risk?: ClauseRiskLevel) {
|
|
173
|
+
switch (risk) {
|
|
174
|
+
case 'high':
|
|
175
|
+
return { label: '高风险', class: 'bg-destructive/15 text-destructive border-destructive/30' };
|
|
176
|
+
case 'medium':
|
|
177
|
+
return { label: '中风险', class: 'bg-warning/15 text-warning border-warning/30' };
|
|
178
|
+
default:
|
|
179
|
+
return { label: '低风险', class: 'bg-muted/80 text-muted-foreground border-border' };
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function getDecisionBadge(status?: ClauseDecisionStatus) {
|
|
184
|
+
switch (status) {
|
|
185
|
+
case 'accepted':
|
|
186
|
+
return { label: '已采纳', class: 'bg-success/15 text-success border-success/30' };
|
|
187
|
+
case 'rejected':
|
|
188
|
+
return { label: '已驳回', class: 'bg-destructive/15 text-destructive border-destructive/30' };
|
|
189
|
+
default:
|
|
190
|
+
return { label: '待决策', class: 'bg-warning/15 text-warning border-warning/30' };
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
</script>
|
|
194
|
+
|
|
195
|
+
<div
|
|
196
|
+
class={cn(
|
|
197
|
+
'flex flex-col rounded-xl border border-border bg-card text-card-foreground shadow-sm overflow-hidden',
|
|
198
|
+
className
|
|
199
|
+
)}
|
|
200
|
+
data-svadmin-component="ContractClauseDiffViewer"
|
|
201
|
+
>
|
|
202
|
+
<!-- 顶部工具条 -->
|
|
203
|
+
<header class="flex flex-wrap items-center justify-between gap-3 border-b border-border bg-muted/30 px-4 py-3">
|
|
204
|
+
<div class="flex items-center gap-3">
|
|
205
|
+
<div class="flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10 text-primary">
|
|
206
|
+
<FileText class="h-5 w-5" />
|
|
207
|
+
</div>
|
|
208
|
+
<div>
|
|
209
|
+
<h3 class="text-sm font-semibold text-foreground">合同条款版本对比与法务决策</h3>
|
|
210
|
+
<p class="text-xs text-muted-foreground">逐条比对合同条款差异,追踪法务合规批注与决策记录</p>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
<!-- 操作组 -->
|
|
215
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
216
|
+
<!-- 视图切换 -->
|
|
217
|
+
<div class="flex items-center rounded-lg border border-border bg-background p-0.5 text-xs">
|
|
218
|
+
<button
|
|
219
|
+
type="button"
|
|
220
|
+
class={cn(
|
|
221
|
+
'flex items-center gap-1 rounded-md px-2.5 py-1 font-medium transition-colors',
|
|
222
|
+
viewMode === 'split' ? 'bg-primary text-primary-foreground shadow-xs' : 'text-muted-foreground hover:text-foreground'
|
|
223
|
+
)}
|
|
224
|
+
onclick={() => (viewMode = 'split')}
|
|
225
|
+
title="双侧分屏对比"
|
|
226
|
+
>
|
|
227
|
+
<Columns class="h-3.5 w-3.5" />
|
|
228
|
+
分侧对比
|
|
229
|
+
</button>
|
|
230
|
+
<button
|
|
231
|
+
type="button"
|
|
232
|
+
class={cn(
|
|
233
|
+
'flex items-center gap-1 rounded-md px-2.5 py-1 font-medium transition-colors',
|
|
234
|
+
viewMode === 'unified' ? 'bg-primary text-primary-foreground shadow-xs' : 'text-muted-foreground hover:text-foreground'
|
|
235
|
+
)}
|
|
236
|
+
onclick={() => (viewMode = 'unified')}
|
|
237
|
+
title="单侧整合对比"
|
|
238
|
+
>
|
|
239
|
+
<Split class="h-3.5 w-3.5" />
|
|
240
|
+
合并对比
|
|
241
|
+
</button>
|
|
242
|
+
</div>
|
|
243
|
+
|
|
244
|
+
<!-- 批量决策按钮 -->
|
|
245
|
+
{#if !readonly}
|
|
246
|
+
<div class="flex items-center gap-1.5 border-l border-border pl-2">
|
|
247
|
+
<button
|
|
248
|
+
type="button"
|
|
249
|
+
class="flex items-center gap-1 rounded-md border border-success/30 bg-success/10 px-2.5 py-1 text-xs font-medium text-success transition-colors hover:bg-success/20 "
|
|
250
|
+
onclick={() => handleBatch('accepted')}
|
|
251
|
+
>
|
|
252
|
+
<Check class="h-3.5 w-3.5" />
|
|
253
|
+
一键全采纳
|
|
254
|
+
</button>
|
|
255
|
+
<button
|
|
256
|
+
type="button"
|
|
257
|
+
class="flex items-center gap-1 rounded-md border border-destructive/30 bg-destructive/10 px-2.5 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/20 "
|
|
258
|
+
onclick={() => handleBatch('rejected')}
|
|
259
|
+
>
|
|
260
|
+
<X class="h-3.5 w-3.5" />
|
|
261
|
+
一键全驳回
|
|
262
|
+
</button>
|
|
263
|
+
</div>
|
|
264
|
+
{/if}
|
|
265
|
+
|
|
266
|
+
{#if actions}
|
|
267
|
+
{@render actions()}
|
|
268
|
+
{/if}
|
|
269
|
+
</div>
|
|
270
|
+
</header>
|
|
271
|
+
|
|
272
|
+
<!-- 统计指标与过滤条 -->
|
|
273
|
+
<div class="flex flex-wrap items-center justify-between gap-3 border-b border-border bg-card px-4 py-2.5 text-xs">
|
|
274
|
+
<!-- 指标统计 -->
|
|
275
|
+
<div class="flex flex-wrap items-center gap-2 text-muted-foreground">
|
|
276
|
+
<span>总计 <strong class="font-semibold text-foreground">{statistics.total}</strong> 条</span>
|
|
277
|
+
<span class="text-border">|</span>
|
|
278
|
+
<span class="text-success ">新增 +{statistics.added}</span>
|
|
279
|
+
<span class="text-destructive ">删除 -{statistics.removed}</span>
|
|
280
|
+
<span class="text-warning ">修改 ~{statistics.modified}</span>
|
|
281
|
+
<span class="text-border">|</span>
|
|
282
|
+
<span>待决 <strong class="text-warning ">{statistics.pending}</strong></span>
|
|
283
|
+
<span>已采纳 <strong class="text-success ">{statistics.accepted}</strong></span>
|
|
284
|
+
<span>已驳回 <strong class="text-destructive ">{statistics.rejected}</strong></span>
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
<!-- 过滤器 -->
|
|
288
|
+
<div class="flex items-center gap-1.5">
|
|
289
|
+
<Filter class="h-3.5 w-3.5 text-muted-foreground" />
|
|
290
|
+
<button
|
|
291
|
+
type="button"
|
|
292
|
+
class={cn(
|
|
293
|
+
'rounded-md px-2 py-0.5 text-xs transition-colors',
|
|
294
|
+
filter === 'all' ? 'bg-primary/10 font-semibold text-primary' : 'text-muted-foreground hover:text-foreground'
|
|
295
|
+
)}
|
|
296
|
+
onclick={() => (filter = 'all')}
|
|
297
|
+
>
|
|
298
|
+
全部
|
|
299
|
+
</button>
|
|
300
|
+
<button
|
|
301
|
+
type="button"
|
|
302
|
+
class={cn(
|
|
303
|
+
'rounded-md px-2 py-0.5 text-xs transition-colors',
|
|
304
|
+
filter === 'changed' ? 'bg-primary/10 font-semibold text-primary' : 'text-muted-foreground hover:text-foreground'
|
|
305
|
+
)}
|
|
306
|
+
onclick={() => (filter = 'changed')}
|
|
307
|
+
>
|
|
308
|
+
仅看变更
|
|
309
|
+
</button>
|
|
310
|
+
<button
|
|
311
|
+
type="button"
|
|
312
|
+
class={cn(
|
|
313
|
+
'rounded-md px-2 py-0.5 text-xs transition-colors',
|
|
314
|
+
filter === 'high_risk' ? 'bg-primary/10 font-semibold text-primary' : 'text-muted-foreground hover:text-foreground'
|
|
315
|
+
)}
|
|
316
|
+
onclick={() => (filter = 'high_risk')}
|
|
317
|
+
>
|
|
318
|
+
高风险条款
|
|
319
|
+
</button>
|
|
320
|
+
</div>
|
|
321
|
+
</div>
|
|
322
|
+
|
|
323
|
+
<!-- 主体工作区:左侧目录 + 右侧对比内容 -->
|
|
324
|
+
<div class="grid grid-cols-1 divide-y divide-border lg:grid-cols-12 lg:divide-x lg:divide-y-0">
|
|
325
|
+
<!-- 左侧条款导航列表 (3 列) -->
|
|
326
|
+
<aside class="max-h-[700px] overflow-y-auto p-2 lg:col-span-4 xl:col-span-3">
|
|
327
|
+
<div class="mb-2 px-2 text-xs font-semibold text-muted-foreground">条款目录与风险索引</div>
|
|
328
|
+
<div class="flex flex-col gap-1.5">
|
|
329
|
+
{#each filteredClauses as clause (clause.id)}
|
|
330
|
+
{@const change = getChangeBadge(clause.changeType)}
|
|
331
|
+
{@const risk = getRiskBadge(clause.riskLevel)}
|
|
332
|
+
{@const decision = getDecisionBadge(clause.decision)}
|
|
333
|
+
<button
|
|
334
|
+
type="button"
|
|
335
|
+
class={cn(
|
|
336
|
+
'flex flex-col gap-1 rounded-lg border p-2.5 text-left text-xs transition-colors',
|
|
337
|
+
activeId === clause.id
|
|
338
|
+
? 'border-primary bg-primary/5 shadow-xs'
|
|
339
|
+
: 'border-border bg-card hover:bg-muted/40'
|
|
340
|
+
)}
|
|
341
|
+
onclick={() => handleSelect(clause.id)}
|
|
342
|
+
>
|
|
343
|
+
<div class="flex items-center justify-between gap-1.5">
|
|
344
|
+
<span class="font-semibold text-foreground">
|
|
345
|
+
{clause.clauseNumber} {clause.title}
|
|
346
|
+
</span>
|
|
347
|
+
<span class={cn('rounded border px-1.5 py-0.2 text-[10px] font-medium', change.class)}>
|
|
348
|
+
{change.label}
|
|
349
|
+
</span>
|
|
350
|
+
</div>
|
|
351
|
+
|
|
352
|
+
<div class="flex flex-wrap items-center gap-1.5 pt-0.5 text-[10px]">
|
|
353
|
+
{#if clause.riskLevel}
|
|
354
|
+
<span class={cn('rounded border px-1.5 py-0.2', risk.class)}>
|
|
355
|
+
{risk.label}
|
|
356
|
+
</span>
|
|
357
|
+
{/if}
|
|
358
|
+
<span class={cn('rounded border px-1.5 py-0.2', decision.class)}>
|
|
359
|
+
{decision.label}
|
|
360
|
+
</span>
|
|
361
|
+
{#if clause.annotations && clause.annotations.length > 0}
|
|
362
|
+
<span class="flex items-center gap-0.5 text-muted-foreground">
|
|
363
|
+
<MessageSquare class="h-3 w-3" />
|
|
364
|
+
{clause.annotations.length}
|
|
365
|
+
</span>
|
|
366
|
+
{/if}
|
|
367
|
+
</div>
|
|
368
|
+
</button>
|
|
369
|
+
{/each}
|
|
370
|
+
|
|
371
|
+
{#if filteredClauses.length === 0}
|
|
372
|
+
<div class="py-8 text-center text-xs text-muted-foreground">无匹配的合同条款</div>
|
|
373
|
+
{/if}
|
|
374
|
+
</div>
|
|
375
|
+
</aside>
|
|
376
|
+
|
|
377
|
+
<!-- 右侧条款比对明细展示区 (9 列) -->
|
|
378
|
+
<main class="flex flex-col divide-y divide-border overflow-hidden lg:col-span-8 xl:col-span-9">
|
|
379
|
+
{#each filteredClauses as clause (clause.id)}
|
|
380
|
+
{#if !activeId || activeId === clause.id}
|
|
381
|
+
{@const change = getChangeBadge(clause.changeType)}
|
|
382
|
+
{@const risk = getRiskBadge(clause.riskLevel)}
|
|
383
|
+
{@const isExpanded = expandedAnnotations[clause.id] ?? false}
|
|
384
|
+
<article class="flex flex-col gap-3 p-4">
|
|
385
|
+
<!-- 条款头:编号、标题、标签与采纳驳回操作 -->
|
|
386
|
+
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
387
|
+
<div class="flex items-center gap-2">
|
|
388
|
+
<h4 class="text-base font-semibold text-foreground">
|
|
389
|
+
第 {clause.clauseNumber} 条:{clause.title}
|
|
390
|
+
</h4>
|
|
391
|
+
<span class={cn('rounded border px-2 py-0.5 text-xs font-medium', change.class)}>
|
|
392
|
+
{change.label}
|
|
393
|
+
</span>
|
|
394
|
+
{#if clause.riskLevel}
|
|
395
|
+
<span class={cn('rounded border px-2 py-0.5 text-xs font-medium', risk.class)}>
|
|
396
|
+
{risk.label}
|
|
397
|
+
</span>
|
|
398
|
+
{/if}
|
|
399
|
+
</div>
|
|
400
|
+
|
|
401
|
+
<!-- 决策与批注控制 -->
|
|
402
|
+
<div class="flex items-center gap-1.5">
|
|
403
|
+
{#if !readonly}
|
|
404
|
+
<button
|
|
405
|
+
type="button"
|
|
406
|
+
class={cn(
|
|
407
|
+
'flex items-center gap-1 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors',
|
|
408
|
+
clause.decision === 'accepted'
|
|
409
|
+
? 'border-success bg-success text-success-foreground shadow-xs'
|
|
410
|
+
: 'border-border bg-card text-muted-foreground hover:bg-success/10 hover:text-success'
|
|
411
|
+
)}
|
|
412
|
+
onclick={() => handleDecision(clause.id, 'accepted')}
|
|
413
|
+
title="采纳修订方案"
|
|
414
|
+
>
|
|
415
|
+
<Check class="h-3.5 w-3.5" />
|
|
416
|
+
采纳
|
|
417
|
+
</button>
|
|
418
|
+
<button
|
|
419
|
+
type="button"
|
|
420
|
+
class={cn(
|
|
421
|
+
'flex items-center gap-1 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors',
|
|
422
|
+
clause.decision === 'rejected'
|
|
423
|
+
? 'border-destructive bg-destructive text-destructive-foreground shadow-xs'
|
|
424
|
+
: 'border-border bg-card text-muted-foreground hover:bg-destructive/10 hover:text-destructive'
|
|
425
|
+
)}
|
|
426
|
+
onclick={() => handleDecision(clause.id, 'rejected')}
|
|
427
|
+
title="驳回修订方案"
|
|
428
|
+
>
|
|
429
|
+
<X class="h-3.5 w-3.5" />
|
|
430
|
+
驳回
|
|
431
|
+
</button>
|
|
432
|
+
{/if}
|
|
433
|
+
|
|
434
|
+
<button
|
|
435
|
+
type="button"
|
|
436
|
+
class={cn(
|
|
437
|
+
'flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium transition-colors hover:bg-muted',
|
|
438
|
+
isExpanded ? 'bg-muted text-foreground' : 'bg-card text-muted-foreground'
|
|
439
|
+
)}
|
|
440
|
+
onclick={() => toggleAnnotationSection(clause.id)}
|
|
441
|
+
>
|
|
442
|
+
<MessageSquare class="h-3.5 w-3.5" />
|
|
443
|
+
批注 ({clause.annotations?.length ?? 0})
|
|
444
|
+
</button>
|
|
445
|
+
</div>
|
|
446
|
+
</div>
|
|
447
|
+
|
|
448
|
+
<!-- 对比内容区 -->
|
|
449
|
+
{#if viewMode === 'split'}
|
|
450
|
+
<!-- 双侧对比 -->
|
|
451
|
+
<div class="grid grid-cols-1 gap-3 md:grid-cols-2">
|
|
452
|
+
<!-- 左:基线/原始版本 -->
|
|
453
|
+
<div class="flex flex-col rounded-lg border border-border bg-muted/20 p-3">
|
|
454
|
+
<div class="mb-2 flex items-center justify-between text-xs font-semibold text-muted-foreground">
|
|
455
|
+
<span>{originalVersionLabel}</span>
|
|
456
|
+
<span class="rounded bg-muted px-1.5 py-0.5 text-[10px]">原条款</span>
|
|
457
|
+
</div>
|
|
458
|
+
<div class="min-h-[90px] whitespace-pre-wrap text-xs leading-relaxed text-foreground/90 font-mono">
|
|
459
|
+
{#if clause.originalContent}
|
|
460
|
+
<span class={cn(clause.changeType === 'modified' ? 'bg-destructive/15 text-destructive rounded px-1 py-0.5' : '')}>
|
|
461
|
+
{clause.originalContent}
|
|
462
|
+
</span>
|
|
463
|
+
{:else}
|
|
464
|
+
<span class="italic text-muted-foreground/60">(原合同中无此条款,属新增项)</span>
|
|
465
|
+
{/if}
|
|
466
|
+
</div>
|
|
467
|
+
</div>
|
|
468
|
+
|
|
469
|
+
<!-- 右:修订/对手方版本 -->
|
|
470
|
+
<div class="flex flex-col rounded-lg border border-border bg-card p-3">
|
|
471
|
+
<div class="mb-2 flex items-center justify-between text-xs font-semibold text-muted-foreground">
|
|
472
|
+
<span>{proposedVersionLabel}</span>
|
|
473
|
+
<span class="rounded bg-primary/10 text-primary px-1.5 py-0.5 text-[10px]">修订提案</span>
|
|
474
|
+
</div>
|
|
475
|
+
<div class="min-h-[90px] whitespace-pre-wrap text-xs leading-relaxed text-foreground font-mono">
|
|
476
|
+
{#if clause.proposedContent}
|
|
477
|
+
<span class={cn(
|
|
478
|
+
clause.changeType === 'modified' ? 'bg-success/15 text-success rounded px-1 py-0.5' : '',
|
|
479
|
+
clause.changeType === 'added' ? 'bg-success/15 text-success rounded px-1 py-0.5' : ''
|
|
480
|
+
)}>
|
|
481
|
+
{clause.proposedContent}
|
|
482
|
+
</span>
|
|
483
|
+
{:else}
|
|
484
|
+
<span class="italic text-muted-foreground/60">(修订案建议删除此条款)</span>
|
|
485
|
+
{/if}
|
|
486
|
+
</div>
|
|
487
|
+
</div>
|
|
488
|
+
</div>
|
|
489
|
+
{:else}
|
|
490
|
+
<!-- 单侧合并对比 -->
|
|
491
|
+
<div class="flex flex-col rounded-lg border border-border bg-card p-3 font-mono text-xs leading-relaxed">
|
|
492
|
+
<div class="mb-2 text-xs font-semibold text-muted-foreground">合并比对视图</div>
|
|
493
|
+
{#if clause.changeType === 'unchanged'}
|
|
494
|
+
<div class="text-foreground">{clause.proposedContent || clause.originalContent}</div>
|
|
495
|
+
{:else}
|
|
496
|
+
{#if clause.originalContent}
|
|
497
|
+
<div class="rounded bg-destructive/10 p-2 text-destructive line-through mb-1.5">
|
|
498
|
+
- {clause.originalContent}
|
|
499
|
+
</div>
|
|
500
|
+
{/if}
|
|
501
|
+
{#if clause.proposedContent}
|
|
502
|
+
<div class="rounded bg-success/10 p-2 text-success">
|
|
503
|
+
+ {clause.proposedContent}
|
|
504
|
+
</div>
|
|
505
|
+
{/if}
|
|
506
|
+
{/if}
|
|
507
|
+
</div>
|
|
508
|
+
{/if}
|
|
509
|
+
|
|
510
|
+
<!-- 批注与法务意见区 -->
|
|
511
|
+
{#if isExpanded}
|
|
512
|
+
<div class="flex flex-col gap-2 rounded-lg border border-border bg-muted/30 p-3">
|
|
513
|
+
<div class="text-xs font-semibold text-foreground">法务与合规批注 ({clause.annotations?.length ?? 0})</div>
|
|
514
|
+
|
|
515
|
+
<!-- 批注列表 -->
|
|
516
|
+
{#if clause.annotations && clause.annotations.length > 0}
|
|
517
|
+
<div class="flex flex-col gap-2">
|
|
518
|
+
{#each clause.annotations as anno (anno.id)}
|
|
519
|
+
<div class="flex flex-col gap-1 rounded-md border border-border bg-card p-2 text-xs">
|
|
520
|
+
<div class="flex items-center justify-between text-muted-foreground">
|
|
521
|
+
<div class="flex items-center gap-1.5">
|
|
522
|
+
<span class="font-medium text-foreground">{anno.author}</span>
|
|
523
|
+
{#if anno.role}
|
|
524
|
+
<span class="rounded bg-muted px-1.5 py-0.2 text-[10px]">{anno.role}</span>
|
|
525
|
+
{/if}
|
|
526
|
+
</div>
|
|
527
|
+
<span class="text-[10px]">{anno.timestamp}</span>
|
|
528
|
+
</div>
|
|
529
|
+
<p class="text-foreground/90">{anno.content}</p>
|
|
530
|
+
</div>
|
|
531
|
+
{/each}
|
|
532
|
+
</div>
|
|
533
|
+
{:else}
|
|
534
|
+
<div class="py-2 text-xs text-muted-foreground">暂想法务批注记录</div>
|
|
535
|
+
{/if}
|
|
536
|
+
|
|
537
|
+
<!-- 追加批注输入框 -->
|
|
538
|
+
{#if !readonly}
|
|
539
|
+
<div class="mt-1 flex items-center gap-2">
|
|
540
|
+
<input
|
|
541
|
+
type="text"
|
|
542
|
+
class="h-8 flex-1 rounded-md border border-input bg-background px-3 text-xs placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
543
|
+
placeholder="针对该条款添加法务合规意见..."
|
|
544
|
+
bind:value={newAnnotationInputs[clause.id]}
|
|
545
|
+
onkeydown={(e) => {
|
|
546
|
+
if (e.key === 'Enter') handleSendAnnotation(clause.id);
|
|
547
|
+
}}
|
|
548
|
+
/>
|
|
549
|
+
<button
|
|
550
|
+
type="button"
|
|
551
|
+
class="flex h-8 items-center gap-1 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90"
|
|
552
|
+
onclick={() => handleSendAnnotation(clause.id)}
|
|
553
|
+
>
|
|
554
|
+
<Send class="h-3 w-3" />
|
|
555
|
+
发表
|
|
556
|
+
</button>
|
|
557
|
+
</div>
|
|
558
|
+
{/if}
|
|
559
|
+
</div>
|
|
560
|
+
{/if}
|
|
561
|
+
</article>
|
|
562
|
+
{/if}
|
|
563
|
+
{/each}
|
|
564
|
+
</main>
|
|
565
|
+
</div>
|
|
566
|
+
</div>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export type ClauseChangeType = 'unchanged' | 'added' | 'removed' | 'modified';
|
|
3
|
+
export type ClauseRiskLevel = 'low' | 'medium' | 'high';
|
|
4
|
+
export type ClauseDecisionStatus = 'pending' | 'accepted' | 'rejected';
|
|
5
|
+
export interface ClauseAnnotation {
|
|
6
|
+
id: string;
|
|
7
|
+
author: string;
|
|
8
|
+
avatar?: string;
|
|
9
|
+
role?: string;
|
|
10
|
+
timestamp: string;
|
|
11
|
+
content: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ContractClause {
|
|
14
|
+
id: string;
|
|
15
|
+
clauseNumber: string;
|
|
16
|
+
title: string;
|
|
17
|
+
changeType: ClauseChangeType;
|
|
18
|
+
riskLevel?: ClauseRiskLevel;
|
|
19
|
+
originalContent?: string;
|
|
20
|
+
proposedContent?: string;
|
|
21
|
+
annotations?: ClauseAnnotation[];
|
|
22
|
+
decision?: ClauseDecisionStatus;
|
|
23
|
+
}
|
|
24
|
+
export interface ContractClauseDiffViewerProps {
|
|
25
|
+
/** 原始版本标识,如 "v1.0 (基线版本)" */
|
|
26
|
+
originalVersionLabel?: string;
|
|
27
|
+
/** 修订版本标识,如 "v2.0 (法务修订版)" */
|
|
28
|
+
proposedVersionLabel?: string;
|
|
29
|
+
/** 条款列表 */
|
|
30
|
+
clauses: ContractClause[];
|
|
31
|
+
/** 对比视图模式:'split' (双侧对比) | 'unified' (单侧合并) */
|
|
32
|
+
viewMode?: 'split' | 'unified';
|
|
33
|
+
/** 过滤模式:'all' | 'changed' | 'high_risk' */
|
|
34
|
+
filter?: 'all' | 'changed' | 'high_risk';
|
|
35
|
+
/** 当前高亮选中的条款 ID */
|
|
36
|
+
selectedClauseId?: string;
|
|
37
|
+
/** 只读模式 */
|
|
38
|
+
readonly?: boolean;
|
|
39
|
+
/** 决策变更回调 */
|
|
40
|
+
onDecisionChange?: (clauseId: string, decision: ClauseDecisionStatus) => void;
|
|
41
|
+
/** 批量决策回调 */
|
|
42
|
+
onBatchDecision?: (decision: ClauseDecisionStatus) => void;
|
|
43
|
+
/** 新增批注回调 */
|
|
44
|
+
onAddAnnotation?: (clauseId: string, content: string) => void;
|
|
45
|
+
/** 选中条款变更回调 */
|
|
46
|
+
onSelectClause?: (clauseId: string) => void;
|
|
47
|
+
/** 自定义头部操作区插槽 */
|
|
48
|
+
actions?: Snippet | undefined;
|
|
49
|
+
class?: string | undefined;
|
|
50
|
+
}
|
|
51
|
+
declare const ContractClauseDiffViewer: import("svelte").Component<ContractClauseDiffViewerProps, {}, "filter" | "viewMode" | "selectedClauseId">;
|
|
52
|
+
type ContractClauseDiffViewer = ReturnType<typeof ContractClauseDiffViewer>;
|
|
53
|
+
export default ContractClauseDiffViewer;
|