快乐的昕的电脑
2025-11-24 c0c29bab83c18e7900343c43bf7e2e28dd91471c
components/machine.vue
@@ -19,11 +19,11 @@
         </view>
         <view class="item">
            <!-- 调机开始按钮,maStartTime有值时禁用 -->
            <button :class="maStartTime ? 'btn-disabled' : 'btn-blue'"
                  :disabled="!!maStartTime"
                  @click="handleMaStartTime">
               调机开始
            </button>
                <button :class="maStartTime ? 'btn-disabled' : 'btn-blue'"
                        :disabled="!!maStartTime"
                        @click="handleMaStartTime">
                    调机开始(=上刀完成)
                </button>
            <!-- 显示调机开始时间 -->
            <input class="txt-inp" v-model="maStartTime" placeholder="点击按钮带出调机时间" disabled="true" />
         </view>
@@ -257,12 +257,20 @@
            })
         }
      },
      mounted() {
         // 页面加载时,启动定时器,每隔5分钟自动保存(当前示例使用 30s,可改回 5 分钟)
         this.autoSaveTimer = setInterval(() => {
            this.save(); // 直接调用已有的保存方法(save 已返回 Promise)
         }, 1 * 30 * 1000); // 30秒
      },
        mounted() {
                // 页面加载时,启动定时器,每隔30秒自动保存
                this.autoSaveTimer = setInterval(() => {
                    // 1. 调机完成时间有了就不自动保存
                    if (this.maEndTime) {
                        return;
                    }
                    // 2. 送检时间为空也不自动保存
                    if (!this.maShoutTime) {
                        return;
                    }
                    this.save(); // 满足条件才自动保存
                }, 1 * 30 * 1000); // 30秒
            },
      beforeDestroy() {
         // 页面卸载时清理定时器
         clearInterval(this.autoSaveTimer);
@@ -271,161 +279,174 @@
</script>
<style scoped>
   /* 页面整体布局 */
   .page {
      padding: 8px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      box-sizing: border-box;
      height: 100%;
   }
    /* 页面整体布局 */
    .page {
        padding: 8px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        box-sizing: border-box;
        height: 100%;
    }
   /* 右上角刷新按钮 */
   .top-right {
      position: absolute;
      top: 8px;
      right: 40px;
      z-index: 1000;
   }
    /* 右上角刷新按钮 */
    .top-right {
        position: absolute;
        top: 8px;
        right: 40px;
        width: 200px;
        z-index: 1000;
    }
   .refresh-btn {
      padding: 8px 16px;
      background-color: #00A2E9;
      color: white;
      border: none;
      font-size: 16px;
      border-radius: 5px;
   }
    .refresh-btn {
        padding: 8px 16px;
        background-color: #00A2E9;
        color: white;
        border: none;
        font-size: 24px;
        border-radius: 5px;
    }
   label {
      margin-right: 10px;
      font-size: 16px;
   }
    label {
        margin-right: 10px;
        font-size: 24px;
    }
   /* 中间状态部分布局 */
   .middle-section {
      display: flex;
      flex-direction: column;
      margin-bottom: 8px;
   }
    /* 中间状态部分布局 */
    .middle-section {
        display: flex;
        flex-direction: column;
        margin-bottom: 8px;
    }
   .item {
      display: flex;
      flex-direction: row;
      align-items: center;
      margin-bottom: 10px;
      gap: 10px;
   }
    .item {
        display: flex;
        flex-direction: row;
        align-items: center;
        margin-bottom: 10px;
        gap: 10px;
    }
   .item h4 {
      font-size: 14px;
      line-height: 1.4;
      margin: 0;
      padding: 5px 0;
   }
        .item h4 {
            font-size: 24px;
            line-height: 1.4;
            margin: 0;
            padding: 5px 0;
        }
   button {
      width: 50%;
      flex-shrink: 0;
      padding: 10px;
      font-size: 16px;
      border: none;
      text-align: center;
      min-height: 40px;
   }
    button {
        width: 50%;
        flex-shrink: 0;
        padding: 10px;
        font-size: 24px;
        border: none;
        text-align: center;
        min-height: 40px;
    }
   .btn-disabled {
      background-color: #ccc;
      color: white;
   }
    .btn-disabled {
        background-color: #ccc;
        color: white;
    }
   .btn-blue {
      background-color: #00A2E9;
      color: white;
   }
    .btn-blue {
        background-color: #00A2E9;
        color: white;
    }
   input {
      margin-top: 0;
      padding: 8px;
      font-size: 15px;
      border: 1px solid #ccc;
      width: 50%;
      flex-grow: 1;
      box-sizing: border-box;
   }
    input {
        margin-top: 0;
        padding: 8px;
        font-size: 24px;
        border: 1px solid #ccc;
        width: 50%;
        flex-grow: 1;
        box-sizing: border-box;
    }
   /* 底部保存/取消按钮布局 */
   .bottom-section {
      display: flex;
      justify-content: space-between;
      margin-top: 10px;
      padding-top: 10px;
   }
    /* 底部保存/取消按钮布局 */
    .bottom-section {
        display: flex;
        justify-content: space-between;
        margin-top: 10px;
        padding-top: 10px;
    }
   .save-btn,
   .cancel-btn {
      width: 48%;
      padding: 12px;
      background-color: #00A2E9;
      color: white;
      font-size: 18px;
      border: none;
      text-align: center;
      min-height: 45px;
   }
    .save-btn,
    .cancel-btn {
        width: 48%;
        padding: 12px;
        background-color: #00A2E9;
        color: white;
        font-size: 24px;
        border: none;
        text-align: center;
        min-height: 45px;
    }
   .txt-inp {
      height: 40px;
      padding: 8px;
      font-size: 15px;
      width: 50%;
      flex-grow: 1;
      box-sizing: border-box;
      margin-top: 0;
   }
    .txt-inp {
        height: 80px; /* 增大高度 */
        padding: 12px; /* 增大内边距 */
        font-size: 24px; /* 增大字体 */
        width: 50%;
        flex-grow: 1;
        box-sizing: border-box;
        margin-top: 0;
    }
   /* 针对1280*717屏幕的特定优化 */
   @media screen and (max-width: 1280px) and (max-height: 800px) {
      .page {
         padding: 6px;
      }
    /* 针对1280*717屏幕的特定优化 */
    @media screen and (max-width: 1280px) and (max-height: 800px) {
        .page {
            padding: 6px;
        }
      .middle-section {
         margin-bottom: 6px;
      }
        .middle-section {
            margin-bottom: 6px;
        }
      .item {
         margin-bottom: 8px;
      }
        .item {
            margin-bottom: 8px;
        }
      .item h4 {
         font-size: 13px;
         padding: 3px 0;
      }
            .item h4 {
                font-size: 24px;
                padding: 3px 0;
            }
      button {
         padding: 8px;
         font-size: 15px;
         min-height: 38px;
      }
        button {
            padding: 8px;
            font-size: 24px;
            min-height: 38px;
        }
      .txt-inp {
         height: 38px;
         padding: 6px;
         font-size: 14px;
      }
        .txt-inp {
            height: 46px;
            padding: 10px;
            font-size: 24px;
        }
      .bottom-section {
         margin-top: 8px;
         padding-top: 8px;
      }
        .bottom-section {
            margin-top: 8px;
            padding-top: 8px;
        }
      .save-btn,
      .cancel-btn {
         padding: 10px;
         font-size: 17px;
         min-height: 42px;
      }
   }
        .save-btn,
        .cancel-btn {
            padding: 10px;
            font-size: 24px;
            min-height: 42px;
        }
        input {
            font-size: 24px;
        }
        .refresh-btn {
            font-size: 24px;
        }
        label {
            font-size: 24px;
        }
    }
</style>