From 9aa6fe72192ec6b5160a127070002fde1765115b Mon Sep 17 00:00:00 2001 From: lixiangyu <lixiangyu@xalxzn.com> Date: 星期二, 09 九月 2025 17:55:30 +0800 Subject: [PATCH] feat(cms): 选择刀具库存替代刀具信息 --- src/views/cms/CuttingReceiveDetailList.vue | 4 src/views/cms/modules/JSelectInventoryModal.vue | 256 ++++++++++++++++++ src/views/cms/CuttingReceiveList.vue | 328 +++++++++++----------- src/views/cms/modules/CuttingReceiveModal.vue | 211 ++++++++------ 4 files changed, 542 insertions(+), 257 deletions(-) diff --git a/src/views/cms/CuttingReceiveDetailList.vue b/src/views/cms/CuttingReceiveDetailList.vue index ebb39c0..dc1113d 100644 --- a/src/views/cms/CuttingReceiveDetailList.vue +++ b/src/views/cms/CuttingReceiveDetailList.vue @@ -119,7 +119,7 @@ deleteBatch: "/cms/cuttingReceiveDetail/deleteBatch", exportXlsUrl: "/cms/cuttingReceiveDetail/exportXls", importExcelUrl: "cms/cuttingReceiveDetail/importExcel", - + }, dictOptions:{}, superFieldList:[], @@ -141,6 +141,8 @@ let fieldList=[]; fieldList.push({type:'string',value:'orderId',text:'棰嗙敤鍗旾D'}) fieldList.push({type:'string',value:'cuttingId',text:'鍒�鍏稩D'}) + fieldList.push({type:'string',value:'cuttingCode',text:'鍒�鍏风紪鐮�'}) // 娣诲姞杩欎竴琛� + fieldList.push({type:'string',value:'cuttingName',text:'鍒�鍏峰悕绉�'}) // 娣诲姞杩欎竴琛� fieldList.push({type:'string',value:'inventoryId',text:'搴撳瓨ID'}) fieldList.push({type:'string',value:'workpieceMaterial',text:'宸ヤ欢鏉愯川'}) fieldList.push({type:'int',value:'usedLife',text:'浣跨敤瀵垮懡'}) diff --git a/src/views/cms/CuttingReceiveList.vue b/src/views/cms/CuttingReceiveList.vue index a12e0e6..36899db 100644 --- a/src/views/cms/CuttingReceiveList.vue +++ b/src/views/cms/CuttingReceiveList.vue @@ -7,22 +7,22 @@ <a-col :md="6" :sm="8"> <a-form-item label="棰嗙敤鍗曠姸鎬�"> <j-search-select-tag - placeholder="璇烽�夋嫨棰嗙敤鍗曠姸鎬�" - v-model="queryParam.orderStatus" - dict="order_status" - /> + placeholder="璇烽�夋嫨棰嗙敤鍗曠姸鎬�" + v-model="queryParam.orderStatus" + dict="order_status" + /> </a-form-item> </a-col> <a-col :md="6" :sm="8"> - <a-form-item label="棰嗙敤浜�"> - <j-search-select-tag - placeholder="璇烽�夋嫨棰嗙敤浜�" - v-model="queryParam.receiver" - dict="sys_user,realname,id,del_flag!=1" - /> - </a-form-item> - </a-col> - <a-col + <a-form-item label="棰嗙敤浜�"> + <j-search-select-tag + placeholder="璇烽�夋嫨棰嗙敤浜�" + v-model="queryParam.receiver" + dict="sys_user,realname,id,del_flag!=1" + /> + </a-form-item> + </a-col> + <a-col :md="6" :sm="8" > @@ -60,11 +60,12 @@ <!-- table鍖哄煙-begin --> <div> <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> - <i class="anticon anticon-info-circle ant-alert-icon"></i> 宸查�夋嫨 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>椤� + <i class="anticon anticon-info-circle ant-alert-icon"></i> 宸查�夋嫨 <a + style="font-weight: 600">{{ selectedRowKeys.length }}</a>椤� <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a> </div> - <a-table + <a-table ref="table" size="middle" :scroll="{x:true}" @@ -83,7 +84,8 @@ </template> <template slot="imgSlot" slot-scope="text,record"> <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犲浘鐗�</span> - <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> + <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" + style="max-width:80px;font-size: 12px;font-style: italic;" /> </template> <template slot="fileSlot" slot-scope="text"> <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犳枃浠�</span> @@ -119,7 +121,7 @@ </a-table> </div> -<a-tabs defaultActiveKey="1"> + <a-tabs defaultActiveKey="1"> <a-tab-pane tab="鍒�鍏烽鐢ㄦ槑缁�" key="1"> <cutting-receive-detail-list ref="cuttingReceiveDetailList"></cutting-receive-detail-list> </a-tab-pane> @@ -130,162 +132,162 @@ <script> - import '@/assets/less/TableExpand.less' - import { mixinDevice } from '@/utils/mixin' - import { JeecgListMixin } from '@/mixins/JeecgListMixin' - import CuttingReceiveModal from './modules/CuttingReceiveModal' - import CuttingReceiveDetailList from './CuttingReceiveDetailList' +import '@/assets/less/TableExpand.less' +import { mixinDevice } from '@/utils/mixin' +import { JeecgListMixin } from '@/mixins/JeecgListMixin' +import CuttingReceiveModal from './modules/CuttingReceiveModal' +import CuttingReceiveDetailList from './CuttingReceiveDetailList' - export default { - name: 'CuttingReceiveList', - mixins:[JeecgListMixin, mixinDevice], - components: { - CuttingReceiveModal, - CuttingReceiveDetailList - }, - data () { - return { - description: '鍒�鍏烽鐢ㄥ崟绠$悊椤甸潰', - // 琛ㄥご - columns: [ - { - title: '#', - dataIndex: '', - key:'rowIndex', - width:60, - align:"center", - customRender:function (t,r,index) { - return parseInt(index)+1; - } - }, - { - title:'棰嗙敤浜�', - align:"center", - dataIndex: 'receiver_dictText' - }, - { - title:'棰嗙敤鏃堕棿', - align:"center", - dataIndex: 'receiveTime', - customRender:function (text) { - return !text?"":(text.length>10?text.substr(0,10):text) - } - }, - { - title:'棰嗙敤璇存槑', - align:"center", - dataIndex: 'receiveComment' - }, - { - title:'纭浜�', - align:"center", - dataIndex: 'confirmer_dictText' - }, - { - title:'纭鏃堕棿', - align:"center", - dataIndex: 'confirmTime', - customRender:function (text) { - return !text?"":(text.length>10?text.substr(0,10):text) - } - }, - { - title:'纭鎰忚', - align:"center", - dataIndex: 'confirmComment' - }, - { - title:'鏄惁浼氬綊杩�', - align:"center", - dataIndex: 'returnFlag' - }, - { - title:'褰掕繕鏃堕棿', - align:"center", - dataIndex: 'returnTime', - customRender:function (text) { - return !text?"":(text.length>10?text.substr(0,10):text) - } - }, - { - title:'褰掕繕璇存槑', - align:"center", - dataIndex: 'returnComment' - }, - { - title:'褰掕繕纭浜�', - align:"center", - dataIndex: 'returnConfirmer_dictText' - }, - { - title:'褰掕繕纭鏃堕棿', - align:"center", - dataIndex: 'returnConfirmTime', - customRender:function (text) { - return !text?"":(text.length>10?text.substr(0,10):text) - } - }, - { - title:'褰掕繕纭鎰忚', - align:"center", - dataIndex: 'returnConfirmComment' - }, - { - title:'棰嗙敤鍗曠姸鎬�', - align:"center", - dataIndex: 'orderStatus' - }, - { - title: '鎿嶄綔', - dataIndex: 'action', - align:"center", - fixed:"right", - width:147, - scopedSlots: { customRender: 'action' } +export default { + name: 'CuttingReceiveList', + mixins: [JeecgListMixin, mixinDevice], + components: { + CuttingReceiveModal, + CuttingReceiveDetailList + }, + data() { + return { + description: '鍒�鍏烽鐢ㄥ崟绠$悊椤甸潰', + // 琛ㄥご + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 60, + align: 'center', + customRender: function(t, r, index) { + return parseInt(index) + 1 } - ], - url: { - list: "/cms/cuttingReceive/list", - delete: "/cms/cuttingReceive/delete", - deleteBatch: "/cms/cuttingReceive/deleteBatch", - exportXlsUrl: "/cms/cuttingReceive/exportXls", - importExcelUrl: "cms/cuttingReceive/importExcel", - }, - dictOptions:{}, - superFieldList:[], - } - }, - created() { - this.getSuperFieldList(); - }, - computed: { - importExcelUrl: function(){ - return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + { + title: '棰嗙敤浜�', + align: 'center', + dataIndex: 'receiver_dictText' + }, + { + title: '棰嗙敤鏃堕棿', + align: 'center', + dataIndex: 'receiveTime', + customRender: function(text) { + return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text) + } + }, + { + title: '棰嗙敤璇存槑', + align: 'center', + dataIndex: 'receiveComment' + }, + { + title: '纭浜�', + align: 'center', + dataIndex: 'confirmer_dictText' + }, + { + title: '纭鏃堕棿', + align: 'center', + dataIndex: 'confirmTime', + customRender: function(text) { + return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text) + } + }, + { + title: '纭鎰忚', + align: 'center', + dataIndex: 'confirmComment' + }, + { + title: '鏄惁浼氬綊杩�', + align: 'center', + dataIndex: 'returnFlag' + }, + { + title: '褰掕繕鏃堕棿', + align: 'center', + dataIndex: 'returnTime', + customRender: function(text) { + return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text) + } + }, + { + title: '褰掕繕璇存槑', + align: 'center', + dataIndex: 'returnComment' + }, + { + title: '褰掕繕纭浜�', + align: 'center', + dataIndex: 'returnConfirmer_dictText' + }, + { + title: '褰掕繕纭鏃堕棿', + align: 'center', + dataIndex: 'returnConfirmTime', + customRender: function(text) { + return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text) + } + }, + { + title: '褰掕繕纭鎰忚', + align: 'center', + dataIndex: 'returnConfirmComment' + }, + { + title: '棰嗙敤鍗曠姸鎬�', + align: 'center', + dataIndex: 'orderStatus' + }, + { + title: '鎿嶄綔', + dataIndex: 'action', + align: 'center', + fixed: 'right', + width: 147, + scopedSlots: { customRender: 'action' } + } + ], + url: { + list: '/cms/cuttingReceive/list', + delete: '/cms/cuttingReceive/delete', + deleteBatch: '/cms/cuttingReceive/deleteBatch', + exportXlsUrl: '/cms/cuttingReceive/exportXls', + importExcelUrl: 'cms/cuttingReceive/importExcel' + }, - }, - methods: { - searchReset() { + dictOptions: {}, + superFieldList: [] + } + }, + created() { + this.getSuperFieldList() + }, + computed: { + importExcelUrl: function() { + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}` + } + }, + methods: { + searchReset() { this.queryParam = {} this.$refs.cuttingReceiveDetailList.dataSource = [] - this.loadData(1); + this.loadData(1) }, - handleEdit: function (record) { - this.$refs.modalForm.edit(record) - this.$refs.modalForm.title = '缂栬緫' - this.$refs.modalForm.disableSubmit = false + handleEdit: function(record) { + this.$refs.modalForm.edit(record) + this.$refs.modalForm.title = '缂栬緫' + this.$refs.modalForm.disableSubmit = false }, handleAdd() { this.$refs.modalForm.add() this.$refs.modalForm.title = '鏂板' this.$refs.modalForm.disableSubmit = false }, - handleDetail:function(record){ - this.$refs.modalForm.edit(record); - this.$refs.modalForm.title="璇︽儏"; - this.$refs.modalForm.disableSubmit = true; + handleDetail: function(record) { + this.$refs.modalForm.edit(record) + this.$refs.modalForm.title = '璇︽儏' + this.$refs.modalForm.disableSubmit = true }, - customRow(record) { + customRow(record) { return { on: { click: (e) => { @@ -302,13 +304,13 @@ for (let i = 0; i < children.length; i++) { children[i].classList.add('checked-td-of-add-table') } - }, - }, + } + } } - }, } } +} </script> <style scoped> - @import '~@assets/less/common.less'; +@import '~@assets/less/common.less'; </style> \ No newline at end of file diff --git a/src/views/cms/modules/CuttingReceiveModal.vue b/src/views/cms/modules/CuttingReceiveModal.vue index d6e3212..75531e4 100644 --- a/src/views/cms/modules/CuttingReceiveModal.vue +++ b/src/views/cms/modules/CuttingReceiveModal.vue @@ -3,7 +3,7 @@ <a-spin :spinning="confirmLoading"> <a-form :form="form"> <a-row style="width: 100%"> - <a-col :span="24 / 2"> + <a-col :span="24 / 2"> <a-form-item label="棰嗙敤浜�" :labelCol="labelCol" :wrapperCol="wrapperCol"> <j-search-select-tag :disabled="disableSubmit" @@ -26,12 +26,13 @@ <a-row style="width: 100%"> <a-col :span="24"> <a-form-item label="棰嗙敤璇存槑" :labelCol="{span:3}" :wrapperCol="{span:21}"> - <a-textarea :disabled="disableSubmit" placeholder="璇疯緭鍏ラ鐢ㄨ鏄�" v-decorator="['receiveComment', validatorRules.receiveComment]" /> + <a-textarea :disabled="disableSubmit" placeholder="璇疯緭鍏ラ鐢ㄨ鏄�" + v-decorator="['receiveComment', validatorRules.receiveComment]" /> </a-form-item> </a-col> </a-row> <a-row style="width: 100%"> - <a-col :span="24 / 2"> + <a-col :span="24 / 2"> <a-form-item label="纭浜�" :labelCol="labelCol" :wrapperCol="wrapperCol"> <j-search-select-tag :disabled="disableSubmit" @@ -54,14 +55,16 @@ <a-row style="width: 100%"> <a-col :span="24"> <a-form-item label="纭鎰忚" :labelCol="{span:3}" :wrapperCol="{span:21}"> - <a-textarea :disabled="disableSubmit" placeholder="璇疯緭鍏ョ‘璁ゆ剰瑙�" v-decorator="['confirmComment', validatorRules.confirmComment]" /> + <a-textarea :disabled="disableSubmit" placeholder="璇疯緭鍏ョ‘璁ゆ剰瑙�" + v-decorator="['confirmComment', validatorRules.confirmComment]" /> </a-form-item> </a-col> </a-row> - <a-row style="width: 100%"> - <a-col :span="24 / 2"> + <a-row style="width: 100%"> + <a-col :span="24 / 2"> <a-form-item label="鏄惁浼氬綊杩�" :labelCol="labelCol" :wrapperCol="wrapperCol"> - <a-input :disabled="disableSubmit" placeholder="璇疯緭鍏ユ槸鍚︿細褰掕繕" v-decorator="['returnFlag', validatorRules.returnFlag]" ></a-input> + <a-input :disabled="disableSubmit" placeholder="璇疯緭鍏ユ槸鍚︿細褰掕繕" + v-decorator="['returnFlag', validatorRules.returnFlag]"></a-input> </a-form-item> </a-col> <a-col :span="24 / 2"> @@ -77,12 +80,13 @@ <a-row style="width: 100%"> <a-col :span="24"> <a-form-item label="褰掕繕璇存槑" :labelCol="{span:3}" :wrapperCol="{span:21}"> - <a-textarea :disabled="disableSubmit" placeholder="璇疯緭鍏ュ綊杩樿鏄�" v-decorator="['returnComment', validatorRules.returnComment]" /> + <a-textarea :disabled="disableSubmit" placeholder="璇疯緭鍏ュ綊杩樿鏄�" + v-decorator="['returnComment', validatorRules.returnComment]" /> </a-form-item> </a-col> </a-row> - <a-row style="width: 100%"> - <a-col :span="24 / 2"> + <a-row style="width: 100%"> + <a-col :span="24 / 2"> <a-form-item label="褰掕繕纭浜�" :labelCol="labelCol" :wrapperCol="wrapperCol"> <j-search-select-tag :disabled="disableSubmit" @@ -102,18 +106,17 @@ </a-form-item> </a-col> </a-row> - <a-row style="width: 100%"> + <a-row style="width: 100%"> <a-col :span="24"> <a-form-item label="褰掕繕纭鎰忚" :labelCol="{span:3}" :wrapperCol="{span:21}"> - <a-textarea :disabled="disableSubmit" placeholder="璇疯緭鍏ュ綊杩樼‘璁ゆ剰瑙�" v-decorator="['returnConfirmComment', validatorRules.returnConfirmComment]" /> + <a-textarea :disabled="disableSubmit" placeholder="璇疯緭鍏ュ綊杩樼‘璁ゆ剰瑙�" + v-decorator="['returnConfirmComment', validatorRules.returnConfirmComment]" /> </a-form-item> </a-col> </a-row> </a-form> </a-spin> - <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectTooling()" - >閫夋嫨鍒�鍏�</a-button - > + <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectTooling()">閫夋嫨鍒�鍏�</a-button> <a-table ref="table" bordered @@ -124,16 +127,16 @@ :pagination="ipagination" :loading="loading" > - <template v-for="col in columns" :slot="col.dataIndex" slot-scope="text, record, index"> + <template v-for="col in columns" :slot="col.dataIndex" slot-scope="text, record, index" > <div :key="col.dataIndex"> - <a-input - :value="text" - :disabled="disableSubmit" - v-if="col.dataIndex == 'workpieceMaterial'" - @change="(e)=>handleChange(e.target.value, record.key, col, index)" - /> - <a-input-number - v-if="col.dataIndex == 'usedLife'" + <a-input + :value="text" + :disabled="disableSubmit" + v-if="col.dataIndex === 'workpieceMaterial'" + @change="(e)=>handleChange(e.target.value, record.key, col, index)" + /> + <a-input-number + v-if="col.dataIndex === 'usedLife'" :value="text" @change="(e) => handleChange(e, record.key, col, index)" :min="1" @@ -154,33 +157,37 @@ <template slot="footer" v-if="disableSubmit == true"> <a-button :style="{ marginRight: '8px' }" @click="handleCancel">鍏抽棴</a-button> </template> - <j-select-tooling-modal ref="toolingModalForm" @ok="modalFormOk"></j-select-tooling-modal> + <j-select-inventory-modal ref="inventoryModalForm" @ok="modalFormOk"></j-select-inventory-modal> +<!-- <j-select-tooling-modal ref="toolingModalForm" @ok="modalFormOk"></j-select-tooling-modal>--> </a-modal> </template> <script> - import pick from 'lodash.pick' - import JSelectToolingModal from './JSelectToolingModal' - import moment from 'moment' - import { getAction, postAction, requestPut } from '@/api/manage' - import JDictSelectTag from '@/components/dict/JDictSelectTag' - import JSearchSelectTag from '@/components/dict/JSearchSelectTag' - import JMultiSelectTag from '@/components/dict/JMultiSelectTag' - import { filterObj } from '@/utils/util' - import store from '@/store/' - export default { - name: 'CuttingInboundModal', - components: { +import pick from 'lodash.pick' +import JSelectToolingModal from './JSelectToolingModal' +import moment from 'moment' +import { getAction, postAction, requestPut } from '@/api/manage' +import JDictSelectTag from '@/components/dict/JDictSelectTag' +import JSearchSelectTag from '@/components/dict/JSearchSelectTag' +import JMultiSelectTag from '@/components/dict/JMultiSelectTag' +import { filterObj } from '@/utils/util' +import store from '@/store/' +import JSelectInventoryModal from '@views/cms/modules/JSelectInventoryModal.vue' + +export default { + name: 'CuttingInboundModal', + components: { JSelectToolingModal, + JSelectInventoryModal, JMultiSelectTag, JDictSelectTag, store, - moment, + moment }, - data () { - return { - /* 鍒嗛〉鍙傛暟 */ + data() { + return { + /* 鍒嗛〉鍙傛暟 */ ipagination: { current: 1, pageSize: 10, @@ -190,27 +197,26 @@ }, showQuickJumper: true, showSizeChanger: true, - total: 0, + total: 0 }, - title:'鏂板', - visible: false, - selectedRowKeys: {}, + title: '鏂板', + visible: false, + selectedRowKeys: {}, model: {}, labelCol: { xs: { span: 24 }, - sm: { span: 6 }, + sm: { span: 6 } }, wrapperCol: { xs: { span: 24 }, - sm: { span: 18 }, + sm: { span: 18 } }, confirmLoading: false, loading: false, form: this.$form.createForm(this), dataSource: [], param: {}, - validatorRules: { - }, + validatorRules: {}, columns: [ { title: '#', @@ -218,59 +224,58 @@ key: 'rowIndex', width: 50, align: 'center', - customRender: function (t, r, index) { + customRender: function(t, r, index) { return parseInt(index) + 1 - }, + } }, { title: '鍒�鍏风紪鐮�', align: 'center', dataIndex: 'cuttingCode', - width: 150, + width: 150 }, { title: '鍒�鍏峰悕绉�', align: 'center', - dataIndex: 'cuttingName', + dataIndex: 'cuttingName' }, { title: '宸ヤ欢鏉愯川', align: 'center', dataIndex: 'workpieceMaterial', - scopedSlots: { customRender: 'workpieceMaterial' }, - + scopedSlots: { customRender: 'workpieceMaterial' } }, { title: '浣跨敤瀵垮懡', align: 'center', dataIndex: 'usedLife', - scopedSlots: { customRender: 'usedLife' }, + scopedSlots: { customRender: 'usedLife' } }, { title: '鎿嶄綔', dataIndex: 'action', align: 'center', - scopedSlots: { customRender: 'action' }, - }, + scopedSlots: { customRender: 'action' } + } ], url: { add: '/cms/cuttingReceive/add', - detailList: '/cms/cuttingReceive/detailList', + detailList: '/cms/cuttingReceive/detailList' }, - orderId:'', - disableSubmit:false - } - }, - methods: { - modalFormOk(){ + orderId: '', + disableSubmit: false + } + }, + methods: { + modalFormOk() { - }, - getQueryParams() { + }, + getQueryParams() { this.param.pageNo = this.ipagination.current this.param.pageSize = this.ipagination.pageSize return filterObj(this.param) }, - add() { + add() { let receiver = store.getters.userInfo.id let receiveTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss') this.edit({ receiver: receiver, receiveTime: receiveTime }) @@ -293,7 +298,7 @@ ) }) }, - handleDelete(record, index) { + handleDelete(record, index) { this.dataSource.splice(index, 1) }, handleChange(value, key, column, index) { @@ -305,14 +310,20 @@ this.dataSource = temp } }, - selectTooling: function () { + selectTooling: function() { let ids = [] for (let i = 0; i < this.dataSource.length; i++) { - ids.push(this.dataSource[i].cuttingId) + ids.push(this.dataSource[i].inventoryId) + console.log('褰撳墠鏁版嵁婧�:', this.dataSource) } - this.$refs.toolingModalForm.showModal(ids) - this.$refs.toolingModalForm.title = '閫夋嫨鍒�鍏�' - this.$refs.toolingModalForm.disableSubmit = false + // this.$refs.toolingModalForm.showModal(ids) + // this.$refs.toolingModalForm.title = '閫夋嫨鍒�鍏�' + // this.$refs.toolingModalForm.disableSubmit = false + + this.$refs.inventoryModalForm.showModal(ids) + this.$refs.inventoryModalForm.title = '閫夋嫨鍒�鍏�' + this.$refs.inventoryModalForm.disableSubmit = false + }, detailList(orderId) { this.param.orderId = orderId @@ -337,19 +348,30 @@ that.confirmLoading = true let formData = Object.assign(this.model, values) formData.detailData = this.dataSource - postAction(that.url.add, formData) - .then((res) => { - if (res.success) { - that.$message.success('棰嗙敤鎴愬姛') - that.$emit('ok', new Date()) - } else { - that.$message.warning(res.message) - } - }) - .finally(() => { - that.confirmLoading = false - that.close() - }) + + // 娣诲姞鏇存柊搴撳瓨鐘舵�佺殑閫昏緫 + const inventoryIds = this.dataSource.map(item => item.inventoryId) + const updateInventoryStatus = inventoryIds.length > 0 ? + //闇�瑕佸啓涓�涓洿鏂板簱瀛樼姸鎬佺殑鎺ュ彛鍦ㄥ悗绔紙杩樻病鍐�25/9/9锛� + postAction('/cms/inventory/updateStatus', { + ids: inventoryIds, + status: '寰呭嚭搴�' //璁句负寰呭嚭搴� + }) : Promise.resolve() + updateInventoryStatus.then(() => { + return postAction(that.url.add, formData) + }).then((res) => { + if (res.success) { + that.$message.success('棰嗙敤鎴愬姛') + that.$emit('ok', new Date()) + } else { + that.$message.warning(res.message) + } + }).catch((error) => { + that.$message.error('鎿嶄綔澶辫触: ' + error.message) + }).finally(() => { + that.confirmLoading = false + that.close() + }) } }) }, @@ -361,19 +383,22 @@ this.dataSource = [] this.visible = false this.disableSubmit = false - }, - }, - mounted() { + } + }, + mounted() { this.$bus.$on('selectionRows', (data) => { + console.log('鎺ユ敹鍒扮殑閫夋嫨鏁版嵁:', data) //getCurrSelected 浜嬩欢 鎺ユ敹缁勪欢浼犻�掔殑鍙傛暟 for (let i = 0; i < data.length; i++) { this.dataSource.push({ - cuttingId: data[i].id, + inventoryId: data[i].id, cuttingCode: data[i].cuttingCode, - cuttingName: data[i].cuttingName + cuttingName: data[i].cuttingName, + cuttingId: data[i].cuttingId }) } + console.log('鏇存柊鍚庣殑鏁版嵁婧�:', this.dataSource) }) - }, } +} </script> \ No newline at end of file diff --git a/src/views/cms/modules/JSelectInventoryModal.vue b/src/views/cms/modules/JSelectInventoryModal.vue new file mode 100644 index 0000000..c4b2d97 --- /dev/null +++ b/src/views/cms/modules/JSelectInventoryModal.vue @@ -0,0 +1,256 @@ +<template> + <!--鏀寔鍏ㄥ睆缂╂斁--> + <!--閫夋嫨鍒�鍏风殑寮圭獥锛屾牴鎹繖涓脊绐楀皢閫夋嫨鍒�鍏蜂粠鍒�鍏蜂俊鎭縼绉诲埌鍒�鍏峰簱瀛橈紝鐢ㄦ潵棰嗙敤鍒�鍏峰簱瀛橀噷鐨勫垁鍏� --> + <j-modal + :visible="visible" + :title="title" + switchFullscreen + :width="1200" + @ok="handleSubmit" + @cancel="close" + style="top: 50px" + cancelText="鍏抽棴" + > + <a-card :bordered="false"> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="鍒�鍏风紪鐮�"> + <a-input placeholder="璇疯緭鍏ュ垁鍏风紪鐮�,鏀寔妯$硦鏌ヨ" v-model="queryParam.cuttingCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="鍒�鍏峰悕绉�"> + <a-input placeholder="璇疯緭鍏ュ垁鍏峰悕绉�,鏀寔妯$硦鏌ヨ" v-model="queryParam.cuttingName"></a-input> + </a-form-item> + </a-col> + + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button> + </a-row> + </a-form> + </div> + <!--鍒�鍏峰垪琛�--> + <a-table + ref="table" + :scroll="scrollTrigger" + size="middle" + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :rowSelection="rowSelection" + :loading="loading" + @change="handleTableChange" + > + </a-table> + </a-card> + </j-modal> +</template> + +<script> +import { filterObj } from '@/utils/util' +import { getAction } from '@/api/manage' + +export default { + name: 'JSelectInventoryModal', + components: {}, + props: {}, + data() { + return { + queryParam: {}, + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 50, + align: 'center', + customRender: function (t, r, index) { + return parseInt(index) + 1 + }, + }, + { + title: '鍒�鍏风紪鐮�', + align: 'center', + dataIndex: 'cuttingCode', + sorter: true, + }, + { + title: '鍒�鍏峰悕绉�', + align: 'center', + dataIndex: 'cuttingName', + sorter: true, + }, + { + title: '鍒�鍏峰垎绫�', + align: 'center', + dataIndex: 'cuttingCategory', + sorter: true, + }, + { + title:'鍒�鍏锋潯鐮�', + align: 'center', + dataIndex: 'cuttingBarcode', + sorter: true, + }, + { + title:'鍒�鍏峰綋鍓嶅鍛斤紙鐧惧垎姣旓級', + align: 'center', + dataIndex: 'currentLife', + sorter: true, + }, + ], + selectedRowKeys: [], + oldSlelectRows: [], + scrollTrigger: {}, + dataSource: [], + selectionRows: [], + title: '鏍规嵁鏌ヨ缁撴灉閫夋嫨鍒�鍏�', + ipagination: { + current: 1, + pageSize: 10, + pageSizeOptions: ['5', '10', '20'], + showTotal: (total, range) => { + return range[0] + '-' + range[1] + ' 鍏�' + total + '鏉�' + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0, + }, + isorter: { + column: 'num', + order: 'desc', + }, + departTree: [], + visible: false, + loading: false, + url: { + // list: '/cms/cuttingTool/getCuttingToolList', + list:'/cms/cuttingReceive/getInventoryToolList' + }, + } + }, + computed: { + rowSelection() { + return { + type: 'checkbox', + onChange: (selectedRowKeys, selectedRows) => { + this.selectedRowKeys = selectedRowKeys + this.onSelectChange(selectedRows) + }, + getCheckboxProps: (record) => ({ + props: { + disabled: record.distable, + }, + }), + selectedRowKeys: this.selectedRowKeys, + } + }, + }, + watch: {}, + created() {}, + methods: { + async loadData(arg) { + if (arg === 1) { + this.ipagination.current = 1 + } + let that = this + this.loading = true + let params = this.getQueryParams() //鏌ヨ鏉′欢 + await getAction(this.url.list, params).then((res) => { + if (res.success) { + for (let i = 0; i < res.result.records.length; i++) { + if (that.oldSlelectRows.indexOf(res.result.records[i].id) > -1) { + res.result.records[i].distable = true + } else { + res.result.records[i].distable = false + } + } + this.dataSource = res.result.records + this.ipagination.total = res.result.total + } + if (res.code === 510) { + this.$message.warning(res.message) + } + this.loading = false + }) + }, + showModal(oldSlelectRows) { + this.oldSlelectRows = oldSlelectRows + this.visible = true + this.loadData(1) + }, + getQueryParams() { + let param = Object.assign({}, this.queryParam, this.isorter) + param.field = this.getQueryField() + param.pageNo = this.ipagination.current + param.pageSize = this.ipagination.pageSize + return filterObj(param) + }, + //鏌ヨ鏉′欢澶勭悊 + getQueryField() { + let str = 'id,' + for (let a = 0; a < this.columns.length; a++) { + str += ',' + this.columns[a].dataIndex + } + return str + }, + searchReset(num) { + let that = this + if (num !== 0) { + that.loadData(1) + } + that.selectborrowIds = [] + }, + close() { + this.searchReset(0) + this.selectedRowKeys = [] + this.visible = false + }, + handleTableChange(pagination, filters, sorter) { + //TODO 绛涢�� + if (Object.keys(sorter).length > 0) { + this.isorter.column = sorter.field + this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc' + } + this.ipagination = pagination + this.loadData() + }, + handleSubmit() { + this.$bus.$emit('selectionRows', this.selectionRows) + this.searchReset(0) + this.close() + }, + onSelectChange(selectionRows) { + this.selectionRows = selectionRows + }, + onSearch() { + this.loadData(1) + }, + searchQuery() { + this.loadData(1); + }, + // searchReset() { + // this.queryParam = {} + // this.loadData(1) + // }, + }, +} +</script> + +<style scoped> +.ant-table-tbody .ant-table-row td { + padding-top: 10px; + padding-bottom: 10px; +} + +#components-layout-demo-custom-trigger .trigger { + font-size: 18px; + line-height: 64px; + padding: 0 24px; + cursor: pointer; + transition: color 0.3s; +} +</style> \ No newline at end of file -- Gitblit v1.9.3