gaohaiyong há 4 meses atrás
pai
commit
b69ec6cb11
1 ficheiros alterados com 55 adições e 98 exclusões
  1. 55 98
      src/views/rule/config/components/CreateDialog.vue

+ 55 - 98
src/views/rule/config/components/CreateDialog.vue

@@ -180,7 +180,7 @@
                     </el-col>
                     <el-col :span="4">
                       <el-select v-model="sItem.condition" filterable clearable placeholder="请选择" style="width: 100%;">
-                        <el-option v-for="(item,bindex) in selectFormula" :key="bindex" :label="item.formula" :value="item.formula" />
+                        <el-option v-for="(items,bindex) in selectFormula" :key="bindex" :label="items.formula" :value="items.formula" />
                       </el-select>
                     </el-col>
                     <el-col :span="6">
@@ -236,7 +236,7 @@
                     </el-col>
                     <el-col :span="4">
                       <el-select v-model="sItem.condition" filterable clearable placeholder="请选择" style="width: 100%;">
-                        <el-option v-for="(item,bindex) in selectFormula" :key="bindex" :label="item.formula" :value="item.formula" />
+                        <el-option v-for="(items,bindex) in selectFormula" :key="bindex" :label="items.formula" :value="items.formula" />
                       </el-select>
                     </el-col>
                     <el-col v-if=" sItem.condition == '等于' || sItem.condition == '不等于'|| sItem.condition == '包含' || sItem.condition == '不包含'" :span="4">
@@ -273,10 +273,10 @@
               </el-card>
             </el-col>
             <!-- 质控依据 -->
-            <el-col v-if="ruleForm.zkyj.length" :span="24">
-              <el-card v-for="(item, index) of ruleForm.zkyj" :key="'zkyj'+index" class="box-card" shadow="never">
+            <el-col v-if="ruleForm.rule[0].custom_basis.length" :span="24">
+              <el-card v-for="(item, index) of ruleForm.rule" :key="'rule'+index" class="box-card" shadow="never">
                 <div slot="header" class="clearfix box-card_header span">
-                  <span class="text">质控依据{{ index + 1 }}</span>
+                  <span class="text">质控依据</span>
                   <i class="el-icon-delete" style="float: right; margin-top: 13px; cursor: pointer;" @click="onDeleteZKYJ(index)" />
                 </div>
                 <div>
@@ -316,11 +316,11 @@
               </el-card>
             </el-col>
             <!-- 质控预警 -->
-            <el-col v-if="ruleForm.zkyujing.length" :span="24">
+            <el-col v-if=" Object.keys(ruleForm.rule[0].custom_msg).length != 0 " :span="24">
 
-              <el-card v-for="(item, index) of ruleForm.zkyujing" :key="'rule'+index" class="box-card" shadow="never">
+              <el-card v-for="(item, index) of ruleForm.rule" :key="'rule'+index" class="box-card" shadow="never">
                 <div slot="header" class="clearfix box-card_header span">
-                  <span class="text">质控预警{{ index + 1 }}</span>
+                  <span class="text">质控预警</span>
                   <i class="el-icon-delete" style="float: right; margin-top: 13px; cursor: pointer;" @click="onDeleteZKyujing(index)" />
                 </div>
                 <div>
@@ -367,11 +367,6 @@
                     </el-col>
                     <el-col :span="4" />
                   </el-row>
-                  <!-- <div class="span">
-                    <span>条件之间的逻辑</span>
-                    <el-radio v-model="item.condition_relation" :label="1" class="ml40">且(满足所有条件)</el-radio>
-                    <el-radio v-model="item.condition_relation" :label="2">或(满足任意一条件)</el-radio>
-                  </div> -->
                 </div>
               </el-card>
             </el-col>
@@ -445,45 +440,14 @@ export default {
                 param2: '',
                 condition: '等于'
               }
-            ]
-          }
-        ],
-        qztj: [
-          // 前置条件默认只有一条
-          {
-            is_pre_condition: 1,
-            condition_type: 1,
-            condition_relation: 2,
-            detail_status: 1,
-            condition_content: [
-              {
-                param1: '',
-                param2: '',
-                condition: '等于'
-              }
-            ]
-          }
-        ],
-        zkyj: [
-          {
-            custom_basis: [{
-              param1: '',
-              input1: '',
-              input2: ''
-            }]
-          }
-        ],
-        zkyujing: [
-          {
+            ],
+            custom_basis: [], // 质控依据
+
             pre_warning_time: '',
-            custom_msg: {
-              aftertime: '',
-              param1: '',
-              input1: '',
-              input2: ''
-            }
+            custom_msg: {}
           }
-        ]
+        ],
+        qztj: []
       },
       rules: {
         description: [
@@ -613,51 +577,7 @@ export default {
     handleSelect(item) {
       console.log(item)
     },
-    // 添加质控预警
-    onAddZKyujing() {
-      this.ruleForm.zkyujing.push({
-        pre_warning_time: '',
-        custom_msg: {
-          aftertime: '',
-          param1: '',
-          input1: '',
-          input2: ''
-        }
-      })
-    },
-    // 删除质控预警大框
-    onDeleteZKyujing(index) {
-      this.ruleForm.zkyujing.splice(index, 1)
-    },
 
-    // 添加质控依据
-    onAddZKYJ() {
-      this.ruleForm.zkyj.push({
-        custom_basis: [
-          {
-            param1: '',
-            input1: '',
-            input2: ''
-          }
-        ]
-      })
-    },
-    // 删除质控依据大框
-    onDeleteZKYJ(index) {
-      this.ruleForm.zkyj.splice(index, 1)
-    },
-    // 新增质控依据大框中_条件
-    onAddTJZKYJ(index, sIndex) {
-      this.ruleForm.zkyj[index].custom_basis.push({
-        param1: '',
-        input1: '',
-        input2: ''
-      })
-    },
-    // 删除质控依据大框中_条件
-    onDeleteTJZKYJ(index, sIndex) {
-      this.ruleForm.zkyj[index].custom_basis.splice(sIndex, 1)
-    },
     // 添加前置条件大框
     onAddQZTJ() {
       this.ruleForm.qztj.push({
@@ -702,9 +622,48 @@ export default {
     onDeleteGZ(index, sIndex) {
       this.ruleForm.rule[index].condition_content.splice(sIndex, 1)
     },
+    // 添加质控依据
+    onAddZKYJ() {
+      this.ruleForm.rule[0].custom_basis.push({
+        param1: '',
+        input1: '',
+        input2: ''
+      })
+    },
+    // 删除质控依据大框
+    onDeleteZKYJ(index) {
+      this.ruleForm.rule[0].custom_basis = []
+    },
+    // 新增质控依据大框中_条件
+    onAddTJZKYJ(index, sIndex) {
+      this.ruleForm.rule[index].custom_basis.push({
+        param1: '',
+        input1: '',
+        input2: ''
+      })
+    },
+    // 删除质控依据大框中_条件
+    onDeleteTJZKYJ(index, sIndex) {
+      this.ruleForm.rule[index].custom_basis.splice(sIndex, 1)
+    },
+    // 添加质控预警
+    onAddZKyujing() {
+      this.ruleForm.rule[0].custom_msg = {
+        aftertime: '',
+        param1: '',
+        input1: '',
+        input2: ''
+      }
+    },
+    // 删除质控预警大框
+    onDeleteZKyujing(index) {
+      this.ruleForm.rule[0].custom_msg = {}
+    },
+
     hasEmptyValues(obj) {
       return Object.values(obj).some(value => !value)
     },
+
     // 验证前置条件
     judgeQZTJ() {
       const { qztj } = this.ruleForm
@@ -754,9 +713,7 @@ export default {
           status,
           rule_type,
           rule,
-          qztj,
-          zkyj,
-          zkyujing
+          qztj
         } = this.ruleForm
         rule.forEach(ele => {
           ele.condition_content.forEach(i => {
@@ -779,7 +736,7 @@ export default {
               error_level,
               status,
               rule_type,
-              rule: [...rule, ...qztj, ...zkyj, ...zkyujing]
+              rule: [...rule, ...qztj]
             }
             if (this.data.row.id) {
               params.id = this.data.row.id