| | |
| | | beforeClose: (action, instance, done) => { |
| | | if (action === 'confirm') { |
| | | instance.confirmButtonLoading = true; |
| | | this.confirmReport(orderNo, done); |
| | | this.confirmReport(orderNo, instance, done); |
| | | } else { |
| | | done(); |
| | | } |
| | |
| | | }, |
| | | |
| | | // 确认上报 |
| | | confirmReport(orderNo, done) { |
| | | confirmReport(orderNo, instance, done) { |
| | | this.reportLoading = true; |
| | | const finish = () => { |
| | | this.reportLoading = false; |
| | | if (instance) { |
| | | instance.confirmButtonLoading = false; |
| | | } |
| | | if (typeof done === 'function') { |
| | | done(); |
| | | } |
| | | }; |
| | | |
| | | const rowsToIssue = (this.tableDataB || []).filter(item => parseInt(item.inspect) === 1); |
| | | if (rowsToIssue.length === 0) { |
| | | this.reportLoading = false; |
| | | if (typeof done === 'function') done(); |
| | | finish(); |
| | | this.$message.error('没有待下发项'); |
| | | return; |
| | | } |
| | |
| | | Promise.all(updates).then(results => { |
| | | const failed = results.find(r => !r.ok); |
| | | if (failed) { |
| | | this.reportLoading = false; |
| | | if (typeof done === 'function') done(); |
| | | finish(); |
| | | this.$message.error(failed.msg || '同步beBatch失败'); |
| | | return; |
| | | } |
| | |
| | | data: { orderNo: orderNo }, |
| | | method: 'POST', |
| | | success: (res) => { |
| | | this.reportLoading = false; |
| | | if (typeof done === 'function') done(); |
| | | finish(); |
| | | if (res.code === 200 || res.success) { |
| | | this.$message({ |
| | | message: `订单号 ${orderNo} 下发成功`, |
| | |
| | | } |
| | | }, |
| | | error: (error) => { |
| | | this.reportLoading = false; |
| | | if (typeof done === 'function') done(); |
| | | finish(); |
| | | console.error('下发失败:', error); |
| | | this.$message.error('下发失败,请检查网络连接'); |
| | | } |