ÎļþÃû´Ó HIAWms/web/src/widgets/HIAWms/Controllers/WmsMaterialDrawer.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 { WmsMaterialDrawer } from '../Models/WmsMaterialDrawer' |
| | | import { ElMessage } from 'element-plus' |
| | |
| | | // ref |
| | | const formRef = ref() |
| | | |
| | | const disabled = ref(false) |
| | | |
| | | const current = computed(() => { |
| | | return props.row || null |
| | | }) |
| | | |
| | | const inputNumber = (attrs) => { |
| | | return ( |
| | | <el-input-number |
| | | min="1" |
| | | step="1" |
| | | precision="0" |
| | | {...attrs} |
| | | ></el-input-number> |
| | | ) |
| | | } |
| | | |
| | | const visible = computed({ |
| | | get() { |
| | | return props.modelValue |
| | |
| | | label: 'ç©æç¼ç ', |
| | | prop: 'materialCode', |
| | | el: 'input', |
| | | disabled: disabled, |
| | | placeholder: '请è¾å
¥ç©æç¼ç ', |
| | | rules: [{ required: true, message: 'ç©æç¼ç ä¸è½ä¸ºç©º', trigger: 'blur' }], |
| | | }, |
| | |
| | | prop: 'purchaseType', |
| | | el: 'select', |
| | | placeholder: 'è¯·éæ©éè´ç±»å', |
| | | options: [ |
| | | { label: 'ç±»å1', value: 1 }, |
| | | { label: 'ç±»å2', value: 2 }, |
| | | // Add all enum values |
| | | ], |
| | | options: [], |
| | | rules: [{ required: true, message: 'è¯·éæ©éè´ç±»å', trigger: 'change' }], |
| | | }, |
| | | { |
| | |
| | | prop: 'materialType', |
| | | el: 'select', |
| | | placeholder: 'è¯·éæ©ç©æç±»å', |
| | | options: [ |
| | | { label: 'ç±»åA', value: 1 }, |
| | | { label: 'ç±»åB', value: 2 }, |
| | | // Add all enum values |
| | | ], |
| | | options: [], |
| | | rules: [{ required: true, message: 'è¯·éæ©ç©æç±»å', trigger: 'change' }], |
| | | }, |
| | | { |
| | |
| | | { |
| | | label: 'å¤å¾(mm)', |
| | | prop: 'outerDiameter', |
| | | el: 'input-number', |
| | | el: (props: any, { attrs }: SetupContext) => { |
| | | return h(inputNumber, { |
| | | ...props, |
| | | clearable: true, |
| | | ...attrs, |
| | | }) |
| | | }, |
| | | width: '100%', |
| | | placeholder: '请è¾å
¥å¤å¾', |
| | | step: 0.01, |
| | | precision: 2, |
| | |
| | | { |
| | | label: 'å£å(mm)', |
| | | prop: 'wallThickness', |
| | | el: 'input-number', |
| | | el: (props: any, { attrs }: SetupContext) => { |
| | | return h(inputNumber, { |
| | | ...props, |
| | | clearable: true, |
| | | ...attrs, |
| | | }) |
| | | }, |
| | | width: '100%', |
| | | placeholder: '请è¾å
¥å£å', |
| | | step: 0.01, |
| | | precision: 2, |
| | |
| | | { |
| | | label: 'é¿åº¦(m)', |
| | | prop: 'length', |
| | | el: 'input-number', |
| | | el: (props: any, { attrs }: SetupContext) => { |
| | | return h(inputNumber, { |
| | | ...props, |
| | | clearable: true, |
| | | ...attrs, |
| | | }) |
| | | }, |
| | | width: '100%', |
| | | placeholder: '请è¾å
¥é¿åº¦', |
| | | step: 0.1, |
| | | precision: 2, |
| | |
| | | label: 'æ¯å¦ä¸»æ¯ç®¡', |
| | | prop: 'isMainBranch', |
| | | el: 'select', |
| | | options: [ |
| | | { label: 'æ¯', value: 1 }, |
| | | { label: 'å¦', value: 2 }, |
| | | ], |
| | | options: [], |
| | | }, |
| | | { |
| | | label: 'ç产工å', |
| | |
| | | wallThickness: formData.value.wallThickness, |
| | | materialQuality: formData.value.materialQuality, |
| | | length: formData.value.length, |
| | | isMainBranch: formData.value.isMainBranch === 1, |
| | | isMainBranch: formData.value.isMainBranch, |
| | | factory: formData.value.factory, |
| | | certification: formData.value.certification, |
| | | remark: formData.value.remark, |
| | |
| | | }, |
| | | } |
| | | } |
| | | 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 materialTypeEnum = await wmsMaterialDrawer.getWmsEnumData({ |
| | | EnumName: 'MaterialTypeEnum', |
| | | }) |
| | | updateFormItemOptions('materialType', materialTypeEnum) |
| | | |
| | | const purchaseTypeEnum = await wmsMaterialDrawer.getWmsEnumData({ |
| | | EnumName: 'PurchaseTypeEnum', |
| | | }) |
| | | updateFormItemOptions('purchaseType', purchaseTypeEnum) |
| | | |
| | | const yesOrNoTypeEnum = await wmsMaterialDrawer.getWmsEnumData({ |
| | | EnumName: 'YesNoEnum', |
| | | }) |
| | | updateFormItemOptions('isMainBranch', yesOrNoTypeEnum) |
| | | |
| | | if (current.value) { |
| | | const res = await wmsMaterialDrawer.getWmsMaterialDetail(current.value) |
| | | |
| | |
| | | wallThickness: res.wallThickness, |
| | | materialQuality: res.materialQuality, |
| | | length: res.length, |
| | | isMainBranch: res.isMainBranch ? 1 : 2, |
| | | isMainBranch: res.isMainBranch, |
| | | factory: res.factory, |
| | | certification: res.certification, |
| | | remark: res.remark, |
| | | id: res.id, |
| | | } |
| | | disabled.value = true |
| | | updateCheckData() |
| | | } else { |
| | | formData.value = {} |
| | | |
| | | disabled.value = false |
| | | updateCheckData() |
| | | } |
| | | } |