Ver Fonte

refactor(产前准备): 简化工时显示逻辑并移除无用代码

liujt há 6 meses atrás
pai
commit
7d6772e49e
1 ficheiros alterados com 38 adições e 37 exclusões
  1. 38 37
      src/views/produce/components/prenatalExamination/index.vue

+ 38 - 37
src/views/produce/components/prenatalExamination/index.vue

@@ -171,9 +171,10 @@
             minWidth: 150,
             formatter: (row) => {
               // 毫秒转小时
-              return row.duration && row.executeStatus == 2
-                ? (row.duration / 1000 / 60 / 60).toFixed(2) + ' 时'
-                : '';
+              // return row.duration && row.executeStatus == 2
+              //   ? (row.duration / 1000 / 60 / 60).toFixed(2) + ' 时'
+              //   : '';
+              return (row.duration / 1000 / 60 / 60).toFixed(2) + ' 时';
             }
           },
           // 操作
@@ -278,40 +279,40 @@
 
             return
 
-            // 是否有计划
-            if(!item.plans || item.plans.length == 0) {
-              this.$message.error('未生成记录计划');
-              return;
-            }
-            // 有计划无工单  派单
-            if(item.plans && item.plans.length > 0 && (!item.records || item.records.length == 0)) {
-              this.$refs.programRulesDialogRef.open('dispatch', item.plans[0], item.plans);
-              return;
-            }
-            // 有计划有工单未报工执行中  报工
-            if(item.plans && item.plans.length > 0 && item.records && item.records.length > 0 && (item.executeStatus == 1 || item.executeStatus == 0)) {
-              item.plans.forEach(plan => {
-                // 找到records数组中planid与当前plan.id匹配的记录
-                plan.matchedRecords = item.records.filter(record => record.planId == plan.id);
-              });
-              console.log('匹配后的plans数组:', item);
-              this.$refs.workOrderReportRef.open('add', item.plans[0]?.matchedRecords[0], item.plans[0]?.matchedRecords);
-              return;
-            }
-            // 有计划有工单已报工  详情
-            if(item.plans && item.plans.length > 0 && item.records && item.records.length > 0 && item.executeStatus == 2) {
-              item.plans.forEach(plan => {
-                // 找到records数组中planid与当前plan.id匹配的记录
-                plan.matchedRecords = item.records.filter(record => record.planId == plan.id);
-              });
-              console.log('详情匹配后的plans数组:', item);
-              if(item.plans[0]?.matchedRecords.length == 0) {
-                this.$message.error('未生成工单');
-                return
-              }
-              this.$refs.workOrderReportRef.open('detail', item.plans[0]?.matchedRecords[0], item.plans[0]?.matchedRecords);
-              return;
-            }
+            // // 是否有计划
+            // if(!item.plans || item.plans.length == 0) {
+            //   this.$message.error('未生成记录计划');
+            //   return;
+            // }
+            // // 有计划无工单  派单
+            // if(item.plans && item.plans.length > 0 && (!item.records || item.records.length == 0)) {
+            //   this.$refs.programRulesDialogRef.open('dispatch', item.plans[0], item.plans);
+            //   return;
+            // }
+            // // 有计划有工单未报工执行中  报工
+            // if(item.plans && item.plans.length > 0 && item.records && item.records.length > 0 && (item.executeStatus == 1 || item.executeStatus == 0)) {
+            //   item.plans.forEach(plan => {
+            //     // 找到records数组中planid与当前plan.id匹配的记录
+            //     plan.matchedRecords = item.records.filter(record => record.planId == plan.id);
+            //   });
+            //   console.log('匹配后的plans数组:', item);
+            //   this.$refs.workOrderReportRef.open('add', item.plans[0]?.matchedRecords[0], item.plans[0]?.matchedRecords);
+            //   return;
+            // }
+            // // 有计划有工单已报工  详情
+            // if(item.plans && item.plans.length > 0 && item.records && item.records.length > 0 && item.executeStatus == 2) {
+            //   item.plans.forEach(plan => {
+            //     // 找到records数组中planid与当前plan.id匹配的记录
+            //     plan.matchedRecords = item.records.filter(record => record.planId == plan.id);
+            //   });
+            //   console.log('详情匹配后的plans数组:', item);
+            //   if(item.plans[0]?.matchedRecords.length == 0) {
+            //     this.$message.error('未生成工单');
+            //     return
+            //   }
+            //   this.$refs.workOrderReportRef.open('detail', item.plans[0]?.matchedRecords[0], item.plans[0]?.matchedRecords);
+            //   return;
+            // }
           }
           this.$refs.releaseRulesDialogRef.open(
             item,