jingshuyong 10 сар өмнө
parent
commit
9448463768

+ 93 - 7
src/views/inspectionWork/components/sampleListDialog.vue

@@ -20,32 +20,78 @@
                 prop="qualitySchemeTemplateCode"
                 align="center"
               >
+                <template slot-scope="scope">
+                  <span :class="scope.row.qualityResults === 2 ? 'warn' : ''">
+                    {{ scope.row.qualitySchemeTemplateCode }}
+                  </span>
+                </template>
               </el-table-column>
               <el-table-column
                 label="质检方案名称"
                 prop="qualitySchemeTemplateName"
                 align="center"
-              ></el-table-column>
+              >
+                <template slot-scope="scope">
+                  <span :class="scope.row.qualityResults === 2 ? 'warn' : ''">
+                    {{ scope.row.qualitySchemeTemplateName }}
+                  </span>
+                </template>
+              </el-table-column>
               <el-table-column
                 label="质检类型"
                 prop="categoryLevelClassName"
                 align="center"
-              ></el-table-column>
+              >
+                <template slot-scope="scope">
+                  <span :class="scope.row.qualityResults === 2 ? 'warn' : ''">
+                    {{ scope.row.categoryLevelClassName }}
+                  </span>
+                </template>
+              </el-table-column>
               <el-table-column
                 label="质检项编码"
                 prop="inspectionCode"
                 align="center"
-              ></el-table-column>
+              >
+                <template slot-scope="scope">
+                  <span :class="scope.row.qualityResults === 2 ? 'warn' : ''">
+                    {{ scope.row.inspectionCode }}
+                  </span>
+                </template>
+              </el-table-column>
               <el-table-column
                 label="质检项名称"
                 prop="inspectionName"
                 align="center"
-              ></el-table-column>
+              >
+                <template slot-scope="scope">
+                  <span :class="scope.row.qualityResults === 2 ? 'warn' : ''">
+                    {{ scope.row.inspectionName }}
+                  </span>
+                </template>
+              </el-table-column>
               <el-table-column
                 label="工艺参数"
                 prop="defaultValue"
                 align="center"
               >
+                <template slot-scope="scope">
+                  <!-- <span :class="scope.row.qualityResults === 2 ? 'warn' : ''">
+                    {{ scope.row.defaultValue }}
+                  </span> -->
+                  <div style="display: flex; justify-content: center" :class="scope.row.qualityResults === 2 ? 'warn' : ''">
+                    <span>{{ scope.row.symbol }}</span>
+                    <span v-if="scope.row.textType == 3">
+                      {{ scope.row.minValue }}-{{ scope.row.maxValue }}
+                    </span>
+
+                    <span v-else>
+                      <span>{{ scope.row.defaultValue }}</span>
+                    </span>
+
+                    {{ scope.row.unitName }}
+                  </div>
+                </template>
               </el-table-column>
               <el-table-column label="质检工具" prop="" align="center">
                 <template slot-scope="scope">
@@ -65,6 +111,8 @@
               >
                 <template slot-scope="scope">
                   <el-input
+                    :class="scope.row.qualityResults === 2 ? 'warn' : ''"
+                    @blur="(e) => inputResultContent(e, scope.row)"
                     v-model="scope.row.qualityResultContent"
                     placeholder="请输入内容"
                     :disabled="type == 'detail'"
@@ -234,16 +282,19 @@
         this.tableData = [];
         this.rowIndex = index;
         this.type = type;
+        console.log(list, 'list +++++++++');
         // console.log(list, 'lklllllllllllllllllkkkkkkkkkkkkkkkkkkkkk', list[0].qualityResults);
         //如果质检项qualitySampleTemplateList只有一条数据且质检结果是让步接收
         if (list[0].qualitySampleTemplateList.length == 1) {
           for (let i = 0; i < list[0].qualitySampleTemplateList.length; i++) {
-            list[0].qualitySampleTemplateList[i].qualityResults =
-              list[0].qualityResults;
+            list[0].qualitySampleTemplateList[i].qualityResults = list[0]
+              .qualityResults
+              ? list[0].qualityResults
+              : 1;
           }
         }
         this.tableData = JSON.parse(JSON.stringify(list));
-        console.log( this.tableData,'33333333333333333');
+        console.log(this.tableData, '33333333333333333');
 
         this.visible = true;
       },
@@ -265,7 +316,33 @@
         });
         return getQualityValue;
       },
+      inputResultContent(e, row) {
+        console.log(row, 'row row row');
+        console.log(e, 'eeeeeeeee');
+        if (row.textType == '1') {
+          if (row.qualityResultContent != row.defaultValue) {
+            this.$set(row, 'qualityResults', 2);
+          } else {
+            this.$set(row, 'qualityResults', 1);
+          }
+          return;
+        }
+        if (row.textType == '3') {
+          let num = Number(row.qualityResultContent)
+          if(num == NaN){
+             this.$set(row, 'qualityResults', 2);
+            return;
+          }
+          console.log(num,'num')
+          if(num >= Number(row.minValue) && num <= Number(row.maxValue)){
+            this.$set(row, 'qualityResults', 1);
+          }else{
+             this.$set(row, 'qualityResults', 2);
+          }
+        }
 
+        console.log(row, 'row 11111111111');
+      },
       handleClose() {
         this.visible = false;
       },
@@ -284,3 +361,12 @@
     }
   };
 </script>
+
+<style scoped lang="scss">
+  ::v-deep .warn {
+    color: red;
+    .el-input__inner {
+      color: red;
+    }
+  }
+</style>