From 1f87271ebcba938b53788b124f92f8f7035a7cec Mon Sep 17 00:00:00 2001 From: xudan Date: Sun, 28 Sep 2025 16:25:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=A8=A1=E6=80=81=E6=A1=86=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=BC=96=E8=BE=91=E6=A8=A1=E5=BC=8F=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=94=AF=E6=8C=81=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=92=8C=E6=9C=BA=E5=99=A8=E4=BA=BA=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=EF=BC=8C=E4=BC=98=E5=8C=96=E7=9B=B8=E5=85=B3=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=92=8C=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/modal/batch-edit-modal.vue | 299 ++++++++++++---------- src/components/modal/robot-bind-modal.vue | 26 +- 2 files changed, 182 insertions(+), 143 deletions(-) diff --git a/src/components/modal/batch-edit-modal.vue b/src/components/modal/batch-edit-modal.vue index 8fb8f83..a49b3a1 100644 --- a/src/components/modal/batch-edit-modal.vue +++ b/src/components/modal/batch-edit-modal.vue @@ -3,104 +3,110 @@ v-model:open="modalVisible" title="批量编辑" width="500px" - :ok-button-props="{ disabled: !hasChanges }" + :ok-button-props="{ disabled: !hasChanges && editMode === 'property' }" @ok="handleConfirm" @cancel="handleCancel" >
- -
- -
+ + 属性编辑 + 机器人绑定 + - -
-

点位编辑 ({{ pointItems.length }} 个)

- - - - - {{ key }} - - - - -
+ +
+ +
+ +
- -
-

路线编辑 ({{ lineItems.length }} 个)

- - - - - {{ key }} - - - - -
+ +
+

点位编辑 ({{ pointItems.length }} 个)

+ + + + + {{ key }} + + + + +
- -
-

预览更改

-
-
- {{ getItemName(item) }} - {{ getItemType(item) }} -
- - 点位: {{ getPointChanges(item).join(', ') }} - - - 路线: {{ getRouteChanges(item).join(', ') }} - + +
+

路线编辑 ({{ lineItems.length }} 个)

+ + + + + {{ key }} + + + + +
+ + +
+

预览更改

+
+
+ {{ getItemName(item) }} + {{ getItemType(item) }} +
+ + 点位: {{ getPointChanges(item).join(', ') }} + + + 路线: {{ getRouteChanges(item).join(', ') }} + +
+ + +
+
+ +
+
+

充电点 ({{ chargingPoints.length }} 个)

+ 批量绑定机器人 +
+
+

停靠点 ({{ parkingPoints.length }} 个)

+ 批量绑定机器人 +
+
+

无符合条件的点位

+

仅充电点和停靠点支持批量绑定机器人。

+
+
+ @@ -315,28 +340,28 @@ defineOptions({ .selection-info { margin-bottom: 16px; } - + .edit-section { margin-bottom: 16px; padding: 12px; border-radius: 6px; - + h4 { margin: 0 0 12px 0; font-size: 14px; } } - + .preview-section { h4 { margin: 0 0 12px 0; font-size: 14px; } - + .preview-list { max-height: 150px; overflow-y: auto; - + .preview-item { display: flex; align-items: center; @@ -344,32 +369,32 @@ defineOptions({ margin-bottom: 6px; border-radius: 4px; font-size: 12px; - + .item-name { font-weight: 500; margin-right: 10px; min-width: 80px; } - + .item-type { margin-right: 10px; min-width: 100px; } - + .changes { flex: 1; - + .ant-tag { margin-right: 6px; margin-bottom: 2px; font-size: 11px; } - + .change-tag { font-weight: 500; border: 1px solid currentColor; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); - + // 突出显示箭头符号 &::before { content: ''; @@ -395,22 +420,22 @@ defineOptions({ .edit-section { background: theme.get-color(fill3); border: 1px solid theme.get-color(border2); - + h4 { color: theme.get-color(primary); } } - + .preview-section { h4 { color: theme.get-color(success); } - + .preview-list { .preview-item { background: theme.get-color(bg_component); border: 1px solid theme.get-color(border1); - + .item-type { color: theme.get-color(text3); } diff --git a/src/components/modal/robot-bind-modal.vue b/src/components/modal/robot-bind-modal.vue index c964ab1..0e3cfb1 100644 --- a/src/components/modal/robot-bind-modal.vue +++ b/src/components/modal/robot-bind-modal.vue @@ -12,13 +12,23 @@ const editor = inject(props.token)!; export type RobotBindModalRef = Ref; type Ref = { - open: (pen: MapPen) => void; + open: (pen: MapPen | MapPen[]) => void; }; +const targetPens = ref([]); const open: Ref['open'] = (pen) => { - if (!pen?.id) return; + if (!pen) return; + const pens = Array.isArray(pen) ? pen : [pen]; + if (pens.length === 0) return; + keyword.value = ''; - id.value = pen.id; - selected.value = pen.point?.robots ?? []; + targetPens.value = pens; + + if (pens.length === 1) { + selected.value = pens[0].point?.robots ?? []; + } else { + selected.value = []; + } + show.value = true; }; defineExpose({ open }); @@ -28,11 +38,15 @@ const keyword = ref(''); const robots = computed(() => editor.value.robots.filter(({ label }) => label.includes(keyword.value))); -const id = ref(''); const selected = ref([]); const submit = () => { - editor.value.updatePoint(id.value, { robots: toRaw(selected.value) }); + const robotIds = toRaw(selected.value); + targetPens.value.forEach((pen) => { + if (pen.id) { + editor.value.updatePoint(pen.id, { robots: robotIds }); + } + }); show.value = false; };