BUG
快乐的昕的电脑
2025-10-31 418f4a9b326e054bf052d967e329a106e42b92e0
components/machine.vue
@@ -151,17 +151,17 @@
            console.log('调机完成按钮被点击');
            this.maEndTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
         },
         // 刷新工单数据
         // 刷新工单数据(局部刷新当前组件)
         refresh() {
            this.findByOrderId();
         },
            // 保存并生效,将时间等信息提交到后端
         // 变更:返回 Promise;成功后局部刷新(调用 findByOrderId)而不是整页 reload
            save() {
                if (!this.statusForm.id) {
                    this.$showMessage("id为空,不允许推送");
                    return;
               return Promise.resolve();
                }
                // 返回 Promise 方便调用者链式处理
                return this.$post({
                    url: "/MesOrderSta/ChangeMachineTime",
                    data: {
@@ -174,19 +174,21 @@
                        flag: this.flag
                    }
                }).then(res => {
                    if (res.data && res.data.tbBillList) {
               if (res && res.data && res.data.tbBillList) {
                        this.$showMessage("呼叫成功");
                        // 先刷新组件数据,确保本地状态与后端一致
                  // 局部刷新:重新拉取当前工单状态并更新当前组件数据
                        this.findByOrderId();
                        // 可视化提示后刷新整个页面(整页 reload),让界面完全重载
                        setTimeout(() => {
                            window.location.reload();
                        }, 700); // 700ms 用于让提示短暂可见,可根据需要调整或去掉 setTimeout
                  // 如果需要在保存后关闭对话框或返回上一级,可在这里处理
                    } else {
                        this.$showMessage("呼叫失败");
                        this.cancel();
                    }
                    return res;
            }).catch(err => {
               // 保持友好的错误提示并将错误抛出以便外部链式处理
               console.error('保存失败:', err);
               this.$showMessage("保存时发生错误");
               throw err;
                });
            },
         // 取消操作,恢复为上次保存的数据
@@ -233,9 +235,9 @@
         }
      },
        mounted() {
            // 页面加载时,启动定时器,每隔5分钟自动保存
         // 页面加载时,启动定时器,每隔5分钟自动保存(当前示例使用 30s,可改回 5 分钟)
            this.autoSaveTimer = setInterval(() => {
                this.save(); // 直接调用已有的保存方法
            this.save(); // 直接调用已有的保存方法(save 已返回 Promise)
            }, 1 * 30 * 1000); // 30秒
        },
        beforeDestroy() {