BUG
快乐的昕的电脑
2025-11-13 24946a7945620878b05120a7fa91a2cc1be550ed
components/machine.vue
@@ -177,14 +177,31 @@
                    if (res && res.data && res.data.tbBillList) {
                        this.$showMessage("呼叫成功");
                        // 方案2:完全刷新当前页面
                        // 延迟一下让用户看到成功提示
                        setTimeout(() => {
                            // 方法1:使用 uni.reLaunch 重新加载(推荐)
                            uni.reLaunch({
                                url: '/' + getCurrentPages()[0].route
                            });
                        }, 1500);
                        // 关键修改:清空 flag 的值
                        this.flag = -1; // 或者根据业务需求设置为其他初始值
                        // 方案1:使用uni-app的页面刷新方法
                        // 方法1:触发下拉刷新(如果页面支持)
                        if (uni.startPullDownRefresh) {
                            uni.startPullDownRefresh();
                            // 2秒后停止刷新
                            setTimeout(() => {
                                uni.stopPullDownRefresh();
                            }, 2000);
                        }
                        // 方法2:重新调用页面的onLoad方法(推荐)
                        const pages = getCurrentPages();
                        const currentPage = pages[pages.length - 1];
                        if (currentPage && currentPage.onLoad) {
                            // 保存当前页面参数
                            const pageOptions = currentPage.options || {};
                            // 重新加载页面数据
                            currentPage.onLoad(pageOptions);
                        }
                        // 方法3:同时刷新组件数据
                        this.findByOrderId();
                    } else {
                        this.$showMessage("呼叫失败");
@@ -240,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);
@@ -256,7 +281,7 @@
<style scoped>
   /* 页面整体布局 */
   .page {
      padding: 2vh;
      padding: 8px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
@@ -267,54 +292,56 @@
   /* 右上角刷新按钮 */
   .top-right {
      position: absolute;
      top: 10px;
      right: 50px;
      top: 8px;
      right: 40px;
      width: 200px;
      z-index: 1000;
   }
   .refresh-btn {
      padding: 10px;
      padding: 8px 16px;
      background-color: #00A2E9;
      color: white;
      border: none;
      font-size: 1.5vw;
      font-size: 16px;
      border-radius: 5px;
   }
   label {
      margin-right: 1vw;
      font-size: 1.6vw;
   }
   input {
      padding: 1vh;
      font-size: 1.5vw;
      border: 1px solid #ccc;
      width: 100%;
      margin-top: 1vh;
      box-sizing: border-box;
      margin-right: 10px;
      font-size: 16px;
   }
   /* 中间状态部分布局 */
   .middle-section {
      display: flex;
      flex-direction: column;
      margin-bottom: 4vh;
      margin-bottom: 8px;
   }
   .item {
      display: flex;
      flex-direction: row;
      align-items: flex-start;
      margin-bottom: 2vh;
      align-items: center;
      margin-bottom: 10px;
      gap: 10px;
   }
   .item h4 {
      font-size: 14px;
      line-height: 1.4;
      margin: 0;
      padding: 5px 0;
   }
   button {
      width: 100%;
      padding: 1.5vh;
      font-size: 1.5vw;
      width: 50%;
      flex-shrink: 0;
      padding: 10px;
      font-size: 16px;
      border: none;
      text-align: center;
      min-height: 40px;
   }
   .btn-disabled {
@@ -328,36 +355,86 @@
   }
   input {
      margin-top: 10px;
      padding: 10px;
      font-size: 14px;
      margin-top: 0;
      padding: 8px;
      font-size: 15px;
      border: 1px solid #ccc;
      width: 100%;
      width: 50%;
      flex-grow: 1;
      box-sizing: border-box;
   }
   /* 底部保存/取消按钮布局 */
   .bottom-section {
      display: flex;
      justify-content: space-between;
      margin-top: 4vh;
      margin-top: 10px;
      padding-top: 10px;
   }
   .save-btn,
   .cancel-btn {
      width: 48%;
      padding: 1.5vh;
      padding: 12px;
      background-color: #00A2E9;
      color: white;
      font-size: 1.6vw;
      font-size: 18px;
      border: none;
      text-align: center;
      min-height: 45px;
   }
   .txt-inp {
      height: 8vh;
      padding: 1vh;
      font-size: 1.5vw;
      width: 100%;
      height: 40px;
      padding: 8px;
      font-size: 15px;
      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;
      }
      .middle-section {
         margin-bottom: 6px;
      }
      .item {
         margin-bottom: 8px;
      }
      .item h4 {
         font-size: 13px;
         padding: 3px 0;
      }
      button {
         padding: 8px;
         font-size: 15px;
         min-height: 38px;
      }
      .txt-inp {
         height: 38px;
         padding: 6px;
         font-size: 14px;
      }
      .bottom-section {
         margin-top: 8px;
         padding-top: 8px;
      }
      .save-btn,
      .cancel-btn {
         padding: 10px;
         font-size: 17px;
         min-height: 42px;
      }
   }
</style>