From a17f09e572d644b04d1a40aa889ee1fd38a2b643 Mon Sep 17 00:00:00 2001 From: lixiangyu <lixiangyu@xalxzn.com> Date: 星期五, 12 九月 2025 17:56:13 +0800 Subject: [PATCH] feat(cms): 添加刀具归还功能并优化 CuttingReceiveList组件 --- src/views/cms/CuttingReceiveList.vue | 71 ++++++++++++++++++++++++++++++----- 1 files changed, 61 insertions(+), 10 deletions(-) diff --git a/src/views/cms/CuttingReceiveList.vue b/src/views/cms/CuttingReceiveList.vue index b99b965..1f46ebf 100644 --- a/src/views/cms/CuttingReceiveList.vue +++ b/src/views/cms/CuttingReceiveList.vue @@ -120,7 +120,7 @@ <!-- </span>--> <span slot="action" slot-scope="text, record"> - <a @click="handleEdit(record)" :disabled="record.orderStatus === '2'">缂栬緫</a> + <a @click="handleEdit(record)" :disabled="record.orderStatus === '2' || record.orderStatus === '3'">缂栬緫</a> <a-divider type="vertical" /> <a-dropdown> <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a> @@ -128,15 +128,10 @@ <a-menu-item> <a @click="handleDetail(record)">璇︽儏</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 v-if="record.orderStatus !== '2'"> + <a-menu-item v-if="record.orderStatus === '1'"> <a @click="handleSubmit(record.id)" :disabled="record.orderStatus === '3'">鎻愪氦</a> </a-menu-item> - <a-menu-item v-if="record.orderStatus !== '2'"> + <a-menu-item v-if="record.orderStatus === '1'"> <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)"> <a>鍒犻櫎</a> </a-popconfirm> @@ -282,7 +277,8 @@ deleteBatch: '/cms/cuttingReceive/deleteBatch', exportXlsUrl: '/cms/cuttingReceive/exportXls', importExcelUrl: 'cms/cuttingReceive/importExcel', - submit: '/cms/cuttingReceive/submit' + submit: '/cms/cuttingReceive/submit', + returnBack: '/cms/cuttingReceive/handleBack' }, dictOptions: {}, superFieldList: [] @@ -393,7 +389,62 @@ } }) }, - //TODO锛氬垁鍏峰綊杩� handleBack + + /** + * 鍗曟嵁棰嗙敤 + */ + + handleBack: function(id) { + if (!this.url.returnBack) { + this.$message.error('璇疯缃畊rl.return灞炴��!') + 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.returnBack + '?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 + }) + } + }) + } } } </script> -- Gitblit v1.9.3