ÎļþÃû´Ó HIAWms/web/src/widgets/WmsContainer/Controllers/WmsContainerDrawer.ts ÐÞ¸Ä |
| | |
| | | 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 = |
| | |
| | | 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 |
| | |
| | | prop: 'containerType', |
| | | el: 'select', |
| | | placeholder: 'è¯·éæ©æçç±»å', |
| | | options: [ |
| | | { label: 'ç±»å1', value: 0 }, |
| | | { label: 'ç±»å2', value: 1 }, |
| | | // æ·»å æææä¸¾å¼ |
| | | ], |
| | | options: [], |
| | | rules: [{ required: true, message: 'è¯·éæ©æçç±»å', trigger: 'change' }], |
| | | }, |
| | | { |
| | |
| | | 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, |
| | |
| | | { |
| | | 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, |
| | |
| | | { |
| | | 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, |
| | |
| | | }, |
| | | } |
| | | } |
| | | |
| | | 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) |
| | | |
| | |
| | | id: res.id, |
| | | } |
| | | updateCheckData() |
| | | disabled.value = true |
| | | } else { |
| | | formData.value = {} |
| | | disabled.value = false |
| | | updateCheckData() |
| | | } |
| | | } |