@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.
Files changed (76) hide show
  1. package/dist/app.css +301 -0
  2. package/dist/app.theme.css +301 -0
  3. package/dist/components/AboutSettings.svelte +1 -1
  4. package/dist/components/AccessRevocationMatrix.svelte +425 -0
  5. package/dist/components/AccessRevocationMatrix.svelte.d.ts +27 -0
  6. package/dist/components/AudioVisualInspector.svelte +458 -0
  7. package/dist/components/AudioVisualInspector.svelte.d.ts +53 -0
  8. package/dist/components/AuditSnapshotCapture.svelte +328 -0
  9. package/dist/components/AuditSnapshotCapture.svelte.d.ts +28 -0
  10. package/dist/components/CannedResponsePicker.svelte +257 -0
  11. package/dist/components/CannedResponsePicker.svelte.d.ts +22 -0
  12. package/dist/components/ContentModerationCenter.svelte +166 -0
  13. package/dist/components/ContentModerationCenter.svelte.d.ts +11 -0
  14. package/dist/components/ContractClauseDiffViewer.svelte +566 -0
  15. package/dist/components/ContractClauseDiffViewer.svelte.d.ts +53 -0
  16. package/dist/components/DataImportPipeline.svelte +577 -0
  17. package/dist/components/DataImportPipeline.svelte.d.ts +35 -0
  18. package/dist/components/DataRetentionPolicyEditor.svelte +455 -0
  19. package/dist/components/DataRetentionPolicyEditor.svelte.d.ts +10 -0
  20. package/dist/components/ElectronicSealInspector.svelte +450 -0
  21. package/dist/components/ElectronicSealInspector.svelte.d.ts +72 -0
  22. package/dist/components/EmployeeOffboardingAuditor.svelte +405 -0
  23. package/dist/components/EmployeeOffboardingAuditor.svelte.d.ts +39 -0
  24. package/dist/components/FieldMappingBuilder.svelte +393 -0
  25. package/dist/components/FieldMappingBuilder.svelte.d.ts +39 -0
  26. package/dist/components/GatewayRouteEditor.svelte +493 -0
  27. package/dist/components/GatewayRouteEditor.svelte.d.ts +34 -0
  28. package/dist/components/I18nStudio.svelte +635 -0
  29. package/dist/components/I18nStudio.svelte.d.ts +23 -0
  30. package/dist/components/IpAccessRuleEditor.svelte +290 -0
  31. package/dist/components/IpAccessRuleEditor.svelte.d.ts +19 -0
  32. package/dist/components/IpWhitelistDrawer.svelte +94 -0
  33. package/dist/components/IpWhitelistDrawer.svelte.d.ts +10 -0
  34. package/dist/components/MediaAuthenticityAuditCard.svelte +357 -0
  35. package/dist/components/MediaAuthenticityAuditCard.svelte.d.ts +64 -0
  36. package/dist/components/PrintDocument.svelte +95 -0
  37. package/dist/components/PrintDocument.svelte.d.ts +10 -0
  38. package/dist/components/PrintPreviewModal.svelte +52 -0
  39. package/dist/components/PrintPreviewModal.svelte.d.ts +11 -0
  40. package/dist/components/PrintTemplateDesigner.svelte +280 -0
  41. package/dist/components/PrintTemplateDesigner.svelte.d.ts +11 -0
  42. package/dist/components/RateLimitPolicyPanel.svelte +369 -0
  43. package/dist/components/RateLimitPolicyPanel.svelte.d.ts +29 -0
  44. package/dist/components/SensitiveWordAuditor.svelte +368 -0
  45. package/dist/components/SensitiveWordAuditor.svelte.d.ts +9 -0
  46. package/dist/components/ServiceDeskTicketCard.svelte +297 -0
  47. package/dist/components/ServiceDeskTicketCard.svelte.d.ts +52 -0
  48. package/dist/components/ShiftScheduler.svelte +490 -0
  49. package/dist/components/ShiftScheduler.svelte.d.ts +50 -0
  50. package/dist/components/SslCertificateMonitorCard.svelte +309 -0
  51. package/dist/components/SslCertificateMonitorCard.svelte.d.ts +30 -0
  52. package/dist/components/SsoConnectionStudio.svelte +784 -0
  53. package/dist/components/SsoConnectionStudio.svelte.d.ts +44 -0
  54. package/dist/components/SsoSpMetadataPanel.svelte +44 -0
  55. package/dist/components/SsoSpMetadataPanel.svelte.d.ts +8 -0
  56. package/dist/components/StepUpAuthModal.svelte +448 -0
  57. package/dist/components/StepUpAuthModal.svelte.d.ts +26 -0
  58. package/dist/components/TrafficTopologyInspector.svelte +361 -0
  59. package/dist/components/TrafficTopologyInspector.svelte.d.ts +43 -0
  60. package/dist/components/ip-access-rules.d.ts +24 -0
  61. package/dist/components/ip-access-rules.js +110 -0
  62. package/dist/components/moderation-utils.d.ts +45 -0
  63. package/dist/components/moderation-utils.js +74 -0
  64. package/dist/components/print-document.d.ts +3 -0
  65. package/dist/components/print-document.js +65 -0
  66. package/dist/components/print-utils.d.ts +44 -0
  67. package/dist/components/print-utils.js +68 -0
  68. package/dist/components/retention-utils.d.ts +31 -0
  69. package/dist/components/retention-utils.js +38 -0
  70. package/dist/components/sso-connection-presets.d.ts +2 -0
  71. package/dist/components/sso-connection-presets.js +59 -0
  72. package/dist/components/ui/sheet/sheet.svelte +3 -1
  73. package/dist/components/ui/sheet/sheet.svelte.d.ts +1 -0
  74. package/dist/index.d.ts +29 -0
  75. package/dist/index.js +44 -0
  76. package/package.json +5 -4
@@ -0,0 +1,458 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import {
4
+ Play,
5
+ Pause,
6
+ RotateCcw,
7
+ Volume2,
8
+ VolumeX,
9
+ CheckCircle2,
10
+ FileAudio,
11
+ FileVideo,
12
+ Tag
13
+ } from '@lucide/svelte';
14
+ import { cn } from '../utils.js';
15
+
16
+ export type InspectionViolationLevel = 'minor' | 'major' | 'critical';
17
+ export type InspectionOverallResult = 'passed' | 'rework' | 'failed';
18
+
19
+ export interface ViolationMarker {
20
+ id: string;
21
+ timestampSeconds: number;
22
+ title: string;
23
+ level: InspectionViolationLevel;
24
+ deduction: number;
25
+ description?: string;
26
+ }
27
+
28
+ export interface AudioVisualMediaMeta {
29
+ title: string;
30
+ mediaType: 'audio' | 'video';
31
+ durationSeconds: number;
32
+ fileSizeMb?: number;
33
+ format?: string;
34
+ sampleRateOrResolution?: string;
35
+ operatorName?: string;
36
+ channel?: string;
37
+ }
38
+
39
+ export interface AudioVisualInspectorProps {
40
+ /** 音视频媒体元数据 */
41
+ media: AudioVisualMediaMeta;
42
+ /** 模拟或真实的波形幅度数据(0~100 的数值数组,若未提供则自动生成模拟波形) */
43
+ waveformData?: number[];
44
+ /** 违规标记点列表 */
45
+ violations?: ViolationMarker[];
46
+ /** 初始满分值,默认 100 */
47
+ maxScore?: number;
48
+ /** 当前播放进度秒数(受控) */
49
+ currentTime?: number;
50
+ isPlaying?: boolean;
51
+ isMuted?: boolean;
52
+ playbackRate?: number;
53
+ onPlayChange?: (playing: boolean) => void;
54
+ onMuteChange?: (muted: boolean) => void;
55
+ onPlaybackRateChange?: (rate: number) => void;
56
+ /** 是否只读模式(不可修改评分与批注) */
57
+ readonly?: boolean;
58
+ /** 综合判定结果变更回调 */
59
+ onResultChange?: (result: InspectionOverallResult, score: number) => void;
60
+ /** 标记点击或跳转时间回调 */
61
+ onSeek?: (timestampSeconds: number) => void;
62
+ /** 添加违规标记回调 */
63
+ onAddViolation?: (timestampSeconds: number, title: string, level: InspectionViolationLevel) => void;
64
+ /** 自定义操作栏插槽 */
65
+ actions?: Snippet | undefined;
66
+ class?: string | undefined;
67
+ }
68
+
69
+ let {
70
+ media,
71
+ waveformData,
72
+ violations = [],
73
+ maxScore = 100,
74
+ currentTime = $bindable(0),
75
+ isPlaying = false,
76
+ isMuted = false,
77
+ playbackRate = 1,
78
+ onPlayChange,
79
+ onMuteChange,
80
+ onPlaybackRateChange,
81
+ readonly = false,
82
+ onResultChange,
83
+ onSeek,
84
+ onAddViolation,
85
+ actions,
86
+ class: className = ''
87
+ }: AudioVisualInspectorProps = $props();
88
+
89
+ let selectedMarkerId = $state<string | null>(null);
90
+ let newMarkerTitle = $state('');
91
+ let newMarkerLevel = $state<InspectionViolationLevel>('minor');
92
+
93
+ // 生成默认平滑波形数据(若未传入)
94
+ const computedWaveform = $derived.by(() => {
95
+ if (waveformData && waveformData.length > 0) return waveformData;
96
+ const points: number[] = [];
97
+ const count = 64;
98
+ for (let i = 0; i < count; i++) {
99
+ const base = Math.sin(i * 0.25) * 35 + 50;
100
+ const noise = (i % 5) * 6 - 15;
101
+ points.push(Math.max(10, Math.min(95, Math.round(base + noise))));
102
+ }
103
+ return points;
104
+ });
105
+
106
+ // 计算总扣分与综合得分
107
+ const scoring = $derived.by(() => {
108
+ const totalDeduction = violations.reduce((sum, v) => sum + v.deduction, 0);
109
+ const finalScore = Math.max(0, maxScore - totalDeduction);
110
+ let result: InspectionOverallResult = 'passed';
111
+ if (finalScore < 60) {
112
+ result = 'failed';
113
+ } else if (finalScore < 85) {
114
+ result = 'rework';
115
+ }
116
+ return { totalDeduction, finalScore, result };
117
+ });
118
+
119
+ function formatTime(seconds: number): string {
120
+ const mins = Math.floor(seconds / 60);
121
+ const secs = Math.floor(seconds % 60);
122
+ return `${String(mins).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
123
+ }
124
+
125
+ // 通知宿主综合判定与得分变更
126
+ $effect(() => {
127
+ onResultChange?.(scoring.result, scoring.finalScore);
128
+ });
129
+
130
+ function handleSeekTo(seconds: number) {
131
+ currentTime = Math.max(0, Math.min(media.durationSeconds, seconds));
132
+ onSeek?.(currentTime);
133
+ }
134
+
135
+ function handleTogglePlay() {
136
+ onPlayChange?.(!isPlaying);
137
+ }
138
+
139
+ function handleAddMarker() {
140
+ if (!newMarkerTitle.trim() || readonly) return;
141
+ onAddViolation?.(currentTime, newMarkerTitle.trim(), newMarkerLevel);
142
+ newMarkerTitle = '';
143
+ }
144
+
145
+ function getLevelConfig(level: InspectionViolationLevel) {
146
+ switch (level) {
147
+ case 'critical':
148
+ return { label: '合规红线 / 严重', class: 'bg-destructive/15 text-destructive border-destructive/30 dark:text-destructive' };
149
+ case 'major':
150
+ return { label: '业务违规 / 中度', class: 'bg-warning/15 text-warning border-warning/30 dark:text-warning' };
151
+ default:
152
+ return { label: '话术瑕疵 / 轻微', class: 'bg-info/15 text-info border-info/30 dark:text-info' };
153
+ }
154
+ }
155
+
156
+ function getResultConfig(result: InspectionOverallResult) {
157
+ switch (result) {
158
+ case 'passed':
159
+ return { label: '质检合格', class: 'bg-success/15 text-success border-success/30 dark:text-success' };
160
+ case 'rework':
161
+ return { label: '待复核整改', class: 'bg-warning/15 text-warning border-warning/30 dark:text-warning' };
162
+ default:
163
+ return { label: '质检不合格', class: 'bg-destructive/15 text-destructive border-destructive/30 dark:text-destructive' };
164
+ }
165
+ }
166
+
167
+ const resultBadge = $derived(getResultConfig(scoring.result));
168
+ </script>
169
+
170
+ <div
171
+ class={cn(
172
+ 'flex flex-col rounded-xl border border-border bg-card text-card-foreground shadow-sm overflow-hidden',
173
+ className
174
+ )}
175
+ data-svadmin-component="AudioVisualInspector"
176
+ >
177
+ <!-- 头部:媒体信息与质检总分胶囊 -->
178
+ <header class="flex flex-wrap items-center justify-between gap-3 border-b border-border bg-muted/30 px-5 py-4">
179
+ <div class="flex items-center gap-3.5">
180
+ <div class="flex h-10 w-10 items-center justify-center rounded-xl bg-primary/10 text-primary">
181
+ {#if media.mediaType === 'video'}
182
+ <FileVideo class="h-5 w-5" />
183
+ {:else}
184
+ <FileAudio class="h-5 w-5" />
185
+ {/if}
186
+ </div>
187
+ <div class="flex flex-col gap-0.5">
188
+ <div class="flex items-center gap-2">
189
+ <h3 class="text-sm font-semibold text-foreground">{media.title}</h3>
190
+ <span class="rounded bg-muted px-2 py-0.5 text-xs text-muted-foreground uppercase font-mono">
191
+ {media.format || (media.mediaType === 'video' ? 'MP4' : 'WAV')}
192
+ </span>
193
+ {#if media.operatorName}
194
+ <span class="text-xs text-muted-foreground">坐席:{media.operatorName}</span>
195
+ {/if}
196
+ </div>
197
+ <div class="flex flex-wrap items-center gap-3 text-xs text-muted-foreground">
198
+ <span>总时长:{formatTime(media.durationSeconds)}</span>
199
+ {#if media.fileSizeMb}
200
+ <span>大小:{media.fileSizeMb} MB</span>
201
+ {/if}
202
+ {#if media.sampleRateOrResolution}
203
+ <span>规格:{media.sampleRateOrResolution}</span>
204
+ {/if}
205
+ </div>
206
+ </div>
207
+ </div>
208
+
209
+ <!-- 质检得分与判定状态 -->
210
+ <div class="flex items-center gap-3">
211
+ <div class="flex flex-col items-end">
212
+ <div class="flex items-center gap-2">
213
+ <span class="text-xs text-muted-foreground">质检综合评分</span>
214
+ <span class="text-lg font-black tracking-tight text-foreground font-mono">
215
+ {scoring.finalScore}
216
+ <span class="text-xs font-normal text-muted-foreground">/ {maxScore}</span>
217
+ </span>
218
+ </div>
219
+ <span class={cn('rounded border px-2 py-0.2 text-[10px] font-semibold', resultBadge.class)}>
220
+ {resultBadge.label}
221
+ </span>
222
+ </div>
223
+
224
+ {#if actions}
225
+ {@render actions()}
226
+ {/if}
227
+ </div>
228
+ </header>
229
+
230
+ <!-- 波形图可视化与播放控制轴 -->
231
+ <div class="flex flex-col gap-2.5 border-b border-border bg-card p-5">
232
+ <!-- 纯 SVG 交互式波形谱图 -->
233
+ <div class="relative flex h-24 w-full items-center justify-between rounded-lg border border-border bg-muted/20 px-3 py-2">
234
+ <!-- 播放头指示竖线 -->
235
+ <div
236
+ class="absolute top-0 bottom-0 z-10 w-0.5 bg-primary pointer-events-none transition-all duration-75"
237
+ style="left: {(currentTime / Math.max(1, media.durationSeconds)) * 100}%;"
238
+ >
239
+ <div class="absolute -top-1 -translate-x-1/2 h-2.5 w-2.5 rounded-full bg-primary shadow-xs"></div>
240
+ </div>
241
+
242
+ <!-- 违规标记点在波形上的落点图钉 -->
243
+ {#each violations as v (v.id)}
244
+ {@const posPercent = (v.timestampSeconds / Math.max(1, media.durationSeconds)) * 100}
245
+ <button
246
+ type="button"
247
+ class={cn(
248
+ 'absolute -bottom-1 z-20 -translate-x-1/2 flex items-center justify-center rounded-full transition-transform hover:scale-125',
249
+ v.level === 'critical' ? 'bg-destructive text-white h-4 w-4 text-[10px]' : 'bg-warning text-white h-3.5 w-3.5 text-[9px]'
250
+ )}
251
+ style="left: {posPercent}%;"
252
+ onclick={() => handleSeekTo(v.timestampSeconds)}
253
+ title="{v.title} ({formatTime(v.timestampSeconds)}) - 扣 {v.deduction} 分"
254
+ >
255
+ !
256
+ </button>
257
+ {/each}
258
+
259
+ <!-- 波形采样条柱 -->
260
+ <div class="flex h-full w-full items-center justify-between gap-0.5">
261
+ {#each computedWaveform as val, idx (idx)}
262
+ {@const barTime = (idx / computedWaveform.length) * media.durationSeconds}
263
+ {@const isPassed = barTime <= currentTime}
264
+ <div
265
+ class="group relative flex h-full flex-1 cursor-pointer items-center justify-center"
266
+ onclick={() => handleSeekTo(barTime)}
267
+ role="button"
268
+ tabindex="0"
269
+ onkeydown={(e) => {
270
+ if (e.key === 'Enter') handleSeekTo(barTime);
271
+ }}
272
+ >
273
+ <div
274
+ class={cn(
275
+ 'w-full max-w-[5px] rounded-full transition-colors',
276
+ isPassed ? 'bg-primary' : 'bg-muted-foreground/30 group-hover:bg-primary/50'
277
+ )}
278
+ style="height: {val}%;"
279
+ ></div>
280
+ </div>
281
+ {/each}
282
+ </div>
283
+ </div>
284
+
285
+ <!-- 播放器工具栏 -->
286
+ <div class="flex flex-wrap items-center justify-between gap-3 pt-1 text-xs">
287
+ <div class="flex items-center gap-2">
288
+ <button
289
+ type="button"
290
+ class="flex h-8 w-8 items-center justify-center rounded-lg bg-primary text-primary-foreground shadow-xs transition-colors hover:bg-primary/90"
291
+ onclick={handleTogglePlay}
292
+ disabled={!onPlayChange}
293
+ aria-label={isPlaying ? '暂停' : '播放'}
294
+ >
295
+ {#if isPlaying}
296
+ <Pause class="h-4 w-4" />
297
+ {:else}
298
+ <Play class="h-4 w-4 ml-0.5" />
299
+ {/if}
300
+ </button>
301
+
302
+ <button
303
+ type="button"
304
+ class="flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-background text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
305
+ onclick={() => handleSeekTo(0)}
306
+ title="重置到片头"
307
+ >
308
+ <RotateCcw class="h-3.5 w-3.5" />
309
+ </button>
310
+
311
+ <!-- 播放进度时间指示 -->
312
+ <span class="font-mono text-foreground font-semibold">
313
+ {formatTime(currentTime)} <span class="text-muted-foreground font-normal">/ {formatTime(media.durationSeconds)}</span>
314
+ </span>
315
+ </div>
316
+
317
+ <!-- 倍速与静音 -->
318
+ <div class="flex items-center gap-2">
319
+ <!-- 倍速切换 -->
320
+ <div class="flex items-center rounded-md border border-border bg-muted/40 p-0.5 text-[11px] font-mono">
321
+ {#each [1.0, 1.25, 1.5, 2.0] as rate (rate)}
322
+ <button
323
+ type="button"
324
+ class={cn(
325
+ 'rounded px-1.5 py-0.5 transition-colors',
326
+ playbackRate === rate ? 'bg-primary text-primary-foreground font-semibold shadow-xs' : 'text-muted-foreground hover:text-foreground'
327
+ )}
328
+ disabled={!onPlaybackRateChange}
329
+ onclick={() => onPlaybackRateChange?.(rate)}
330
+ aria-pressed={playbackRate === rate}
331
+ >
332
+ {rate}x
333
+ </button>
334
+ {/each}
335
+ </div>
336
+
337
+ <button
338
+ type="button"
339
+ class="flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-background text-muted-foreground transition-colors hover:bg-muted"
340
+ disabled={!onMuteChange}
341
+ onclick={() => onMuteChange?.(!isMuted)}
342
+ aria-label={isMuted ? '取消静音' : '静音'}
343
+ >
344
+ {#if isMuted}
345
+ <VolumeX class="h-3.5 w-3.5 text-destructive" />
346
+ {:else}
347
+ <Volume2 class="h-3.5 w-3.5" />
348
+ {/if}
349
+ </button>
350
+ </div>
351
+ </div>
352
+ </div>
353
+
354
+ <!-- 下部双分栏:左侧违规扣分标记清单 + 右侧快速添加标记 -->
355
+ <div class="grid grid-cols-1 divide-y divide-border lg:grid-cols-12 lg:divide-x lg:divide-y-0 text-xs">
356
+ <!-- 违规标记列表 (7 列) -->
357
+ <div class="flex flex-col gap-2 p-4 lg:col-span-7">
358
+ <div class="flex items-center justify-between">
359
+ <span class="font-semibold text-foreground">质检违规扣分点 ({violations.length})</span>
360
+ <span class="text-destructive dark:text-destructive font-mono">累计扣分:-{scoring.totalDeduction} 分</span>
361
+ </div>
362
+
363
+ <div class="flex flex-col gap-1.5 pt-1">
364
+ {#each violations as v (v.id)}
365
+ {@const levelBadge = getLevelConfig(v.level)}
366
+ <button
367
+ type="button"
368
+ class={cn(
369
+ 'flex w-full items-center justify-between rounded-lg border p-2.5 text-left transition-colors cursor-pointer',
370
+ selectedMarkerId === v.id
371
+ ? 'border-primary bg-primary/5'
372
+ : 'border-border bg-card hover:bg-muted/40'
373
+ )}
374
+ data-violation-id={v.id}
375
+ onclick={() => {
376
+ selectedMarkerId = v.id;
377
+ handleSeekTo(v.timestampSeconds);
378
+ }}
379
+ >
380
+ <div class="flex items-center gap-2.5">
381
+ <span class="rounded bg-muted px-2 py-0.5 font-mono text-[11px] font-semibold text-foreground">
382
+ {formatTime(v.timestampSeconds)}
383
+ </span>
384
+ <div class="flex flex-col">
385
+ <span class="font-medium text-foreground">{v.title}</span>
386
+ {#if v.description}
387
+ <span class="text-[11px] text-muted-foreground">{v.description}</span>
388
+ {/if}
389
+ </div>
390
+ </div>
391
+
392
+ <div class="flex items-center gap-2">
393
+ <span class={cn('rounded border px-1.5 py-0.2 text-[10px] font-medium', levelBadge.class)}>
394
+ {levelBadge.label}
395
+ </span>
396
+ <span class="font-mono font-semibold text-destructive dark:text-destructive">
397
+ -{v.deduction}分
398
+ </span>
399
+ </div>
400
+ </button>
401
+ {/each}
402
+
403
+ {#if violations.length === 0}
404
+ <div class="flex flex-col items-center justify-center py-8 text-center text-muted-foreground">
405
+ <CheckCircle2 class="h-6 w-6 text-success mb-1" />
406
+ <span>未发现违规扣分项,质检表现良好</span>
407
+ </div>
408
+ {/if}
409
+ </div>
410
+ </div>
411
+
412
+ <!-- 右侧:添加质检违规标记 (5 列) -->
413
+ <div class="flex flex-col gap-3 p-4 bg-muted/10 lg:col-span-5">
414
+ <div class="font-semibold text-foreground">快速打标时间点</div>
415
+ <p class="text-muted-foreground text-[11px]">
416
+ 定位当前播放进度 <code class="font-mono font-semibold text-foreground">{formatTime(currentTime)}</code>,为音视频添加合规扣分标记。
417
+ </p>
418
+
419
+ {#if !readonly}
420
+ <div class="flex flex-col gap-2 pt-1">
421
+ <input
422
+ type="text"
423
+ class="h-8 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"
424
+ placeholder="违规事项(如:违规承诺收益率)..."
425
+ bind:value={newMarkerTitle}
426
+ onkeydown={(e) => {
427
+ if (e.key === 'Enter') handleAddMarker();
428
+ }}
429
+ />
430
+
431
+ <div class="flex items-center justify-between gap-2">
432
+ <select
433
+ class="h-8 flex-1 rounded-md border border-input bg-background px-2 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
434
+ bind:value={newMarkerLevel}
435
+ >
436
+ <option value="minor">轻微瑕疵 (-5 分)</option>
437
+ <option value="major">业务违规 (-15 分)</option>
438
+ <option value="critical">合规红线 (-30 分)</option>
439
+ </select>
440
+
441
+ <button
442
+ type="button"
443
+ 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"
444
+ onclick={handleAddMarker}
445
+ >
446
+ <Tag class="h-3 w-3" />
447
+ 打标
448
+ </button>
449
+ </div>
450
+ </div>
451
+ {:else}
452
+ <div class="rounded-md border border-border bg-card p-3 text-center text-muted-foreground">
453
+ 只读质检查看态,不可编辑扣分记录
454
+ </div>
455
+ {/if}
456
+ </div>
457
+ </div>
458
+ </div>
@@ -0,0 +1,53 @@
1
+ import type { Snippet } from 'svelte';
2
+ export type InspectionViolationLevel = 'minor' | 'major' | 'critical';
3
+ export type InspectionOverallResult = 'passed' | 'rework' | 'failed';
4
+ export interface ViolationMarker {
5
+ id: string;
6
+ timestampSeconds: number;
7
+ title: string;
8
+ level: InspectionViolationLevel;
9
+ deduction: number;
10
+ description?: string;
11
+ }
12
+ export interface AudioVisualMediaMeta {
13
+ title: string;
14
+ mediaType: 'audio' | 'video';
15
+ durationSeconds: number;
16
+ fileSizeMb?: number;
17
+ format?: string;
18
+ sampleRateOrResolution?: string;
19
+ operatorName?: string;
20
+ channel?: string;
21
+ }
22
+ export interface AudioVisualInspectorProps {
23
+ /** 音视频媒体元数据 */
24
+ media: AudioVisualMediaMeta;
25
+ /** 模拟或真实的波形幅度数据(0~100 的数值数组,若未提供则自动生成模拟波形) */
26
+ waveformData?: number[];
27
+ /** 违规标记点列表 */
28
+ violations?: ViolationMarker[];
29
+ /** 初始满分值,默认 100 */
30
+ maxScore?: number;
31
+ /** 当前播放进度秒数(受控) */
32
+ currentTime?: number;
33
+ isPlaying?: boolean;
34
+ isMuted?: boolean;
35
+ playbackRate?: number;
36
+ onPlayChange?: (playing: boolean) => void;
37
+ onMuteChange?: (muted: boolean) => void;
38
+ onPlaybackRateChange?: (rate: number) => void;
39
+ /** 是否只读模式(不可修改评分与批注) */
40
+ readonly?: boolean;
41
+ /** 综合判定结果变更回调 */
42
+ onResultChange?: (result: InspectionOverallResult, score: number) => void;
43
+ /** 标记点击或跳转时间回调 */
44
+ onSeek?: (timestampSeconds: number) => void;
45
+ /** 添加违规标记回调 */
46
+ onAddViolation?: (timestampSeconds: number, title: string, level: InspectionViolationLevel) => void;
47
+ /** 自定义操作栏插槽 */
48
+ actions?: Snippet | undefined;
49
+ class?: string | undefined;
50
+ }
51
+ declare const AudioVisualInspector: import("svelte").Component<AudioVisualInspectorProps, {}, "currentTime">;
52
+ type AudioVisualInspector = ReturnType<typeof AudioVisualInspector>;
53
+ export default AudioVisualInspector;