| | |
| | | }, |
| | | // 保存并生效,将时间等信息提交到后端 |
| | | // 变更:返回 Promise;成功后局部刷新(调用 findByOrderId)而不是整页 reload |
| | | save() { |
| | | if (!this.statusForm.id) { |
| | | this.$showMessage("id为空,不允许推送"); |
| | | return Promise.resolve(); |
| | | } |
| | | return this.$post({ |
| | | url: "/MesOrderSta/ChangeMachineTime", |
| | | data: { |
| | | maStartTime: this.maStartTime, |
| | | maShoutTime: this.maShoutTime, |
| | | maEndTime: this.maEndTime, |
| | | id: this.statusForm.id, |
| | | orderId: this.orderId, |
| | | machineNo: this.machineNo, |
| | | flag: this.flag |
| | | } |
| | | }).then(res => { |
| | | if (res && res.data && res.data.tbBillList) { |
| | | this.$showMessage("呼叫成功"); |
| | | // 局部刷新:重新拉取当前工单状态并更新当前组件数据 |
| | | this.findByOrderId(); |
| | | // 如果需要在保存后关闭对话框或返回上一级,可在这里处理 |
| | | } else { |
| | | this.$showMessage("呼叫失败"); |
| | | this.cancel(); |
| | | } |
| | | return res; |
| | | }).catch(err => { |
| | | // 保持友好的错误提示并将错误抛出以便外部链式处理 |
| | | console.error('保存失败:', err); |
| | | this.$showMessage("保存时发生错误"); |
| | | throw err; |
| | | }); |
| | | }, |
| | | save() { |
| | | if (!this.statusForm.id) { |
| | | this.$showMessage("id为空,不允许推送"); |
| | | return Promise.resolve(); |
| | | } |
| | | return this.$post({ |
| | | url: "/MesOrderSta/ChangeMachineTime", |
| | | data: { |
| | | maStartTime: this.maStartTime, |
| | | maShoutTime: this.maShoutTime, |
| | | maEndTime: this.maEndTime, |
| | | id: this.statusForm.id, |
| | | orderId: this.orderId, |
| | | machineNo: this.machineNo, |
| | | flag: this.flag |
| | | } |
| | | }).then(res => { |
| | | if (res && res.data && res.data.tbBillList) { |
| | | this.$showMessage("呼叫成功"); |
| | | |
| | | // 方案2:完全刷新当前页面 |
| | | // 延迟一下让用户看到成功提示 |
| | | setTimeout(() => { |
| | | // 方法1:使用 uni.reLaunch 重新加载(推荐) |
| | | uni.reLaunch({ |
| | | url: '/' + getCurrentPages()[0].route |
| | | }); |
| | | }, 1500); |
| | | |
| | | } else { |
| | | this.$showMessage("呼叫失败"); |
| | | this.cancel(); |
| | | } |
| | | return res; |
| | | }).catch(err => { |
| | | console.error('保存失败:', err); |
| | | this.$showMessage("保存时发生错误"); |
| | | throw err; |
| | | }); |
| | | }, |
| | | // 取消操作,恢复为上次保存的数据 |
| | | cancel() { |
| | | this.maShoutTime = this.statusForm.maShoutTime; |