From bda833babf139081fcf70546cc6d914a4a33ab78 Mon Sep 17 00:00:00 2001 From: lixiangyu <lixiangyu@xalxzn.com> Date: 星期四, 21 八月 2025 17:58:44 +0800 Subject: [PATCH] feat(刀具入库): 实现单据提交功能并优化操作权限控制 --- src/views/cms/CuttingInboundList.vue | 246 +++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 208 insertions(+), 38 deletions(-) diff --git a/src/views/cms/CuttingInboundList.vue b/src/views/cms/CuttingInboundList.vue index 972c824..6f4ce01 100644 --- a/src/views/cms/CuttingInboundList.vue +++ b/src/views/cms/CuttingInboundList.vue @@ -117,8 +117,7 @@ </template> <span slot="action" slot-scope="text, record"> - <a @click="handleEdit(record)">缂栬緫</a> - + <a @click="handleEdit(record)" :disabled="record.orderStatus == '2'">缂栬緫</a> <a-divider type="vertical" /> <a-dropdown> <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a> @@ -126,14 +125,17 @@ <a-menu-item> <a @click="handleDetail(record)">璇︽儏</a> </a-menu-item> - <a-menu-item> +<!-- <a-menu-item v-if="record.orderStatus != '2'">--> +<!-- <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">--> +<!-- <a>鍒犻櫎</a>--> +<!-- </a-popconfirm>--> +<!-- </a-menu-item>--> + <a-menu-item v-if="record.orderStatus != '2'"> + <a @click="handleSubmit(record.id)" :disabled="record.orderStatus == '3'">鎻愪氦</a> + </a-menu-item> + <a-menu-item v-if="record.orderStatus != '2'"> <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)"> <a>鍒犻櫎</a> - </a-popconfirm> - </a-menu-item> - <a-menu-item> - <a-popconfirm title="纭畾鎻愪氦鍚�?" @confirm="() => handleSubmit(record.id)"> - <a>鎻愪氦</a> </a-popconfirm> </a-menu-item> </a-menu> @@ -165,7 +167,7 @@ import Vue from 'vue' import { ACCESS_TOKEN } from '@/store/mutation-types' import store from '@/store' - + import { Modal } from 'ant-design-vue'; export default { name: 'CuttingInboundList', @@ -245,6 +247,7 @@ deleteBatch: "/cms/cuttingInbound/deleteBatch", exportXlsUrl: "/cms/cuttingInbound/exportXls", importExcelUrl: "cms/cuttingInbound/importExcel", + submit: "/cms/cuttingInbound/submit", }, dictOptions:{}, superFieldList:[], @@ -284,6 +287,7 @@ this.$refs.modalForm.title="璇︽儏"; this.$refs.modalForm.disableSubmit = true; }, + // 鑷畾涔夎鐐瑰嚮浜嬩欢 customRow(record) { return { @@ -409,42 +413,208 @@ /** * 鍗曟嵁鎻愪氦 */ - // handleSubmit: function() { + handleSubmit: function(id) { + if (!this.url.submit) { + this.$message.error('璇疯缃畊rl.submit灞炴��!') + return + } + + let targetId = id; // 浠庡弬鏁拌幏鍙朓D + // 濡傛灉娌℃湁閫氳繃鍙傛暟浼犻�扞D锛屽垯妫�鏌ラ�変腑鐨勮褰� + if (!targetId) { + if (this.selectedRowKeys.length != 1) { + this.$message.warning('璇烽�夋嫨涓�鏉¤褰曪紒') + return + } else { + targetId = this.selectedRowKeys[0] + } + } + + // 灏嗗弬鏁颁綔涓烘煡璇㈠弬鏁伴檮鍔犲埌URL涓� + let httpurl = this.url.submit + '?orderId=' + encodeURIComponent(targetId) + let method = 'get' + var params = {} // 娓呯┖params锛屽洜涓哄弬鏁板凡缁忓湪URL涓紶閫� + + const that = this + + this.$confirm({ + title: '纭鎻愪氦锛�', + // content: '姝e湪鎻愪氦鏁版嵁锛岃鑰愬績绛夊緟...', + okText: '纭', + cancelText: '鍙栨秷', + onOk() { + // 鏄剧ず鍔犺浇鎻愮ず + const hide = that.$message.loading('姝e湪鎻愪氦鏁版嵁锛岃鑰愬績绛夊緟...', 0); + + // 鍙戦�佽姹� + return httpAction(httpurl, params, method).then((res) => { + hide(); // 闅愯棌鍔犺浇鎻愮ず + if (res.success) { + that.$message.success(res.message) + that.loadData() + } else { + that.$message.warning(res.message) + } + }).catch(error => { + hide(); // 闅愯棌鍔犺浇鎻愮ず + that.$message.error('鎻愪氦澶辫触: ' + error.message) + }).finally(() => { + that.loading = false + }) + } + }) + }, + + // /** + // * 鍗曟嵁鎻愪氦锛堟敮鎸佸疄鏃惰繘搴︽洿鏂帮級 + // */ + // handleSubmit: function(id) { // if (!this.url.submit) { // this.$message.error('璇疯缃畊rl.submit灞炴��!') // return // } - // if (this.selectedRowKeys.length != 1) { - // this.$message.warning('璇烽�夋嫨涓�鏉¤褰曪紒') - // return - // } else { - // var id = this.selectedRowKeys[0] - // let httpurl = this.url.submit - // let method = 'post' - // var params = { id: id } // - // const that = this - // - // this.$confirm({ - // title: '纭鎻愪氦锛�', - // okText: '纭', - // cancelText: '鍙栨秷', - // onOk() { - // httpAction(httpurl, params, method).then((res) => { - // if (res.success) { - // that.$message.success(res.message) - // that.loadData() - // } else { - // that.$message.warning(res.message) - // } - // }).finally(() => { - // that.loading = false - // - // }) - // } - // }) + // let targetId = id; // 浠庡弬鏁拌幏鍙朓D + // // 濡傛灉娌℃湁閫氳繃鍙傛暟浼犻�扞D锛屽垯妫�鏌ラ�変腑鐨勮褰� + // if (!targetId) { + // if (this.selectedRowKeys.length != 1) { + // this.$message.warning('璇烽�夋嫨涓�鏉¤褰曪紒') + // return + // } else { + // targetId = this.selectedRowKeys[0] + // } // } + // + // const that = this + // + // this.$confirm({ + // title: '纭鎻愪氦锛�', + // content: '鎻愪氦杩囩▼涓彲鑳介渶瑕佽緝闀挎椂闂达紝璇疯�愬績绛夊緟...', + // okText: '纭', + // cancelText: '鍙栨秷', + // + // onOk() { + // // 鍒涘缓杩涘害鏉℃ā鎬佹 + // let percent = 0; + // let totalTools = 0; // 鍒�鍏锋�绘暟 + // let processedTools = 0; // 宸插鐞嗗垁鍏锋暟 + // + // // 浣跨敤 this.$info 鍒涘缓妯℃�佹 + // const modal = that.$info({ + // title: '姝e湪鎻愪氦鏁版嵁', + // content: that.$createElement('div', [ + // that.$createElement('p', '姝e湪澶勭悊鍒�鍏峰叆搴擄紝璇风◢鍊�...'), + // that.$createElement('a-progress', { + // props: { + // percent: percent, + // status: 'active' + // } + // }), + // // that.$createElement('p', { + // // style: { + // // marginTop: '10px' + // // } + // // }, `杩涘害: ${processedTools}/${totalTools} 鎶婂垁鍏穈) + // ]), + // okButtonProps: { style: { display: 'none' } }, // 闅愯棌纭鎸夐挳 + // cancelText: '鍙栨秷', + // closable: false, // 绂佹鍏抽棴妯℃�佹 + // }); + // + // // 鏇存柊杩涘害鏄剧ず鍑芥暟 + // const updateProgress = () => { + // if (totalTools > 0) { + // percent = Math.round((processedTools / totalTools) * 100); + // // 纭繚杩涘害涓嶈秴杩�90%锛屼繚鐣欐渶鍚�10%缁欐渶缁堝畬鎴� + // percent = percent > 90 ? 90 : percent; + // } + // + // modal.update({ + // content: that.$createElement('div', [ + // that.$createElement('p', '姝e湪澶勭悊鍒�鍏峰叆搴擄紝璇风◢鍊�...'), + // that.$createElement('a-progress', { + // props: { + // percent: percent, + // status: 'active' + // } + // }), + // // that.$createElement('p', { + // // style: { + // // marginTop: '10px' + // // } + // // }, `杩涘害: ${processedTools}/${totalTools} 鎶婂垁鍏穈) + // ]) + // }); + // }; + // + // // 鍙戦�佽姹� + // let httpurl = that.url.submit + '?orderId=' + encodeURIComponent(targetId) + // + // return httpAction(httpurl, {}, 'get').then((res) => { + // // 鏍规嵁鍚庣杩斿洖鐨勬�诲垁鍏锋暟璁剧疆杩涘害 + // if (res.success) { + // // 濡傛灉鍚庣杩斿洖浜嗘�诲垁鍏锋暟 + // if (res.result && res.result.quantity !== undefined) { + // totalTools = res.result.quantity; + // processedTools = res.result.totalSubmitted || 0; //宸插鐞嗗垁鍏锋暟 + // } + // // 濡傛灉鍚庣杩斿洖浜嗘槑缁嗗垪琛紝鏍规嵁receive_number璁$畻鎬绘暟閲� + // else if (res.result && res.result.detailList) { + // // 鏍规嵁姣忎釜鏄庣粏鐨剅eceive_number绱姞璁$畻鎬诲垁鍏锋暟 + // totalTools = res.result.detailList.reduce((total, detail) => { + // return total + (detail.receiveNumber || 0); + // }, 0); + // processedTools = totalTools; // 宸插鐞嗘暟閲� + // } + // + // // 鏇存柊杩涘害鏄剧ず + // percent = 100; // 鐩存帴鏄剧ず100%瀹屾垚 + // updateProgress(); + // + // // 鏄剧ず瀹屾垚鐘舵�� + // setTimeout(() => { + // modal.update({ + // content: that.$createElement('div', [ + // that.$createElement('p', '姝e湪澶勭悊鍒�鍏峰叆搴擄紝璇风◢鍊�...'), + // that.$createElement('a-progress', { + // props: { + // percent: percent, + // status: 'success' + // } + // }), + // that.$createElement('p', { + // style: { + // marginTop: '10px' + // } + // }, totalTools > 0 ? + // `杩涘害: ${processedTools}/${totalTools} 鎶婂垁鍏穈 : + // '澶勭悊瀹屾垚') + // ]) + // }); + // + // // 寤惰繜鍏抽棴妯℃�佹 + // setTimeout(() => { + // modal.destroy(); + // that.$message.success(res.message || '鎻愪氦鎴愬姛'); + // that.loadData(); + // }, 500); + // }, 300); + // } else { + // // 澶勭悊閿欒鎯呭喌 + // modal.destroy(); + // that.$message.warning(res.message || '鎻愪氦澶辫触'); + // } + // }).catch(error => { + // modal.destroy(); + // that.$message.error('鎻愪氦澶辫触: ' + error.message) + // }).finally(() => { + // that.loading = false + // }) + // } + // }) // }, + + } } </script> -- Gitblit v1.9.3