快乐的昕的电脑
13 小时以前 0a0aaff74884a8ecab15fb581855a148f442f5c5
pages/index.vue
@@ -361,17 +361,8 @@
      onShow() {
         this.refresh();
         this.resetAutoRedirectTimer();
         // 页面显示时加载工单列表
         // 如果在工单选择页面,启动定时刷新
         if (this.currentTab === 7) {
            // 默认选中“待开工、未开工、暂停”
            this.engineeringNo = '待开工、未开工、暂停';
            this.engineeringNoMapList = [
               '待开工、未开工、暂停',
               '开工',
               '完工'
            ];
            this.getWomdaaByStatus();
            // 启动定时刷新
            this.startAutoRefresh();
         }
      },
@@ -474,12 +465,20 @@
         
         refresh() {
            this.getMachineList();
            this.getPrintInfo();
            this.getWomdaaIsShow();
            this.getPrintInfo(); // getPrintInfo 完成后会自动调用 getWomdaaIsShow()
            // 如果当前在工单选择页面,默认加载工单列表
            if (this.currentTab === 7) {
               // 默认选中“待开工、未开工、暂停”
               this.engineeringNo = '待开工、未开工、暂停';
               // 根据当前绑定工单的状态决定默认筛选条件
               let defaultStatus = '待开工、未开工、暂停';
               if (this.isShowTableData.length > 0) {
                  const currentOrderStatus = this.isShowTableData[0].daa018;
                  if (currentOrderStatus === '开工') {
                     defaultStatus = '开工';
                  } else if (currentOrderStatus === '完工') {
                     defaultStatus = '完工';
                  }
               }
               this.engineeringNo = defaultStatus;
               this.engineeringNoMapList = [
                  '待开工、未开工、暂停',
                  '开工',
@@ -862,7 +861,7 @@
         getStartBtnText(item) {
            const isSelected = this.isShowTableData.length > 0 && this.isShowTableData[0].daa001 === item.daa001;
            if (isSelected) {
               return '转跳到主界面';
               return '转跳报工界面';
            }
            return '开工';
         },
@@ -873,8 +872,12 @@
            const isSelected = this.isShowTableData.length > 0 && this.isShowTableData[0].daa001 === item.daa001;
            
            if (isSelected) {
               // 如果已选中,则跳转到主界面
               // 如果已选中,则先跳转到主界面,然后跳转到报工界面
               this.toDetail(item);
               // 延迟跳转到报工界面
               setTimeout(() => {
                  this.currentTab = 4;
               }, 100);
            } else {
               // 如果未选中,则执行开工逻辑
               let orderSelect = [{
@@ -909,7 +912,7 @@
            if (!this.machineNo) {
               return;
            }
            // 直接用 flag 判断
            if (this.hasBindedCutterFlag) {
               uni.showToast({
@@ -919,10 +922,10 @@
               });
               return;
            }
            let editDate = this.formatDate(new Date());
            this.selectedIndexs = [];
            this.$post({
               url: "/MesOrderSelect/Remove",
               data: {
@@ -937,8 +940,35 @@
                     icon: 'success',
                     duration: 2000
                  });
                  // 暂停成功后,刷新当前页面
                  setTimeout(() => {
                     this.refresh();
                  }, 500);
               }
            });
         },
         // 启动自动刷新
         startAutoRefresh() {
            // 先清除现有定时器
            this.stopAutoRefresh();
            // 只在工单选择页面启动定时刷新
            if (this.currentTab === 7) {
               this.autoRefreshTimer = setInterval(() => {
                  if (this.currentTab === 7) {
                     this.refresh();
                  }
               }, this.autoRefreshInterval);
            }
         },
         // 停止自动刷新
         stopAutoRefresh() {
            if (this.autoRefreshTimer) {
               clearInterval(this.autoRefreshTimer);
               this.autoRefreshTimer = null;
            }
         }
      },
      computed: {}