From ddae4f91733cd5829859610c432fee3c92cc82c5 Mon Sep 17 00:00:00 2001 From: WUSIJIAN <13825895+wsj0228@user.noreply.gitee.com> Date: Tue, 24 Feb 2026 14:20:18 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E7=9B=98=E7=82=B9=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E9=80=89=E6=8B=A9=E4=BA=A4=E4=BA=92,=E5=B0=86?= =?UTF-8?q?=E5=8D=95=E4=B8=80=E6=8A=BD=E5=B1=89=E6=94=B9=E4=B8=BA=E5=88=86?= =?UTF-8?q?=E6=AD=A5=E9=80=89=E6=8B=A9=E6=A8=A1=E5=BC=8F,=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=9B=98=E7=82=B9=E8=8C=83=E5=9B=B4=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=AD=97=E6=AE=B5,=E6=94=AF=E6=8C=81=E4=BB=93=E5=BA=93/?= =?UTF-8?q?=E5=BA=93=E5=8C=BA/=E5=BA=93=E4=BD=8D=E5=88=86=E5=88=AB?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=B9=B6=E5=8F=AF=E7=A7=BB=E9=99=A4,?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=80=89=E6=8B=A9=E6=B5=81=E7=A8=8B=E5=92=8C?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../count/component/editInventoryCount.vue | 180 +++++++--- .../count/component/scopeSelectDialog.vue | 313 ++++++++++++++++++ 2 files changed, 456 insertions(+), 37 deletions(-) create mode 100644 src/views/assets/operation/count/component/scopeSelectDialog.vue diff --git a/src/views/assets/operation/count/component/editInventoryCount.vue b/src/views/assets/operation/count/component/editInventoryCount.vue index 0736bba..ed351bd 100644 --- a/src/views/assets/operation/count/component/editInventoryCount.vue +++ b/src/views/assets/operation/count/component/editInventoryCount.vue @@ -22,23 +22,59 @@ - + + + + + + + + + + + +
-
- {{ getScopeLabel(form.scope) }} - {{ name }} - {{ name }} - {{ name }} +
+ {{ name }}
- - - {{ scopeDisplayText ? '修改' : '选择盘点范围' }} + + + {{ form.warehouseIds.length > 0 ? '继续选择' : '选择仓库' }}
- - + + +
+
+ {{ name }} +
+ + + {{ form.zoneIds.length > 0 ? '继续选择' : '选择库区' }} + + 请先选择仓库 +
+
+ + + +
+
+ {{ name }} +
+ + + {{ form.locationIds.length > 0 ? '继续选择' : '选择库位' }} + + 请先选择库区 +
+
+ + + @@ -66,14 +102,14 @@ import { ref, reactive, computed } from 'vue'; import { ElMessage } from 'element-plus'; import type { FormInstance, FormRules } from 'element-plus'; import { createInventoryCount, updateInventoryCount, getInventoryCount } from '/@/api/assets/operation/count'; -import ScopeSelectDrawer from './scopeSelectDrawer.vue'; +import ScopeSelectDialog from './scopeSelectDialog.vue'; const emit = defineEmits(['refresh']); const visible = ref(false); const loading = ref(false); const formRef = ref(); -const scopeDrawerRef = ref(); +const scopeSelectDialogRef = ref(); // 表单数据 const form = reactive({ @@ -98,15 +134,53 @@ const selectedLocationNames = ref([]); // 参与人员输入框 const participantsInput = ref(''); -// 盘点范围显示文本 -const scopeDisplayText = computed(() => { - return form.warehouseIds.length > 0; -}); +// 当前选择的类型(1-仓库 2-库区 3-库位) +const currentSelectType = ref(1); -// 获取盘点范围标签 -const getScopeLabel = (scope: number) => { - const labels: Record = { 1: '按仓库盘点', 2: '按库区盘点', 3: '按库位盘点', 4: '按SKU盘点', 5: '按资产盘点' }; - return labels[scope] || ''; +// 移除仓库 +const removeWarehouse = (name: string) => { + const idx = selectedWarehouseNames.value.indexOf(name); + if (idx > -1) { + selectedWarehouseNames.value.splice(idx, 1); + form.warehouseIds.splice(idx, 1); + // 清空下级选择 + form.zoneIds = []; + form.locationIds = []; + selectedZoneNames.value = []; + selectedLocationNames.value = []; + } +}; + +// 移除库区 +const removeZone = (name: string) => { + const idx = selectedZoneNames.value.indexOf(name); + if (idx > -1) { + selectedZoneNames.value.splice(idx, 1); + form.zoneIds.splice(idx, 1); + // 清空下级选择 + form.locationIds = []; + selectedLocationNames.value = []; + } +}; + +// 移除库位 +const removeLocation = (name: string) => { + const idx = selectedLocationNames.value.indexOf(name); + if (idx > -1) { + selectedLocationNames.value.splice(idx, 1); + form.locationIds.splice(idx, 1); + } +}; + +// 盘点范围类型变化 +const onScopeTypeChange = () => { + // 清空已选项 + form.warehouseIds = []; + form.zoneIds = []; + form.locationIds = []; + selectedWarehouseNames.value = []; + selectedZoneNames.value = []; + selectedLocationNames.value = []; }; // 表单校验规则 @@ -186,25 +260,52 @@ const resetForm = () => { formRef.value?.resetFields(); }; -// 打开盘点范围选择抽屉 -const openScopeDrawer = () => { - scopeDrawerRef.value?.openDrawer({ - scope: form.scope, +// 打开选择弹窗 +const openSelectDialog = (type: number) => { + currentSelectType.value = type; + let selectedIds: string[] = []; + let selectedNames: string[] = []; + + if (type === 1) { + selectedIds = form.warehouseIds; + selectedNames = selectedWarehouseNames.value; + } else if (type === 2) { + selectedIds = form.zoneIds; + selectedNames = selectedZoneNames.value; + } else if (type === 3) { + selectedIds = form.locationIds; + selectedNames = selectedLocationNames.value; + } + + scopeSelectDialogRef.value?.open({ + scope: type, + selectedIds, + selectedNames, warehouseIds: form.warehouseIds, zoneIds: form.zoneIds, - locationIds: form.locationIds, }); }; -// 盘点范围选择确认 -const onScopeConfirm = (data: any) => { - form.scope = data.scope; - form.warehouseIds = data.warehouseIds; - form.zoneIds = data.zoneIds; - form.locationIds = data.locationIds; - selectedWarehouseNames.value = data.warehouseNames; - selectedZoneNames.value = data.zoneNames; - selectedLocationNames.value = data.locationNames; +// 选择确认 +const onSelectConfirm = (data: any) => { + if (currentSelectType.value === 1) { + form.warehouseIds = data.selectedIds; + selectedWarehouseNames.value = data.selectedNames; + // 清空下级选择 + form.zoneIds = []; + form.locationIds = []; + selectedZoneNames.value = []; + selectedLocationNames.value = []; + } else if (currentSelectType.value === 2) { + form.zoneIds = data.selectedIds; + selectedZoneNames.value = data.selectedNames; + // 清空下级选择 + form.locationIds = []; + selectedLocationNames.value = []; + } else if (currentSelectType.value === 3) { + form.locationIds = data.selectedIds; + selectedLocationNames.value = data.selectedNames; + } }; // 关闭弹窗 @@ -269,7 +370,7 @@ defineExpose({ diff --git a/src/views/assets/operation/count/component/scopeSelectDialog.vue b/src/views/assets/operation/count/component/scopeSelectDialog.vue new file mode 100644 index 0000000..90d9858 --- /dev/null +++ b/src/views/assets/operation/count/component/scopeSelectDialog.vue @@ -0,0 +1,313 @@ + + + + +