zhonghuizhen 7 месяцев назад
Родитель
Сommit
1fa6cff81b
1 измененных файлов с 59 добавлено и 13 удалено
  1. 59 13
      src/views/component/reagent/personnelComparison.vue

+ 59 - 13
src/views/component/reagent/personnelComparison.vue

@@ -50,15 +50,15 @@
             :span-method="spanMethod"
             @selection-change="handleSelectionChange"
           >
-            <el-table-column type="selection" width="55" />
+            <el-table-column :type="isEditable ? 'selection' : ''" width="55" />
             <el-table-column label="比对人员" prop="renYuan" width="110" >
               <template slot-scope="{ row }">
                 <span>{{ getUserName(row.renYuan) }}</span>
               </template>
             </el-table-column>
-            <el-table-column label="比对项目" prop="biDuiXiangMu"  width="200">
+            <el-table-column label="比对项目" prop="jieGuo3"  width="200">
               <template slot-scope="{ row }">
-                <span>{{ row.biDuiXiangMu }}</span>
+                <span>{{ row.jieGuo3 }}</span>
               </template>
             </el-table-column>
             <el-table-column label="样品编号" prop="yangPinBianHao">
@@ -108,6 +108,20 @@
                 <span v-else>{{ row.shiFouYiZhi1 || '/' }}</span>
               </template>
             </el-table-column>
+            <el-table-column label="是否通过" prop="shiFouTongGuo" width="90">
+              <template slot-scope="{ row }">
+                <el-select
+                  v-if="isEditable"
+                  v-model="row.shiFouTongGuo"
+                  size="mini"
+                  placeholder="请选择"
+                >
+                  <el-option label="是" value="是" />
+                  <el-option label="否" value="否" />
+                </el-select>
+                <span v-else>{{ row.shiFouTongGuo || '/' }}</span>
+              </template>
+            </el-table-column>
           </el-table>
         </el-col>
       </el-row>
@@ -123,15 +137,42 @@ export default {
     formData: {
       type: Object,
       default: () => {}
+    },
+    params: {
+      type: Object,
+      default: () => {}
     }
   },
   data() {
     return {
-      comparisonData: [],
+      comparisonData: this.formData.rybdjg || [], 
       multipleSelection: [],
       show: true,
-      nodeId: 'Activity_0xxvzg0',
-      userList: this.$store.getters.userList
+      nodeId: '',
+      userList: this.$store.getters.userList,
+      isSyncing: false // Flag to prevent watch deadlock
+    }
+  },
+  watch: {
+    comparisonData: {
+      deep: true,
+      handler(newVal) {
+        if (!this.isSyncing) {
+          this.isSyncing = true;
+          this.$set(this.formData, 'rybdjg', newVal);
+          this.isSyncing = false;
+        }
+      }
+    },
+    'formData.rybdjg': {
+      deep: true,
+      handler(newVal) {
+        if (!this.isSyncing) {
+          this.isSyncing = true;
+          this.comparisonData = newVal;
+          this.isSyncing = false;
+        }
+      }
     }
   },
   computed: {
@@ -145,6 +186,9 @@ export default {
       return this.comparisonData
     }
   },
+  mounted() {
+    this.nodeId = this.params ? this.params.nodeId : ''
+  },
   methods: {
     getUserName(userId) {
       const user = this.userList.find((i) => i.userId === userId)
@@ -161,11 +205,12 @@ export default {
       }
       this.comparisonData.push({
         renYuan: '',
-        biDuiXiangMu: xuanZeXiangMu,
+        jieGuo3: xuanZeXiangMu,
         yangPinBianHao: '',
         jieGuo1: '',
         jieGuo2: '',
-        shiFouYiZhi1: '是'
+        shiFouYiZhi1: '是',
+        shiFouTongGuo: '是' // Default value
       })
     },
     // 复制
@@ -210,11 +255,12 @@ export default {
           for (let i = 1; i <= samples; i++) {
             generatedData.push({
               renYuan: person,
-              biDuiXiangMu: project,
+              jieGuo3: project,
               yangPinBianHao: ``,
               jieGuo1: '',
               jieGuo2: '',
-              shiFouYiZhi1: '是'
+              shiFouYiZhi1: '是',
+              shiFouTongGuo: '是' // Default value
             })
           }
         })
@@ -245,9 +291,9 @@ export default {
         }
       }
       if (columnIndex === 2) {
-        const currentValue = row.biDuiXiangMu
+        const currentValue = row.jieGuo3
         const preRow = this.comparisonData[rowIndex - 1]
-        const preValue = preRow ? preRow.biDuiXiangMu : null
+        const preValue = preRow ? preRow.jieGuo3 : null
         if (currentValue === preValue && row.renYuan === preRow.renYuan) {
           return { rowspan: 0, colspan: 0 }
         } else {
@@ -255,7 +301,7 @@ export default {
           for (let i = rowIndex + 1; i < this.comparisonData.length; i++) {
             const nextRow = this.comparisonData[i]
             if (
-              nextRow.biDuiXiangMu === currentValue &&
+              nextRow.jieGuo3 === currentValue &&
               nextRow.renYuan === row.renYuan
             ) {
               rowspan++