From 98749f73549cbbb1eb1db0916f3f2073e006384e Mon Sep 17 00:00:00 2001 From: zs <zhousong@weben-smart.com> Date: 周三, 30 4月 2025 19:47:32 +0800 Subject: [PATCH] 托盘管理 --- HIAWms/web/src/widgets/WmsContainer/Controllers/WmsContainerDrawer.tsx | 140 +++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 125 insertions(+), 15 deletions(-) diff --git a/HIAWms/web/src/widgets/WmsContainer/Controllers/WmsContainerDrawer.ts b/HIAWms/web/src/widgets/WmsContainer/Controllers/WmsContainerDrawer.tsx similarity index 62% rename from HIAWms/web/src/widgets/WmsContainer/Controllers/WmsContainerDrawer.ts rename to HIAWms/web/src/widgets/WmsContainer/Controllers/WmsContainerDrawer.tsx index 54066ec..f7f5228 100644 --- a/HIAWms/web/src/widgets/WmsContainer/Controllers/WmsContainerDrawer.ts +++ b/HIAWms/web/src/widgets/WmsContainer/Controllers/WmsContainerDrawer.tsx @@ -1,10 +1,20 @@ -import { ref, onMounted, reactive, computed, Ref, watch } from 'vue' +import { + ref, + onMounted, + reactive, + computed, + Ref, + watch, + SetupContext, + h, +} from 'vue' import { injectModel } from '@/libs/Provider/Provider' import { WmsContainerDrawer } from '../Models/WmsContainerDrawer' import { ElMessage } from 'element-plus' import isEqual from 'lodash/isEqual' import { ConfirmBox } from '@/components/ConfirmBox/ConfirmBox' import { cloneDeep } from 'lodash' +import { getWmsEnumData } from '@/widgets/HIAWms/Models/Service/WmsMaterialDrawer' export const useWmsContainerDrawer = (props: any, ctx?: any) => { const wmsContainerDrawer = @@ -16,6 +26,18 @@ const formData = ref<Record<string, any>>({}) // ref const formRef = ref() + const disabled = ref(false) + + const inputNumber = (attrs) => { + return ( + <el-input-number + min="1" + step="1" + precision="0" + {...attrs} + ></el-input-number> + ) + } const current = computed(() => { return props.row || null @@ -44,11 +66,7 @@ prop: 'containerType', el: 'select', placeholder: '璇烽�夋嫨鎵樼洏绫诲瀷', - options: [ - { label: '绫诲瀷1', value: 0 }, - { label: '绫诲瀷2', value: 1 }, - // 娣诲姞鎵�鏈夋灇涓惧�� - ], + options: [], rules: [{ required: true, message: '璇烽�夋嫨鎵樼洏绫诲瀷', trigger: 'change' }], }, { @@ -56,17 +74,20 @@ prop: 'containerStatus', el: 'select', placeholder: '璇烽�夋嫨鎵樼洏鐘舵��', - options: [ - { label: '鐘舵��1', value: 0 }, - { label: '鐘舵��2', value: 1 }, - // 娣诲姞鎵�鏈夋灇涓惧�� - ], + options: [], rules: [{ required: true, message: '璇烽�夋嫨鎵樼洏鐘舵��', trigger: 'change' }], }, { label: '闀垮害(mm)', prop: 'specLength', - el: 'input', + el: (props: any, { attrs }: SetupContext) => { + return h(inputNumber, { + ...props, + clearable: true, + ...attrs, + }) + }, + width: '100%', placeholder: '璇疯緭鍏ラ暱搴�', step: 0.01, precision: 2, @@ -74,7 +95,14 @@ { label: '瀹藉害(mm)', prop: 'specWidth', - el: 'input', + el: (props: any, { attrs }: SetupContext) => { + return h(inputNumber, { + ...props, + clearable: true, + ...attrs, + }) + }, + width: '100%', placeholder: '璇疯緭鍏ュ搴�', step: 0.01, precision: 2, @@ -82,15 +110,74 @@ { label: '楂樺害(mm)', prop: 'specHeight', - el: 'input', + el: (props: any, { attrs }: SetupContext) => { + return h(inputNumber, { + ...props, + clearable: true, + ...attrs, + }) + }, + width: '100%', placeholder: '璇疯緭鍏ラ珮搴�', step: 0.01, precision: 2, }, { + label: '闄愰暱(mm)', + prop: 'limitLength', + el: (props: any, { attrs }: SetupContext) => { + return h(inputNumber, { + ...props, + clearable: true, + ...attrs, + }) + }, + width: '100%', + placeholder: '璇疯緭鍏ヨ浇閲嶄笂闄�', + step: 0.1, + precision: 2, + }, + { + label: '闄愬(mm)', + prop: 'limitWidth', + el: (props: any, { attrs }: SetupContext) => { + return h(inputNumber, { + ...props, + clearable: true, + ...attrs, + }) + }, + width: '100%', + placeholder: '璇疯緭鍏ヨ浇閲嶄笂闄�', + step: 0.1, + precision: 2, + }, + { + label: '闄愰珮(mm)', + prop: 'limitHeight', + el: (props: any, { attrs }: SetupContext) => { + return h(inputNumber, { + ...props, + clearable: true, + ...attrs, + }) + }, + width: '100%', + placeholder: '璇疯緭鍏ヨ浇閲嶄笂闄�', + step: 0.1, + precision: 2, + }, + { label: '杞介噸涓婇檺(kg)', prop: 'maxWeight', - el: 'input', + el: (props: any, { attrs }: SetupContext) => { + return h(inputNumber, { + ...props, + clearable: true, + ...attrs, + }) + }, + width: '100%', placeholder: '璇疯緭鍏ヨ浇閲嶄笂闄�', step: 0.1, precision: 2, @@ -168,10 +255,31 @@ }, } } + + const updateFormItemOptions = (propName: string, enumData: any[]) => { + const item = formItems.find((item) => item.prop === propName) + if (item && enumData) { + item.options = enumData.map((item) => ({ + label: item.description, + value: item.value, + })) + } + } + /** * 寮圭獥鎵撳紑鑾峰彇璇︽儏 */ const onOpen = async () => { + const containerTypeEnum = await getWmsEnumData({ + EnumName: 'ContainerTypeEnum', + }) + updateFormItemOptions('containerType', containerTypeEnum) + + const containerStatusEnum = await getWmsEnumData({ + EnumName: 'ContainerStatusEnum', + }) + updateFormItemOptions('containerStatus', containerStatusEnum) + if (current.value) { const res = await wmsContainerDrawer.getWmsContainerDetail(current.value) @@ -190,8 +298,10 @@ id: res.id, } updateCheckData() + disabled.value = true } else { formData.value = {} + disabled.value = false updateCheckData() } } -- Gitblit v1.9.3