gis-view-webgl2 0.1.0 → 0.1.1
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/README.md +28 -8
- package/dist/gis-view.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +781 -246
- package/dist/index.js +1 -1
- package/docs/AI/345/257/271/350/257/235/346/261/207/346/200/273.md +129 -0
- package/docs/GisView.md +9 -8
- package/docs/GisView/345/256/236/347/216/260/345/216/237/347/220/206.md +2 -2
- package/docs/ai/06-/344/274/232/350/257/235/347/264/242/345/274/225/344/270/216/345/244/215/346/237/245/346/226/271/346/263/225.md +114 -0
- package/docs/api/index.html +545 -59
- package/docs/demos/BackendSyncDemo.vue +10 -8
- package/docs/demos/BasicDemo.vue +101 -101
- package/docs/demos/BatchAddDemo.vue +5 -5
- package/docs/demos/ChannelDemo.vue +51 -4
- package/docs/demos/ConnectDemo.vue +392 -0
- package/docs/demos/CopyMergeDemo.vue +936 -936
- package/docs/demos/DecorationDraftDemo.vue +1300 -0
- package/docs/demos/DemoShell.vue +569 -240
- package/docs/demos/DragDropDemo.vue +11 -11
- package/docs/demos/EffectsDemo.vue +6 -6
- package/docs/demos/EventDemo.vue +327 -327
- package/docs/demos/ExtensionDemo.vue +458 -0
- package/docs/demos/GisViewDemo.vue +61 -48
- package/docs/demos/GraphicDemo.vue +338 -0
- package/docs/demos/LabelDemo.vue +509 -509
- package/docs/demos/MinimapDemo.vue +358 -0
- package/docs/demos/PerfDemo.vue +29 -0
- package/docs/demos/SearchFilterDemo.vue +412 -0
- package/docs/demos/StyleDemo.vue +121 -121
- package/docs/demos/api-index.js +87 -76
- package/docs/demos/demos.js +159 -135
- package/docs/demos/shared/demoData.js +107 -107
- package/docs/demos/shared/demoStyle.css +249 -249
- package/docs/demos/shared/fakeBackend.js +93 -6
- package/docs/format/03-/346/213/220/347/202/271/350/243/205/351/245/260/344/270/216/346/240/267/345/274/217.md +24 -6
- package/docs/format/06-/345/257/274/345/205/245/345/257/274/345/207/272/344/270/216/346/240/207/345/207/206/346/226/207/346/241/243.md +8 -6
- package/docs/format/07-/344/272/213/344/273/266/350/275/275/350/215/267/344/270/216/347/244/272/344/276/213/346/225/260/346/215/256.md +6 -6
- package/docs/guide/sample-document.html +4 -4
- package/docs/index.html +180 -9
- package/docs/internals/11-/350/246/206/347/233/226/345/261/202/346/240/207/347/255/276/344/270/216/346/217/220/347/244/272.md +1 -1
- package/docs/internals/13-/351/271/260/347/234/274/345/233/276.md +3 -2
- package/docs/internals/15-03-/351/200/220/350/275/256/350/256/260/345/275/225-/346/200/247/350/203/275/344/270/216/344/277/256/345/244/215-/344/270/213.md +16 -0
- package/docs/internals/16-03-/344/274/230/345/214/226/344/270/216/345/217/226/350/210/215-/344/270/213.md +11 -0
- package/docs/internals/17-/350/260/203/350/257/225/344/270/216/346/211/251/345/261/225/345/273/272/350/256/256.md +1 -1
- package/docs/manual/02-/345/235/220/346/240/207/344/270/216/346/225/260/346/215/256.md +11 -2
- package/docs/manual/03-/351/205/215/347/275/256/351/241/271.md +89 -20
- package/docs/manual/04-/344/272/213/344/273/266/344/270/216/345/233/236/350/260/203.md +13 -8
- package/docs/manual/06-/346/225/260/346/215/256/344/270/216/345/234/272/346/231/257/346/233/264/346/226/260.md +11 -10
- package/docs/manual/07-/346/214/207/351/222/210/344/270/216/350/246/201/347/264/240/347/274/226/350/276/221.md +9 -9
- package/docs/manual/08-/351/200/211/344/270/255/344/270/216/346/213/220/347/202/271.md +13 -11
- package/docs/manual/09-/351/200/232/351/201/223/344/270/216/345/244/232/345/233/236/347/272/277.md +3 -3
- package/docs/manual/10-/351/200/232/351/201/223/347/274/226/350/276/221/344/270/216/346/226/260/345/242/236.md +47 -5
- package/docs/manual/11-/346/240/267/345/274/217/344/270/216/350/247/204/345/210/231.md +3 -2
- package/docs/manual/12-/346/240/207/347/255/276/344/270/216/350/243/205/351/245/260.md +215 -2
- package/docs/manual/13-/345/212/250/346/225/210/344/270/216/345/233/276/345/205/203.md +6 -5
- package/docs/manual/14-/350/247/206/345/233/276/344/270/216/347/255/233/351/200/211.md +27 -14
- package/docs/manual/15-/345/257/274/345/207/272/344/270/216/351/233/206/346/210/220.md +142 -49
- package/docs/manual/16-/345/256/236/344/276/213/346/226/271/346/263/225/346/200/273/350/241/250.md +25 -29
- package/docs/manual/17-/345/217/202/346/225/260/351/200/237/346/237/245.md +47 -39
- package/docs/manual/18-/351/200/220/346/226/271/346/263/225/347/244/272/344/276/213.md +161 -64
- package/docs/manual/19-/350/257/273/346/225/260/344/270/216/346/213/226/346/213/275/351/242/204/350/247/210.md +4 -4
- package/docs/manual/20-/346/200/247/350/203/275/344/270/216/345/244/247/346/225/260/346/215/256.md +39 -2
- package/docs/manual/21-/350/257/264/346/230/216/344/270/216/345/270/270/350/247/201/351/227/256/351/242/230.md +21 -5
- package/docs/playground/index.html +5 -5
- package/docs/steps/README.md +12 -10
- package/docs/steps/check-doc-truth.mjs +1 -1
- package/docs/steps/selftest-actions.html +10 -10
- package/docs/steps/selftest-data.html +96 -14
- package/docs/steps/selftest-decoration.html +577 -0
- package/docs/steps/selftest-demo.html +6 -5
- package/docs/steps/selftest-demos.html +2048 -1624
- package/docs/steps/selftest-docs.html +86 -14
- package/docs/steps/selftest-effects.html +5 -5
- package/docs/steps/selftest-features.html +544 -85
- package/docs/steps/selftest-full.html +583 -583
- package/docs/steps/selftest-labels.html +797 -660
- package/docs/steps/selftest-perf.html +1899 -1844
- package/docs/steps/selftest-scale.html +117 -7
- package/docs/steps/selftest-select.html +24 -17
- package/docs/steps/step-10-full.js +1 -1
- package/docs//346/216/245/345/217/243/345/215/217/350/256/256.md +151 -7
- package/docs//346/225/260/346/215/256/346/240/274/345/274/217.md +1 -1
- package/package.json +42 -42
- package/docs/demos/HistoryDemo.vue +0 -230
- package/docs/demos/InterfaceDemo.vue +0 -309
- package/docs/demos/SampleDemo.vue +0 -283
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
/**
|
|
3
|
-
* 批量复制与合并(可交互版):同一张画布上把三条链路走完 ——
|
|
4
|
-
* 框选 → 复制 / 合并;Alt 点击复制 → 从 pointCopy 载荷接管或回滚;
|
|
5
|
-
* 拖点相撞 → 从 pointMerge 的 pending / confirm 载荷指定保留节点并改写最终节点。
|
|
6
|
-
*/
|
|
1
|
+
<script setup>
|
|
2
|
+
/**
|
|
3
|
+
* 批量复制与合并(可交互版):同一张画布上把三条链路走完 ——
|
|
4
|
+
* 框选 → 复制 / 合并;Alt 点击复制 → 从 pointCopy 载荷接管或回滚;
|
|
5
|
+
* 拖点相撞 → 从 pointMerge 的 pending / confirm 载荷指定保留节点并改写最终节点。
|
|
6
|
+
*/
|
|
7
7
|
import { computed, nextTick, onBeforeUnmount, onMounted, ref, shallowRef, triggerRef } from 'vue'
|
|
8
8
|
import { createGisView } from '../../src/index.js'
|
|
9
9
|
import { buildDemoData } from './shared/demoData.js'
|
|
10
10
|
import { createFakeBackend, cloneFakeData, FAKE_BACKEND_MODES } from './shared/fakeBackend.js'
|
|
11
11
|
import './shared/demoStyle.css'
|
|
12
|
-
|
|
13
|
-
const emit = defineEmits(['notice'])
|
|
14
|
-
const container = ref(null)
|
|
15
|
-
const selectionText = ref('未选中')
|
|
16
|
-
const actionText = ref('先框选一组节点,再试复制或合并')
|
|
17
|
-
const copyText = ref('复制:—')
|
|
18
|
-
const clipboardText = ref('剪贴板:—')
|
|
19
|
-
const mergeText = ref('合并:—')
|
|
20
|
-
const pendingText = ref('拖动一个节点撞到另一个节点上,这里会出现待确认载荷')
|
|
21
|
-
const mergeDetailText = ref('合并影响详情:—')
|
|
12
|
+
|
|
13
|
+
const emit = defineEmits(['notice'])
|
|
14
|
+
const container = ref(null)
|
|
15
|
+
const selectionText = ref('未选中')
|
|
16
|
+
const actionText = ref('先框选一组节点,再试复制或合并')
|
|
17
|
+
const copyText = ref('复制:—')
|
|
18
|
+
const clipboardText = ref('剪贴板:—')
|
|
19
|
+
const mergeText = ref('合并:—')
|
|
20
|
+
const pendingText = ref('拖动一个节点撞到另一个节点上,这里会出现待确认载荷')
|
|
21
|
+
const mergeDetailText = ref('合并影响详情:—')
|
|
22
22
|
const copyEventText = ref('还没有 pointCopy 事件')
|
|
23
23
|
const copySourcesText = ref('—')
|
|
24
24
|
const copyItemsText = ref('—')
|
|
@@ -37,24 +37,24 @@ const copyBackendRetry = shallowRef(null)
|
|
|
37
37
|
const mergeBackendRetry = shallowRef(null)
|
|
38
38
|
const copyBackendLast = shallowRef(null)
|
|
39
39
|
const mergeBackendLast = shallowRef(null)
|
|
40
|
-
const mergedName = ref('合并后节点(demo 改写)')
|
|
41
|
-
const mergedZone = ref('合并后(item 改写)')
|
|
42
|
-
const mergedVoltage = ref('525')
|
|
43
|
-
const mergedColor = ref('#ff5d8f')
|
|
44
|
-
const mergedSize = ref('16')
|
|
45
|
-
const mergedSymbol = ref('square')
|
|
46
|
-
const mergedStrokeColor = ref('#ffffff')
|
|
47
|
-
const mergeTargetId = ref('')
|
|
48
|
-
const mergeKeep = ref('target')
|
|
49
|
-
const rewriteOnConfirm = ref(true)
|
|
50
|
-
const pointOptions = ref([])
|
|
51
|
-
const selectedPoints = ref([])
|
|
52
|
-
const selectionCounts = ref({ points: 0, lines: 0, channels: 0 })
|
|
53
|
-
const selectionFilters = ref({ point: true, line: true, channel: true })
|
|
54
|
-
const logLines = ref([])
|
|
55
|
-
const copyToast = shallowRef(null)
|
|
56
|
-
const lastBatch = shallowRef(null)
|
|
57
|
-
const clipboardItem = shallowRef(null)
|
|
40
|
+
const mergedName = ref('合并后节点(demo 改写)')
|
|
41
|
+
const mergedZone = ref('合并后(item 改写)')
|
|
42
|
+
const mergedVoltage = ref('525')
|
|
43
|
+
const mergedColor = ref('#ff5d8f')
|
|
44
|
+
const mergedSize = ref('16')
|
|
45
|
+
const mergedSymbol = ref('square')
|
|
46
|
+
const mergedStrokeColor = ref('#ffffff')
|
|
47
|
+
const mergeTargetId = ref('')
|
|
48
|
+
const mergeKeep = ref('target')
|
|
49
|
+
const rewriteOnConfirm = ref(true)
|
|
50
|
+
const pointOptions = ref([])
|
|
51
|
+
const selectedPoints = ref([])
|
|
52
|
+
const selectionCounts = ref({ points: 0, lines: 0, channels: 0 })
|
|
53
|
+
const selectionFilters = ref({ point: true, line: true, channel: true })
|
|
54
|
+
const logLines = ref([])
|
|
55
|
+
const copyToast = shallowRef(null)
|
|
56
|
+
const lastBatch = shallowRef(null)
|
|
57
|
+
const clipboardItem = shallowRef(null)
|
|
58
58
|
const pendingMerge = shallowRef(null)
|
|
59
59
|
const copyEvent = shallowRef(null)
|
|
60
60
|
const fakeBackend = createFakeBackend({ initialVersion: 12, latency: 420, prefix: 'copy-merge' })
|
|
@@ -67,7 +67,7 @@ let addPointRound = 0
|
|
|
67
67
|
let mergeSyncTimer = null
|
|
68
68
|
let mergeSyncQueue = []
|
|
69
69
|
let disposed = false
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
const pointLabel = item => String(item?.name ?? item?.label ?? item?.id ?? '节点')
|
|
72
72
|
const pointKey = item => String(item?.id ?? item?.label ?? item?.name ?? '—')
|
|
73
73
|
const itemId = item => (item?.id ?? item?.line_id ?? item?.channel_id ?? '无 id')
|
|
@@ -95,7 +95,7 @@ const describeMergeChangeSets = (sets) => {
|
|
|
95
95
|
return `后端事务:删节点 [${points('removedPoint')}] → 更新节点 [${points('point')}] · 更新线 [${ids('lines')}] / 删线 [${ids('removedLines')}] · 更新通道 [${ids('channels')}] / 删通道 [${ids('removedChannels')}]`
|
|
96
96
|
}
|
|
97
97
|
const describeMergeChanges = changes => describeMergeChangeSets(changes ? [changes] : [])
|
|
98
|
-
/** 合并载荷里的影响预演:lineCount 是「改写 + 删除」的线路并集,后两项分别与落地结果同口径 */
|
|
98
|
+
/** 合并载荷里的影响预演:lineCount 是「改写 + 删除」的线路并集,后两项分别与落地结果同口径 */
|
|
99
99
|
const describeMergeImpact = impact => (impact
|
|
100
100
|
? `影响 ${impact.lineCount} 条线路(改线 ${impact.linesChanged} / 删线 ${impact.removedLines})· 通道 改 ${impact.channelsChanged} / 删 ${impact.removedChannels} / 并 ${impact.mergedChannels}`
|
|
101
101
|
: '影响读数:当前数据对不上')
|
|
@@ -376,447 +376,447 @@ const resetBackendDemo = () => {
|
|
|
376
376
|
}
|
|
377
377
|
/** pending / confirm 阶段按 impact 里的 id 调现有 getLine / getChannel 查详情;确认落地前查,删掉的通道仍有数据 */
|
|
378
378
|
const showMergeImpactDetails = () => {
|
|
379
|
-
const payload = pendingMerge.value
|
|
380
|
-
const impact = payload?.impact
|
|
381
|
-
if (!impact) {
|
|
382
|
-
mergeDetailText.value = '合并影响详情:当前没有可用的影响载荷'
|
|
383
|
-
return mergeDetailText.value
|
|
384
|
-
}
|
|
385
|
-
const lines = impact.lineIds.map(id => {
|
|
386
|
-
const line = view?.getLine(id)
|
|
387
|
-
if (!line) {
|
|
388
|
-
return `${id}(已不存在)`
|
|
389
|
-
}
|
|
390
|
-
return `${id}(${line.item?.name ?? '未命名'}:${line.item?.from ?? '—'}→${line.item?.to ?? '—'})`
|
|
391
|
-
})
|
|
392
|
-
const channels = impact.channelIds.map(id => {
|
|
393
|
-
const channel = view?.getChannel(id)
|
|
394
|
-
if (!channel) {
|
|
395
|
-
return `${id}(已不存在)`
|
|
396
|
-
}
|
|
397
|
-
return `${id}(${channel.item?.name ?? '未命名'}:${channel.lineIndexes.length} 回)`
|
|
398
|
-
})
|
|
399
|
-
mergeDetailText.value = `影响线路 ${lines.join(' / ') || '无'} · 影响通道 ${channels.join(' / ') || '无'}`
|
|
400
|
-
return mergeDetailText.value
|
|
401
|
-
}
|
|
402
|
-
const selectionKinds = computed(() => ['point', 'line', 'channel'].filter(kind => selectionFilters.value[kind]))
|
|
403
|
-
const selectionKindsText = computed(() => selectionKinds.value.length ? selectionKinds.value.join(' + ') : '全关')
|
|
404
|
-
const mergeTargetOptions = computed(() => selectedPoints.value.map(item => ({
|
|
405
|
-
value: pointKey(item),
|
|
406
|
-
label: `${pointLabel(item)}(${pointKey(item)})`
|
|
407
|
-
})))
|
|
408
|
-
const canMerge = computed(() => selectedPoints.value.length >= 2)
|
|
409
|
-
const copyToastTitle = computed(() => {
|
|
410
|
-
const payload = copyToast.value
|
|
411
|
-
if (!payload) return ''
|
|
412
|
-
if (payload.ok === false) return '复制没有落地'
|
|
413
|
-
if (payload.phase === 'clipboard') return '剪贴板快照已就绪'
|
|
414
|
-
if (payload.phase === 'batch') return payload.via === 'paste' ? 'Ctrl+V 整组粘贴已落地' : '整组复制已落地'
|
|
415
|
-
if (payload.phase === 'end') return payload.via === 'paste' ? 'Ctrl+V 已粘贴' : 'Alt 复制已落地'
|
|
416
|
-
if (payload.phase === 'commit') return '复制正在提交'
|
|
417
|
-
return '复制预览中'
|
|
418
|
-
})
|
|
419
|
-
const copyToastText = computed(() => {
|
|
420
|
-
const payload = copyToast.value
|
|
421
|
-
if (!payload) return ''
|
|
422
|
-
const sources = payload.sources ?? (payload.source ? [payload.source] : [])
|
|
423
|
-
const items = payload.items ?? (payload.item ? [payload.item] : [])
|
|
424
|
-
const sourceText = sources.slice(0, 4).map(entry => pointLabel(entry.item)).join(' / ') || '—'
|
|
425
|
-
const itemText = items.slice(0, 4).map(pointLabel).join(' / ') || '—'
|
|
426
|
-
const supportCount = payload.supportSources?.length ?? sources.filter(entry => entry.support).length
|
|
427
|
-
return `来源 ${sourceText}${supportCount ? `(含 ${supportCount} 个补端点)` : ''} → 结果 ${itemText} · 线路 ${payload.lines?.length ?? 0} / 通道 ${payload.channels?.length ?? 0}`
|
|
428
|
-
})
|
|
429
|
-
|
|
430
|
-
const pushLog = (name, text) => {
|
|
431
|
-
logSeq += 1
|
|
432
|
-
logLines.value = [{ id: logSeq, name, text }, ...logLines.value].slice(0, 18)
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
const focusCanvas = () => nextTick(() => {
|
|
436
|
-
container.value?.querySelector('.gis-view')?.focus({ preventScroll: true })
|
|
437
|
-
})
|
|
438
|
-
|
|
439
|
-
const refreshState = () => {
|
|
440
|
-
if (!view) return
|
|
441
|
-
const data = view.getData()
|
|
442
|
-
pointOptions.value = data.points.map((item, index) => ({
|
|
443
|
-
value: pointKey(item) || String(index),
|
|
444
|
-
label: `${pointLabel(item)}(${pointKey(item)})`
|
|
445
|
-
}))
|
|
446
|
-
const selection = view.getSelectionData()
|
|
447
|
-
selectedPoints.value = selection.points ?? []
|
|
448
|
-
selectionCounts.value = { points: selection.pointCount, lines: selection.lineCount, channels: selection.channelCount }
|
|
449
|
-
selectionText.value = selection.count
|
|
450
|
-
? `${selection.pointCount} 节点 / ${selection.lineCount} 线路 / ${selection.channelCount} 通道:${(selection.items ?? []).slice(0, 5).map(entry => pointLabel(entry.item)).join(' / ')}`
|
|
451
|
-
: '未选中'
|
|
452
|
-
if (!mergeTargetOptions.value.some(item => item.value === mergeTargetId.value)) {
|
|
453
|
-
mergeTargetId.value = mergeTargetOptions.value[0]?.value ?? ''
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
const describeBatchCopy = payload => {
|
|
458
|
-
const sourceNames = (payload?.sources ?? []).slice(0, 4).map(entry => pointLabel(entry.item)).join(' / ')
|
|
459
|
-
const supportCount = payload?.supportSources?.length ?? 0
|
|
460
|
-
return `phase=${payload?.phase ?? '—'} · via=${payload?.via ?? '—'} · count=${payload?.count ?? 0} · 来源 ${sourceNames || '—'} · 节点 ${payload?.items?.length ?? 0}${supportCount ? `(补端点 ${supportCount})` : ''} / 线路 ${payload?.lines?.length ?? 0} / 通道 ${payload?.channels?.length ?? 0}`
|
|
461
|
-
}
|
|
462
|
-
|
|
379
|
+
const payload = pendingMerge.value
|
|
380
|
+
const impact = payload?.impact
|
|
381
|
+
if (!impact) {
|
|
382
|
+
mergeDetailText.value = '合并影响详情:当前没有可用的影响载荷'
|
|
383
|
+
return mergeDetailText.value
|
|
384
|
+
}
|
|
385
|
+
const lines = impact.lineIds.map(id => {
|
|
386
|
+
const line = view?.getLine(id)
|
|
387
|
+
if (!line) {
|
|
388
|
+
return `${id}(已不存在)`
|
|
389
|
+
}
|
|
390
|
+
return `${id}(${line.item?.name ?? '未命名'}:${line.item?.from ?? '—'}→${line.item?.to ?? '—'})`
|
|
391
|
+
})
|
|
392
|
+
const channels = impact.channelIds.map(id => {
|
|
393
|
+
const channel = view?.getChannel(id)
|
|
394
|
+
if (!channel) {
|
|
395
|
+
return `${id}(已不存在)`
|
|
396
|
+
}
|
|
397
|
+
return `${id}(${channel.item?.name ?? '未命名'}:${channel.lineIndexes.length} 回)`
|
|
398
|
+
})
|
|
399
|
+
mergeDetailText.value = `影响线路 ${lines.join(' / ') || '无'} · 影响通道 ${channels.join(' / ') || '无'}`
|
|
400
|
+
return mergeDetailText.value
|
|
401
|
+
}
|
|
402
|
+
const selectionKinds = computed(() => ['point', 'line', 'channel'].filter(kind => selectionFilters.value[kind]))
|
|
403
|
+
const selectionKindsText = computed(() => selectionKinds.value.length ? selectionKinds.value.join(' + ') : '全关')
|
|
404
|
+
const mergeTargetOptions = computed(() => selectedPoints.value.map(item => ({
|
|
405
|
+
value: pointKey(item),
|
|
406
|
+
label: `${pointLabel(item)}(${pointKey(item)})`
|
|
407
|
+
})))
|
|
408
|
+
const canMerge = computed(() => selectedPoints.value.length >= 2)
|
|
409
|
+
const copyToastTitle = computed(() => {
|
|
410
|
+
const payload = copyToast.value
|
|
411
|
+
if (!payload) return ''
|
|
412
|
+
if (payload.ok === false) return '复制没有落地'
|
|
413
|
+
if (payload.phase === 'clipboard') return '剪贴板快照已就绪'
|
|
414
|
+
if (payload.phase === 'batch') return payload.via === 'paste' ? 'Ctrl+V 整组粘贴已落地' : '整组复制已落地'
|
|
415
|
+
if (payload.phase === 'end') return payload.via === 'paste' ? 'Ctrl+V 已粘贴' : 'Alt 复制已落地'
|
|
416
|
+
if (payload.phase === 'commit') return '复制正在提交'
|
|
417
|
+
return '复制预览中'
|
|
418
|
+
})
|
|
419
|
+
const copyToastText = computed(() => {
|
|
420
|
+
const payload = copyToast.value
|
|
421
|
+
if (!payload) return ''
|
|
422
|
+
const sources = payload.sources ?? (payload.source ? [payload.source] : [])
|
|
423
|
+
const items = payload.items ?? (payload.item ? [payload.item] : [])
|
|
424
|
+
const sourceText = sources.slice(0, 4).map(entry => pointLabel(entry.item)).join(' / ') || '—'
|
|
425
|
+
const itemText = items.slice(0, 4).map(pointLabel).join(' / ') || '—'
|
|
426
|
+
const supportCount = payload.supportSources?.length ?? sources.filter(entry => entry.support).length
|
|
427
|
+
return `来源 ${sourceText}${supportCount ? `(含 ${supportCount} 个补端点)` : ''} → 结果 ${itemText} · 线路 ${payload.lines?.length ?? 0} / 通道 ${payload.channels?.length ?? 0}`
|
|
428
|
+
})
|
|
429
|
+
|
|
430
|
+
const pushLog = (name, text) => {
|
|
431
|
+
logSeq += 1
|
|
432
|
+
logLines.value = [{ id: logSeq, name, text }, ...logLines.value].slice(0, 18)
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const focusCanvas = () => nextTick(() => {
|
|
436
|
+
container.value?.querySelector('.gis-view')?.focus({ preventScroll: true })
|
|
437
|
+
})
|
|
438
|
+
|
|
439
|
+
const refreshState = () => {
|
|
440
|
+
if (!view) return
|
|
441
|
+
const data = view.getData()
|
|
442
|
+
pointOptions.value = data.points.map((item, index) => ({
|
|
443
|
+
value: pointKey(item) || String(index),
|
|
444
|
+
label: `${pointLabel(item)}(${pointKey(item)})`
|
|
445
|
+
}))
|
|
446
|
+
const selection = view.getSelectionData()
|
|
447
|
+
selectedPoints.value = selection.points ?? []
|
|
448
|
+
selectionCounts.value = { points: selection.pointCount, lines: selection.lineCount, channels: selection.channelCount }
|
|
449
|
+
selectionText.value = selection.count
|
|
450
|
+
? `${selection.pointCount} 节点 / ${selection.lineCount} 线路 / ${selection.channelCount} 通道:${(selection.items ?? []).slice(0, 5).map(entry => pointLabel(entry.item)).join(' / ')}`
|
|
451
|
+
: '未选中'
|
|
452
|
+
if (!mergeTargetOptions.value.some(item => item.value === mergeTargetId.value)) {
|
|
453
|
+
mergeTargetId.value = mergeTargetOptions.value[0]?.value ?? ''
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
const describeBatchCopy = payload => {
|
|
458
|
+
const sourceNames = (payload?.sources ?? []).slice(0, 4).map(entry => pointLabel(entry.item)).join(' / ')
|
|
459
|
+
const supportCount = payload?.supportSources?.length ?? 0
|
|
460
|
+
return `phase=${payload?.phase ?? '—'} · via=${payload?.via ?? '—'} · count=${payload?.count ?? 0} · 来源 ${sourceNames || '—'} · 节点 ${payload?.items?.length ?? 0}${supportCount ? `(补端点 ${supportCount})` : ''} / 线路 ${payload?.lines?.length ?? 0} / 通道 ${payload?.channels?.length ?? 0}`
|
|
461
|
+
}
|
|
462
|
+
|
|
463
463
|
const rememberCopyPayload = payload => {
|
|
464
464
|
copyEvent.value = payload
|
|
465
465
|
copyLineChannelsText.value = describeLineChannels(payload)
|
|
466
466
|
const sources = payload.sources ?? (payload.source ? [payload.source] : [])
|
|
467
|
-
const items = payload.items ?? (payload.item ? [payload.item] : [])
|
|
468
|
-
copyEventText.value = `phase=${payload.phase ?? '—'} · via=${payload.via ?? '—'} · count=${payload.count ?? items.length}`
|
|
469
|
-
copySourcesText.value = sources.length
|
|
470
|
-
? sources.map(entry => `${pointLabel(entry.item)}(${pointKey(entry.item)}${entry.support ? ' · 补端点' : ''})`).join(' / ')
|
|
471
|
-
: '—'
|
|
472
|
-
copyItemsText.value = items.length ? items.map(pointLabel).join(' / ') : '—'
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
const handlePointCopy = (payload) => {
|
|
476
|
-
rememberCopyPayload(payload)
|
|
477
|
-
if (payload.phase === 'batch') {
|
|
478
|
-
if (payload.ok === false) {
|
|
479
|
-
copyText.value = `批量复制失败:${payload.reason}`
|
|
480
|
-
actionText.value = copyText.value
|
|
481
|
-
copyToast.value = payload
|
|
482
|
-
pushLog('pointCopy/batch', copyText.value)
|
|
483
|
-
return
|
|
484
|
-
}
|
|
485
|
-
lastBatch.value = payload
|
|
486
|
-
copyText.value = `${payload.via === 'paste' ? 'pastePoints' : 'copySelectedPoints'}:${describeBatchCopy(payload)}`
|
|
487
|
-
actionText.value = copyText.value
|
|
467
|
+
const items = payload.items ?? (payload.item ? [payload.item] : [])
|
|
468
|
+
copyEventText.value = `phase=${payload.phase ?? '—'} · via=${payload.via ?? '—'} · count=${payload.count ?? items.length}`
|
|
469
|
+
copySourcesText.value = sources.length
|
|
470
|
+
? sources.map(entry => `${pointLabel(entry.item)}(${pointKey(entry.item)}${entry.support ? ' · 补端点' : ''})`).join(' / ')
|
|
471
|
+
: '—'
|
|
472
|
+
copyItemsText.value = items.length ? items.map(pointLabel).join(' / ') : '—'
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
const handlePointCopy = (payload) => {
|
|
476
|
+
rememberCopyPayload(payload)
|
|
477
|
+
if (payload.phase === 'batch') {
|
|
478
|
+
if (payload.ok === false) {
|
|
479
|
+
copyText.value = `批量复制失败:${payload.reason}`
|
|
480
|
+
actionText.value = copyText.value
|
|
481
|
+
copyToast.value = payload
|
|
482
|
+
pushLog('pointCopy/batch', copyText.value)
|
|
483
|
+
return
|
|
484
|
+
}
|
|
485
|
+
lastBatch.value = payload
|
|
486
|
+
copyText.value = `${payload.via === 'paste' ? 'pastePoints' : 'copySelectedPoints'}:${describeBatchCopy(payload)}`
|
|
487
|
+
actionText.value = copyText.value
|
|
488
488
|
copyToast.value = payload
|
|
489
489
|
pushLog('pointCopy/batch', copyText.value)
|
|
490
490
|
refreshState()
|
|
491
491
|
startCopyBackend(payload)
|
|
492
492
|
return
|
|
493
|
-
}
|
|
494
|
-
if (payload.phase === 'clipboard') {
|
|
495
|
-
clipboardItem.value = view?.getPointClipboard() ?? null
|
|
496
|
-
clipboardText.value = `剪贴板:count=${payload.count ?? 0} · 节点 ${payload.items?.length ?? 0} / 线路 ${payload.lines?.length ?? 0} / 通道 ${payload.channels?.length ?? 0} · sources=${(payload.sources ?? []).map(entry => pointLabel(entry.item)).join(' / ')}`
|
|
497
|
-
actionText.value = clipboardText.value
|
|
498
|
-
copyToast.value = payload
|
|
499
|
-
pushLog('pointCopy/clipboard', clipboardText.value)
|
|
500
|
-
return
|
|
501
|
-
}
|
|
502
|
-
if (payload.phase === 'start' || payload.phase === 'commit') {
|
|
503
|
-
copyText.value = `复制预览 · 来源 ${pointLabel(payload.source?.item)} → ${pointLabel(payload.item)}`
|
|
504
|
-
copyToast.value = payload
|
|
505
|
-
pushLog(`pointCopy/${payload.phase}`, copyText.value)
|
|
506
|
-
return
|
|
507
|
-
}
|
|
508
|
-
if (payload.phase === 'end') {
|
|
509
|
-
copyText.value = `复制落地 · ${payload.via} · 来源 ${pointLabel(payload.source?.item)} → ${pointLabel(payload.item)}(${pointKey(payload.item)})`
|
|
510
|
-
actionText.value = copyText.value
|
|
493
|
+
}
|
|
494
|
+
if (payload.phase === 'clipboard') {
|
|
495
|
+
clipboardItem.value = view?.getPointClipboard() ?? null
|
|
496
|
+
clipboardText.value = `剪贴板:count=${payload.count ?? 0} · 节点 ${payload.items?.length ?? 0} / 线路 ${payload.lines?.length ?? 0} / 通道 ${payload.channels?.length ?? 0} · sources=${(payload.sources ?? []).map(entry => pointLabel(entry.item)).join(' / ')}`
|
|
497
|
+
actionText.value = clipboardText.value
|
|
498
|
+
copyToast.value = payload
|
|
499
|
+
pushLog('pointCopy/clipboard', clipboardText.value)
|
|
500
|
+
return
|
|
501
|
+
}
|
|
502
|
+
if (payload.phase === 'start' || payload.phase === 'commit') {
|
|
503
|
+
copyText.value = `复制预览 · 来源 ${pointLabel(payload.source?.item)} → ${pointLabel(payload.item)}`
|
|
504
|
+
copyToast.value = payload
|
|
505
|
+
pushLog(`pointCopy/${payload.phase}`, copyText.value)
|
|
506
|
+
return
|
|
507
|
+
}
|
|
508
|
+
if (payload.phase === 'end') {
|
|
509
|
+
copyText.value = `复制落地 · ${payload.via} · 来源 ${pointLabel(payload.source?.item)} → ${pointLabel(payload.item)}(${pointKey(payload.item)})`
|
|
510
|
+
actionText.value = copyText.value
|
|
511
511
|
copyToast.value = payload
|
|
512
512
|
pushLog('pointCopy/end', copyText.value)
|
|
513
513
|
refreshState()
|
|
514
514
|
startCopyBackend(payload)
|
|
515
515
|
return
|
|
516
|
-
}
|
|
517
|
-
if (payload.phase === 'cancel') {
|
|
518
|
-
copyText.value = payload.invalidated ? '复制作废:数据已换过' : '复制已取消,预览没有落地'
|
|
519
|
-
actionText.value = copyText.value
|
|
520
|
-
copyToast.value = null
|
|
521
|
-
pushLog('pointCopy/cancel', copyText.value)
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
const sourceIds = () => {
|
|
526
|
-
const points = view?.getData().points ?? []
|
|
527
|
-
const indexes = [0, 7, 12, 5]
|
|
528
|
-
const picked = indexes.map(index => points[index % points.length]?.id).filter(id => id !== undefined && id !== null)
|
|
529
|
-
return [...new Set(picked)]
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
const selectBatchSources = () => {
|
|
533
|
-
const ids = sourceIds()
|
|
534
|
-
view.
|
|
535
|
-
refreshState()
|
|
536
|
-
actionText.value = `已选中 ${ids.length} 个来源:${ids.join(' / ')}(画布上也已高亮)`
|
|
537
|
-
pushLog('select', actionText.value)
|
|
538
|
-
return actionText.value
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
const clearSelection = () => {
|
|
542
|
-
view.
|
|
543
|
-
refreshState()
|
|
544
|
-
actionText.value = '已清空选中;现在可拖动单个节点撞向另一个节点'
|
|
545
|
-
return actionText.value
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
const applySelectionKinds = () => {
|
|
549
|
-
view?.updateOptions({ selectionKinds: selectionKinds.value })
|
|
550
|
-
actionText.value = `框选 / Ctrl 多选类型:${selectionKindsText.value}`
|
|
551
|
-
pushLog('selectionKinds', actionText.value)
|
|
552
|
-
return actionText.value
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
const selectSampleLine = () => {
|
|
556
|
-
view.selectFeatures({ type: 'line', index: 0 })
|
|
557
|
-
refreshState()
|
|
558
|
-
actionText.value = '已选中示例独立线路(不含两端节点);复制会自动补两个端点节点并带上线路'
|
|
559
|
-
pushLog('select/line', actionText.value)
|
|
560
|
-
return actionText.value
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
const selectSampleChannel = () => {
|
|
564
|
-
view.selectFeatures({ type: 'channel', channelId: 'channel-a' })
|
|
565
|
-
refreshState()
|
|
566
|
-
actionText.value = '已选中甲通道整条(全部回线);复制会同时补端点、线路与通道'
|
|
567
|
-
pushLog('select/channel', actionText.value)
|
|
568
|
-
return actionText.value
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
const ensureBatchSelection = () => {
|
|
572
|
-
const current = view?.getSelectionData().points ?? []
|
|
573
|
-
if (current.length) return current
|
|
574
|
-
view.
|
|
575
|
-
refreshState()
|
|
576
|
-
return selectedPoints.value
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
const copySelectedByApi = () => {
|
|
580
|
-
if (!view.getSelectionData().count) ensureBatchSelection()
|
|
581
|
-
copyRound += 1
|
|
582
|
-
const result = view.copySelectedPoints({
|
|
583
|
-
offset: [64 + copyRound * 12, 46 + copyRound * 8],
|
|
584
|
-
select: true,
|
|
585
|
-
label: `demo 框选复制 ${copyRound}`
|
|
586
|
-
})
|
|
587
|
-
if (result.ok) {
|
|
588
|
-
lastBatch.value = result
|
|
589
|
-
copyText.value = `copySelectedPoints:${describeBatchCopy(result)}`
|
|
590
|
-
actionText.value = copyText.value
|
|
591
|
-
}
|
|
592
|
-
else {
|
|
593
|
-
copyText.value = `copySelectedPoints 失败:${result.reason}`
|
|
594
|
-
actionText.value = copyText.value
|
|
595
|
-
}
|
|
596
|
-
refreshState()
|
|
597
|
-
return copyText.value
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
const copyPointsByApi = () => {
|
|
601
|
-
copyRound += 1
|
|
602
|
-
const result = view.copyPoints(sourceIds(), {
|
|
603
|
-
offset: [74 + copyRound * 12, 58 + copyRound * 8],
|
|
604
|
-
select: true,
|
|
605
|
-
label: `demo copyPoints ${copyRound}`
|
|
606
|
-
})
|
|
607
|
-
if (result.ok) {
|
|
608
|
-
lastBatch.value = result
|
|
609
|
-
copyText.value = `copyPoints:${describeBatchCopy(result)}`
|
|
610
|
-
actionText.value = copyText.value
|
|
611
|
-
}
|
|
612
|
-
else {
|
|
613
|
-
copyText.value = `copyPoints 失败:${result.reason}`
|
|
614
|
-
actionText.value = copyText.value
|
|
615
|
-
}
|
|
616
|
-
refreshState()
|
|
617
|
-
return copyText.value
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
const copyClipboardByApi = () => {
|
|
621
|
-
if (!view.getSelectionData().count) ensureBatchSelection()
|
|
622
|
-
const item = view.copyPointsToClipboard(undefined, { via: 'demo-copy-clipboard' })
|
|
623
|
-
clipboardItem.value = item
|
|
624
|
-
clipboardText.value = item
|
|
625
|
-
? `剪贴板:count=${item.count} · 节点 ${item.items.length}${item.supportSources?.length ? `(补端点 ${item.supportSources.length})` : ''} / 线路 ${item.lines.length} / 通道 ${item.channels.length} · sources=${item.sources.map(entry => `${pointLabel(entry.item)}${entry.support ? '·补端点' : ''}`).join(' / ')}`
|
|
626
|
-
: '剪贴板为空'
|
|
627
|
-
actionText.value = item ? `${clipboardText.value};焦点已交给画布,按 Ctrl+V 或点 pastePoints` : '剪贴板为空'
|
|
628
|
-
focusCanvas()
|
|
629
|
-
refreshState()
|
|
630
|
-
return clipboardText.value
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
const pasteFromClipboard = () => {
|
|
634
|
-
clipboardItem.value = view.getPointClipboard() ?? clipboardItem.value
|
|
635
|
-
if (!clipboardItem.value) return 'pastePoints:先复制到剪贴板'
|
|
636
|
-
pasteRound += 1
|
|
637
|
-
const anchor = clipboardItem.value.anchor ?? [0, 0]
|
|
638
|
-
const result = view.pastePoints({
|
|
639
|
-
coordinate: [anchor[0] + 1.05 + pasteRound * 0.18, anchor[1] - 0.72 - pasteRound * 0.12],
|
|
640
|
-
select: true,
|
|
641
|
-
label: `demo 粘贴 ${pasteRound}`
|
|
642
|
-
})
|
|
643
|
-
if (result?.ok) {
|
|
644
|
-
lastBatch.value = result
|
|
645
|
-
copyText.value = `pastePoints:${describeBatchCopy(result)}`
|
|
646
|
-
actionText.value = copyText.value
|
|
647
|
-
}
|
|
648
|
-
else {
|
|
649
|
-
copyText.value = `pastePoints 失败:${result?.reason ?? '剪贴板为空或复制已关闭'}`
|
|
650
|
-
actionText.value = copyText.value
|
|
651
|
-
}
|
|
652
|
-
refreshState()
|
|
653
|
-
return copyText.value
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
const revertLastCopy = () => {
|
|
657
|
-
const payload = copyToast.value ?? copyEvent.value
|
|
658
|
-
if (!payload) return '没有可取消 / 回滚的复制'
|
|
659
|
-
let message = '复制已经不在数据里'
|
|
660
|
-
if (payload.phase === 'clipboard') {
|
|
661
|
-
payload.cancel?.()
|
|
662
|
-
clipboardItem.value = null
|
|
663
|
-
message = '已清空剪贴板'
|
|
664
|
-
}
|
|
665
|
-
else if (typeof payload.revert === 'function') {
|
|
666
|
-
const outcome = payload.revert()
|
|
667
|
-
message = outcome?.ok
|
|
668
|
-
? `${payload.phase === 'batch' ? '已撤销整组复制' : '已回滚本次复制'} · 收回 ${outcome.items?.length ?? outcome.count ?? 0} 个节点`
|
|
669
|
-
: '复制已经不在数据里'
|
|
670
|
-
}
|
|
671
|
-
else if (typeof payload.cancel === 'function') {
|
|
672
|
-
payload.cancel()
|
|
673
|
-
message = '已取消这次复制预览,数据没有落地'
|
|
674
|
-
}
|
|
675
|
-
copyToast.value = null
|
|
676
|
-
if (lastBatch.value === payload) lastBatch.value = null
|
|
677
|
-
actionText.value = message
|
|
678
|
-
pushLog('copy/revert', message)
|
|
679
|
-
refreshState()
|
|
680
|
-
return message
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
const manualAddPointCopy = () => {
|
|
684
|
-
const previous = lastBatch.value ?? (copyToast.value?.phase === 'batch' || copyToast.value?.phase === 'end' ? copyToast.value : null)
|
|
685
|
-
let reverted = 0
|
|
686
|
-
if (previous && typeof previous.revert === 'function') {
|
|
687
|
-
const outcome = previous.revert()
|
|
688
|
-
reverted = outcome?.items?.length ?? outcome?.count ?? 0
|
|
689
|
-
if (lastBatch.value === previous) lastBatch.value = null
|
|
690
|
-
if (copyToast.value === previous) copyToast.value = null
|
|
691
|
-
}
|
|
692
|
-
if (!view.getSelectionData().pointCount) ensureBatchSelection()
|
|
693
|
-
if (!view.getSelectionData().pointCount) return '手动 addPoint 只接管节点复制:先选中至少一个节点'
|
|
694
|
-
addPointRound += 1
|
|
695
|
-
// 先让内置复制算出一份真实落点(同时不带上选中线路 / 通道),拿到 items 后立刻整批撤销,
|
|
696
|
-
// 再按这些落点逐个 addPoint:最终数据里只有手动副本,不会残留自动副本。
|
|
697
|
-
const probe = view.copySelectedPoints({
|
|
698
|
-
offset: [84 + addPointRound * 10, 54 + addPointRound * 8],
|
|
699
|
-
withLines: false,
|
|
700
|
-
withChannels: false,
|
|
701
|
-
select: false,
|
|
702
|
-
via: 'manual-addpoint-probe',
|
|
703
|
-
label: 'demo 手动复制落点'
|
|
704
|
-
})
|
|
705
|
-
if (!probe?.ok) {
|
|
706
|
-
manualText.value = `手动 addPoint 准备失败:${probe?.reason ?? '复制没有落地'}`
|
|
707
|
-
actionText.value = manualText.value
|
|
708
|
-
return manualText.value
|
|
709
|
-
}
|
|
710
|
-
const placements = probe.items.map(item => ({ ...item }))
|
|
711
|
-
const probeSources = probe.sources.filter(entry => !entry.support)
|
|
712
|
-
probe.revert()
|
|
713
|
-
lastBatch.value = null
|
|
714
|
-
copyToast.value = null
|
|
715
|
-
const created = []
|
|
716
|
-
for (let index = 0; index < placements.length; index += 1) {
|
|
717
|
-
const placement = placements[index]
|
|
718
|
-
const source = probeSources[index]
|
|
719
|
-
const { id: _oldId, ...rest } = placement
|
|
720
|
-
const result = view.addPoint({
|
|
721
|
-
...rest,
|
|
722
|
-
id: `addpoint-copy-${addPointRound}-${index + 1}`,
|
|
723
|
-
name: `${pointLabel(source?.item ?? placement)} · addPoint 副本`,
|
|
724
|
-
zone_name: 'addPoint 手动复制',
|
|
725
|
-
demo_copy: true,
|
|
726
|
-
demo_copy_via: 'addPoint'
|
|
727
|
-
})
|
|
728
|
-
if (result.ok && result.item) created.push(result.item)
|
|
729
|
-
}
|
|
730
|
-
view.
|
|
731
|
-
manualText.value = `addPoint ×${created.length}:${created.map(item => `${pointLabel(item)}(${pointKey(item)})`).join(' / ') || '没有落地'}${reverted ? ` · 已删自动副本 ${reverted} 个` : ''} · 最终只多一份`
|
|
732
|
-
actionText.value = manualText.value
|
|
733
|
-
pushLog('addPoint', manualText.value)
|
|
734
|
-
refreshState()
|
|
735
|
-
return manualText.value
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
const prepareMerge = () => {
|
|
739
|
-
if (!selectedPoints.value.length) selectBatchSources()
|
|
740
|
-
if (!mergeTargetOptions.value.some(item => item.value === mergeTargetId.value)) {
|
|
741
|
-
mergeTargetId.value = mergeTargetOptions.value[0]?.value ?? ''
|
|
742
|
-
}
|
|
743
|
-
refreshState()
|
|
744
|
-
actionText.value = `已准备 ${selectedPoints.value.length} 个选中节点;保留目标 ${mergeTargetId.value || '—'},可在画布继续 Ctrl 点选`
|
|
745
|
-
pushLog('merge/prepare', actionText.value)
|
|
746
|
-
return actionText.value
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
const mergePatch = () => {
|
|
750
|
-
const patch = {
|
|
751
|
-
name: mergedName.value.trim() || '合并后节点',
|
|
752
|
-
zone_name: mergedZone.value.trim() || '合并后(item 改写)',
|
|
753
|
-
demo_merged: true
|
|
754
|
-
}
|
|
755
|
-
const voltage = Number(mergedVoltage.value)
|
|
756
|
-
if (Number.isFinite(voltage)) patch.vn_kv = voltage
|
|
757
|
-
const size = Number(mergedSize.value)
|
|
758
|
-
if (Number.isFinite(size) && size > 0) patch.size = size
|
|
759
|
-
if (mergedColor.value.trim()) patch.color = mergedColor.value.trim()
|
|
760
|
-
if (mergedSymbol.value.trim()) patch.symbol = mergedSymbol.value.trim()
|
|
761
|
-
if (mergedStrokeColor.value.trim()) patch.strokeColor = mergedStrokeColor.value.trim()
|
|
762
|
-
return patch
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
const mergeSelectedByApi = () => {
|
|
766
|
-
const points = selectedPoints.value
|
|
767
|
-
if (points.length < 2) return 'mergeSelectedPoints:至少选中两个节点'
|
|
768
|
-
const targetId = mergeTargetOptions.value.some(item => item.value === mergeTargetId.value)
|
|
769
|
-
? mergeTargetId.value
|
|
770
|
-
: mergeTargetOptions.value[0].value
|
|
771
|
-
const target = points.find(item => pointKey(item) === targetId)
|
|
772
|
-
const sources = points.filter(item => pointKey(item) !== targetId).map(item => item.id)
|
|
773
|
-
const result = view.mergeSelectedPoints({
|
|
774
|
-
target: { id: target?.id ?? targetId },
|
|
775
|
-
sources,
|
|
776
|
-
item: mergePatch(),
|
|
777
|
-
label: 'demo 合并选中节点'
|
|
778
|
-
})
|
|
779
|
-
if (result.ok) {
|
|
780
|
-
view.
|
|
781
|
-
mergeText.value = `mergeSelectedPoints · 保留 ${pointLabel(result.target?.item)} · 并掉 ${result.sourcesMerged} 个 · 改线 ${result.linesChanged} / 删线 ${result.removedLines} / 并通道 ${result.mergedChannels ?? 0} · 最终 ${pointLabel(result.target?.item)}`
|
|
782
|
-
pendingText.value = '这次走 API 直接合并,没有 pending 阶段'
|
|
783
|
-
}
|
|
784
|
-
else {
|
|
785
|
-
mergeText.value = `mergeSelectedPoints 失败:${result.reason}`
|
|
786
|
-
}
|
|
787
|
-
actionText.value = mergeText.value
|
|
788
|
-
pushLog('mergeSelectedPoints', mergeText.value)
|
|
789
|
-
refreshState()
|
|
790
|
-
return mergeText.value
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
const handlePointMerge = (payload) => {
|
|
516
|
+
}
|
|
517
|
+
if (payload.phase === 'cancel') {
|
|
518
|
+
copyText.value = payload.invalidated ? '复制作废:数据已换过' : '复制已取消,预览没有落地'
|
|
519
|
+
actionText.value = copyText.value
|
|
520
|
+
copyToast.value = null
|
|
521
|
+
pushLog('pointCopy/cancel', copyText.value)
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
const sourceIds = () => {
|
|
526
|
+
const points = view?.getData().points ?? []
|
|
527
|
+
const indexes = [0, 7, 12, 5]
|
|
528
|
+
const picked = indexes.map(index => points[index % points.length]?.id).filter(id => id !== undefined && id !== null)
|
|
529
|
+
return [...new Set(picked)]
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
const selectBatchSources = () => {
|
|
533
|
+
const ids = sourceIds()
|
|
534
|
+
view.selectFeatures(ids)
|
|
535
|
+
refreshState()
|
|
536
|
+
actionText.value = `已选中 ${ids.length} 个来源:${ids.join(' / ')}(画布上也已高亮)`
|
|
537
|
+
pushLog('select', actionText.value)
|
|
538
|
+
return actionText.value
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
const clearSelection = () => {
|
|
542
|
+
view.selectFeatures(null)
|
|
543
|
+
refreshState()
|
|
544
|
+
actionText.value = '已清空选中;现在可拖动单个节点撞向另一个节点'
|
|
545
|
+
return actionText.value
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const applySelectionKinds = () => {
|
|
549
|
+
view?.updateOptions({ selectionKinds: selectionKinds.value })
|
|
550
|
+
actionText.value = `框选 / Ctrl 多选类型:${selectionKindsText.value}`
|
|
551
|
+
pushLog('selectionKinds', actionText.value)
|
|
552
|
+
return actionText.value
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
const selectSampleLine = () => {
|
|
556
|
+
view.selectFeatures({ type: 'line', index: 0 })
|
|
557
|
+
refreshState()
|
|
558
|
+
actionText.value = '已选中示例独立线路(不含两端节点);复制会自动补两个端点节点并带上线路'
|
|
559
|
+
pushLog('select/line', actionText.value)
|
|
560
|
+
return actionText.value
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
const selectSampleChannel = () => {
|
|
564
|
+
view.selectFeatures({ type: 'channel', channelId: 'channel-a' })
|
|
565
|
+
refreshState()
|
|
566
|
+
actionText.value = '已选中甲通道整条(全部回线);复制会同时补端点、线路与通道'
|
|
567
|
+
pushLog('select/channel', actionText.value)
|
|
568
|
+
return actionText.value
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
const ensureBatchSelection = () => {
|
|
572
|
+
const current = view?.getSelectionData().points ?? []
|
|
573
|
+
if (current.length) return current
|
|
574
|
+
view.selectFeatures(sourceIds())
|
|
575
|
+
refreshState()
|
|
576
|
+
return selectedPoints.value
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
const copySelectedByApi = () => {
|
|
580
|
+
if (!view.getSelectionData().count) ensureBatchSelection()
|
|
581
|
+
copyRound += 1
|
|
582
|
+
const result = view.copySelectedPoints({
|
|
583
|
+
offset: [64 + copyRound * 12, 46 + copyRound * 8],
|
|
584
|
+
select: true,
|
|
585
|
+
label: `demo 框选复制 ${copyRound}`
|
|
586
|
+
})
|
|
587
|
+
if (result.ok) {
|
|
588
|
+
lastBatch.value = result
|
|
589
|
+
copyText.value = `copySelectedPoints:${describeBatchCopy(result)}`
|
|
590
|
+
actionText.value = copyText.value
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
copyText.value = `copySelectedPoints 失败:${result.reason}`
|
|
594
|
+
actionText.value = copyText.value
|
|
595
|
+
}
|
|
596
|
+
refreshState()
|
|
597
|
+
return copyText.value
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
const copyPointsByApi = () => {
|
|
601
|
+
copyRound += 1
|
|
602
|
+
const result = view.copyPoints(sourceIds(), {
|
|
603
|
+
offset: [74 + copyRound * 12, 58 + copyRound * 8],
|
|
604
|
+
select: true,
|
|
605
|
+
label: `demo copyPoints ${copyRound}`
|
|
606
|
+
})
|
|
607
|
+
if (result.ok) {
|
|
608
|
+
lastBatch.value = result
|
|
609
|
+
copyText.value = `copyPoints:${describeBatchCopy(result)}`
|
|
610
|
+
actionText.value = copyText.value
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
copyText.value = `copyPoints 失败:${result.reason}`
|
|
614
|
+
actionText.value = copyText.value
|
|
615
|
+
}
|
|
616
|
+
refreshState()
|
|
617
|
+
return copyText.value
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
const copyClipboardByApi = () => {
|
|
621
|
+
if (!view.getSelectionData().count) ensureBatchSelection()
|
|
622
|
+
const item = view.copyPointsToClipboard(undefined, { via: 'demo-copy-clipboard' })
|
|
623
|
+
clipboardItem.value = item
|
|
624
|
+
clipboardText.value = item
|
|
625
|
+
? `剪贴板:count=${item.count} · 节点 ${item.items.length}${item.supportSources?.length ? `(补端点 ${item.supportSources.length})` : ''} / 线路 ${item.lines.length} / 通道 ${item.channels.length} · sources=${item.sources.map(entry => `${pointLabel(entry.item)}${entry.support ? '·补端点' : ''}`).join(' / ')}`
|
|
626
|
+
: '剪贴板为空'
|
|
627
|
+
actionText.value = item ? `${clipboardText.value};焦点已交给画布,按 Ctrl+V 或点 pastePoints` : '剪贴板为空'
|
|
628
|
+
focusCanvas()
|
|
629
|
+
refreshState()
|
|
630
|
+
return clipboardText.value
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
const pasteFromClipboard = () => {
|
|
634
|
+
clipboardItem.value = view.getPointClipboard() ?? clipboardItem.value
|
|
635
|
+
if (!clipboardItem.value) return 'pastePoints:先复制到剪贴板'
|
|
636
|
+
pasteRound += 1
|
|
637
|
+
const anchor = clipboardItem.value.anchor ?? [0, 0]
|
|
638
|
+
const result = view.pastePoints({
|
|
639
|
+
coordinate: [anchor[0] + 1.05 + pasteRound * 0.18, anchor[1] - 0.72 - pasteRound * 0.12],
|
|
640
|
+
select: true,
|
|
641
|
+
label: `demo 粘贴 ${pasteRound}`
|
|
642
|
+
})
|
|
643
|
+
if (result?.ok) {
|
|
644
|
+
lastBatch.value = result
|
|
645
|
+
copyText.value = `pastePoints:${describeBatchCopy(result)}`
|
|
646
|
+
actionText.value = copyText.value
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
copyText.value = `pastePoints 失败:${result?.reason ?? '剪贴板为空或复制已关闭'}`
|
|
650
|
+
actionText.value = copyText.value
|
|
651
|
+
}
|
|
652
|
+
refreshState()
|
|
653
|
+
return copyText.value
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
const revertLastCopy = () => {
|
|
657
|
+
const payload = copyToast.value ?? copyEvent.value
|
|
658
|
+
if (!payload) return '没有可取消 / 回滚的复制'
|
|
659
|
+
let message = '复制已经不在数据里'
|
|
660
|
+
if (payload.phase === 'clipboard') {
|
|
661
|
+
payload.cancel?.()
|
|
662
|
+
clipboardItem.value = null
|
|
663
|
+
message = '已清空剪贴板'
|
|
664
|
+
}
|
|
665
|
+
else if (typeof payload.revert === 'function') {
|
|
666
|
+
const outcome = payload.revert()
|
|
667
|
+
message = outcome?.ok
|
|
668
|
+
? `${payload.phase === 'batch' ? '已撤销整组复制' : '已回滚本次复制'} · 收回 ${outcome.items?.length ?? outcome.count ?? 0} 个节点`
|
|
669
|
+
: '复制已经不在数据里'
|
|
670
|
+
}
|
|
671
|
+
else if (typeof payload.cancel === 'function') {
|
|
672
|
+
payload.cancel()
|
|
673
|
+
message = '已取消这次复制预览,数据没有落地'
|
|
674
|
+
}
|
|
675
|
+
copyToast.value = null
|
|
676
|
+
if (lastBatch.value === payload) lastBatch.value = null
|
|
677
|
+
actionText.value = message
|
|
678
|
+
pushLog('copy/revert', message)
|
|
679
|
+
refreshState()
|
|
680
|
+
return message
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
const manualAddPointCopy = () => {
|
|
684
|
+
const previous = lastBatch.value ?? (copyToast.value?.phase === 'batch' || copyToast.value?.phase === 'end' ? copyToast.value : null)
|
|
685
|
+
let reverted = 0
|
|
686
|
+
if (previous && typeof previous.revert === 'function') {
|
|
687
|
+
const outcome = previous.revert()
|
|
688
|
+
reverted = outcome?.items?.length ?? outcome?.count ?? 0
|
|
689
|
+
if (lastBatch.value === previous) lastBatch.value = null
|
|
690
|
+
if (copyToast.value === previous) copyToast.value = null
|
|
691
|
+
}
|
|
692
|
+
if (!view.getSelectionData().pointCount) ensureBatchSelection()
|
|
693
|
+
if (!view.getSelectionData().pointCount) return '手动 addPoint 只接管节点复制:先选中至少一个节点'
|
|
694
|
+
addPointRound += 1
|
|
695
|
+
// 先让内置复制算出一份真实落点(同时不带上选中线路 / 通道),拿到 items 后立刻整批撤销,
|
|
696
|
+
// 再按这些落点逐个 addPoint:最终数据里只有手动副本,不会残留自动副本。
|
|
697
|
+
const probe = view.copySelectedPoints({
|
|
698
|
+
offset: [84 + addPointRound * 10, 54 + addPointRound * 8],
|
|
699
|
+
withLines: false,
|
|
700
|
+
withChannels: false,
|
|
701
|
+
select: false,
|
|
702
|
+
via: 'manual-addpoint-probe',
|
|
703
|
+
label: 'demo 手动复制落点'
|
|
704
|
+
})
|
|
705
|
+
if (!probe?.ok) {
|
|
706
|
+
manualText.value = `手动 addPoint 准备失败:${probe?.reason ?? '复制没有落地'}`
|
|
707
|
+
actionText.value = manualText.value
|
|
708
|
+
return manualText.value
|
|
709
|
+
}
|
|
710
|
+
const placements = probe.items.map(item => ({ ...item }))
|
|
711
|
+
const probeSources = probe.sources.filter(entry => !entry.support)
|
|
712
|
+
probe.revert()
|
|
713
|
+
lastBatch.value = null
|
|
714
|
+
copyToast.value = null
|
|
715
|
+
const created = []
|
|
716
|
+
for (let index = 0; index < placements.length; index += 1) {
|
|
717
|
+
const placement = placements[index]
|
|
718
|
+
const source = probeSources[index]
|
|
719
|
+
const { id: _oldId, ...rest } = placement
|
|
720
|
+
const result = view.addPoint({
|
|
721
|
+
...rest,
|
|
722
|
+
id: `addpoint-copy-${addPointRound}-${index + 1}`,
|
|
723
|
+
name: `${pointLabel(source?.item ?? placement)} · addPoint 副本`,
|
|
724
|
+
zone_name: 'addPoint 手动复制',
|
|
725
|
+
demo_copy: true,
|
|
726
|
+
demo_copy_via: 'addPoint'
|
|
727
|
+
})
|
|
728
|
+
if (result.ok && result.item) created.push(result.item)
|
|
729
|
+
}
|
|
730
|
+
view.selectFeatures(created.map(item => item.id))
|
|
731
|
+
manualText.value = `addPoint ×${created.length}:${created.map(item => `${pointLabel(item)}(${pointKey(item)})`).join(' / ') || '没有落地'}${reverted ? ` · 已删自动副本 ${reverted} 个` : ''} · 最终只多一份`
|
|
732
|
+
actionText.value = manualText.value
|
|
733
|
+
pushLog('addPoint', manualText.value)
|
|
734
|
+
refreshState()
|
|
735
|
+
return manualText.value
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
const prepareMerge = () => {
|
|
739
|
+
if (!selectedPoints.value.length) selectBatchSources()
|
|
740
|
+
if (!mergeTargetOptions.value.some(item => item.value === mergeTargetId.value)) {
|
|
741
|
+
mergeTargetId.value = mergeTargetOptions.value[0]?.value ?? ''
|
|
742
|
+
}
|
|
743
|
+
refreshState()
|
|
744
|
+
actionText.value = `已准备 ${selectedPoints.value.length} 个选中节点;保留目标 ${mergeTargetId.value || '—'},可在画布继续 Ctrl 点选`
|
|
745
|
+
pushLog('merge/prepare', actionText.value)
|
|
746
|
+
return actionText.value
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
const mergePatch = () => {
|
|
750
|
+
const patch = {
|
|
751
|
+
name: mergedName.value.trim() || '合并后节点',
|
|
752
|
+
zone_name: mergedZone.value.trim() || '合并后(item 改写)',
|
|
753
|
+
demo_merged: true
|
|
754
|
+
}
|
|
755
|
+
const voltage = Number(mergedVoltage.value)
|
|
756
|
+
if (Number.isFinite(voltage)) patch.vn_kv = voltage
|
|
757
|
+
const size = Number(mergedSize.value)
|
|
758
|
+
if (Number.isFinite(size) && size > 0) patch.size = size
|
|
759
|
+
if (mergedColor.value.trim()) patch.color = mergedColor.value.trim()
|
|
760
|
+
if (mergedSymbol.value.trim()) patch.symbol = mergedSymbol.value.trim()
|
|
761
|
+
if (mergedStrokeColor.value.trim()) patch.strokeColor = mergedStrokeColor.value.trim()
|
|
762
|
+
return patch
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
const mergeSelectedByApi = () => {
|
|
766
|
+
const points = selectedPoints.value
|
|
767
|
+
if (points.length < 2) return 'mergeSelectedPoints:至少选中两个节点'
|
|
768
|
+
const targetId = mergeTargetOptions.value.some(item => item.value === mergeTargetId.value)
|
|
769
|
+
? mergeTargetId.value
|
|
770
|
+
: mergeTargetOptions.value[0].value
|
|
771
|
+
const target = points.find(item => pointKey(item) === targetId)
|
|
772
|
+
const sources = points.filter(item => pointKey(item) !== targetId).map(item => item.id)
|
|
773
|
+
const result = view.mergeSelectedPoints({
|
|
774
|
+
target: { id: target?.id ?? targetId },
|
|
775
|
+
sources,
|
|
776
|
+
item: mergePatch(),
|
|
777
|
+
label: 'demo 合并选中节点'
|
|
778
|
+
})
|
|
779
|
+
if (result.ok) {
|
|
780
|
+
view.selectFeatures(target?.id ?? targetId)
|
|
781
|
+
mergeText.value = `mergeSelectedPoints · 保留 ${pointLabel(result.target?.item)} · 并掉 ${result.sourcesMerged} 个 · 改线 ${result.linesChanged} / 删线 ${result.removedLines} / 并通道 ${result.mergedChannels ?? 0} · 最终 ${pointLabel(result.target?.item)}`
|
|
782
|
+
pendingText.value = '这次走 API 直接合并,没有 pending 阶段'
|
|
783
|
+
}
|
|
784
|
+
else {
|
|
785
|
+
mergeText.value = `mergeSelectedPoints 失败:${result.reason}`
|
|
786
|
+
}
|
|
787
|
+
actionText.value = mergeText.value
|
|
788
|
+
pushLog('mergeSelectedPoints', mergeText.value)
|
|
789
|
+
refreshState()
|
|
790
|
+
return mergeText.value
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
const handlePointMerge = (payload) => {
|
|
794
794
|
if (payload.phase === 'pending') {
|
|
795
795
|
pendingMerge.value = payload
|
|
796
796
|
mergeBackendText.value = '合并变更 → 后端事务:数据还没动;确认落地后 changes 会给出完整事务入参'
|
|
797
|
-
mergeDetailText.value = '合并影响详情:点「查看影响详情」按 id 调 getLine / getChannel'
|
|
798
|
-
pendingText.value = `待确认:拖动来源 ${pointLabel(payload.source.item)} → 碰撞目标 ${pointLabel(payload.target.item)} · ${describeMergeImpact(payload.impact)} · 数据还没动`
|
|
799
|
-
mergeText.value = pendingText.value
|
|
800
|
-
actionText.value = mergeText.value
|
|
801
|
-
pushLog('pointMerge/pending', pendingText.value)
|
|
802
|
-
return
|
|
803
|
-
}
|
|
804
|
-
if (payload.phase === 'confirm') {
|
|
805
|
-
if (rewriteOnConfirm.value && payload.item) {
|
|
806
|
-
payload.item = { ...payload.item, ...mergePatch() }
|
|
807
|
-
}
|
|
808
|
-
pendingMerge.value = payload
|
|
809
|
-
mergeText.value = `confirm · 保留 ${payload.keep === 'source' ? '拖动来源' : '碰撞目标'} · ${describeMergeImpact(payload.impact)} · 来源 ${pointLabel(payload.source.item)} / 目标 ${pointLabel(payload.target.item)} · 最终节点 ${pointLabel(payload.item)} · 色 ${payload.item?.color ?? '—'} / 尺寸 ${payload.item?.size ?? '—'} / 图标 ${String(payload.item?.symbol ?? '—')}`
|
|
810
|
-
actionText.value = mergeText.value
|
|
811
|
-
pushLog('pointMerge/confirm', mergeText.value)
|
|
812
|
-
return
|
|
813
|
-
}
|
|
797
|
+
mergeDetailText.value = '合并影响详情:点「查看影响详情」按 id 调 getLine / getChannel'
|
|
798
|
+
pendingText.value = `待确认:拖动来源 ${pointLabel(payload.source.item)} → 碰撞目标 ${pointLabel(payload.target.item)} · ${describeMergeImpact(payload.impact)} · 数据还没动`
|
|
799
|
+
mergeText.value = pendingText.value
|
|
800
|
+
actionText.value = mergeText.value
|
|
801
|
+
pushLog('pointMerge/pending', pendingText.value)
|
|
802
|
+
return
|
|
803
|
+
}
|
|
804
|
+
if (payload.phase === 'confirm') {
|
|
805
|
+
if (rewriteOnConfirm.value && payload.item) {
|
|
806
|
+
payload.item = { ...payload.item, ...mergePatch() }
|
|
807
|
+
}
|
|
808
|
+
pendingMerge.value = payload
|
|
809
|
+
mergeText.value = `confirm · 保留 ${payload.keep === 'source' ? '拖动来源' : '碰撞目标'} · ${describeMergeImpact(payload.impact)} · 来源 ${pointLabel(payload.source.item)} / 目标 ${pointLabel(payload.target.item)} · 最终节点 ${pointLabel(payload.item)} · 色 ${payload.item?.color ?? '—'} / 尺寸 ${payload.item?.size ?? '—'} / 图标 ${String(payload.item?.symbol ?? '—')}`
|
|
810
|
+
actionText.value = mergeText.value
|
|
811
|
+
pushLog('pointMerge/confirm', mergeText.value)
|
|
812
|
+
return
|
|
813
|
+
}
|
|
814
814
|
if (payload.phase === 'mergeSelected') {
|
|
815
815
|
const mergedNames = (payload.merged ?? []).map(result => pointLabel(result.source.item)).join(' / ') || '—'
|
|
816
816
|
mergeBackendText.value = describeMergeChangeSets((payload.merged ?? []).map(result => result.changes))
|
|
817
817
|
mergeText.value = payload.ok
|
|
818
|
-
? `mergeSelected · 保留 ${pointLabel(payload.target?.item)} · 并掉 ${mergedNames} · 最终 ${pointLabel(payload.target?.item)} · 改线 ${payload.linesChanged} / 删线 ${payload.removedLines} / 通道 ${payload.channelsChanged}`
|
|
819
|
-
: `mergeSelected 失败:${payload.reason}`
|
|
818
|
+
? `mergeSelected · 保留 ${pointLabel(payload.target?.item)} · 并掉 ${mergedNames} · 最终 ${pointLabel(payload.target?.item)} · 改线 ${payload.linesChanged} / 删线 ${payload.removedLines} / 通道 ${payload.channelsChanged}`
|
|
819
|
+
: `mergeSelected 失败:${payload.reason}`
|
|
820
820
|
actionText.value = mergeText.value
|
|
821
821
|
pushLog('pointMerge/mergeSelected', mergeText.value)
|
|
822
822
|
cancelScheduledMergeBackend()
|
|
@@ -826,333 +826,333 @@ const handlePointMerge = (payload) => {
|
|
|
826
826
|
if (payload.phase === 'merge') {
|
|
827
827
|
mergeBackendText.value = payload.ok ? describeMergeChanges(payload.changes) : '合并变更 → 后端事务:合并失败,没有变更集'
|
|
828
828
|
mergeText.value = payload.ok
|
|
829
|
-
? `merge · 被并 ${pointLabel(payload.source?.item)} → 保留 ${pointLabel(payload.target?.item)} · 最终 ${pointLabel(payload.item)} · 色 ${payload.item?.color ?? '—'} / 尺寸 ${payload.item?.size ?? '—'} / 图标 ${String(payload.item?.symbol ?? '—')} · 改线 ${payload.linesChanged} / 删线 ${payload.removedLines}`
|
|
830
|
-
: `merge 失败:${payload.reason}`
|
|
831
|
-
pendingMerge.value = null
|
|
832
|
-
pendingText.value = payload.ok ? '合并已落地,拖动来源节点已经收进保留目标' : `合并失败:${payload.reason}`
|
|
829
|
+
? `merge · 被并 ${pointLabel(payload.source?.item)} → 保留 ${pointLabel(payload.target?.item)} · 最终 ${pointLabel(payload.item)} · 色 ${payload.item?.color ?? '—'} / 尺寸 ${payload.item?.size ?? '—'} / 图标 ${String(payload.item?.symbol ?? '—')} · 改线 ${payload.linesChanged} / 删线 ${payload.removedLines}`
|
|
830
|
+
: `merge 失败:${payload.reason}`
|
|
831
|
+
pendingMerge.value = null
|
|
832
|
+
pendingText.value = payload.ok ? '合并已落地,拖动来源节点已经收进保留目标' : `合并失败:${payload.reason}`
|
|
833
833
|
actionText.value = mergeText.value
|
|
834
834
|
pushLog('pointMerge/merge', mergeText.value)
|
|
835
835
|
refreshState()
|
|
836
836
|
if (payload.ok) scheduleMergeBackend(payload)
|
|
837
837
|
return
|
|
838
|
-
}
|
|
838
|
+
}
|
|
839
839
|
if (payload.phase === 'cancel') {
|
|
840
840
|
pendingMerge.value = null
|
|
841
841
|
mergeBackendText.value = '合并变更 → 后端事务:合并已取消,没有变更集'
|
|
842
|
-
pendingText.value = '已取消:拖动的节点回到原位,数据没动'
|
|
843
|
-
mergeText.value = pendingText.value
|
|
844
|
-
actionText.value = mergeText.value
|
|
845
|
-
pushLog('pointMerge/cancel', pendingText.value)
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
const confirmPendingMerge = () => {
|
|
850
|
-
const options = { keep: mergeKeep.value }
|
|
851
|
-
if (rewriteOnConfirm.value) options.item = mergePatch()
|
|
852
|
-
const result = view.
|
|
853
|
-
if (!result) return '当前没有待确认的合并'
|
|
854
|
-
mergeText.value = `
|
|
855
|
-
actionText.value = mergeText.value
|
|
856
|
-
pushLog('
|
|
857
|
-
return mergeText.value
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
const cancelPendingMerge = () => {
|
|
861
|
-
const result = view.
|
|
862
|
-
pendingMerge.value = null
|
|
863
|
-
return result ? '已取消:拖动的节点回到原位,数据没动' : '当前没有待确认的合并'
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
const resetScene = () => {
|
|
867
|
-
const fresh = buildDemoData({ count: 14, channels: 2 })
|
|
868
|
-
view.updateData({ points: fresh.points, lines: fresh.lines, channels: fresh.channels })
|
|
869
|
-
view.
|
|
870
|
-
view.clearHistory()
|
|
871
|
-
view.fitView(50)
|
|
872
|
-
lastBatch.value = null
|
|
873
|
-
clipboardItem.value = null
|
|
874
|
-
pendingMerge.value = null
|
|
875
|
-
copyEvent.value = null
|
|
876
|
-
copyToast.value = null
|
|
877
|
-
pendingText.value = '拖动一个节点撞到另一个节点上,这里会出现待确认载荷'
|
|
842
|
+
pendingText.value = '已取消:拖动的节点回到原位,数据没动'
|
|
843
|
+
mergeText.value = pendingText.value
|
|
844
|
+
actionText.value = mergeText.value
|
|
845
|
+
pushLog('pointMerge/cancel', pendingText.value)
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
const confirmPendingMerge = () => {
|
|
850
|
+
const options = { keep: mergeKeep.value }
|
|
851
|
+
if (rewriteOnConfirm.value) options.item = mergePatch()
|
|
852
|
+
const result = view.resolvePointMerge(true, options)
|
|
853
|
+
if (!result) return '当前没有待确认的合并'
|
|
854
|
+
mergeText.value = `resolvePointMerge(true, { keep: '${mergeKeep.value}', item }) · ${rewriteOnConfirm.value ? '名称 / 分区 / 电压 / 样式已随 item 写回' : '使用引擎缺省合并结果'}`
|
|
855
|
+
actionText.value = mergeText.value
|
|
856
|
+
pushLog('resolvePointMerge(true)', mergeText.value)
|
|
857
|
+
return mergeText.value
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
const cancelPendingMerge = () => {
|
|
861
|
+
const result = view.resolvePointMerge(false)
|
|
862
|
+
pendingMerge.value = null
|
|
863
|
+
return result ? '已取消:拖动的节点回到原位,数据没动' : '当前没有待确认的合并'
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
const resetScene = () => {
|
|
867
|
+
const fresh = buildDemoData({ count: 14, channels: 2 })
|
|
868
|
+
view.updateData({ points: fresh.points, lines: fresh.lines, channels: fresh.channels })
|
|
869
|
+
view.selectFeatures(null)
|
|
870
|
+
view.clearHistory()
|
|
871
|
+
view.fitView(50)
|
|
872
|
+
lastBatch.value = null
|
|
873
|
+
clipboardItem.value = null
|
|
874
|
+
pendingMerge.value = null
|
|
875
|
+
copyEvent.value = null
|
|
876
|
+
copyToast.value = null
|
|
877
|
+
pendingText.value = '拖动一个节点撞到另一个节点上,这里会出现待确认载荷'
|
|
878
878
|
mergeText.value = '合并:—'
|
|
879
879
|
copyText.value = '复制:—'
|
|
880
880
|
copyLineChannelsText.value = '—'
|
|
881
881
|
mergeBackendText.value = '合并变更 → 后端事务:—'
|
|
882
|
-
clipboardText.value = '剪贴板:—'
|
|
883
|
-
copyEventText.value = '还没有 pointCopy 事件'
|
|
884
|
-
copySourcesText.value = '—'
|
|
885
|
-
copyItemsText.value = '—'
|
|
882
|
+
clipboardText.value = '剪贴板:—'
|
|
883
|
+
copyEventText.value = '还没有 pointCopy 事件'
|
|
884
|
+
copySourcesText.value = '—'
|
|
885
|
+
copyItemsText.value = '—'
|
|
886
886
|
manualText.value = '—'
|
|
887
887
|
mergeKeep.value = 'target'
|
|
888
888
|
resetBackendDemo()
|
|
889
889
|
copyRound = 0
|
|
890
|
-
pasteRound = 0
|
|
891
|
-
addPointRound = 0
|
|
892
|
-
refreshState()
|
|
893
|
-
actionText.value = `已恢复 ${fresh.points.length} 节点 / ${fresh.lines.length} 线路 / ${fresh.channels.length} 通道`
|
|
894
|
-
return actionText.value
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
onMounted(() => {
|
|
898
|
-
const dataset = buildDemoData({ count: 14, channels: 2 })
|
|
899
|
-
view = createGisView(container.value, {
|
|
900
|
-
points: dataset.points,
|
|
901
|
-
lines: dataset.lines,
|
|
902
|
-
channels: dataset.channels,
|
|
903
|
-
channelWidth: 2.2,
|
|
904
|
-
channelInset: 1.3,
|
|
905
|
-
pointStyle: { size: 9, color: '#ffffff', strokeColor: '#4c8dff', strokeWidth: 1.6 },
|
|
906
|
-
lineStyle: { width: 1.5, color: 'rgba(120, 168, 226, 0.66)' },
|
|
907
|
-
pointSelectStyle: { sizeScale: 1.5, color: '#ffd166', strokeColor: '#a33c00', strokeWidth: 3 },
|
|
908
|
-
pointMultiSelectStyle: { sizeScale: 1.45, color: '#ffb703', strokeColor: '#7a2d00', strokeWidth: 2.5 },
|
|
909
|
-
pointBoxSelectStyle: { sizeScale: 1.55, color: '#ff9f1c', strokeColor: '#7a2d00', strokeWidth: 3 },
|
|
910
|
-
lineSelectStyle: { width: 3.2, color: '#ffb703' },
|
|
911
|
-
lineMultiSelectStyle: { width: 2.6, color: '#ff9f1c' },
|
|
912
|
-
selectionBoxStyle: { fill: '#3678bf', fillOpacity: 0.18, stroke: '#1d4ed8', strokeWidth: 2 },
|
|
913
|
-
selectionOnTop: true,
|
|
914
|
-
label: {
|
|
915
|
-
content: '{name}',
|
|
916
|
-
position: 'top',
|
|
917
|
-
gap: 7,
|
|
918
|
-
maxCount: 26,
|
|
919
|
-
avoidOverlap: true,
|
|
920
|
-
style: { color: '#27405f', fontSize: '11px' }
|
|
921
|
-
},
|
|
922
|
-
showGrid: true,
|
|
923
|
-
fitPadding: 52,
|
|
924
|
-
history: { limit: 60 },
|
|
925
|
-
interactive: true,
|
|
926
|
-
clickable: true,
|
|
927
|
-
draggable: true,
|
|
928
|
-
boxSelect: true,
|
|
929
|
-
multiSelect: true,
|
|
930
|
-
selectionKinds: ['point', 'line', 'channel'],
|
|
931
|
-
channelSelectMode: 'channel',
|
|
932
|
-
features: {
|
|
933
|
-
pan: true,
|
|
934
|
-
zoom: true,
|
|
935
|
-
hover: true,
|
|
936
|
-
select: true,
|
|
937
|
-
boxSelect: true,
|
|
938
|
-
drag: true,
|
|
939
|
-
copy: true,
|
|
940
|
-
merge: true,
|
|
941
|
-
keyboard: true,
|
|
942
|
-
waypoint: false,
|
|
943
|
-
remove: false,
|
|
944
|
-
channelDraft: false,
|
|
945
|
-
channelMenu: false,
|
|
946
|
-
contextMenu: false
|
|
947
|
-
},
|
|
890
|
+
pasteRound = 0
|
|
891
|
+
addPointRound = 0
|
|
892
|
+
refreshState()
|
|
893
|
+
actionText.value = `已恢复 ${fresh.points.length} 节点 / ${fresh.lines.length} 线路 / ${fresh.channels.length} 通道`
|
|
894
|
+
return actionText.value
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
onMounted(() => {
|
|
898
|
+
const dataset = buildDemoData({ count: 14, channels: 2 })
|
|
899
|
+
view = createGisView(container.value, {
|
|
900
|
+
points: dataset.points,
|
|
901
|
+
lines: dataset.lines,
|
|
902
|
+
channels: dataset.channels,
|
|
903
|
+
channelWidth: 2.2,
|
|
904
|
+
channelInset: 1.3,
|
|
905
|
+
pointStyle: { size: 9, color: '#ffffff', strokeColor: '#4c8dff', strokeWidth: 1.6 },
|
|
906
|
+
lineStyle: { width: 1.5, color: 'rgba(120, 168, 226, 0.66)' },
|
|
907
|
+
pointSelectStyle: { sizeScale: 1.5, color: '#ffd166', strokeColor: '#a33c00', strokeWidth: 3 },
|
|
908
|
+
pointMultiSelectStyle: { sizeScale: 1.45, color: '#ffb703', strokeColor: '#7a2d00', strokeWidth: 2.5 },
|
|
909
|
+
pointBoxSelectStyle: { sizeScale: 1.55, color: '#ff9f1c', strokeColor: '#7a2d00', strokeWidth: 3 },
|
|
910
|
+
lineSelectStyle: { width: 3.2, color: '#ffb703' },
|
|
911
|
+
lineMultiSelectStyle: { width: 2.6, color: '#ff9f1c' },
|
|
912
|
+
selectionBoxStyle: { fill: '#3678bf', fillOpacity: 0.18, stroke: '#1d4ed8', strokeWidth: 2 },
|
|
913
|
+
selectionOnTop: true,
|
|
914
|
+
label: {
|
|
915
|
+
content: '{name}',
|
|
916
|
+
position: 'top',
|
|
917
|
+
gap: 7,
|
|
918
|
+
maxCount: 26,
|
|
919
|
+
avoidOverlap: true,
|
|
920
|
+
style: { color: '#27405f', fontSize: '11px' }
|
|
921
|
+
},
|
|
922
|
+
showGrid: true,
|
|
923
|
+
fitPadding: 52,
|
|
924
|
+
history: { limit: 60 },
|
|
925
|
+
interactive: true,
|
|
926
|
+
clickable: true,
|
|
927
|
+
draggable: true,
|
|
928
|
+
boxSelect: true,
|
|
929
|
+
multiSelect: true,
|
|
930
|
+
selectionKinds: ['point', 'line', 'channel'],
|
|
931
|
+
channelSelectMode: 'channel',
|
|
932
|
+
features: {
|
|
933
|
+
pan: true,
|
|
934
|
+
zoom: true,
|
|
935
|
+
hover: true,
|
|
936
|
+
select: true,
|
|
937
|
+
boxSelect: true,
|
|
938
|
+
drag: true,
|
|
939
|
+
copy: true,
|
|
940
|
+
merge: true,
|
|
941
|
+
keyboard: true,
|
|
942
|
+
waypoint: false,
|
|
943
|
+
remove: false,
|
|
944
|
+
channelDraft: false,
|
|
945
|
+
channelMenu: false,
|
|
946
|
+
contextMenu: false
|
|
947
|
+
},
|
|
948
948
|
copy: {
|
|
949
|
-
enabled: true,
|
|
950
|
-
offset: [64, 46],
|
|
951
|
-
createItem: (item, context) => ({
|
|
952
|
-
...item,
|
|
953
|
-
name: `${pointLabel(context?.sourceItem ?? item)} · 副本`,
|
|
954
|
-
zone_name: '内置复制副本',
|
|
955
|
-
demo_copy: true
|
|
956
|
-
})
|
|
949
|
+
enabled: true,
|
|
950
|
+
offset: [64, 46],
|
|
951
|
+
createItem: (item, context) => ({
|
|
952
|
+
...item,
|
|
953
|
+
name: `${pointLabel(context?.sourceItem ?? item)} · 副本`,
|
|
954
|
+
zone_name: '内置复制副本',
|
|
955
|
+
demo_copy: true
|
|
956
|
+
})
|
|
957
957
|
},
|
|
958
958
|
// Ctrl+C / Ctrl+V 监听的三件套:copy 打开 + keyboard 打开 + 快捷键映射(不写也是这两个缺省值)
|
|
959
959
|
shortcuts: { copy: 'ctrl+c', paste: 'ctrl+v' },
|
|
960
960
|
merge: { enabled: true, distance: 12, channelGroups: 'keep' },
|
|
961
|
-
onReady: () => {
|
|
962
|
-
nextTick(() => {
|
|
963
|
-
view?.fitView(50)
|
|
964
|
-
refreshState()
|
|
965
|
-
})
|
|
961
|
+
onReady: () => {
|
|
962
|
+
nextTick(() => {
|
|
963
|
+
view?.fitView(50)
|
|
964
|
+
refreshState()
|
|
965
|
+
})
|
|
966
966
|
emit('notice', '批量复制与合并:先点一下画布取得焦点,再框选 / Ctrl+C / Ctrl+V;也可拖动节点相撞合并')
|
|
967
|
-
},
|
|
968
|
-
onPointCopy: handlePointCopy,
|
|
969
|
-
onPointMerge: handlePointMerge,
|
|
970
|
-
onSelectChange: () => refreshState(),
|
|
971
|
-
onDataChange: payload => {
|
|
972
|
-
pushLog(payload.type, `${payload.counts?.points ?? 0} 点 / ${payload.counts?.lines ?? 0} 线 / ${payload.counts?.channels ?? 0} 通道`)
|
|
973
|
-
refreshState()
|
|
974
|
-
}
|
|
975
|
-
})
|
|
976
|
-
offEvents = view.on('*', (name, payload) => {
|
|
977
|
-
if (name === 'dataChange' && payload?.type === 'batch') {
|
|
978
|
-
pushLog('batch', `一次批量收口 · ${payload.changes?.length ?? 0} 笔`)
|
|
979
|
-
}
|
|
980
|
-
})
|
|
981
|
-
})
|
|
982
|
-
|
|
967
|
+
},
|
|
968
|
+
onPointCopy: handlePointCopy,
|
|
969
|
+
onPointMerge: handlePointMerge,
|
|
970
|
+
onSelectChange: () => refreshState(),
|
|
971
|
+
onDataChange: payload => {
|
|
972
|
+
pushLog(payload.type, `${payload.counts?.points ?? 0} 点 / ${payload.counts?.lines ?? 0} 线 / ${payload.counts?.channels ?? 0} 通道`)
|
|
973
|
+
refreshState()
|
|
974
|
+
}
|
|
975
|
+
})
|
|
976
|
+
offEvents = view.on('*', (name, payload) => {
|
|
977
|
+
if (name === 'dataChange' && payload?.type === 'batch') {
|
|
978
|
+
pushLog('batch', `一次批量收口 · ${payload.changes?.length ?? 0} 笔`)
|
|
979
|
+
}
|
|
980
|
+
})
|
|
981
|
+
})
|
|
982
|
+
|
|
983
983
|
onBeforeUnmount(() => {
|
|
984
984
|
disposed = true
|
|
985
985
|
cancelScheduledMergeBackend()
|
|
986
986
|
offEvents?.()
|
|
987
|
-
offEvents = null
|
|
988
|
-
view?.destroy()
|
|
989
|
-
view = null
|
|
990
|
-
})
|
|
991
|
-
</script>
|
|
992
|
-
|
|
993
|
-
<template>
|
|
994
|
-
<section class="dv-demo cm-demo">
|
|
995
|
-
<div class="dv-stage">
|
|
996
|
-
<div ref="container" class="dv-canvas"></div>
|
|
997
|
-
<div class="dv-toolbar">
|
|
998
|
-
<button type="button" class="dv-button" @click="view?.fitView(50)">适应全部</button>
|
|
999
|
-
<button type="button" class="dv-button" @click="resetScene">恢复初始数据</button>
|
|
1000
|
-
</div>
|
|
1001
|
-
<div class="cm-guide">
|
|
987
|
+
offEvents = null
|
|
988
|
+
view?.destroy()
|
|
989
|
+
view = null
|
|
990
|
+
})
|
|
991
|
+
</script>
|
|
992
|
+
|
|
993
|
+
<template>
|
|
994
|
+
<section class="dv-demo cm-demo">
|
|
995
|
+
<div class="dv-stage">
|
|
996
|
+
<div ref="container" class="dv-canvas"></div>
|
|
997
|
+
<div class="dv-toolbar">
|
|
998
|
+
<button type="button" class="dv-button" @click="view?.fitView(50)">适应全部</button>
|
|
999
|
+
<button type="button" class="dv-button" @click="resetScene">恢复初始数据</button>
|
|
1000
|
+
</div>
|
|
1001
|
+
<div class="cm-guide">
|
|
1002
1002
|
<span><b>1</b><kbd>Shift</kbd> + 拖动框选节点 / 线路 / 通道(按右侧类型过滤)</span>
|
|
1003
|
-
<span><b>2</b><kbd>Alt</kbd> + 点击节点复制;<kbd>Ctrl</kbd> + <kbd>V</kbd> 粘贴</span>
|
|
1004
|
-
<span><b>3</b>拖动一个节点撞向另一个节点:可保留来源 / 目标并改写信息与样式</span>
|
|
1005
|
-
</div>
|
|
1006
|
-
<div v-if="copyToast" class="cm-toast cm-toast--copy">
|
|
1007
|
-
<div class="cm-toast__head">
|
|
1008
|
-
<strong>{{ copyToastTitle }}</strong>
|
|
1009
|
-
<span class="cm-tag">{{ copyToast.phase }} · {{ copyToast.via }}</span>
|
|
1010
|
-
</div>
|
|
1011
|
-
<p>{{ copyToastText }}</p>
|
|
1012
|
-
<div class="cm-toast__actions">
|
|
1013
|
-
<button v-if="copyToast.phase === 'clipboard'" type="button" @click="pasteFromClipboard">粘贴整组</button>
|
|
1014
|
-
<button type="button" @click="manualAddPointCopy">手动 addPoint</button>
|
|
1015
|
-
<button type="button" @click="revertLastCopy">取消 / 回滚</button>
|
|
1016
|
-
</div>
|
|
1017
|
-
</div>
|
|
1018
|
-
<div v-if="pendingMerge" class="cm-toast cm-toast--merge">
|
|
1019
|
-
<div class="cm-toast__head">
|
|
1020
|
-
<strong>合并待确认</strong>
|
|
1021
|
-
<span class="cm-tag">{{ pendingMerge.phase }}</span>
|
|
1022
|
-
</div>
|
|
1023
|
-
<p>拖动来源 {{ pointLabel(pendingMerge.source.item) }} → 碰撞目标 {{ pointLabel(pendingMerge.target.item) }} · 数据还没动</p>
|
|
1024
|
-
<p class="cm-toast__hint">保留 {{ mergeKeep === 'source' ? '拖动来源' : '碰撞目标' }};确认时把名称 / 分区 / 电压 / 颜色 / 尺寸 / 图标写进 payload.item</p>
|
|
1025
|
-
<div class="cm-toast__actions">
|
|
1026
|
-
<button v-if="pendingMerge.phase === 'pending'" type="button" class="is-primary" @click="confirmPendingMerge">确认并改写</button>
|
|
1027
|
-
<button type="button" @click="showMergeImpactDetails">查看影响详情</button>
|
|
1028
|
-
<button type="button" @click="cancelPendingMerge">取消并复位</button>
|
|
1029
|
-
</div>
|
|
1030
|
-
</div>
|
|
1031
|
-
<div class="cm-dock">
|
|
1032
|
-
<span>选中 <b>{{ selectionCounts.points }}</b> 节点 / <b>{{ selectionCounts.lines }}</b> 线路 / <b>{{ selectionCounts.channels }}</b> 通道</span>
|
|
1033
|
-
<button type="button" @click="selectBatchSources">选中示例组</button>
|
|
1034
|
-
<button type="button" @click="copySelectedByApi">复制选中</button>
|
|
1035
|
-
<button type="button" @click="prepareMerge">准备合并</button>
|
|
1036
|
-
<button type="button" @click="clearSelection">清空选中</button>
|
|
1037
|
-
</div>
|
|
1038
|
-
</div>
|
|
1039
|
-
<aside class="dv-panel">
|
|
1040
|
-
<div class="dv-group">
|
|
1041
|
-
<h3>1 · 框选来源</h3>
|
|
1042
|
-
<p class="dv-readout" data-demo="copy-merge-selection">{{ selectionText }}</p>
|
|
1003
|
+
<span><b>2</b><kbd>Alt</kbd> + 点击节点复制;<kbd>Ctrl</kbd> + <kbd>V</kbd> 粘贴</span>
|
|
1004
|
+
<span><b>3</b>拖动一个节点撞向另一个节点:可保留来源 / 目标并改写信息与样式</span>
|
|
1005
|
+
</div>
|
|
1006
|
+
<div v-if="copyToast" class="cm-toast cm-toast--copy">
|
|
1007
|
+
<div class="cm-toast__head">
|
|
1008
|
+
<strong>{{ copyToastTitle }}</strong>
|
|
1009
|
+
<span class="cm-tag">{{ copyToast.phase }} · {{ copyToast.via }}</span>
|
|
1010
|
+
</div>
|
|
1011
|
+
<p>{{ copyToastText }}</p>
|
|
1012
|
+
<div class="cm-toast__actions">
|
|
1013
|
+
<button v-if="copyToast.phase === 'clipboard'" type="button" @click="pasteFromClipboard">粘贴整组</button>
|
|
1014
|
+
<button type="button" @click="manualAddPointCopy">手动 addPoint</button>
|
|
1015
|
+
<button type="button" @click="revertLastCopy">取消 / 回滚</button>
|
|
1016
|
+
</div>
|
|
1017
|
+
</div>
|
|
1018
|
+
<div v-if="pendingMerge" class="cm-toast cm-toast--merge">
|
|
1019
|
+
<div class="cm-toast__head">
|
|
1020
|
+
<strong>合并待确认</strong>
|
|
1021
|
+
<span class="cm-tag">{{ pendingMerge.phase }}</span>
|
|
1022
|
+
</div>
|
|
1023
|
+
<p>拖动来源 {{ pointLabel(pendingMerge.source.item) }} → 碰撞目标 {{ pointLabel(pendingMerge.target.item) }} · 数据还没动</p>
|
|
1024
|
+
<p class="cm-toast__hint">保留 {{ mergeKeep === 'source' ? '拖动来源' : '碰撞目标' }};确认时把名称 / 分区 / 电压 / 颜色 / 尺寸 / 图标写进 payload.item</p>
|
|
1025
|
+
<div class="cm-toast__actions">
|
|
1026
|
+
<button v-if="pendingMerge.phase === 'pending'" type="button" class="is-primary" @click="confirmPendingMerge">确认并改写</button>
|
|
1027
|
+
<button type="button" @click="showMergeImpactDetails">查看影响详情</button>
|
|
1028
|
+
<button type="button" @click="cancelPendingMerge">取消并复位</button>
|
|
1029
|
+
</div>
|
|
1030
|
+
</div>
|
|
1031
|
+
<div class="cm-dock">
|
|
1032
|
+
<span>选中 <b>{{ selectionCounts.points }}</b> 节点 / <b>{{ selectionCounts.lines }}</b> 线路 / <b>{{ selectionCounts.channels }}</b> 通道</span>
|
|
1033
|
+
<button type="button" @click="selectBatchSources">选中示例组</button>
|
|
1034
|
+
<button type="button" @click="copySelectedByApi">复制选中</button>
|
|
1035
|
+
<button type="button" @click="prepareMerge">准备合并</button>
|
|
1036
|
+
<button type="button" @click="clearSelection">清空选中</button>
|
|
1037
|
+
</div>
|
|
1038
|
+
</div>
|
|
1039
|
+
<aside class="dv-panel">
|
|
1040
|
+
<div class="dv-group">
|
|
1041
|
+
<h3>1 · 框选来源</h3>
|
|
1042
|
+
<p class="dv-readout" data-demo="copy-merge-selection">{{ selectionText }}</p>
|
|
1043
1043
|
<p class="dv-readout" data-demo="selection-kinds-readout">框选(Shift)/ Ctrl 多选:{{ selectionKindsText }}</p>
|
|
1044
|
-
<div class="dv-row cm-checks">
|
|
1045
|
-
<label><input v-model="selectionFilters.point" data-demo="selection-point" type="checkbox" @change="applySelectionKinds" /> 节点</label>
|
|
1046
|
-
<label><input v-model="selectionFilters.line" data-demo="selection-line" type="checkbox" @change="applySelectionKinds" /> 线路</label>
|
|
1047
|
-
<label><input v-model="selectionFilters.channel" data-demo="selection-channel" type="checkbox" @change="applySelectionKinds" /> 通道</label>
|
|
1048
|
-
</div>
|
|
1049
|
-
<div class="dv-row">
|
|
1050
|
-
<button type="button" class="dv-button dv-button--primary" data-demo="copy-select-sources" @click="selectBatchSources">选中示例组</button>
|
|
1051
|
-
<button type="button" class="dv-button" data-demo="merge-select-sources" @click="prepareMerge">选中并准备合并</button>
|
|
1052
|
-
<button type="button" class="dv-button" @click="clearSelection">清空</button>
|
|
1053
|
-
</div>
|
|
1054
|
-
<div class="dv-row">
|
|
1055
|
-
<button type="button" class="dv-button" data-demo="select-sample-line" @click="selectSampleLine">选中示例线路</button>
|
|
1056
|
-
<button type="button" class="dv-button" data-demo="select-sample-channel" @click="selectSampleChannel">选中示例通道</button>
|
|
1057
|
-
</div>
|
|
1044
|
+
<div class="dv-row cm-checks">
|
|
1045
|
+
<label><input v-model="selectionFilters.point" data-demo="selection-point" type="checkbox" @change="applySelectionKinds" /> 节点</label>
|
|
1046
|
+
<label><input v-model="selectionFilters.line" data-demo="selection-line" type="checkbox" @change="applySelectionKinds" /> 线路</label>
|
|
1047
|
+
<label><input v-model="selectionFilters.channel" data-demo="selection-channel" type="checkbox" @change="applySelectionKinds" /> 通道</label>
|
|
1048
|
+
</div>
|
|
1049
|
+
<div class="dv-row">
|
|
1050
|
+
<button type="button" class="dv-button dv-button--primary" data-demo="copy-select-sources" @click="selectBatchSources">选中示例组</button>
|
|
1051
|
+
<button type="button" class="dv-button" data-demo="merge-select-sources" @click="prepareMerge">选中并准备合并</button>
|
|
1052
|
+
<button type="button" class="dv-button" @click="clearSelection">清空</button>
|
|
1053
|
+
</div>
|
|
1054
|
+
<div class="dv-row">
|
|
1055
|
+
<button type="button" class="dv-button" data-demo="select-sample-line" @click="selectSampleLine">选中示例线路</button>
|
|
1056
|
+
<button type="button" class="dv-button" data-demo="select-sample-channel" @click="selectSampleChannel">选中示例通道</button>
|
|
1057
|
+
</div>
|
|
1058
1058
|
<p class="dv-hint">画布上按住 Shift 从空白处拖动框选;按住 Ctrl 点击仍是累加多选。复选框决定两种选中方式能收哪些类型。只选节点时复制只新增节点,选中线路 / 通道时复制会同时补端点、线路与通道。</p>
|
|
1059
|
-
</div>
|
|
1060
|
-
<div class="dv-group">
|
|
1061
|
-
<h3>2 · 复制事件</h3>
|
|
1059
|
+
</div>
|
|
1060
|
+
<div class="dv-group">
|
|
1061
|
+
<h3>2 · 复制事件</h3>
|
|
1062
1062
|
<p class="dv-readout" data-demo="copy-event-readout">{{ copyEventText }}</p>
|
|
1063
1063
|
<p class="dv-readout" data-demo="copy-sources-readout">来源:{{ copySourcesText }}</p>
|
|
1064
1064
|
<p class="dv-readout" data-demo="copy-items-readout">结果:{{ copyItemsText }}</p>
|
|
1065
1065
|
<p class="dv-readout" data-demo="copy-line-channels-readout">线路 → 通道:{{ copyLineChannelsText }}</p>
|
|
1066
|
-
<div class="dv-row">
|
|
1067
|
-
<button type="button" class="dv-button dv-button--primary" data-demo="copy-selected" @click="copySelectedByApi">copySelectedPoints</button>
|
|
1068
|
-
<button type="button" class="dv-button" data-demo="copy-points" @click="copyPointsByApi">copyPoints(sources)</button>
|
|
1069
|
-
<button type="button" class="dv-button" data-demo="copy-clipboard" @click="copyClipboardByApi">copyPointsToClipboard</button>
|
|
1070
|
-
<button type="button" class="dv-button" data-demo="paste-points" :disabled="!clipboardItem" @click="pasteFromClipboard">pastePoints</button>
|
|
1071
|
-
</div>
|
|
1072
|
-
<div class="dv-row">
|
|
1073
|
-
<button type="button" class="dv-button" data-demo="manual-add-point" @click="manualAddPointCopy">手动 addPoint 复制</button>
|
|
1074
|
-
<button type="button" class="dv-button dv-button--danger" data-demo="copy-revert" @click="revertLastCopy">取消 / 回滚本次复制</button>
|
|
1075
|
-
</div>
|
|
1076
|
-
<p class="dv-readout" data-demo="copy-readout">{{ copyText }}</p>
|
|
1077
|
-
<p class="dv-readout" data-demo="clipboard-readout">{{ clipboardText }}</p>
|
|
1078
|
-
<p class="dv-readout" data-demo="copy-action">{{ actionText }}</p>
|
|
1079
|
-
<p class="dv-readout" data-demo="manual-add-point-readout">{{ manualText }}</p>
|
|
1066
|
+
<div class="dv-row">
|
|
1067
|
+
<button type="button" class="dv-button dv-button--primary" data-demo="copy-selected" @click="copySelectedByApi">copySelectedPoints</button>
|
|
1068
|
+
<button type="button" class="dv-button" data-demo="copy-points" @click="copyPointsByApi">copyPoints(sources)</button>
|
|
1069
|
+
<button type="button" class="dv-button" data-demo="copy-clipboard" @click="copyClipboardByApi">copyPointsToClipboard</button>
|
|
1070
|
+
<button type="button" class="dv-button" data-demo="paste-points" :disabled="!clipboardItem" @click="pasteFromClipboard">pastePoints</button>
|
|
1071
|
+
</div>
|
|
1072
|
+
<div class="dv-row">
|
|
1073
|
+
<button type="button" class="dv-button" data-demo="manual-add-point" @click="manualAddPointCopy">手动 addPoint 复制</button>
|
|
1074
|
+
<button type="button" class="dv-button dv-button--danger" data-demo="copy-revert" @click="revertLastCopy">取消 / 回滚本次复制</button>
|
|
1075
|
+
</div>
|
|
1076
|
+
<p class="dv-readout" data-demo="copy-readout">{{ copyText }}</p>
|
|
1077
|
+
<p class="dv-readout" data-demo="clipboard-readout">{{ clipboardText }}</p>
|
|
1078
|
+
<p class="dv-readout" data-demo="copy-action">{{ actionText }}</p>
|
|
1079
|
+
<p class="dv-readout" data-demo="manual-add-point-readout">{{ manualText }}</p>
|
|
1080
1080
|
<p class="dv-hint">「手动 addPoint」先拿到内置复制的真实落点,立刻撤销自动副本,再在同一坐标逐个 addPoint;最终只多一份手动副本。Ctrl+C / Ctrl+V 需要 copy 打开、features.keyboard: true,并保持画布焦点。复制事件里的 lineChannels 与 lines 一一对应;support 项是线路为了独立成立而补的端点。</p>
|
|
1081
|
-
</div>
|
|
1082
|
-
<div class="dv-group">
|
|
1083
|
-
<h3>3 · 合并事件</h3>
|
|
1084
|
-
<div class="dv-row cm-form">
|
|
1085
|
-
<label>
|
|
1086
|
-
保留节点
|
|
1087
|
-
<select v-model="mergeTargetId" data-demo="merge-target" :disabled="!mergeTargetOptions.length">
|
|
1088
|
-
<option v-for="item in mergeTargetOptions" :key="item.value" :value="item.value">{{ item.label }}</option>
|
|
1089
|
-
</select>
|
|
1090
|
-
</label>
|
|
1091
|
-
<label>
|
|
1092
|
-
最终名称
|
|
1093
|
-
<input v-model="mergedName" data-demo="merge-name" type="text" />
|
|
1094
|
-
</label>
|
|
1095
|
-
</div>
|
|
1096
|
-
<div class="dv-row cm-form">
|
|
1097
|
-
<label>
|
|
1098
|
-
最终分区
|
|
1099
|
-
<input v-model="mergedZone" data-demo="merge-zone" type="text" />
|
|
1100
|
-
</label>
|
|
1101
|
-
<label>
|
|
1102
|
-
最终电压
|
|
1103
|
-
<input v-model="mergedVoltage" type="number" step="0.1" />
|
|
1104
|
-
</label>
|
|
1105
|
-
</div>
|
|
1106
|
-
<div class="dv-row cm-form">
|
|
1107
|
-
<label>
|
|
1108
|
-
最终颜色
|
|
1109
|
-
<input v-model="mergedColor" data-demo="merge-color" type="text" />
|
|
1110
|
-
</label>
|
|
1111
|
-
<label>
|
|
1112
|
-
最终尺寸
|
|
1113
|
-
<input v-model="mergedSize" data-demo="merge-size" type="number" min="1" step="1" />
|
|
1114
|
-
</label>
|
|
1115
|
-
</div>
|
|
1116
|
-
<div class="dv-row cm-form">
|
|
1117
|
-
<label>
|
|
1118
|
-
最终图标
|
|
1119
|
-
<input v-model="mergedSymbol" data-demo="merge-symbol" type="text" />
|
|
1120
|
-
</label>
|
|
1121
|
-
<label>
|
|
1122
|
-
描边颜色
|
|
1123
|
-
<input v-model="mergedStrokeColor" data-demo="merge-stroke-color" type="text" />
|
|
1124
|
-
</label>
|
|
1125
|
-
</div>
|
|
1126
|
-
<div class="dv-row">
|
|
1127
|
-
<label><input v-model="rewriteOnConfirm" type="checkbox" /> 手动拖拽合并确认时改写 payload.item</label>
|
|
1128
|
-
</div>
|
|
1129
|
-
<div class="dv-row">
|
|
1130
|
-
<button type="button" class="dv-button dv-button--primary" data-demo="merge-selected" :disabled="!canMerge" @click="mergeSelectedByApi">合并选中(指定保留节点)</button>
|
|
1131
|
-
</div>
|
|
1081
|
+
</div>
|
|
1082
|
+
<div class="dv-group">
|
|
1083
|
+
<h3>3 · 合并事件</h3>
|
|
1084
|
+
<div class="dv-row cm-form">
|
|
1085
|
+
<label>
|
|
1086
|
+
保留节点
|
|
1087
|
+
<select v-model="mergeTargetId" data-demo="merge-target" :disabled="!mergeTargetOptions.length">
|
|
1088
|
+
<option v-for="item in mergeTargetOptions" :key="item.value" :value="item.value">{{ item.label }}</option>
|
|
1089
|
+
</select>
|
|
1090
|
+
</label>
|
|
1091
|
+
<label>
|
|
1092
|
+
最终名称
|
|
1093
|
+
<input v-model="mergedName" data-demo="merge-name" type="text" />
|
|
1094
|
+
</label>
|
|
1095
|
+
</div>
|
|
1096
|
+
<div class="dv-row cm-form">
|
|
1097
|
+
<label>
|
|
1098
|
+
最终分区
|
|
1099
|
+
<input v-model="mergedZone" data-demo="merge-zone" type="text" />
|
|
1100
|
+
</label>
|
|
1101
|
+
<label>
|
|
1102
|
+
最终电压
|
|
1103
|
+
<input v-model="mergedVoltage" type="number" step="0.1" />
|
|
1104
|
+
</label>
|
|
1105
|
+
</div>
|
|
1106
|
+
<div class="dv-row cm-form">
|
|
1107
|
+
<label>
|
|
1108
|
+
最终颜色
|
|
1109
|
+
<input v-model="mergedColor" data-demo="merge-color" type="text" />
|
|
1110
|
+
</label>
|
|
1111
|
+
<label>
|
|
1112
|
+
最终尺寸
|
|
1113
|
+
<input v-model="mergedSize" data-demo="merge-size" type="number" min="1" step="1" />
|
|
1114
|
+
</label>
|
|
1115
|
+
</div>
|
|
1116
|
+
<div class="dv-row cm-form">
|
|
1117
|
+
<label>
|
|
1118
|
+
最终图标
|
|
1119
|
+
<input v-model="mergedSymbol" data-demo="merge-symbol" type="text" />
|
|
1120
|
+
</label>
|
|
1121
|
+
<label>
|
|
1122
|
+
描边颜色
|
|
1123
|
+
<input v-model="mergedStrokeColor" data-demo="merge-stroke-color" type="text" />
|
|
1124
|
+
</label>
|
|
1125
|
+
</div>
|
|
1126
|
+
<div class="dv-row">
|
|
1127
|
+
<label><input v-model="rewriteOnConfirm" type="checkbox" /> 手动拖拽合并确认时改写 payload.item</label>
|
|
1128
|
+
</div>
|
|
1129
|
+
<div class="dv-row">
|
|
1130
|
+
<button type="button" class="dv-button dv-button--primary" data-demo="merge-selected" :disabled="!canMerge" @click="mergeSelectedByApi">合并选中(指定保留节点)</button>
|
|
1131
|
+
</div>
|
|
1132
1132
|
<p class="dv-readout" data-demo="merge-readout">{{ mergeText }}</p>
|
|
1133
1133
|
<p class="dv-readout" data-demo="merge-backend-readout">{{ mergeBackendText }}</p>
|
|
1134
1134
|
<p class="dv-hint">mergeSelectedPoints 只并选中集;target 可以指定保留谁,item 只改最终节点的字段。拖点相撞走 pending / confirm 两站,确认前也能改写。合并落地后的 changes 可直接作为后端事务:删除来源节点、更新保留节点、更新 / 删除线路与通道。</p>
|
|
1135
|
-
</div>
|
|
1135
|
+
</div>
|
|
1136
1136
|
<div class="dv-group">
|
|
1137
1137
|
<h3>4 · 待确认合并</h3>
|
|
1138
|
-
<p class="dv-readout" data-demo="merge-pending-readout">{{ pendingText }}</p>
|
|
1139
|
-
<div class="dv-row cm-form">
|
|
1140
|
-
<label>
|
|
1141
|
-
拖拽合并保留
|
|
1142
|
-
<select v-model="mergeKeep" data-demo="merge-keep">
|
|
1143
|
-
<option value="target">保留碰撞目标(缺省)</option>
|
|
1144
|
-
<option value="source">保留拖动来源</option>
|
|
1145
|
-
</select>
|
|
1146
|
-
</label>
|
|
1147
|
-
</div>
|
|
1148
|
-
<div class="dv-row">
|
|
1149
|
-
<button type="button" class="dv-button dv-button--primary" data-demo="merge-confirm" :disabled="!pendingMerge" @click="confirmPendingMerge">
|
|
1150
|
-
<button type="button" class="dv-button" data-demo="merge-cancel" :disabled="!pendingMerge" @click="cancelPendingMerge">
|
|
1151
|
-
</div>
|
|
1152
|
-
<div class="dv-row">
|
|
1153
|
-
<button type="button" class="dv-button" data-demo="merge-impact-details" :disabled="!pendingMerge?.impact" @click="showMergeImpactDetails">按 id 查线路 / 通道详情</button>
|
|
1154
|
-
</div>
|
|
1155
|
-
<p class="dv-readout" data-demo="merge-impact-detail-readout">{{ mergeDetailText }}</p>
|
|
1138
|
+
<p class="dv-readout" data-demo="merge-pending-readout">{{ pendingText }}</p>
|
|
1139
|
+
<div class="dv-row cm-form">
|
|
1140
|
+
<label>
|
|
1141
|
+
拖拽合并保留
|
|
1142
|
+
<select v-model="mergeKeep" data-demo="merge-keep">
|
|
1143
|
+
<option value="target">保留碰撞目标(缺省)</option>
|
|
1144
|
+
<option value="source">保留拖动来源</option>
|
|
1145
|
+
</select>
|
|
1146
|
+
</label>
|
|
1147
|
+
</div>
|
|
1148
|
+
<div class="dv-row">
|
|
1149
|
+
<button type="button" class="dv-button dv-button--primary" data-demo="merge-confirm" :disabled="!pendingMerge" @click="confirmPendingMerge">resolvePointMerge(true, { keep, item })</button>
|
|
1150
|
+
<button type="button" class="dv-button" data-demo="merge-cancel" :disabled="!pendingMerge" @click="cancelPendingMerge">resolvePointMerge(false)</button>
|
|
1151
|
+
</div>
|
|
1152
|
+
<div class="dv-row">
|
|
1153
|
+
<button type="button" class="dv-button" data-demo="merge-impact-details" :disabled="!pendingMerge?.impact" @click="showMergeImpactDetails">按 id 查线路 / 通道详情</button>
|
|
1154
|
+
</div>
|
|
1155
|
+
<p class="dv-readout" data-demo="merge-impact-detail-readout">{{ mergeDetailText }}</p>
|
|
1156
1156
|
<p class="dv-hint">清空选中后,把画布上的一个节点拖到另一个节点上松手;选保留拖动来源 / 碰撞目标,再点确认。pending 载荷的 impact 已按「保留碰撞目标」预演影响线路数,confirm 时按最终 keep 重算;名称、分区、电压和样式都随 item 写回最终节点。</p>
|
|
1157
1157
|
</div>
|
|
1158
1158
|
<div class="dv-group">
|
|
@@ -1186,188 +1186,188 @@ onBeforeUnmount(() => {
|
|
|
1186
1186
|
<pre class="cm-request" data-demo="copy-merge-backend-request">{{ backendPreview }}</pre>
|
|
1187
1187
|
</div>
|
|
1188
1188
|
<div class="dv-group">
|
|
1189
|
-
<h3>事件日志</h3>
|
|
1190
|
-
<ul class="dv-log" data-demo="copy-merge-log">
|
|
1191
|
-
<li v-for="line in logLines" :key="line.id"><strong>{{ line.name }}</strong> · {{ line.text }}</li>
|
|
1192
|
-
<li v-if="!logLines.length">还没有事件</li>
|
|
1193
|
-
</ul>
|
|
1194
|
-
</div>
|
|
1195
|
-
</aside>
|
|
1196
|
-
</section>
|
|
1197
|
-
</template>
|
|
1198
|
-
|
|
1199
|
-
<style scoped>
|
|
1200
|
-
.cm-demo .dv-stage {
|
|
1201
|
-
isolation: isolate;
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
.cm-guide {
|
|
1205
|
-
position: absolute;
|
|
1206
|
-
top: 10px;
|
|
1207
|
-
left: 10px;
|
|
1208
|
-
z-index: 4;
|
|
1209
|
-
display: flex;
|
|
1210
|
-
flex-direction: column;
|
|
1211
|
-
gap: 5px;
|
|
1212
|
-
padding: 8px 10px;
|
|
1213
|
-
border: 1px solid rgba(74, 121, 177, 0.18);
|
|
1214
|
-
border-radius: 8px;
|
|
1215
|
-
background: rgba(255, 255, 255, 0.88);
|
|
1216
|
-
box-shadow: 0 5px 18px rgba(31, 62, 105, 0.1);
|
|
1217
|
-
backdrop-filter: blur(6px);
|
|
1218
|
-
pointer-events: none;
|
|
1219
|
-
color: #526b8d;
|
|
1220
|
-
font-size: 11px;
|
|
1221
|
-
line-height: 1.5;
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
.cm-guide span {
|
|
1225
|
-
display: flex;
|
|
1226
|
-
align-items: center;
|
|
1227
|
-
gap: 5px;
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
.cm-guide b {
|
|
1231
|
-
display: inline-grid;
|
|
1232
|
-
place-items: center;
|
|
1233
|
-
width: 16px;
|
|
1234
|
-
height: 16px;
|
|
1235
|
-
border-radius: 50%;
|
|
1236
|
-
background: #3678bf;
|
|
1237
|
-
color: #fff;
|
|
1238
|
-
font-size: 10px;
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
.cm-guide kbd {
|
|
1242
|
-
padding: 0 4px;
|
|
1243
|
-
border: 1px solid #cfdcec;
|
|
1244
|
-
border-bottom-width: 2px;
|
|
1245
|
-
border-radius: 4px;
|
|
1246
|
-
background: #f7faff;
|
|
1247
|
-
color: #2f5e94;
|
|
1248
|
-
font: inherit;
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
.cm-toast {
|
|
1252
|
-
position: absolute;
|
|
1253
|
-
left: 10px;
|
|
1254
|
-
z-index: 5;
|
|
1255
|
-
width: min(440px, calc(100% - 150px));
|
|
1256
|
-
padding: 10px 12px;
|
|
1257
|
-
border: 1px solid #b9d2ee;
|
|
1258
|
-
border-radius: 9px;
|
|
1259
|
-
background: rgba(249, 252, 255, 0.96);
|
|
1260
|
-
box-shadow: 0 8px 24px rgba(31, 62, 105, 0.16);
|
|
1261
|
-
backdrop-filter: blur(8px);
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
.cm-toast--copy {
|
|
1265
|
-
top: 104px;
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
.cm-toast--merge {
|
|
1269
|
-
bottom: 62px;
|
|
1270
|
-
border-color: #efc98f;
|
|
1271
|
-
background: rgba(255, 251, 244, 0.97);
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
.cm-toast__head {
|
|
1275
|
-
display: flex;
|
|
1276
|
-
align-items: center;
|
|
1277
|
-
justify-content: space-between;
|
|
1278
|
-
gap: 8px;
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
.cm-toast__head strong {
|
|
1282
|
-
color: #173a63;
|
|
1283
|
-
font-size: 12px;
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
.cm-toast p {
|
|
1287
|
-
margin: 6px 0 0;
|
|
1288
|
-
color: #526b8d;
|
|
1289
|
-
font-size: 11px;
|
|
1290
|
-
line-height: 1.55;
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
.cm-toast .cm-toast__hint {
|
|
1294
|
-
color: #8b6a35;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
.cm-tag {
|
|
1298
|
-
padding: 1px 6px;
|
|
1299
|
-
border-radius: 999px;
|
|
1300
|
-
background: #eaf2fc;
|
|
1301
|
-
color: #2f5e94;
|
|
1302
|
-
font-size: 10px;
|
|
1303
|
-
white-space: nowrap;
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
.cm-toast__actions {
|
|
1307
|
-
display: flex;
|
|
1308
|
-
flex-wrap: wrap;
|
|
1309
|
-
gap: 6px;
|
|
1310
|
-
margin-top: 8px;
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
.cm-toast__actions button,
|
|
1314
|
-
.cm-dock button {
|
|
1315
|
-
padding: 4px 8px;
|
|
1316
|
-
border: 1px solid #cfdcec;
|
|
1317
|
-
border-radius: 5px;
|
|
1318
|
-
background: #fff;
|
|
1319
|
-
color: #2f5e94;
|
|
1320
|
-
font-size: 11px;
|
|
1321
|
-
cursor: pointer;
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
.cm-toast__actions button:hover,
|
|
1325
|
-
.cm-dock button:hover {
|
|
1326
|
-
background: #e9f1fb;
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
.cm-toast__actions .is-primary {
|
|
1330
|
-
border-color: #3678bf;
|
|
1331
|
-
background: #3678bf;
|
|
1332
|
-
color: #fff;
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
.cm-dock {
|
|
1336
|
-
position: absolute;
|
|
1337
|
-
left: 10px;
|
|
1338
|
-
bottom: 10px;
|
|
1339
|
-
z-index: 5;
|
|
1340
|
-
display: flex;
|
|
1341
|
-
align-items: center;
|
|
1342
|
-
flex-wrap: wrap;
|
|
1343
|
-
gap: 6px;
|
|
1344
|
-
padding: 5px 7px;
|
|
1345
|
-
border: 1px solid rgba(74, 121, 177, 0.16);
|
|
1346
|
-
border-radius: 7px;
|
|
1347
|
-
background: rgba(255, 255, 255, 0.9);
|
|
1348
|
-
box-shadow: 0 4px 16px rgba(31, 62, 105, 0.12);
|
|
1349
|
-
color: #526b8d;
|
|
1350
|
-
font-size: 11px;
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
.cm-dock b {
|
|
1354
|
-
color: #173a63;
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
.cm-form {
|
|
1358
|
-
align-items: flex-end;
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
.cm-form input[type='text'],
|
|
1362
|
-
.cm-form input[type='number'] {
|
|
1363
|
-
width: 132px;
|
|
1364
|
-
padding: 4px 6px;
|
|
1365
|
-
border: 1px solid #d6e0ec;
|
|
1366
|
-
border-radius: 6px;
|
|
1367
|
-
color: #1f2a44;
|
|
1368
|
-
font-size: 12px;
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1189
|
+
<h3>事件日志</h3>
|
|
1190
|
+
<ul class="dv-log" data-demo="copy-merge-log">
|
|
1191
|
+
<li v-for="line in logLines" :key="line.id"><strong>{{ line.name }}</strong> · {{ line.text }}</li>
|
|
1192
|
+
<li v-if="!logLines.length">还没有事件</li>
|
|
1193
|
+
</ul>
|
|
1194
|
+
</div>
|
|
1195
|
+
</aside>
|
|
1196
|
+
</section>
|
|
1197
|
+
</template>
|
|
1198
|
+
|
|
1199
|
+
<style scoped>
|
|
1200
|
+
.cm-demo .dv-stage {
|
|
1201
|
+
isolation: isolate;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
.cm-guide {
|
|
1205
|
+
position: absolute;
|
|
1206
|
+
top: 10px;
|
|
1207
|
+
left: 10px;
|
|
1208
|
+
z-index: 4;
|
|
1209
|
+
display: flex;
|
|
1210
|
+
flex-direction: column;
|
|
1211
|
+
gap: 5px;
|
|
1212
|
+
padding: 8px 10px;
|
|
1213
|
+
border: 1px solid rgba(74, 121, 177, 0.18);
|
|
1214
|
+
border-radius: 8px;
|
|
1215
|
+
background: rgba(255, 255, 255, 0.88);
|
|
1216
|
+
box-shadow: 0 5px 18px rgba(31, 62, 105, 0.1);
|
|
1217
|
+
backdrop-filter: blur(6px);
|
|
1218
|
+
pointer-events: none;
|
|
1219
|
+
color: #526b8d;
|
|
1220
|
+
font-size: 11px;
|
|
1221
|
+
line-height: 1.5;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
.cm-guide span {
|
|
1225
|
+
display: flex;
|
|
1226
|
+
align-items: center;
|
|
1227
|
+
gap: 5px;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
.cm-guide b {
|
|
1231
|
+
display: inline-grid;
|
|
1232
|
+
place-items: center;
|
|
1233
|
+
width: 16px;
|
|
1234
|
+
height: 16px;
|
|
1235
|
+
border-radius: 50%;
|
|
1236
|
+
background: #3678bf;
|
|
1237
|
+
color: #fff;
|
|
1238
|
+
font-size: 10px;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
.cm-guide kbd {
|
|
1242
|
+
padding: 0 4px;
|
|
1243
|
+
border: 1px solid #cfdcec;
|
|
1244
|
+
border-bottom-width: 2px;
|
|
1245
|
+
border-radius: 4px;
|
|
1246
|
+
background: #f7faff;
|
|
1247
|
+
color: #2f5e94;
|
|
1248
|
+
font: inherit;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
.cm-toast {
|
|
1252
|
+
position: absolute;
|
|
1253
|
+
left: 10px;
|
|
1254
|
+
z-index: 5;
|
|
1255
|
+
width: min(440px, calc(100% - 150px));
|
|
1256
|
+
padding: 10px 12px;
|
|
1257
|
+
border: 1px solid #b9d2ee;
|
|
1258
|
+
border-radius: 9px;
|
|
1259
|
+
background: rgba(249, 252, 255, 0.96);
|
|
1260
|
+
box-shadow: 0 8px 24px rgba(31, 62, 105, 0.16);
|
|
1261
|
+
backdrop-filter: blur(8px);
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
.cm-toast--copy {
|
|
1265
|
+
top: 104px;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
.cm-toast--merge {
|
|
1269
|
+
bottom: 62px;
|
|
1270
|
+
border-color: #efc98f;
|
|
1271
|
+
background: rgba(255, 251, 244, 0.97);
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
.cm-toast__head {
|
|
1275
|
+
display: flex;
|
|
1276
|
+
align-items: center;
|
|
1277
|
+
justify-content: space-between;
|
|
1278
|
+
gap: 8px;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
.cm-toast__head strong {
|
|
1282
|
+
color: #173a63;
|
|
1283
|
+
font-size: 12px;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
.cm-toast p {
|
|
1287
|
+
margin: 6px 0 0;
|
|
1288
|
+
color: #526b8d;
|
|
1289
|
+
font-size: 11px;
|
|
1290
|
+
line-height: 1.55;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
.cm-toast .cm-toast__hint {
|
|
1294
|
+
color: #8b6a35;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
.cm-tag {
|
|
1298
|
+
padding: 1px 6px;
|
|
1299
|
+
border-radius: 999px;
|
|
1300
|
+
background: #eaf2fc;
|
|
1301
|
+
color: #2f5e94;
|
|
1302
|
+
font-size: 10px;
|
|
1303
|
+
white-space: nowrap;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
.cm-toast__actions {
|
|
1307
|
+
display: flex;
|
|
1308
|
+
flex-wrap: wrap;
|
|
1309
|
+
gap: 6px;
|
|
1310
|
+
margin-top: 8px;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
.cm-toast__actions button,
|
|
1314
|
+
.cm-dock button {
|
|
1315
|
+
padding: 4px 8px;
|
|
1316
|
+
border: 1px solid #cfdcec;
|
|
1317
|
+
border-radius: 5px;
|
|
1318
|
+
background: #fff;
|
|
1319
|
+
color: #2f5e94;
|
|
1320
|
+
font-size: 11px;
|
|
1321
|
+
cursor: pointer;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
.cm-toast__actions button:hover,
|
|
1325
|
+
.cm-dock button:hover {
|
|
1326
|
+
background: #e9f1fb;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
.cm-toast__actions .is-primary {
|
|
1330
|
+
border-color: #3678bf;
|
|
1331
|
+
background: #3678bf;
|
|
1332
|
+
color: #fff;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
.cm-dock {
|
|
1336
|
+
position: absolute;
|
|
1337
|
+
left: 10px;
|
|
1338
|
+
bottom: 10px;
|
|
1339
|
+
z-index: 5;
|
|
1340
|
+
display: flex;
|
|
1341
|
+
align-items: center;
|
|
1342
|
+
flex-wrap: wrap;
|
|
1343
|
+
gap: 6px;
|
|
1344
|
+
padding: 5px 7px;
|
|
1345
|
+
border: 1px solid rgba(74, 121, 177, 0.16);
|
|
1346
|
+
border-radius: 7px;
|
|
1347
|
+
background: rgba(255, 255, 255, 0.9);
|
|
1348
|
+
box-shadow: 0 4px 16px rgba(31, 62, 105, 0.12);
|
|
1349
|
+
color: #526b8d;
|
|
1350
|
+
font-size: 11px;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
.cm-dock b {
|
|
1354
|
+
color: #173a63;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
.cm-form {
|
|
1358
|
+
align-items: flex-end;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
.cm-form input[type='text'],
|
|
1362
|
+
.cm-form input[type='number'] {
|
|
1363
|
+
width: 132px;
|
|
1364
|
+
padding: 4px 6px;
|
|
1365
|
+
border: 1px solid #d6e0ec;
|
|
1366
|
+
border-radius: 6px;
|
|
1367
|
+
color: #1f2a44;
|
|
1368
|
+
font-size: 12px;
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
1371
|
.cm-form input[type='number'] {
|
|
1372
1372
|
width: 76px;
|
|
1373
1373
|
}
|
|
@@ -1387,13 +1387,13 @@ onBeforeUnmount(() => {
|
|
|
1387
1387
|
}
|
|
1388
1388
|
|
|
1389
1389
|
@media (max-width: 720px) {
|
|
1390
|
-
.cm-toast,
|
|
1391
|
-
.cm-dock {
|
|
1392
|
-
width: calc(100% - 20px);
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
.cm-toast--copy {
|
|
1396
|
-
top: 132px;
|
|
1397
|
-
}
|
|
1398
|
-
}
|
|
1399
|
-
</style>
|
|
1390
|
+
.cm-toast,
|
|
1391
|
+
.cm-dock {
|
|
1392
|
+
width: calc(100% - 20px);
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
.cm-toast--copy {
|
|
1396
|
+
top: 132px;
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
</style>
|