From 184009380d6bb118d9f09331970b05bb4fd9de8d Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 7 Mar 2026 00:49:15 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(mes):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=9D=A1=E7=A0=81=E4=B8=9A=E5=8A=A1=E7=B1=BB=E5=9E=8B=E5=92=8C?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整条码业务类型枚举,修改库位和仓库的常量值,优化条码表单组件的选择逻辑,添加库区和设备的选择器,确保用户能够正确选择业务对象。 --- src/api/mes/wm/barcode/index.ts | 18 +- src/views/mes/utils/constants.ts | 12 +- src/views/mes/wm/barcode/BarcodeForm.vue | 209 +++++++++++------------ 3 files changed, 116 insertions(+), 123 deletions(-) diff --git a/src/api/mes/wm/barcode/index.ts b/src/api/mes/wm/barcode/index.ts index a1b5dee3b..470c116c4 100644 --- a/src/api/mes/wm/barcode/index.ts +++ b/src/api/mes/wm/barcode/index.ts @@ -2,17 +2,17 @@ import request from '@/config/axios' // MES 条码清单 VO export interface WmBarcodeVO { - id: number - configId: number - format: number - bizType: number - content: string - bizId: number - bizCode: string - bizName: string + id?: number + configId?: number + format?: number + bizType?: number + content?: string + bizId?: number + bizCode?: string + bizName?: string status: number remark: string - createTime: string + createTime?: string } // MES 条码 API diff --git a/src/views/mes/utils/constants.ts b/src/views/mes/utils/constants.ts index af1516e18..8ebe2846f 100644 --- a/src/views/mes/utils/constants.ts +++ b/src/views/mes/utils/constants.ts @@ -363,22 +363,18 @@ export const BARCODE_FORMAT_MAP: Record = { } /** MES 条码业务类型枚举(对应后端 BarcodeBizTypeEnum) */ -// TODO @AI:后端的 BizTypeEnum 也搬过来! export enum BarcodeBizTypeEnum { // WM 仓库模块 [100, 200) - WAREHOUSE = 102, - AREA = 103, - PACKAGE = 104, - STOCK = 105, - BATCH = 106, + AREA = 104, + PACKAGE = 105, + STOCK = 106, + BATCH = 107, // PRO 生产模块 [300, 400) PROCARD = 300, WORKORDER = 301, TRANSORDER = 302, // DV 设备模块 [400, 500) MACHINERY = 400, - // TM 工装夹具模块 [500, 600) - TOOL = 500, // MD 主数据模块 [600, 700) ITEM = 600, VENDOR = 601, diff --git a/src/views/mes/wm/barcode/BarcodeForm.vue b/src/views/mes/wm/barcode/BarcodeForm.vue index fcbcdb8a7..b895bcbf5 100644 --- a/src/views/mes/wm/barcode/BarcodeForm.vue +++ b/src/views/mes/wm/barcode/BarcodeForm.vue @@ -27,91 +27,83 @@ /> - - - - - - - - - - - - - - - - - - - - - - + +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + @@ -161,12 +153,14 @@ import { WmBarcodeApi, type WmBarcodeVO } from '@/api/mes/wm/barcode' import { BarcodeBizTypeEnum } from '@/views/mes/utils/constants' import WmWarehouseSelect from '@/views/mes/wm/warehouse/components/WmWarehouseSelect.vue' import WmWarehouseAreaSelect from '@/views/mes/wm/warehouse/components/WmWarehouseAreaSelect.vue' +import WmWarehouseLocationSelect from '@/views/mes/wm/warehouse/components/WmWarehouseLocationSelect.vue' import ProWorkOrderSelect from '@/views/mes/pro/workorder/components/ProWorkOrderSelect.vue' import DvMachinerySelect from '@/views/mes/dv/machinery/components/DvMachinerySelect.vue' import MdItemSelect from '@/views/mes/md/item/components/MdItemSelect.vue' import MdVendorSelect from '@/views/mes/md/vendor/components/MdVendorSelect.vue' import MdWorkstationSelect from '@/views/mes/md/workstation/components/MdWorkstationSelect.vue' import MdWorkshopSelect from '@/views/mes/md/workstation/components/MdWorkshopSelect.vue' +import UserSelect from '@/views/system/user/components/UserSelect.vue' defineOptions({ name: 'BarcodeForm' }) @@ -177,7 +171,7 @@ const dialogVisible = ref(false) // 弹窗的是否展示 const dialogTitle = ref('') // 弹窗的标题 const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 const formType = ref('') // 表单的类型:create - 新增;update - 修改 -const formData = ref({ +const formData = ref({ id: undefined, format: undefined, bizType: undefined, @@ -196,23 +190,8 @@ const formRules = reactive({ }) const formRef = ref() -/** 有 Select 组件的业务类型集合 */ -const BIZ_TYPES_WITH_SELECT = [ - BarcodeBizTypeEnum.WAREHOUSE, - BarcodeBizTypeEnum.AREA, - BarcodeBizTypeEnum.WORKORDER, - BarcodeBizTypeEnum.MACHINERY, - BarcodeBizTypeEnum.ITEM, - BarcodeBizTypeEnum.VENDOR, - BarcodeBizTypeEnum.WORKSTATION, - BarcodeBizTypeEnum.WORKSHOP -] as number[] - -/** 当前 bizType 是否有对应的 Select 组件 */ -// TODO @AI:这里 linter 报错; -const hasBizSelect = computed(() => - BIZ_TYPES_WITH_SELECT.includes(formData.value.bizType as number) -) +const areaWarehouseId = ref() // 库区选择器的临时数据:选择仓库后,传给库区选择器,加载对应仓库的库区列表 +const areaLocationId = ref() // 库区选择器的临时数据:选择库位后,传给库区选择器,加载对应库位的库区列表 /** 业务 Select 选中回调:自动填充 bizId、bizCode、bizName */ const handleBizSelect = (item: any) => { @@ -223,8 +202,23 @@ const handleBizSelect = (item: any) => { return } formData.value.bizId = item.id - formData.value.bizCode = item.code - formData.value.bizName = item.name + formData.value.bizCode = item.code || item.username + formData.value.bizName = item.name || item.nickname +} + +/** 库区仓库选择回调:清空库位和库区 */ +const handleAreaWarehouseChange = () => { + areaLocationId.value = undefined + formData.value.bizId = undefined + formData.value.bizCode = undefined + formData.value.bizName = undefined +} + +/** 库区库位选择回调:清空库区 */ +const handleAreaLocationChange = () => { + formData.value.bizId = undefined + formData.value.bizCode = undefined + formData.value.bizName = undefined } /** bizType 切换时,清空业务字段 */ @@ -234,6 +228,9 @@ watch( formData.value.bizId = undefined formData.value.bizCode = undefined formData.value.bizName = undefined + // 清空库区的临时数据 + areaWarehouseId.value = undefined + areaLocationId.value = undefined } )