Explorar el Código

feature_20260121_陈列奖励案任务复制暂

zhujindu hace 1 semana
padre
commit
438af9aaa1

+ 42 - 6
src/views/deviceWithin/taskPhotoTaking.vue

@@ -90,22 +90,22 @@
         <div class="resultContent">
           <el-table
             :data="taskPhotoRecognitionResult"
+            :span-method="taskObjectSpanMethod"
             border
             class="table-headermd1"
             style="width: 100%">
             <el-table-column label="" type="index" width="50px" align="center" />
             <el-table-column label="产品" prop="skuProductName" align="center" />
-            <el-table-column label="要求" prop="conditionIdentifyNum" align="center" width="60px">
-            </el-table-column>
             <el-table-column
               label="识别排面数"
               prop="identifyTheNumberOfCards"
               width="70px"
-              align="center"
-              >meetTheStandard
+              align="center">
+            </el-table-column>
+            <el-table-column label="要求" prop="conditionIdentifyNum" align="center" width="60px">
               <template slot-scope="scope">
                 <span :style="{ color: scope.row.meetTheStandard == 1 ? '#07c160' : 'red' }">
-                  {{ scope.row.identifyTheNumberOfCards }}
+                  {{ scope.row.conditionIdentifyNum }}
                 </span>
               </template>
             </el-table-column>
@@ -134,6 +134,8 @@ export default {
       insert: '',
       vanPopup: false,
       taskPhotoRecognitionResult: null,
+      spanArr: [],
+      pos: 0,
     };
   },
   activated() {
@@ -149,6 +151,36 @@ export default {
     }
   },
   methods: {
+    taskObjectSpanMethod({ row, column, rowIndex, columnIndex }) {
+      const cellValue = row[column.property];
+      if (cellValue && ['conditionIdentifyNum'].includes(column.property)) {
+        const _row = this.spanArr[rowIndex]; // 合并行数
+        const _col = this.spanArr[rowIndex] > 0 ? 1 : 0; // 合并的列数
+        return {
+          rowspan: _row,
+          colspan: _col,
+        };
+      }
+    },
+    getSpanArr(data) {
+      this.spanArr = []; // tip: 后台获取完成数据后,一定要重置spanArr=[],避免出现合并混乱!!!!!
+      for (let i = 0; i < data.length; i++) {
+        // 当为第一行时
+        if (i === 0) {
+          this.spanArr.push(1);
+          this.pos = 0;
+        } else {
+          // 判断当前值是否与上一行的【名称】相等,相等则进行合并
+          if (data[i].conditionIdentifyNum === data[i - 1].conditionIdentifyNum) {
+            this.spanArr[this.pos] += 1; // 合并单元格:合并的行数 +1
+            this.spanArr.push(0); // 0代表单元格是不需要显示, 已经被合并的单元格
+          } else {
+            this.spanArr.push(1); // 1代表当前这行的数据需要被显示
+            this.pos = i;
+          }
+        }
+      }
+    },
     getVisitsDetailFun() {
       this.toastLoading(0, '加载中...', true);
       getVisitsDetail({ visitsId: this.visitsId }).then((res) => {
@@ -179,7 +211,11 @@ export default {
     },
     openDialog(item) {
       this.vanPopup = true;
-      this.taskPhotoRecognitionResult = item.taskPhotoRecognitionResult;
+      this.getSpanArr(item.taskPhotoRecognitionResult);
+      this.$nextTick(() => {
+        console.log(this.spanArr);
+        this.taskPhotoRecognitionResult = item.taskPhotoRecognitionResult;
+      });
     },
     onSubmit() {
       let formData = {

+ 39 - 6
src/views/historicalVisit/hisvistdeils.vue

@@ -276,22 +276,22 @@
       <div class="resultContent">
         <el-table
           :data="taskPhotoRecognitionResult"
+          :span-method="taskObjectSpanMethod"
           border
           class="table-headermd1"
           style="width: 100%">
           <el-table-column label="" type="index" width="50px" align="center" />
           <el-table-column label="产品" prop="skuProductName" align="center" />
-          <el-table-column label="要求" prop="conditionIdentifyNum" align="center" width="60px">
-          </el-table-column>
           <el-table-column
             label="识别排面数"
             prop="identifyTheNumberOfCards"
             width="70px"
-            align="center"
-            >meetTheStandard
+            align="center">
+          </el-table-column>
+          <el-table-column label="要求" prop="conditionIdentifyNum" align="center" width="60px">
             <template slot-scope="scope">
               <span :style="{ color: scope.row.meetTheStandard == 1 ? '#07c160' : 'red' }">
-                {{ scope.row.identifyTheNumberOfCards }}
+                {{ scope.row.conditionIdentifyNum }}
               </span>
             </template>
           </el-table-column>
@@ -356,6 +356,8 @@ export default {
       equipmentCode: '',
       taskPhotoRecognitionResult: null,
       yfNumFlage: false,
+      spanArr: [],
+      pos: 0,
     };
   },
   activated() {
@@ -396,6 +398,17 @@ export default {
         }
       }
     },
+    taskObjectSpanMethod({ row, column, rowIndex, columnIndex }) {
+      const cellValue = row[column.property];
+      if (cellValue && ['conditionIdentifyNum'].includes(column.property)) {
+        const _row = this.spanArr[rowIndex]; // 合并行数
+        const _col = this.spanArr[rowIndex] > 0 ? 1 : 0; // 合并的列数
+        return {
+          rowspan: _row,
+          colspan: _col,
+        };
+      }
+    },
     // 历史回显
     getCollectionShowHistory(id) {
       getCollectionShowHistory({
@@ -422,6 +435,25 @@ export default {
       }
       return arrc.join(',');
     },
+    getSpanArr(data) {
+      this.spanArr = []; // tip: 后台获取完成数据后,一定要重置spanArr=[],避免出现合并混乱!!!!!
+      for (let i = 0; i < data.length; i++) {
+        // 当为第一行时
+        if (i === 0) {
+          this.spanArr.push(1);
+          this.pos = 0;
+        } else {
+          // 判断当前值是否与上一行的【名称】相等,相等则进行合并
+          if (data[i].conditionIdentifyNum === data[i - 1].conditionIdentifyNum) {
+            this.spanArr[this.pos] += 1; // 合并单元格:合并的行数 +1
+            this.spanArr.push(0); // 0代表单元格是不需要显示, 已经被合并的单元格
+          } else {
+            this.spanArr.push(1); // 1代表当前这行的数据需要被显示
+            this.pos = i;
+          }
+        }
+      }
+    },
     info() {
       this.toastLoading(0, '加载中...', true);
       getVisitsDetail({ visitsId: this.visitId }).then((res) => {
@@ -429,6 +461,7 @@ export default {
         this.infoData = res.data;
         this.taskPhotoRecognitionResult =
           res.data.sfaTaskList[this.$route.query.ids].taskPhotoRecognitionResult;
+        this.getSpanArr(this.taskPhotoRecognitionResult);
         var collectionItemLists = res.data.sfaTaskList[this.$route.query.ids].collectionItemList;
         if (res.data.sfaTaskList[this.$route.query.ids].checkUnManage == 'Y') {
           this.checkShow = true;
@@ -493,7 +526,7 @@ export default {
               for (var qq = 0; qq < collectionItemLists[q].collectionOptionList.length; qq++) {
                 if (collectionItemLists[q].collectionOptionList[qq].isCheck == 1) {
                   collectionItemLists[q].answerValue.push(
-                    collectionItemLists[q].collectionOptionList[qq].collectionOptionId
+                    collectionItemLists[q].collectionOptionList[qq].collectionOptionId,
                   );
                   collectionItemLists[q].collectionOptionList[qq].code =
                     collectionItemLists[q].collectionCode;