Преглед на файлове

人员比对评价表组件调整

zhonghuizhen преди 7 месеца
родител
ревизия
2055a3be8e
променени са 1 файла, в които са добавени 40 реда и са изтрити 0 реда
  1. 40 0
      src/views/component/reagent/personnelComparison.vue

+ 40 - 0
src/views/component/reagent/personnelComparison.vue

@@ -115,6 +115,7 @@
                   v-model="row.shiFouTongGuo"
                   size="mini"
                   placeholder="请选择"
+                  @change="onTongGuoChange(row, $index, $event)"
                 >
                   <el-option label="通过" value="通过" />
                   <el-option label="不通过" value="不通过" />
@@ -270,9 +271,26 @@ export default {
     handleSelectionChange(val) {
       this.multipleSelection = val
     },
+    onTongGuoChange(row, index, value) {
+      // 找到同一人员同一项目的所有行
+      const groupRows = this.comparisonData.filter(
+        item => item.renYuan === row.renYuan && item.jieGuo3 === row.jieGuo3
+      );
+      
+      // 更新组内所有行的"是否通过"值
+      groupRows.forEach(item => {
+        item.shiFouTongGuo = value;
+      });
+      
+      // 强制刷新表格以更新合并行的显示
+      this.$nextTick(() => {
+        this.$refs.comparison.doLayout();
+      });
+    },
     spanMethod({ row, column, rowIndex, columnIndex }) {
        const renyuancolumnIndex =   this.isEditable ? 1 : 0
        const xiangmucolumnIndex =   this.isEditable ? 2 : 1
+       const tongguocolumnIndex =   this.isEditable ? 7 : 6
       if (columnIndex === renyuancolumnIndex) {
         const currentValue = row.renYuan
         const preRow = this.comparisonData[rowIndex - 1]
@@ -314,6 +332,28 @@ export default {
           return { rowspan, colspan: 1 }
         }
       }
+      if (columnIndex === tongguocolumnIndex) {
+        const currentValue = row.shiFouTongGuo
+        const preRow = this.comparisonData[rowIndex - 1]
+        const preValue = preRow ? preRow.shiFouTongGuo : null
+        if (currentValue === preValue && row.renYuan === preRow.renYuan && row.jieGuo3 === preRow.jieGuo3) {
+          return { rowspan: 0, colspan: 0 }
+        } else {
+          let rowspan = 1
+          for (let i = rowIndex + 1; i < this.comparisonData.length; i++) {
+            const nextRow = this.comparisonData[i]
+            if (
+              nextRow.renYuan === row.renYuan &&
+              nextRow.jieGuo3 === row.jieGuo3
+            ) {
+              rowspan++
+            } else {
+              break
+            }
+          }
+          return { rowspan, colspan: 1 }
+        }
+      }
     }
   }
 }