From cdacaa3a770e30582d57b9c4aef379b7da65c8c7 Mon Sep 17 00:00:00 2001 From: liuying <1427574514@qq.com> Date: 周四, 25 4月 2024 19:24:18 +0800 Subject: [PATCH] bug --- iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabForm.vue | 161 ++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 115 insertions(+), 46 deletions(-) diff --git a/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabForm.vue b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabForm.vue index 2749b69..4e2c9bb 100644 --- a/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabForm.vue +++ b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabForm.vue @@ -1,5 +1,5 @@ <template> - <a-modal title="鏂板鍩虹鐗╂枡淇℃伅" :width="1200" :visible="visible" :confirmLoading="confirmLoading" @ok="handleSubmit" + <a-modal :title="title" :width="1300" :visible="visible" :confirmLoading="confirmLoading" @ok="handleSubmit" @cancel="handleCancel"> <a-spin :spinning="confirmLoading"> <!-- tab --> @@ -28,9 +28,9 @@ </a-form-item> --> <a-form-item label="鐗╂枡绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol"> - <a-select style="width: 100%" placeholder="璇烽�夋嫨鐗╂枡绫诲瀷" v-decorator="['materialType']"> - <a-select-option v-for="(item, index) in materialTypeData" :key="index" - :value="Number(item.materialTypeCode)">{{ item.materialTypeName }}</a-select-option> + <a-select style="width: 100%" placeholder="璇烽�夋嫨鐗╂枡绫诲瀷" v-decorator="['materialType', { rules: [{ required: true, message: '璇烽�夋嫨鐗╂枡绫诲瀷锛�' }] }]"> + <a-select-option v-for="(item, index) in materialTypeData" :key="index" :value="item.id">{{ + item.materialTypeName }}</a-select-option> </a-select> </a-form-item> @@ -43,7 +43,7 @@ <a-form-item label="ABC鍒嗙被" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> <!-- <a-input-number placeholder="璇疯緭鍏BC鍒嗙被" style="width: 100%" v-decorator="['aBCClass']" /> --> - <a-select style="width: 100%" placeholder="璇烽�夋嫨ABC鍒嗙被" v-decorator="['factoryCode']"> + <a-select style="width: 100%" placeholder="璇烽�夋嫨ABC鍒嗙被" v-decorator="['abcClass']"> <a-select-option v-for="(item, index) in materialTypeData2" :key="index" :value="Number(item.code)">{{ item.name }}</a-select-option> </a-select> @@ -61,7 +61,7 @@ <!-- <a-input placeholder="璇疯緭鍏ュ簱瀛樺崟浣�" v-decorator="['materialUnit']" /> --> <a-select style="width: 100%" placeholder="璇烽�夋嫨搴撳瓨鍗曚綅" v-decorator="['materialUnit']"> - <a-select-option v-for="(item, index) in selectTypeData1" :key="index" :value="Number(item.unitCode)">{{ + <a-select-option v-for="(item, index) in selectTypeData1" :key="index" :value="item.unitName">{{ item.unitName }}</a-select-option> </a-select> @@ -70,8 +70,8 @@ <a-form-item label="閲囪喘鍗曚綅" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> <!-- <a-input placeholder="璇疯緭鍏ラ噰璐崟浣�" v-decorator="['pOUnit']" /> --> - <a-select style="width: 100%" placeholder="璇烽�夋嫨閲囪喘鍗曚綅" v-decorator="['pOUnit']"> - <a-select-option v-for="(item, index) in selectTypeData2" :key="index" :value="Number(item.unitCode)">{{ + <a-select style="width: 100%" placeholder="璇烽�夋嫨閲囪喘鍗曚綅" v-decorator="['poUnit']"> + <a-select-option v-for="(item, index) in selectTypeData2" :key="index" :value="item.unitName">{{ item.unitName }}</a-select-option> </a-select> @@ -84,7 +84,7 @@ <a-input placeholder="璇疯緭鍏ラ噸閲�" v-decorator="['weight']" /> </a-form-item> <a-form-item label="鏍囧寘鏁伴噺" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> - <a-input placeholder="璇疯緭鍏ユ爣鍖呮暟閲�" v-decorator="['sNP']" /> + <a-input placeholder="璇疯緭鍏ユ爣鍖呮暟閲�" v-decorator="['snp']" /> </a-form-item> <a-form-item label="鎹㈢畻鐜�" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> <a-input placeholder="璇疯緭鍏ユ崲绠楃巼" v-decorator="['translateRate']" /> @@ -101,10 +101,11 @@ <a-form-item label="鎻忚堪" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> <a-input placeholder="璇疯緭鍏ユ弿杩�" v-decorator="['materialDesc']" /> </a-form-item> + <a-form-item v-show="false"><a-input v-decorator="['id']" /></a-form-item> </a-form> </a-tab-pane> <a-tab-pane key="2" tab="鎺у埗灞炴��" force-render> - <add-control-rule v-if="visible" ref="WmsControlRule" /> + <add-control-rule v-if="visible" ref="WmsControlRuleRef" /> </a-tab-pane> <a-tab-pane key="3" tab="鎵规灞炴��"> 闇�姹傚緟瀹� @@ -112,7 +113,7 @@ <a-tab-pane key="4" tab="鏇夸唬鍝佺鐞�"> <add-form-sub v-if="visible" ref="addFormWmsSubstituteGoodRef" /> </a-tab-pane> - <a-tab-pane key="5" tab="瀹㈡埛"> + <a-tab-pane key="5" tab="寰�鏉ュ崟浣�"> <add-form-base-customer v-if="visible" ref="addFormBaseCustomer" /> </a-tab-pane> @@ -125,13 +126,16 @@ </template> <script> -import { WmsMaterialAdd, GetAreas, GetStations, materialTypeDataList } from '@/api/modular/main/WmsMaterialManage' + +import { + WmsMaterialAdd, WmsMaterialEdit, WmsMaterialDetailList, materialTypeDataList +} from '@/api/modular/main/WmsBase/WmsMaterialManage' import addForm from './tabItem/addForm.vue' import addFormBaseCustomer from './tabItem/addFormBaseCustomer/addFormBaseCustomer.vue' import addFormContainerPackaging from './tabItem/WmsContainerPackaging/addFormContainerPackaging.vue' import addFormSub from './tabItem/WmsSubstituteGood/addFormWmsSubstituteGood.vue' import addControlRule from './tabItem/WmsControlRule/addForm.vue' -import { WmsUnitPage, WmsUnitDelete, WmsUnitToExcel } from '@/api/modular/main/WmsBase/WmsUnitManage' +import { WmsUnitPage } from '@/api/modular/main/WmsBase/WmsUnitManage' export default { components: { addForm, @@ -142,9 +146,12 @@ }, created() { this.materialTypeDataList() + const materialTypeOption = this.$options + this.materialTypeData2 = materialTypeOption.filters['dictData']('abc_class_type') }, data() { return { + title: '', labelCol: { // xs: { span: 24 }, // sm: { span: 5 } @@ -161,7 +168,10 @@ stationNameParameterData: [], visible: false, confirmLoading: false, - form: this.$form.createForm(this) + form: this.$form.createForm(this), + materialTypeData2: [], + selectTypeData2: [], + selectTypeData1: [] } }, methods: { @@ -199,22 +209,56 @@ // } // 鏇夸唬鍝� if (e == 4) { - // let materialCode = this.form.getFieldValue('materialCode'); - // let materialName = this.form.getFieldValue('materialName'); - this.$refs.addFormWmsSubstituteGoodRef.initShowSubstituteGood() + this.$nextTick(() => { + // let materialCode = this.form.getFieldValue('materialCode'); + // let materialName = this.form.getFieldValue('materialName'); + this.$refs.addFormWmsSubstituteGoodRef.initShowSubstituteGood() + }) } }, handleOk() { }, // 鍒濆鍖栨柟娉� - add(record) { + add(record, type) { this.visible = true - // this.$nextTick(() => { - // // this.getSelects() - // }) - const materialTypeOption = this.$options - this.materialTypeData2 = materialTypeOption.filters['dictData']('abc_class') - // const inspectionMethodOption = this.$options - // this.inspectionMethodData = inspectionMethodOption.filters['dictData']('material_inspection') + if (record) {//缂栬緫 + if (type == '璇︽儏') { + this.title = '璇︽儏鐗╂枡淇℃伅璇︽儏';// 璇︽儏 + } else { + this.title = '缂栬緫鍩虹鐗╂枡淇℃伅'; + } + this.$nextTick(() => { + this.form.setFieldsValue({ + ...record + }) + }) + WmsMaterialDetailList({ + id: record.id + }) + .then(res => { + if (res.success) { + + console.log(res) + this.$nextTick(() => { + if (res.data.controlRuleDetailList && res.data.controlRuleDetailList.length > 0) { + this.$refs.WmsControlRuleRef.form.setFieldsValue({ + ...res.data.controlRuleDetailList[0] + }) + } + this.$refs.addFormWmsSubstituteGoodRef.list = res.data.substituteGoodList || [] + this.$refs.addFormBaseCustomer.list = res.data.baseCustomerList || [] + }) + + } else { + this.$message.error('璇︽儏澶辫触锛�' + JSON.stringify(res.message)) + } + }) + .finally(res => { + this.confirmLoading = false + }) + + } else { + this.title = '鏂板鍩虹鐗╂枡淇℃伅';// 鏂板 + } }, getSelects() { if (this.areaNameParameterData.length <= 0 || this.stationNameParameterData.length <= 0) { @@ -255,8 +299,12 @@ // values.stationNameParameter = values.stationNameParameterArr.join(',') // } + + console.log("鐗╂枡淇℃伅9999999999999999") + console.log(values); + console.log(6666666666666 + '鎺у埗灞炴��') - var ControlRuleld = this.$refs.WmsControlRule.form.getFieldValue('id') || '' + var ControlRuleld = this.$refs.WmsControlRuleRef.form.getFieldValue('id') || '' let SubstituteGoodList = [] if (this.$refs.addFormWmsSubstituteGoodRef && this.$refs.addFormWmsSubstituteGoodRef.list.length > 0) { @@ -274,33 +322,54 @@ BaseCustomerList = this.$refs.addFormBaseCustomer.list } - console.log(6666666666666 + '瀹㈡埛妗f闆嗗悎') + console.log(6666666666666 + '寰�鏉ュ崟浣嶉泦鍚�') // console.log(6666666666666 + '鍖呰鍏崇郴') // console.log(this.$refs.addFormContainerPackagingRef.list) - + var a1 = [] + BaseCustomerList.forEach((item)=>{ + a1.push(item.id) + }) var param = { MaterialInput: values, ControlRuleld: ControlRuleld, //鎺у埗灞炴�� SubstituteGoodList: SubstituteGoodList, //鏇夸唬鍝� - BaseCustomerList: BaseCustomerList, //瀹㈡埛妗f闆嗗悎 + BaseCustomerList: a1, //寰�鏉ュ崟浣嶉泦鍚� // ContainerPackagingList: this.$refs.addFormContainerPackagingRef.list //鍖呰鍏崇郴 } this.confirmLoading = true - WmsMaterialAdd(param) - .then(res => { - if (res.success) { - this.$message.success('鏂板鎴愬姛') + if (this.title == '鏂板鍩虹鐗╂枡淇℃伅') { + WmsMaterialAdd(param) + .then(res => { + if (res.success) { + this.$message.success('鏂板鎴愬姛') + this.confirmLoading = false + this.$emit('ok', values) + this.handleCancel() + } else { + this.$message.error('鏂板澶辫触锛�' + JSON.stringify(res.message)) + } + }) + .finally(res => { this.confirmLoading = false - this.$emit('ok', values) - this.handleCancel() - } else { - this.$message.error('鏂板澶辫触锛�' + JSON.stringify(res.message)) - } - }) - .finally(res => { - this.confirmLoading = false - }) + }) + } else { + WmsMaterialEdit(param) + .then(res => { + if (res.success) { + this.$message.success('缂栬緫鎴愬姛') + this.confirmLoading = false + this.$emit('ok', values) + this.handleCancel() + } else { + this.$message.error('缂栬緫澶辫触锛�' + JSON.stringify(res.message)) + } + }) + .finally(res => { + this.confirmLoading = false + }) + } + } else { this.confirmLoading = false } @@ -329,8 +398,8 @@ </script> <style lang="less" scoped> - .ant-row.ant-form-item { - width: 50% !important; - display: inline-block; - } +.ant-row.ant-form-item { + width: 50% !important; + display: inline-block; +} </style> -- Gitblit v1.9.3