快乐的昕的电脑
2025-11-12 a68880015e0d83939ff90f4d9e943c3d423bd358
components/machine.vue
@@ -257,12 +257,17 @@
            })
         }
      },
      mounted() {
         // 页面加载时,启动定时器,每隔5分钟自动保存(当前示例使用 30s,可改回 5 分钟)
         this.autoSaveTimer = setInterval(() => {
            this.save(); // 直接调用已有的保存方法(save 已返回 Promise)
         }, 1 * 30 * 1000); // 30秒
      },
        mounted() {
            // 页面加载时,启动定时器,每隔30秒自动保存
            this.autoSaveTimer = setInterval(() => {
                // 判断当前工单是否为开工状态,若是则不触发保存
                if (this.statusForm && this.statusForm.status === '开工') {
                    // 已开工不自动保存
                    return;
                }
                this.save(); // 只有非开工状态才自动保存
            }, 1 * 30 * 1000); // 30秒
        },
      beforeDestroy() {
         // 页面卸载时清理定时器
         clearInterval(this.autoSaveTimer);
@@ -286,6 +291,7 @@
      position: absolute;
      top: 8px;
      right: 40px;
      width: 200px;
      z-index: 1000;
   }
@@ -313,8 +319,9 @@
   .item {
      display: flex;
      flex-direction: row;
      align-items: flex-start;
      align-items: center;
      margin-bottom: 10px;
      gap: 10px;
   }
   .item h4 {
@@ -325,7 +332,8 @@
   }
   button {
      width: 100%;
      width: 50%;
      flex-shrink: 0;
      padding: 10px;
      font-size: 16px;
      border: none;
@@ -348,7 +356,8 @@
      padding: 8px;
      font-size: 15px;
      border: 1px solid #ccc;
      width: 100%;
      width: 50%;
      flex-grow: 1;
      box-sizing: border-box;
   }
@@ -376,7 +385,8 @@
      height: 40px;
      padding: 8px;
      font-size: 15px;
      width: 100%;
      width: 50%;
      flex-grow: 1;
      box-sizing: border-box;
      margin-top: 0;
   }