From 26591535b14ee090a651f177cd6f42f548927fd4 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期四, 21 八月 2025 08:47:06 +0800 Subject: [PATCH] art: 物料拉动新增页面逻辑调整 --- src/views/mes/modules/WorkOrderSelectModal.vue | 173 +++++++++++++++++++ src/views/mes/modules/MesMaterialTransferRequestForm.vue | 297 +++++++++++++++++++++----------- src/views/mes/MesMaterialTransferRequestList.vue | 32 ++ 3 files changed, 395 insertions(+), 107 deletions(-) diff --git a/src/views/mes/MesMaterialTransferRequestList.vue b/src/views/mes/MesMaterialTransferRequestList.vue index c2242c4..66e40e5 100644 --- a/src/views/mes/MesMaterialTransferRequestList.vue +++ b/src/views/mes/MesMaterialTransferRequestList.vue @@ -106,14 +106,34 @@ dataIndex: 'requestCode' }, { - title: '宸ュ崟ID', + title: '浠诲姟鍙�', align: 'center', - dataIndex: 'workOrderId' + dataIndex: 'workOrderId_dictText' }, { title: 'SAP棰勭暀鍙�', align: 'center', dataIndex: 'reservationCode' + }, + { + title: '鐗╂枡缂栫爜', + align: 'center', + dataIndex: 'materialNumber' + }, + { + title: '鐗╂枡鍚嶇О', + align: 'center', + dataIndex: 'materialName' + }, + { + title: '鐞嗚鎷夊姩鏁伴噺', + align: 'center', + dataIndex: 'specifiedQuantity' + }, + { + title: '瀹為檯鎷夊姩鏁伴噺', + align: 'center', + dataIndex: 'actualQuantity' }, { title: '鍙戝竷鐘舵��', @@ -133,17 +153,17 @@ { title: '鍘熷簱瀛樺湴', align: 'center', - dataIndex: 'originalWarehouseId' + dataIndex: 'originalWarehouseId_dictText' }, { title: '鐩爣搴撳瓨鍦�', align: 'center', - dataIndex: 'targetWarehouseId' + dataIndex: 'targetWarehouseId_dictText' }, { - title: '浼樺厛绾э紙鎷夊姩绫诲瀷锛�', + title: '鎷夊姩绫诲瀷', align: 'center', - dataIndex: 'priority_dictText' + dataIndex: 'materialTransferCategory_dictText' }, { title: '鏈�鏅氶厤閫佹椂闂�', diff --git a/src/views/mes/modules/MesMaterialTransferRequestForm.vue b/src/views/mes/modules/MesMaterialTransferRequestForm.vue index e24608f..8bbbbf1 100644 --- a/src/views/mes/modules/MesMaterialTransferRequestForm.vue +++ b/src/views/mes/modules/MesMaterialTransferRequestForm.vue @@ -9,33 +9,44 @@ </a-form-model-item> </a-col> <a-col :span="12"> - <a-form-model-item label="璧峰搴撳瓨鍦扮偣" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="originalWarehouseId"> - <j-dict-select-tag type="list" v-model="model.originalWarehouseId" dictCode="original_warehouse_list" placeholder="璇烽�夋嫨璧峰搴撳瓨鍦扮偣" /> + <a-form-model-item label="璧峰搴撳瓨鍦扮偣" :labelCol="labelCol" :wrapperCol="wrapperCol" + prop="originalWarehouseId"> + <j-dict-select-tag type="list" v-model="model.originalWarehouseId" dictCode="original_warehouse_list" + placeholder="璇烽�夋嫨璧峰搴撳瓨鍦扮偣" /> </a-form-model-item> </a-col> <a-col :span="12"> - <a-form-model-item label="浠诲姟鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workOrderId"> - <a-input v-model="model.workOrderId" placeholder="璇疯緭鍏ュ伐鍗旾D" ></a-input> + <a-form-model-item label="浠诲姟鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workOrderCode"> + <work-order-select-modal :workOrder="workOrderObj" :submitDisabled="formDisabled" + orderStatus="PUBLISHED" @ok="selectConfirm"></work-order-select-modal> </a-form-model-item> </a-col> <a-col :span="12"> - <a-form-model-item label="鐩爣搴撳瓨鍦扮偣" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="targetWarehouseId"> - <a-input v-model="model.targetWarehouseId" placeholder="鑷姩鑾峰彇" readOnly ></a-input> + <a-form-model-item label="鐩爣搴撳瓨鍦扮偣" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="warehouseName"> + <a-input v-model="model.warehouseName" placeholder="鑷姩鑾峰彇" readOnly></a-input> </a-form-model-item> </a-col> <a-col :span="12"> - <a-form-model-item label="鎷夊姩绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialTransferCategory"> - <j-dict-select-tag type="list" v-model="model.materialTransferCategory" dictCode="material_transfer_category" placeholder="璇烽�夋嫨鎷夊姩绫诲瀷" /> + <a-form-model-item label="鎷夊姩绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol" + prop="materialTransferCategory"> + <j-dict-select-tag type="list" v-model="model.materialTransferCategory" + dictCode="material_transfer_category" placeholder="璇烽�夋嫨鎷夊姩绫诲瀷" /> </a-form-model-item> </a-col> <a-col :span="12"> - <a-form-model-item label="鏈�鏅氶厤閫佹椂闂�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="latestDeliveryTime"> - <j-date placeholder="璇烽�夋嫨鏈�鏅氶厤閫佹椂闂�" v-model="model.latestDeliveryTime" :show-time="false" date-format="YYYY-MM-DD" style="width: 100%" /> + <a-form-model-item label="鏈�鏅氶厤閫佹椂闂�" :labelCol="labelCol" :wrapperCol="wrapperCol" + prop="latestDeliveryTime"> + <a-date-picker placeholder="璇烽�夋嫨鏈�鏅氶厤閫佹椂闂�" v-model="model.latestDeliveryTime" + value-format="YYYY-MM-DD" style="width: 100%" /> </a-form-model-item> </a-col> <a-col :span="12"> <a-form-model-item label="鎷夊姩鐗╂枡" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialNumber"> - <j-dict-select-tag type="list" v-model="model.materialNumber" dictCode="priority" placeholder="璇烽�夋嫨鎷夊姩鐗╂枡" /> + <a-select v-model="model.materialNumber" placeholder="璇烽�夋嫨鎷夊姩鐗╂枡" @change="handleMaterialNumberChange"> + <a-select-option v-for="item in materialList" :value="item.materialNumber" :title="item.materialName" :key="item.materialNumber"> + {{ item.materialName }} + </a-select-option> + </a-select> </a-form-model-item> </a-col> <a-col :span="12"> @@ -51,104 +62,188 @@ <script> - import { httpAction, getAction } from '@/api/manage' - import { validateDuplicateValue } from '@/utils/util' +import { getAction, httpAction } from '@/api/manage' +import WorkOrderSelectModal from '@/views/mes/modules/WorkOrderSelectModal.vue' +import moment from 'moment' - export default { - name: 'MesMaterialTransferRequestForm', - components: { +export default { + name: 'MesMaterialTransferRequestForm', + components: { + WorkOrderSelectModal + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + data() { + return { + model: {}, + labelCol: { + xs: { span: 24 }, + sm: { span: 6 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + }, + confirmLoading: false, + validatorRules: { + originalWarehouseId: [ + { required: true, message: '璧峰搴撳瓨鍦扮偣蹇呴��', trigger: 'change' } + ], + workOrderCode: [ + { required: true, message: '浠诲姟鍙峰繀閫�', trigger: 'change' } + ], + materialNumber: [ + { required: true, message: '鎷夊姩鐗╂枡蹇呴��', trigger: 'change' } + ], + specifiedQuantity: [ + { required: true, message: '鎷夊姩鏁伴噺蹇呭~', trigger: 'change' } + ], + materialTransferCategory: [ + { required: true, message: '鎷夊姩绫诲瀷蹇呴��', trigger: 'change' } + ] + }, + url: { + add: '/mes/mesMaterialTransferRequest/add', + edit: '/mes/mesMaterialTransferRequest/edit', + queryById: '/mes/mesMaterialTransferRequest/queryById', + queryByMaterialNumber: '/pms/processBillMaterialsDetail/queryByMaterialNumber', + queryByFactoryId: '/base/lineSideWarehouse/queryByFactoryId', + workOrderQuery: '/mes/mesProductionWorkOrder/queryById' + }, + materialList: [], //鐗╂枡鍒楄〃 + workOrderObj: {}, //宸ュ崟瀵硅薄 + } + }, + computed: { + formDisabled() { + return this.disabled + } + }, + created() { + //澶囦唤model鍘熷鍊� + this.modelDefault = JSON.parse(JSON.stringify(this.model)) + }, + methods: { + add() { + this.modelDefault.latestDeliveryTime = moment() + this.edit(this.modelDefault) }, - props: { - //琛ㄥ崟绂佺敤 - disabled: { - type: Boolean, - default: false, - required: false - } - }, - data () { - return { - model:{ - }, - labelCol: { - xs: { span: 24 }, - sm: { span: 6 }, - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 }, - }, - confirmLoading: false, - validatorRules: { - originalWarehouseId: [ - { required: true, message: '璧峰搴撳瓨鍦扮偣蹇呴��', trigger: 'change' } - ], - workOrderId: [ - { required: true, message: '浠诲姟鍙峰繀閫�', trigger: 'change' } - ], - materialNumber: [ - { required: true, message: '鎷夊姩鐗╂枡蹇呴��', trigger: 'change' } - ], - specifiedQuantity: [ - { required: true, message: '鎷夊姩鏁伴噺蹇呭~', trigger: 'change' } - ], - materialTransferCategory: [ - { required: true, message: '鎷夊姩绫诲瀷蹇呴��', trigger: 'change' } - ], - }, - url: { - add: "/mes/mesMaterialTransferRequest/add", - edit: "/mes/mesMaterialTransferRequest/edit", - queryById: "/mes/mesMaterialTransferRequest/queryById" + async edit(record) { + this.model = Object.assign({}, record) + this.model.workOrderCode = this.model.workOrderId_dictText + this.visible = true + if (this.model.workOrderId) { + let workOrderRes = await this.loadProductionWorkOrder(this.model.workOrderId) + if(!workOrderRes.success || !workOrderRes.result) { + return; + } + //鎺掍骇宸ュ崟璧嬪�� + this.workOrderObj = Object.assign({}, workOrderRes.result); + //鐗╂枡鍒楄〃 + let materialListRes = await this.loadMaterialList(workOrderRes.result.materialNumber) + if (materialListRes.success && materialListRes.result && materialListRes.result.length > 0) { + this.materialList = [...materialListRes.result] + } else { + this.materialList = [] + } + //鐩爣搴撳瓨鍦� + let warehouseRes = await this.loadLineWarehouse(workOrderRes.result.factoryId) + if (warehouseRes.success && warehouseRes.result) { + this.$set(this.model, 'targetWarehouseId', warehouseRes.result.id) + this.$set(this.model, 'warehouseName', warehouseRes.result.warehouseName) + } else { + this.model.targetWarehouseId = undefined + this.model.warehouseName = '' } } }, - computed: { - formDisabled(){ - return this.disabled - }, + async selectConfirm(rows) { + if (rows && rows.length > 0) { + //娓呯┖鍏宠仈鏁版嵁 + this.model.materialNumber = undefined; + this.model.materialName = ''; + this.model.specifiedQuantity = 0; + //璧嬪�兼柊鐨勬暟鎹� + this.model.workOrderId = rows[0].id + this.model.workOrderCode = rows[0].workOrderCode + //鎺掍骇宸ュ崟璧嬪�� + this.workOrderObj = Object.assign({}, rows[0]); + let materialListRes = await this.loadMaterialList(rows[0].materialNumber) + if (materialListRes.success && materialListRes.result && materialListRes.result.length > 0) { + this.materialList = [...materialListRes.result] + } else { + this.materialList = [] + } + let warehouseRes = await this.loadLineWarehouse(rows[0].factoryId) + if (warehouseRes.success && warehouseRes.result) { + this.$set(this.model, 'targetWarehouseId', warehouseRes.result.id) + this.$set(this.model, 'warehouseName', warehouseRes.result.warehouseName) + } else { + this.model.targetWarehouseId = undefined + this.model.warehouseName = '' + } + } else { + //娓呯┖鍏宠仈鏁版嵁 + this.model.materialNumber = undefined; + this.model.materialName = ''; + this.model.specifiedQuantity = 0; + this.materialList = [] + this.model.targetWarehouseId = undefined + this.model.warehouseName = '' + this.workOrderObj = {}; + } }, - created () { - //澶囦唤model鍘熷鍊� - this.modelDefault = JSON.parse(JSON.stringify(this.model)); - }, - methods: { - add () { - this.edit(this.modelDefault); - }, - edit (record) { - this.model = Object.assign({}, record); - this.visible = true; - }, - submitForm () { - const that = this; - // 瑙﹀彂琛ㄥ崟楠岃瘉 - this.$refs.form.validate(valid => { - if (valid) { - that.confirmLoading = true; - let httpurl = ''; - let method = ''; - if(!this.model.id){ - httpurl+=this.url.add; - method = 'post'; - }else{ - httpurl+=this.url.edit; - method = 'put'; - } - httpAction(httpurl,this.model,method).then((res)=>{ - if(res.success){ - that.$message.success(res.message); - that.$emit('ok'); - }else{ - that.$message.warning(res.message); - } - }).finally(() => { - that.confirmLoading = false; - }) + submitForm() { + const that = this + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true + let httpurl = '' + let method = '' + if (!this.model.id) { + httpurl += this.url.add + method = 'post' + } else { + httpurl += this.url.edit + method = 'put' } + httpAction(httpurl, this.model, method).then((res) => { + if (res.success) { + that.$message.success(res.message) + that.$emit('ok') + } else { + that.$message.warning(res.message) + } + }).finally(() => { + that.confirmLoading = false + }) + } - }) - }, + }) + }, + loadMaterialList(materialNumber) { + return getAction(this.url.queryByMaterialNumber, { materialNumber: materialNumber }) + }, + loadLineWarehouse(factoryId) { + return getAction(this.url.queryByFactoryId, { factoryId: factoryId }) + }, + loadProductionWorkOrder(workOrderId) { + return getAction(this.url.workOrderQuery, { id: workOrderId }) + }, + handleMaterialNumberChange(val) { + let find = this.materialList.find(item => item.materialNumber === val) + if (find) { + this.model.materialName = find.materialName + } + this.model.specifiedQuantity = 0 } } +} </script> \ No newline at end of file diff --git a/src/views/mes/modules/WorkOrderSelectModal.vue b/src/views/mes/modules/WorkOrderSelectModal.vue new file mode 100644 index 0000000..1c9abf0 --- /dev/null +++ b/src/views/mes/modules/WorkOrderSelectModal.vue @@ -0,0 +1,173 @@ +<template> + <div> + <!----> + <a-input @click="openModal" placeholder="璇烽�夋嫨浠诲姟鍙�" v-model="textVals" readOnly :disabled="submitDisabled"> + <a-icon slot="prefix" type="cluster" title="鎺掍骇宸ュ崟閫夋嫨"/> + <a-icon v-if="storeVals" slot="suffix" type="close-circle" @click="handleEmpty" title="娓呯┖"/> + </a-input> + <a-modal + title="宸ュ崟閫夋嫨" + :width="1000" + :visible="visible" + :confirmLoading="confirmLoading" + @ok="handleSubmit" + @cancel="handleCancel"> + <a-table + ref="table" + bordered + size="middle" + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + @change="handleTableChange" + :customRow="customTableRow" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio'}"></a-table> + </a-modal> + </div> + +</template> + +<script> +import { JeecgListMixin } from '@/mixins/JeecgListMixin' + +export default { + name: "WorkOrderSelectModal", + mixins: [JeecgListMixin], + props: { + orderStatus: { + type: String, + default: 'null', //濡傛灉娌℃湁浼犲�煎垯鏌ヤ笉鍒版暟鎹� + }, + submitDisabled: { + type: Boolean, + default: false, + }, + workOrder: { + type: Object, + default: undefined, + } + }, + watch: { + workOrder: { + immediate: true, + handler(val) { + this.textVals = val.workOrderCode + this.storeVals = val + } + } + }, + data() { + return { + title: "鎿嶄綔", + visible: false, + model: {}, + confirmLoading: false, + storeVals: undefined, //[key values] + textVals: this.value, //[label values] + queryParam: { + workOrderStatus: this.orderStatus, + }, + url: { + list: "/mes/mesProductionWorkOrder/list" + }, + columns: [ + { + title: '浠诲姟鍙�', + align: "center", + dataIndex: 'workOrderCode', + fixed: 'left', + width: 200 + }, + { + title: '鐗╂枡缂栫爜', + align: "center", + dataIndex: 'materialNumber', + }, + { + title: '鐗╂枡鍚嶇О', + align: "center", + dataIndex: 'materialName' + }, + { + title: '璁″垝鐢熶骇鏁伴噺', + align: "center", + dataIndex: 'planQuantity' + }, + { + title: '宸ュ崟鐘舵��', + align: "center", + dataIndex: 'workOrderStatus_dictText' + }, + ] + } + }, + created() { + //鍔犺浇鎺掍骇宸ュ崟鏁版嵁 + this.queryParam.workOrderStatus = this.orderStatus; + }, + methods: { + openModal(){ + this.visible = true; + if(this.workOrder){ + this.textVals = this.workOrder.workOrderCode; + this.storeVals = this.workOrder; + this.selectedRowKeys = [this.workOrder.id]; + this.selectedRows = [this.workOrder] + }else { + this.selectedRowKeys = [] + this.selectedRows = [] + this.textVals = ''; + this.storeVals = undefined; + } + + }, + handleEmpty(){ + this.textVals = ''; + this.storeVals = undefined; + this.selectedRowKeys = [] + this.selectedRows = [] + this.$emit('ok', []); + }, + close() { + this.$emit('close'); + this.visible = false; + }, + /** + * 鑷畾涔夎澶囧彴璐﹁〃鏍艰 + * @param record 琛ㄦ牸琛屼俊鎭� + * @returns {{style: {cursor: string}, on: {click: *}}} 鏍峰紡瀵硅薄涓庝簨浠舵柟娉� + */ + customTableRow(record) { + return { + style: { + cursor: 'pointer' + }, + on: { + click: () => { + this.onSelectChange([record.id], [record]); + } + } + } + }, + handleCancel() { + this.close() + }, + handleSubmit() { + if(this.selectionRows && this.selectionRows.length === 1){ + this.textVals = this.selectionRows[0].workOrderCode; + this.storeVals = this.selectionRows[0]; + this.$emit('ok', this.selectionRows); + this.close() + }else { + that.$message.warning('璇烽�夋嫨涓�鏉¤褰曪紒'); + } + }, + } +} +</script> + +<style> + +</style> -- Gitblit v1.9.3