浏览代码

Merge remote-tracking branch 'origin/uiUpdate0507' into test

zhouna 4 年之前
父节点
当前提交
55346f4d24

+ 30 - 11
package-lock.json

@@ -4836,7 +4836,8 @@
         "ansi-regex": {
           "version": "2.1.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "aproba": {
           "version": "1.2.0",
@@ -4857,12 +4858,14 @@
         "balanced-match": {
           "version": "1.0.0",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "brace-expansion": {
           "version": "1.1.11",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "balanced-match": "^1.0.0",
             "concat-map": "0.0.1"
@@ -4877,17 +4880,20 @@
         "code-point-at": {
           "version": "1.1.0",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "concat-map": {
           "version": "0.0.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "console-control-strings": {
           "version": "1.1.0",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "core-util-is": {
           "version": "1.0.2",
@@ -5004,7 +5010,8 @@
         "inherits": {
           "version": "2.0.4",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "ini": {
           "version": "1.3.5",
@@ -5016,6 +5023,7 @@
           "version": "1.0.0",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "number-is-nan": "^1.0.0"
           }
@@ -5030,6 +5038,7 @@
           "version": "3.0.4",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "brace-expansion": "^1.1.7"
           }
@@ -5037,12 +5046,14 @@
         "minimist": {
           "version": "0.0.8",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "minipass": {
           "version": "2.9.0",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "safe-buffer": "^5.1.2",
             "yallist": "^3.0.0"
@@ -5061,6 +5072,7 @@
           "version": "0.5.1",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "minimist": "0.0.8"
           }
@@ -5150,7 +5162,8 @@
         "number-is-nan": {
           "version": "1.0.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "object-assign": {
           "version": "4.1.1",
@@ -5162,6 +5175,7 @@
           "version": "1.4.0",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "wrappy": "1"
           }
@@ -5247,7 +5261,8 @@
         "safe-buffer": {
           "version": "5.1.2",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "safer-buffer": {
           "version": "2.1.2",
@@ -5283,6 +5298,7 @@
           "version": "1.0.2",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "code-point-at": "^1.0.0",
             "is-fullwidth-code-point": "^1.0.0",
@@ -5302,6 +5318,7 @@
           "version": "3.0.1",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "ansi-regex": "^2.0.0"
           }
@@ -5345,12 +5362,14 @@
         "wrappy": {
           "version": "1.0.2",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "yallist": {
           "version": "3.1.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         }
       }
     },

文件差异内容过多而无法显示
+ 1327 - 381
src/components/knowledgeExtra/AddDiagBase.vue


文件差异内容过多而无法显示
+ 603 - 481
src/components/knowledgeExtra/AddNewRule.vue


+ 683 - 0
src/components/knowledgeExtra/AddNewRuleTable.vue

@@ -0,0 +1,683 @@
+<style lang="less" scoped>
+.AddNewRuleTable {
+  width: 100%;
+  background: #fff;
+  margin-top: 20px;
+  padding: 20px;
+  box-sizing: border-box;
+  /deep/ .el-input--mini .el-input__inner,
+  .el-select {
+    width: 100%;
+  }
+  .btn_box {
+    width: 100%;
+    height: 100%;
+    display: flex;
+    align-items: center;
+    justify-content: space-around;
+    .btn_div {
+      flex: 1;
+      height: 40px;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+    }
+    img {
+      width: 20px;
+      height: 20px;
+      cursor: pointer;
+    }
+  }
+  .inp_box {
+    // width: 100px;
+    height: 100%;
+    margin: 0 auto;
+  }
+  .type_content {
+    /deep/ .el-form-item--mini.el-form-item,
+    .el-form-item--small.el-form-item {
+      margin: 0;
+      width: 100%;
+    }
+    display: flex;
+    // flex-wrap: wrap;
+    .type_content_item {
+      padding: 10px 0;
+      // flex: 1;
+      // min-width: 200px;
+    }
+  }
+  .custom_table_header {
+    vertical-align: middle;
+    &::before {
+      content: "*";
+      color: red;
+      font-size: 12px;
+      margin-right: 4px;
+    }
+  }
+  /deep/ .el-form-item__error {
+    position: relative;
+  }
+}
+</style>
+
+<template>
+  <!-- :prop="`klRuleByIdSub[${scope.$index}].subDescription`" -->
+  <div class="AddNewRuleTable">
+    <h4 style="marginbottom: 20px">规则内容</h4>
+    <el-table
+      border
+      :data="klRuleByIdSub"
+      style="width: 100%"
+      size="mini"
+      stripe
+      :span-method="ObjectSpanMethod"
+    >
+      <el-table-column width="80px" label="组" prop="groupType">
+        <template slot-scope="scope">
+          <div class="btn_box">
+            <div class="btn_div">
+              <img
+                @click="$emit('addGroup', null, { groupId: scope.row.groupId })"
+                src="../../images/add-new-rule-sub.png"
+                alt=""
+              />
+            </div>
+            <div class="btn_div">
+              <img
+                @click="$emit('delGroup', scope.row.groupId)"
+                v-if="!isLastDate(scope.row.groupId)"
+                src="../../images/add-new-rule-del.png"
+                alt=""
+              />
+            </div>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column
+        width="80px"
+        v-if="maxNum && maxNum > 1"
+        label="基础规则"
+        prop="groupType"
+      >
+        <template slot-scope="scope">
+          <div class="btn_box">
+            <div class="btn_div">
+              <img
+                v-if="!isMax(scope.row.groupId)"
+                @click="
+                  $emit('addGroup', scope.row.groupId, { index: scope.$index })
+                "
+                src="../../images/add-new-rule-sub.png"
+                alt=""
+              />
+            </div>
+            <div class="btn_div">
+              <img
+                @click="$emit('delGroupChild', scope.row.groupChildId)"
+                v-if="klRuleByIdSub.length > 1 && !scope.row.disabled"
+                src="../../images/add-new-rule-del.png"
+                alt=""
+              />
+            </div>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column width="170px" prop="subDescription">
+        <template slot="header" slot-scope="scope">
+          <div class="custom_table_header">基础规则名称</div>
+        </template>
+        <template slot-scope="scope">
+          <el-form-item
+            class="inp_box"
+            :prop="`klRuleByIdSub[${scope.$index}].subDescription`"
+            :rules="rules.subDescription"
+          >
+            <el-input
+              type="text"
+              :disabled="scope.row.disabled"
+              v-model="scope.row.subDescription"
+              clearable
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </template>
+      </el-table-column>
+      <el-table-column width="170px" prop="subType">
+        <template slot="header" slot-scope="scope">
+          <div class="custom_table_header">基础规则类型</div>
+        </template>
+        <template slot-scope="scope">
+          <el-form-item
+            class="inp_box"
+            :prop="`klRuleByIdSub[${scope.$index}].subType`"
+            :rules="rules.subType"
+          >
+            <el-select
+              v-model="scope.row.subType"
+              :disabled="scope.row.disabled"
+              placeholder="请选择"
+              @change="subTypeChange($event, scope.$index)"
+            >
+              <el-option
+                v-for="item in scope.row.baseTypes"
+                :key="item.id"
+                :label="item.name"
+                :value="item.type"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </template>
+      </el-table-column>
+      <el-table-column width="170px" prop="subLenCode">
+        <template slot="header" slot-scope="scope">
+          <div class="custom_table_header">基础规则术语类型</div>
+        </template>
+        <template slot-scope="scope">
+          <el-form-item
+            class="inp_box"
+            :prop="`klRuleByIdSub[${scope.$index}].subLenCode`"
+            :rules="rules.subLenCode"
+          >
+            <el-select
+              :disabled="scope.row.disabled"
+              v-model="scope.row.subLenCode"
+              placeholder="请选择"
+              @change="subCodeChange($event, scope.$index)"
+            >
+              <el-option
+                v-for="item in scope.row.baseTermTypeList"
+                :key="item.id"
+                :label="item.name"
+                :value="item.code"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </template>
+      </el-table-column>
+      <el-table-column width="170px" label="医学标准术语" prop="subConceptId">
+        <template slot="header" slot-scope="scope">
+          <div class="custom_table_header">医学标准术语</div>
+        </template>
+        <template slot-scope="scope">
+          <el-form-item
+            class="inp_box"
+            :prop="`klRuleByIdSub[${scope.$index}].subConceptId`"
+            :rules="rules.subConceptId"
+          >
+            <el-select
+              clearable
+              remote
+              filterable
+              :disabled="scope.row.disabled"
+              @focus="subConceptIdfocus(scope.$index)"
+              :remote-method="searchConcept"
+              v-model.trim="scope.row.subConceptId"
+            >
+              <el-option
+                v-for="item in scope.row.conceptList"
+                :key="item.conceptId"
+                :label="item.conceptName"
+                :value="item.conceptId"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </template>
+      </el-table-column>
+      <el-table-column label="规则具体内容" min-width="900px" prop="">
+        <template slot-scope="scope">
+          <div class="type_content">
+            <el-form-item
+              class="type_content_item"
+              style="width: 240px; marginright: 20px"
+              label="选择类型:"
+              label-width="100px"
+              :prop="`klRuleByIdSub[${scope.$index}].dataType`"
+              :rules="rules.dataType"
+              v-if="scope.row.subType === 2 && showDataType(scope.$index)"
+            >
+              <el-select
+                v-model="scope.row.dataType"
+                placeholder="请选择"
+                @change="dataTypeChange($event, scope.$index)"
+              >
+                <el-option label="数值类型" value="1"> </el-option>
+                <el-option label="文本类型" value="2"> </el-option>
+              </el-select>
+            </el-form-item>
+            <!-- v-if="klRuleByIdSub[scope.$index].dataType === '1'" -->
+            <el-form-item
+              class="type_content_item"
+              style="flex: 2;margin:0 10px"
+              label="最大值:"
+              v-if="scope.row.dataType === '1'"
+            >
+              <div>
+                <el-row :gutter="10">
+                  <el-col :span="6">
+                    <el-form-item
+                      :prop="`klRuleByIdSub[${scope.$index}].subMaxOperator`"
+                      :rules="[
+                        {
+                          validator: (rule, value, callback) => {
+                            subMaxOperator(scope, rule, value, callback);
+                          },
+                          trigger: 'blur'
+                        }
+                      ]"
+                    >
+                      <el-select
+                        v-model="scope.row.subMaxOperator"
+                        placeholder="请选择"
+                        clearable
+                      >
+                        <el-option
+                          v-for="item in operMaxList"
+                          :key="item.key"
+                          :label="item.name"
+                          :value="item.key"
+                        >
+                        </el-option>
+                      </el-select>
+                    </el-form-item>
+                  </el-col>
+                  <el-col :span="6">
+                    <el-form-item
+                      :prop="`klRuleByIdSub[${scope.$index}].subMaxValue`"
+                      :rules="[
+                        {
+                          validator: (rule, value, callback) => {
+                            subMaxValue(scope, rule, value, callback);
+                          },
+                          trigger: 'blur'
+                        }
+                      ]"
+                    >
+                      <el-input
+                        type="text"
+                        v-model="scope.row.subMaxValue"
+                        placeholder="填写数值"
+                      />
+                    </el-form-item>
+                  </el-col>
+                  <el-col :span="6">
+                    <el-form-item
+                      :prop="`klRuleByIdSub[${scope.$index}].subMaxUnit`"
+                      :rules="rules.subMaxUnit"
+                    >
+                      <el-input
+                        type="text"
+                        v-model.trim="scope.row.subMaxUnit"
+                        placeholder="填写单位"
+                      />
+                    </el-form-item>
+                  </el-col>
+                </el-row>
+              </div>
+            </el-form-item>
+            <el-form-item
+              class="type_content_item"
+              style="flex: 2"
+              label="最小值:"
+              v-if="scope.row.dataType === '1'"
+            >
+              <div class="select-item clearfix">
+                <el-row :gutter="10">
+                  <el-col :span="6">
+                    <el-form-item
+                      :prop="`klRuleByIdSub[${scope.$index}].subMinOperator`"
+                      :rules="[
+                        {
+                          validator: (rule, value, callback) => {
+                            subMinOperatorRule(scope, rule, value, callback);
+                          },
+                          trigger: 'blur'
+                        }
+                      ]"
+                    >
+                      <el-select
+                        v-model="scope.row.subMinOperator"
+                        placeholder="请选择"
+                        clearable
+                      >
+                        <el-option
+                          v-for="item in operMinList"
+                          :key="item.name"
+                          :label="item.name"
+                          :value="item.name"
+                        >
+                        </el-option>
+                      </el-select>
+                    </el-form-item>
+                  </el-col>
+                  <el-col :span="6">
+                    <el-form-item
+                      :prop="`klRuleByIdSub[${scope.$index}].subMinValue`"
+                      :rules="[
+                        {
+                          validator: (rule, value, callback) => {
+                            subMinValueRule(scope, rule, value, callback);
+                          },
+                          trigger: 'blur'
+                        }
+                      ]"
+                    >
+                      <el-input
+                        type="text"
+                        v-model="scope.row.subMinValue"
+                        placeholder="填写数值"
+                      />
+                    </el-form-item>
+                  </el-col>
+                  <el-col :span="6">
+                    <el-form-item
+                      :prop="`klRuleByIdSub[${scope.$index}].subMinUnit`"
+                      :rules="rules.subMinUnit"
+                    >
+                      <el-input
+                        type="text"
+                        v-model.trim="scope.row.subMinUnit"
+                        placeholder="填写单位"
+                      />
+                    </el-form-item>
+                  </el-col>
+                </el-row>
+              </div>
+            </el-form-item>
+            <!-- v-if="klRuleByIdSub[scope.$index].subType !== 6 && klRuleByIdSub[scope.$index].dataType === '2'" -->
+            <el-form-item
+              class="type_content_item"
+              style="flex: 2"
+              v-if="scope.row.subType !== 6 && scope.row.dataType === '2'"
+              label="医学内容:"
+              label-width="100px"
+              :prop="`klRuleByIdSub[${scope.$index}].subEqValue`"
+              :rules="[
+                {
+                  validator: (rule, value, callback) => {
+                    subEqValue(scope, rule, value, callback);
+                  },
+                  trigger: 'blur'
+                }
+              ]"
+            >
+              <el-input
+                type="textarea"
+                rows="3"
+                placeholder="请输入医学内容"
+                v-model.trim="scope.row.subEqValue"
+              ></el-input>
+            </el-form-item>
+            <!-- v-if="groupData.subType === 6" -->
+            <el-form-item
+              class="type_content_item"
+              label="正则表达式:"
+              label-width="120px"
+              style="flex: 2"
+              v-if="scope.row.subType === 6"
+              :prop="`klRuleByIdSub[${scope.$index}].subEqValue`"
+              :rules="[
+                {
+                  validator: (rule, value, callback) => {
+                    subEqValuerule(scope, rule, value, callback);
+                  },
+                  trigger: 'blur'
+                }
+              ]"
+            >
+              <el-input
+                type="textarea"
+                rows="2"
+                placeholder="请输入正则表达式"
+                v-model.trim="scope.row.subEqValue"
+              ></el-input>
+            </el-form-item>
+          </div>
+        </template>
+      </el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import api from "@api/knowledgeLib.js";
+import { tableRules } from "./rules";
+export default {
+  name: "AddNewRuleTable",
+  data() {
+    return {
+      numTypes: "",
+      subConceptIdIndex: "",
+      operMaxList: [
+        { name: "<=", key: "<=" },
+        { name: "<", key: "<" }
+      ],
+      operMinList: [
+        { name: ">", key: ">" },
+        { name: ">=", key: ">=" }
+      ],
+      rules: tableRules
+    };
+  },
+  methods: {
+    // 最大值 选择rule
+    subMaxOperator(scope, rule, value, callback) {
+      const { subMaxValue, subMinOperator, subMinValue } = scope.row;
+      const val = value + subMinOperator + subMinValue + subMaxValue;
+      if (!val || (!value && subMaxValue !== "")) {
+        callback(new Error("最大值和最小值至少完整填写一个,单位不必填"));
+      } else {
+        callback();
+      }
+    },
+    // 最大值 数值rule
+    subMaxValue(scope, rule, value, callback) {
+      const { subMaxOperator, subMinOperator, subMinValue } = scope.row;
+      const val = value + subMaxOperator + subMinValue + subMinOperator;
+      const isNum = /^(\-|\+)?\d+(\.\d+)?$/.test(value);
+      if (!val || (value == "" && subMaxOperator)) {
+        callback(new Error("最大值和最小值至少完整填写一个,单位不必填"));
+      } else if (value !== "" && !isNum) {
+        callback(new Error("只能输入数字"));
+      } else {
+        callback();
+      }
+    },
+    // 最小值 选择rule
+    subMinOperatorRule(scope, rule, value, callback) {
+      const { subMaxValue, subMaxOperator, subMinValue } = scope.row;
+      const val = value + subMaxOperator + subMinValue + subMaxValue;
+      if (
+        !val ||
+        (!value && subMinValue !== "最大值和最小值至少完整填写一个,单位不必填")
+      ) {
+        callback(new Error("最大值和最小值至少完整填写一个,单位不必填"));
+      } else {
+        callback();
+      }
+    },
+    // 最小值 数值rule
+    subMinValueRule(scope, rule, value, callback) {
+      const { subMaxValue, subMinOperator, subMaxOperator } = scope.row;
+      const val = value + subMaxOperator + subMaxValue + subMinOperator;
+      const isNum = /^(\-|\+)?\d+(\.\d+)?$/.test(value);
+      if (!val || (value == "" && subMinOperator)) {
+        callback(new Error("最大值和最小值至少完整填写一个,单位不必填"));
+      } else if (value !== "" && !isNum) {
+        callback(new Error("只能输入数字"));
+      } else {
+        callback();
+      }
+    },
+    // 医学内容rule
+    subEqValue(scope, rule, value, callback) {
+      if (value === "") {
+        callback(new Error("请输入" + this.textName(scope.$index)));
+      } else if (value.length > 200) {
+        callback(new Error(this.textName(scope.$index) + "不能超过200字"));
+      } else {
+        callback();
+      }
+    },
+    // 正则rule
+    subEqValuerule(scope, rule, value, callback) {
+      if (value === "") {
+        callback(new Error("请输入" + this.textName));
+      } else if (value.length > 200) {
+        callback(new Error(this.textName + "不能超过200字"));
+      } else {
+        callback();
+      }
+    },
+    // 判断是否为最后一条规则
+    isLastDate(id) {
+      const tableLength = this.klRuleByIdSub.filter(
+        (item) => item.groupId !== id
+      ).length;
+      return tableLength === 0;
+    },
+    // 是否超出最大规则数
+    isMax(id) {
+      const typeNum = this.klRuleByIdSub.filter((item) => item.groupId === id)
+        .length;
+      return typeNum >= this.maxNum;
+    },
+    // 基础规则类型选择
+    subTypeChange(e, index) {
+      this.$emit("subTypeChange", e, index);
+    },
+    // 规则术语类型
+    subCodeChange(val, index) {
+      //基础规则术语类型修改
+      if ((this.numTypes + ",").indexOf(val + ",") > -1) {
+        this.klRuleByIdSub[index].dataType = "1";
+      } else {
+        this.klRuleByIdSub[index].dataType = "";
+      }
+      this.clearConcept(index);
+      this.clearNumText(index);
+    },
+    clearConcept(index) {
+      this.klRuleByIdSub[index].subConceptId = "";
+      this.klRuleByIdSub[index].conceptList = [];
+    },
+    clearNumText(index) {
+      this.klRuleByIdSub[index].subMaxOperator = "";
+      this.klRuleByIdSub[index].subMaxValue = "";
+      this.klRuleByIdSub[index].subMaxUnit = "";
+      this.klRuleByIdSub[index].subMinOperator = "";
+      this.klRuleByIdSub[index].subMinValue = "";
+      this.klRuleByIdSub[index].subMinUnit = "";
+      this.klRuleByIdSub[index].subEqValue = "";
+      this.klRuleByIdSub[index].subEqOperator = "";
+    },
+    //医学标准术语change
+    subConceptIdfocus(index) {
+      this.subConceptIdIndex = "";
+      this.subConceptIdIndex = index;
+    },
+    // 医学标准术语
+    searchConcept(val) {
+      const param = {
+        excludedConceptIds: [
+          this.klRuleByIdSub[this.subConceptIdIndex].subType
+        ],
+        libType: this.klRuleByIdSub[this.subConceptIdIndex].subLenCode,
+        name: val
+      };
+      api
+        .searchConcept(param)
+        .then((res) => {
+          if (res.data.code == "0") {
+            const data = res.data.data;
+            this.$emit("setFormData", this.subConceptIdIndex, data);
+          }
+        })
+        .catch((error) => {
+          console.log(error);
+        });
+    },
+    dataTypeChange(val, index) {
+      this.klRuleByIdSub[index].subEqOperator = val === "2" ? "=" : "";
+      this.clearNumText(index);
+      delete this.klRuleByIdSub[index].dataType; //触发更新
+      this.$set(this.klRuleByIdSub[index], "dataType", val);
+    },
+    // 处理要合并相同行的列
+    getSpanArr(data) {
+      this.spanArr = [];
+      for (var i = 0; i < data.length; i++) {
+        if (i === 0) {
+          // 如果是第一条记录(即索引是0的时候),向数组中加入1
+          /** *
+           * 例子:
+           * name:1
+           * name:1
+           * name:2
+           * name:2
+           * 最终结果:spanArr = [2,0,2,0]
+           */
+          this.spanArr.push(1);
+          this.pos = 0;
+        } else {
+          if (data[i].groupId === data[i - 1].groupId) {
+            // 如果remark相等就累加,并且push 0
+            this.spanArr[this.pos] += 1;
+            this.spanArr.push(0);
+          } else {
+            // 不相等push 1,并且pos 要换成当前下标
+            this.spanArr.push(1);
+            this.pos = i;
+          }
+        }
+      }
+    },
+    // 合并单元格
+    ObjectSpanMethod({ row, column, rowIndex, columnIndex }) {
+      if (columnIndex == 0) {
+        const _row = this.spanArr[rowIndex];
+        const _col = _row > 0 ? 1 : 0;
+        return {
+          rowspan: _row,
+          colspan: _col
+        };
+      }
+    },
+    showDataType(index) {
+      return (
+        (this.numTypes + ",").indexOf(
+          this.klRuleByIdSub[index].subLenCode + ","
+        ) === -1
+      );
+    },
+    textName(index) {
+      return this.klRuleByIdSub[index].subType !== 6 &&
+        this.klRuleByIdSub[index].dataType === "2"
+        ? "医学内容"
+        : "正则表达式";
+    }
+  },
+  components: {},
+  created() {
+    this.numTypes = localStorage.getItem("zskNumDict");
+    this.getSpanArr(this.klRuleByIdSub);
+  },
+  beforeUpdate() {
+    this.getSpanArr(this.klRuleByIdSub);
+  },
+  props: {
+    klRuleByIdSub: {
+      type: Array,
+      required: true
+    },
+    maxNum: {
+      default: null
+    }
+  }
+};
+</script>
+

+ 426 - 382
src/components/knowledgeExtra/DiagBase.vue

@@ -1,398 +1,442 @@
 <template>
-    <div>
-        <crumbs title="诊断依据维护" :minWidth="titleWidth" class="knowledgeTitle">
-            <el-form :inline="true" class="demo-form-inline">
-                <el-form-item label="疾病名称:">
-                    <el-input size="mini" v-model="filter.conceptName" placeholder="输入疾病名称" clearable></el-input>
-                </el-form-item>
-                <el-form-item label="描述:">
-                    <el-input size="mini" v-model="filter.description" placeholder="输入描述" clearable></el-input>
-                </el-form-item>
-                <el-form-item label="状态:">
-                    <el-select v-model="filter.status" clearable placeholder="请选择" size="mini">
-                        <el-option
-                                v-for="item in stateSelect"
-                                :key="item.id"
-                                :label="item.name"
-                                :value="item.id">
-                        </el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item>
-                    <el-button size="mini" @click="filterDatas">确认</el-button>
-                </el-form-item>
-                <el-form class="secLine">
-                    <el-form-item>
-                        <el-button size="mini" @click="addRule" type="warning" style="margin:0 10px">+ 新增诊断依据</el-button>
-                        <el-button size="mini" @click="update">更新数据</el-button>
-                    </el-form-item>
-                </el-form>
-            </el-form>
-        </crumbs>
-        <div class="contents knowledgeContents">
-            <el-table :data="list"
-                      border
-                      style="width: 100%">
-                <el-table-column
-                        type="index"
-                        :index="indexMethod"
-                        label="编号"
-                        width="60">
-                </el-table-column>
-                <el-table-column
-                        prop="conceptName"
-                        label="疾病名称"
-                        width="160">
-                    <template slot-scope="scope">
-                        <el-tooltip v-if="scope.row.conceptName.length>8" class="item" effect="dark" :content="scope.row.conceptName" placement="top">
-                            <span>{{scope.row.conceptName.slice(0,8)+'...'}}</span>
-                        </el-tooltip>
-                        <span v-if="scope.row.conceptName.length<9">{{scope.row.conceptName}}</span>
-                    </template>
-                </el-table-column>
-                <el-table-column
-                        prop="description"
-                        label="描述"
-                        width="160">
-                    <template slot-scope="scope">
-                        <el-tooltip v-if="scope.row.description.length>8" class="item" effect="dark" :content="scope.row.description" placement="top">
-                            <span>{{scope.row.description.slice(0,8)+'...'}}</span>
-                        </el-tooltip>
-                        <span v-if="scope.row.description.length<9">{{scope.row.description}}</span>
-                    </template>
-                </el-table-column>
-                <el-table-column
-                        label="状态">
-                    <template slot-scope="scope">
-                          <span>
-                            {{scope.row.status === 0?'禁用':'启用'}}
-                          </span>
-                    </template>
-                </el-table-column>
-                <el-table-column
-                        prop="modifierName"
-                        label="操作人">
-                </el-table-column>
-                <el-table-column
-                        prop="gmtModified"
-                        label="操作时间"
-                        width="180">
-                </el-table-column>
-                <el-table-column
-                        label="操作"
-                        width="180" fixed="right">
-                    <template slot-scope="scope">
-                        <el-button type="text" size="small" @click="editData(scope.row)">修改</el-button>
-                        <span style="margin:0 3px;">|</span>
-                        <el-button type="text" size="small" @click="editData(scope.row,true)">复制</el-button>
-                        <span style="margin:0 3px;">|</span>
-                        <el-button type="text" size="small" :class="scope.row.status === 0?'':'unvailable'" @click="showDelDialog(scope.row)">{{scope.row.status === 0?'启用':'禁用'}}</el-button>
-                        <span style="margin:0 3px;">|</span>
-                        <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row,1)">删除</el-button>
-                    </template>
-                </el-table-column>
-            </el-table>
-            <el-pagination :current-page.sync="currentPage"
-                           @current-change="currentChange"
-                           background
-                           :page-size="pageSize"
-                           :page-sizes="pageSizeArr"
-                           @size-change="handleSizeChange"
-                           :layout="pageLayout"
-                           :total="total">
-            </el-pagination>
-        </div>
-
+  <div>
+    <crumbs title="诊断依据维护" :minWidth="titleWidth" class="knowledgeTitle">
+      <el-form :inline="true" class="demo-form-inline">
+        <el-form-item label="疾病名称:">
+          <el-input size="mini" v-model="filter.conceptName" placeholder="输入疾病名称" clearable></el-input>
+        </el-form-item>
+        <el-form-item label="描述:">
+          <el-input size="mini" v-model="filter.description" placeholder="输入描述" clearable></el-input>
+        </el-form-item>
+        <el-form-item label="状态:">
+          <el-select v-model="filter.status" clearable placeholder="请选择" size="mini">
+            <el-option
+              v-for="item in stateSelect"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button size="mini" @click="filterDatas">确认</el-button>
+        </el-form-item>
+        <el-form class="secLine">
+          <el-form-item>
+            <el-button size="mini" @click="addRule" type="warning" style="margin:0 10px">+ 新增诊断依据</el-button>
+            <el-button size="mini" @click="update">更新数据</el-button>
+          </el-form-item>
+        </el-form>
+      </el-form>
+    </crumbs>
+    <div class="contents knowledgeContents">
+      <el-table :data="list" border style="width: 100%">
+        <el-table-column type="index" :index="indexMethod" label="编号" width="60"></el-table-column>
+        <el-table-column prop="conceptName" label="疾病名称" width="160">
+          <template slot-scope="scope">
+            <el-tooltip
+              v-if="scope.row.conceptName.length>8"
+              class="item"
+              effect="dark"
+              :content="scope.row.conceptName"
+              placement="top"
+            >
+              <span>{{scope.row.conceptName.slice(0,8)+'...'}}</span>
+            </el-tooltip>
+            <span v-if="scope.row.conceptName.length<9">{{scope.row.conceptName}}</span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="description" label="描述" width="160">
+          <template slot-scope="scope">
+            <el-tooltip
+              v-if="scope.row.description.length>8"
+              class="item"
+              effect="dark"
+              :content="scope.row.description"
+              placement="top"
+            >
+              <span>{{scope.row.description.slice(0,8)+'...'}}</span>
+            </el-tooltip>
+            <span v-if="scope.row.description.length<9">{{scope.row.description}}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="状态">
+          <template slot-scope="scope">
+            <span>{{scope.row.status === 0?'禁用':'启用'}}</span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="modifierName" label="操作人"></el-table-column>
+        <el-table-column prop="gmtModified" label="操作时间" width="180"></el-table-column>
+        <el-table-column label="操作" width="180" fixed="right">
+          <template slot-scope="scope">
+            <el-button type="text" size="small" @click="editData(scope.row)">修改</el-button>
+            <span style="margin:0 3px;">|</span>
+            <el-button type="text" size="small" @click="editData(scope.row,true)">复制</el-button>
+            <span style="margin:0 3px;">|</span>
+            <el-button
+              type="text"
+              size="small"
+              :class="scope.row.status === 0?'':'unvailable'"
+              @click="showDelDialog(scope.row)"
+            >{{scope.row.status === 0?'启用':'禁用'}}</el-button>
+            <span style="margin:0 3px;">|</span>
+            <el-button
+              type="text"
+              size="small"
+              class="delete"
+              @click="showDelDialog(scope.row,1)"
+            >删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <el-pagination
+        :current-page.sync="currentPage"
+        @current-change="currentChange"
+        background
+        :page-size="pageSize"
+        :page-sizes="pageSizeArr"
+        @size-change="handleSizeChange"
+        :layout="pageLayout"
+        :total="total"
+      ></el-pagination>
     </div>
+  </div>
 </template>
 
 <script>
-    import api from '@api/zskDiagBase.js';
-    import config from '@api/config.js';
-    import utils from '@api/utils.js';
+import api from '@api/zskDiagBase.js';
+import config from '@api/config.js';
+import utils from '@api/utils.js';
 
-    export default {
-        name: 'ZskDiagBase',
-        data: function () {
-            return {
-                list: [],
-                stateSelect:[
-                    {id:1,name:'启用'},
-                    {id:0,name:'禁用'},
-                ],
-                ruleTypeList:[],
-                searched: false,
-                filter:{
-                    conceptName:'',
-                    description:'',
-                    status:''
-                },
-                cacheData: {},
-                currentPage: 1,
-                pageSize: config.pageSize,
-                pageSizeArr:config.pageSizeArr,
-                pageLayout:config.pageLayout,
-                total: 0,
-                titleWidth:'1070px' //头部最小宽度
+export default {
+  name: 'ZskDiagBase',
+  data: function() {
+    return {
+      list: [],
+      stateSelect: [
+        { id: 1, name: '启用' },
+        { id: 0, name: '禁用' }
+      ],
+      ruleTypeList: [],
+      searched: false,
+      filter: {
+        conceptName: '',
+        description: '',
+        status: ''
+      },
+      cacheData: {},
+      currentPage: 1,
+      pageSize: config.pageSize,
+      pageSizeArr: config.pageSizeArr,
+      pageLayout: config.pageLayout,
+      total: 0,
+      titleWidth: '1070px' //头部最小宽度
+    };
+  },
+  created() {
+    const param = this.$route.params;
+    if (param.currentPage) {
+      this.inCurrentPage = param.currentPage;
+      this.filter = param.filter;
+    }
+    this.getTypeList();
+    const that = this;
+    //返回时避免参数未赋值就获取列表
+    setTimeout(function() {
+      that.getDataList();
+    });
+  },
+  watch: {
+    filter: {
+      handler: function() {
+        this.searched = false;
+      },
+      deep: true
+    }
+  },
+  // beforeRouteEnter(to, from, next) {
+  //     next(vm => {
+  //         //const pm = to.param;
+  //         Object.assign(vm, to.params);
+  //         vm.inCurrentPage=to.params.currentPage;
+  //     })
+  // },
+  methods: {
+    getDict() {
+      api
+        .zskgetDict()
+        .then(res => {
+          if (res.data.code == '0') {
+            const data = res.data.data;
+            localStorage.setItem(
+              'zskDiagDicts',
+              `{"onlyNum":"${data['24'][0].val}","onlyTxt":"${data['25'][0].val}"}`
+            );
+          }
+        })
+        .catch(error => {
+          console.log(error);
+        });
+    },
+    getTypeList() {
+      this.getDict();
+      api
+        .getTypesList({ planCode: 'dis' })
+        .then(res => {
+          if (res.data.code == '0') {
+            const data = res.data.data;
+            localStorage.setItem('zskDiagList', JSON.stringify(data));
+          }
+        })
+        .catch(error => {
+          console.log(error);
+        });
+    },
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.currentPage = utils.getCurrentPage(
+        this.currentPage,
+        this.total,
+        this.pageSize
+      );
+      this.getDataList();
+    },
+    addRule() {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      this.$router.push({ name: 'AddZskDiagBase', params: pam });
+    },
+    filterDatas() {
+      this.currentPage = 1;
+      this.getDataList(1);
+    },
+    getDataList(flag, isTurnPage) {
+      const params = this.getFilterItems(isTurnPage);
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: 'Loading',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
+      api
+        .diagBasePage(params)
+        .then(res => {
+          loading.close();
+          if (res.data.code == '0') {
+            const data = res.data.data;
+            for (let j = 0; j < data.records.length; j++) {
+              data.records[j].condition =
+                data.records[j].parStatus == '1' ? '启用' : '禁用';
             }
-        },
-        created() {
-            const param = this.$route.params;
-            if(param.currentPage){
-                this.inCurrentPage = param.currentPage;
-                this.filter = param.filter
+            this.list = data.records;
+            if (!flag) {
+              //搜索时不缓存
+              this.cacheData[params.current] = data.records;
+            } else {
+              this.cacheData = {};
             }
-            this.getTypeList();
-            const that = this;
-            //返回时避免参数未赋值就获取列表
-            setTimeout(function(){
-                that.getDataList();
-            });
-        },
-        watch: {
-            'filter': {
-                handler: function () {
-                    this.searched = false;
-                },
-                deep: true
+            this.total = data.total;
+            if (this.inCurrentPage !== undefined) {
+              this.currentPage = this.inCurrentPage;
+              this.inCurrentPage = undefined;
             }
-        },
-        // beforeRouteEnter(to, from, next) {
-        //     next(vm => {
-        //         //const pm = to.param;
-        //         Object.assign(vm, to.params);
-        //         vm.inCurrentPage=to.params.currentPage;
-        //     })
-        // },
-        methods: {
-            getDict(){
-                api.zskgetDict().then((res) => {
-                    if (res.data.code == '0') {
-                        const data = res.data.data;
-                        localStorage.setItem("zskDiagDicts",`{"onlyNum":"${data['24'][0].val}","onlyTxt":"${data['25'][0].val}"}`);
-                    }
-                }).catch((error) => {
-                    console.log(error);
-                });
-            },
-            getTypeList(){
-                this.getDict();
-                api.getTypesList({planCode:'dis'}).then((res) => {
-                    if (res.data.code == '0') {
-                        const data = res.data.data;
-                        localStorage.setItem("zskDiagList",JSON.stringify(data));
-                    }
-                }).catch((error) => {
-                    console.log(error);
-                });
-            },
-            handleSizeChange(val){
-                this.pageSize = val;
-                this.currentPage = utils.getCurrentPage(this.currentPage, this.total, this.pageSize);
-                this.getDataList();
-            },
-            addRule(){
-                const pam = this.searched ? {
-                    currentPage: this.currentPage,
-                    pageSize:this.pageSize,
-                    filter: this.filter
-                } : {currentPage: this.currentPage,
-                    pageSize:this.pageSize};
-                this.$router.push({name: 'AddZskDiagBase', params: pam});
-            },
-            filterDatas(){
-                this.currentPage = 1;
-                this.getDataList(1);
-            },
-            getDataList(flag,isTurnPage) {
-                const params = this.getFilterItems(isTurnPage);
-                this.searched = true;
-                const loading = this.$loading({
-                    lock: true,
-                    text: 'Loading',
-                    spinner: 'el-icon-loading',
-                    background: 'rgba(0, 0, 0, 0.7)'
-                });
-                api.diagBasePage(params).then((res) => {
-                    loading.close();
-                    if (res.data.code == '0') {
-                        const data = res.data.data;
-                        for(let j = 0;j < data.records.length;j++){
-                            data.records[j].condition = (data.records[j].parStatus == '1'?'启用':'禁用')
-                        }
-                        this.list = data.records;
-                        if(!flag){//搜索时不缓存
-                            this.cacheData[params.current] = data.records;
-                        }else{
-                            this.cacheData = {}
-                        }
-                        this.total = data.total;
-                        if(this.inCurrentPage!==undefined){
-                            this.currentPage=this.inCurrentPage;
-                            this.inCurrentPage = undefined;
-                        }
-                    }else{
-                        this.warning(res.data.msg||'获取列表数据失败');
-                    }
-                }).catch((error) => {
-                    loading.close();
-                    console.log(error);
-                });
-            },
-            getFilterItems(isTurnPage) {
-                //翻页时筛选条件没点确定则清空
-                if(isTurnPage&&!this.searched){
-                    this.clearFilter();
-                };
-                const param = {
-                    current: this.inCurrentPage||this.currentPage,
-                    size: this.pageSize,
-                    conceptName: this.filter.conceptName,
-                    description: this.filter.description,
-                    status:this.filter.status
-                };
-                return param;
-            },
-            indexMethod(index) {
-                return ((this.currentPage - 1) * this.pageSize) + index + 1;
-            },
-            currentChange(next) {
-                this.currentPage = next;
-                /*if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+          } else {
+            this.warning(res.data.msg || '获取列表数据失败');
+          }
+        })
+        .catch(error => {
+          loading.close();
+          console.log(error);
+        });
+    },
+    getFilterItems(isTurnPage) {
+      //翻页时筛选条件没点确定则清空
+      if (isTurnPage && !this.searched) {
+        this.clearFilter();
+      }
+      const param = {
+        current: this.inCurrentPage || this.currentPage,
+        size: this.pageSize,
+        conceptName: this.filter.conceptName,
+        description: this.filter.description,
+        status: this.filter.status
+      };
+      return param;
+    },
+    indexMethod(index) {
+      return (this.currentPage - 1) * this.pageSize + index + 1;
+    },
+    currentChange(next) {
+      this.currentPage = next;
+      /*if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
                   this.list = this.cacheData[next];
                 } else {*/
-                this.getDataList(1,true);
-                //}
-            },
-            warning(msg,type){
-                this.$message({
-                    showClose: true,
-                    message:msg,
-                    type:type||'warning'
-                })
-            },
-            showConfirmDialog(msg,resolve){
-                this.$alert(msg, '提示', {
-                    confirmButtonText: '确定',
-                    type: 'warning'
-                }).then(() => {
-                    resolve();
-                }).catch(() => {});
-            },
-            editData(row,isCopy){
-                const pam = this.searched ? {
-                    currentPage: this.currentPage,
-                    pageSize:this.pageSize,
-                    filter: this.filter
-                } : {currentPage: this.currentPage,
-                    pageSize:this.pageSize};
-                api.diagBaseGetDetail({id:row.id}).then((res) => {
-                    if (res.data.code == '0') {
-                        const data = res.data.data;
-                        this.$router.push({name:'AddZskDiagBase',params:{...pam,data:{...row,klDiagnoseTypeVO:data},copy:isCopy}});
-                    }
-                }).catch((error) => {
-                    this.warning('获取详情失败,请重试')
-                });
-            },
-            showDelDialog(row,isDelete){
-                const params = {
-                    id:row.id
-                };
-                const txt=row.status===0?'重新启用':'禁用';
-                const warningTxt = isDelete?'是否删除该诊断依据?可能对现有系统造成影响':'是否'+txt+'该诊断依据?';
-                const handleFn = isDelete?api.diagBaseDelete:(row.status===0?api.diagBaseApply:api.diagBaseStop);
-                this.showConfirmDialog(warningTxt,()=>{
-                    handleFn(params).then((res)=>{
-                        if(res.data.code=='0'){
-                            if(!this.searched){
-                                //未点确认时清空搜索条件
-                                this.clearFilter();
-                            }
-                            if(isDelete){       //恢复成功后跳转到筛选条件的首页
-                                this.currentPage = 1;
-                            } else {
-                                if (this.filter.status!==''&&this.list.length === 1){
-                                    //有启用状态筛选条件且当前页只有最后一条数据删除时,删除成功后跳转到前一页
-                                    this.currentPage = this.currentPage===1?1:this.currentPage-1;
-                                }
-                            }
-                            this.warning(res.data.msg||'操作成功','success');
-                            this.getDataList();
-                        }else{
-                            this.warning(res.data.msg);
-                        }
-                    }).catch((error)=>{
-                        this.warning(error);
-                    })
-                });
-            },
-            clearFilter(){
-                this.filter={
-                    conceptName:'',
-                    description:'',
-                    status:''
-                };
-            },
-            update(){
-                const loading = this.$loading({
-                    lock: true,
-                    text: 'Loading',
-                    spinner: 'el-icon-loading',
-                    background: 'rgba(0, 0, 0, 0.7)'
-                });
-                api.updateDiagBase().then((res) => {
-                    loading.close();
-                    if (res.data.code == '0') {
-                        this.warning('更新成功','success');
-                        this.getDataList();
-                    }else{
-                        this.warning(res.data.msg||'更新失败,请重试');
-                    }
-                }).catch((error) => {
-                    loading.close();
-                    this.warning('更新失败,请重试')
-                });
-            },
-        }
+      this.getDataList(1, true);
+      //}
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || 'warning'
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$alert(msg, '提示', {
+        confirmButtonText: '确定',
+        type: 'warning'
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    editData(row, isCopy) {
+      const pam = this.searched
+        ? {
+            currentPage: this.currentPage,
+            pageSize: this.pageSize,
+            filter: this.filter
+          }
+        : { currentPage: this.currentPage, pageSize: this.pageSize };
+      api
+        .diagBaseGetDetail({ id: row.id })
+        .then(res => {
+          if (res.data.code == '0') {
+            const data = res.data.data;
+            this.$router.push({
+              name: 'AddZskDiagBase',
+              params: {
+                ...pam,
+                data: { ...row, klDiagnoseTypeVO: data },
+                copy: isCopy
+              }
+            });
+          }
+        })
+        .catch(error => {
+          this.warning('获取详情失败,请重试');
+        });
+    },
+    showDelDialog(row, isDelete) {
+      const params = {
+        id: row.id
+      };
+      const txt = row.status === 0 ? '重新启用' : '禁用';
+      const warningTxt = isDelete
+        ? '是否删除该诊断依据?可能对现有系统造成影响'
+        : '是否' + txt + '该诊断依据?';
+      const handleFn = isDelete
+        ? api.diagBaseDelete
+        : row.status === 0
+        ? api.diagBaseApply
+        : api.diagBaseStop;
+      this.showConfirmDialog(warningTxt, () => {
+        handleFn(params)
+          .then(res => {
+            if (res.data.code == '0') {
+              if (!this.searched) {
+                //未点确认时清空搜索条件
+                this.clearFilter();
+              }
+              if (isDelete) {
+                //恢复成功后跳转到筛选条件的首页
+                this.currentPage = 1;
+              } else {
+                if (this.filter.status !== '' && this.list.length === 1) {
+                  //有启用状态筛选条件且当前页只有最后一条数据删除时,删除成功后跳转到前一页
+                  this.currentPage =
+                    this.currentPage === 1 ? 1 : this.currentPage - 1;
+                }
+              }
+              this.warning(res.data.msg || '操作成功', 'success');
+              this.getDataList();
+            } else {
+              this.warning(res.data.msg);
+            }
+          })
+          .catch(error => {
+            this.warning(error);
+          });
+      });
+    },
+    clearFilter() {
+      this.filter = {
+        conceptName: '',
+        description: '',
+        status: ''
+      };
+    },
+    update() {
+      const loading = this.$loading({
+        lock: true,
+        text: 'Loading',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
+      api
+        .updateDiagBase()
+        .then(res => {
+          loading.close();
+          if (res.data.code == '0') {
+            this.warning('更新成功', 'success');
+            this.getDataList();
+          } else {
+            this.warning(res.data.msg || '更新失败,请重试');
+          }
+        })
+        .catch(error => {
+          loading.close();
+          this.warning('更新失败,请重试');
+        });
     }
+  }
+};
 </script>
 
 <style lang="less" scoped>
-    @import "../../less/admin.less";
-    /deep/ .container.knowledgeTitle {
-        height: 40px;
-        min-width: 970px!important;
-    }
-    .demo-form-inline{
-        margin: 0 20px 0 0;
-    }
-    /deep/ .contents.knowledgeContents {
-        padding: 64px 20px 0;
-    }
-    /deep/ .secLine.el-form {
-        float: right;
-        display: block;
-        position: relative;
-        top: -1px;
-    }
-    .delete{
-        color: red;
-    }
-    .review{
-        color: #22ccc8;
-    }
-    .el-table .cell{
-        overflow: hidden;
-        white-space: nowrap;
-    }
-    #upFile{
-        display: none !important;
-    }
-    .unvailable{
-        color: #FE7D3D;
-        &:hover,&:active,&:focus{
-            color: #f19061;
-        }
-    }
+@import '../../less/admin.less';
+/deep/ .container.knowledgeTitle {
+  height: 40px;
+  min-width: 970px !important;
+}
+.demo-form-inline {
+  margin: 0 20px 0 0;
+}
+/deep/ .contents.knowledgeContents {
+  padding: 64px 20px 0;
+}
+/deep/ .secLine.el-form {
+  float: right;
+  display: block;
+  position: relative;
+  top: -1px;
+}
+.delete {
+  color: red;
+}
+.review {
+  color: #22ccc8;
+}
+.el-table .cell {
+  overflow: hidden;
+  white-space: nowrap;
+}
+#upFile {
+  display: none !important;
+}
+.unvailable {
+  color: #fe7d3d;
+  &:hover,
+  &:active,
+  &:focus {
+    color: #f19061;
+  }
+}
 </style>

+ 3 - 0
src/components/knowledgeExtra/DiagBaseGroup.vue

@@ -47,6 +47,9 @@
             return {
             }
         },
+        mounted(){
+            console.log(this.data)
+        },
         computed:{
             len:function(){
                 return util.delNullObj(this.data.klDiagnoseDetail).length;

+ 430 - 366
src/components/knowledgeExtra/DiagBaseItem.vue

@@ -1,385 +1,449 @@
 <template>
-    <div class="groups-cont" v-if="groupData">
-        <!--<el-form ref="groupData" label-width="150px" class="sub-condition-form" :model="groupData" :rules="rules">-->
-        <div class="sub-condition-form">
-        <span v-if="!hideDel" class="del-btn"  @click="delRule">删除</span><!--:class="isLast?'disable del-btn':'del-btn'"-->
-            <el-form-item label="基础依据名称:" :key="0" :prop="ruleLine+ind+'.basDescription'">
-                <el-input v-model.trim = "groupData.basDescription" clearable></el-input>
+  <div class="groups-cont" v-if="groupData">
+    <!--<el-form ref="groupData" label-width="150px" class="sub-condition-form" :model="groupData" :rules="rules">-->
+    <div class="sub-condition-form">
+      <span v-if="!hideDel" class="del-btn" @click="delRule">删除</span>
+      <!--:class="isLast?'disable del-btn':'del-btn'"-->
+      <el-form-item label="基础依据名称:" :key="0" :prop="ruleLine+ind+'.basDescription'">
+        <el-input v-model.trim="groupData.basDescription" clearable></el-input>
+      </el-form-item>
+      <el-form-item label="基础依据类型:" :key="1" :prop="ruleLine+ind+'.basType'">
+        <el-select
+          v-model="groupData.basType"
+          id="basTypeRef"
+          placeholder="请选择"
+          size="small"
+          @change="basTypeChange"
+        >
+          <el-option v-for="item in baseTypes" :key="item.id" :label="item.name" :value="item.type"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item v-if="!showRegx" :key="2" label="基础依据术语类型:" :prop="ruleLine+ind+'.basLibType'">
+        <el-select
+          v-model="groupData.basLibType"
+          placeholder="请选择"
+          size="small"
+          :disabled="showRegx"
+          @change="basLibTypeChange"
+        >
+          <el-option
+            v-for="item in baseTermTypeList"
+            :key="item.id"
+            :label="item.name"
+            :value="Number(item.code)"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item v-if="showRegx" :key="3" label="基础依据术语类型:" class="is-required">
+        <el-input disabled v-model="basTypeName"></el-input>
+      </el-form-item>
+      <el-form-item
+        v-if="!showRegx"
+        :key="4"
+        class="addDepartFormItem"
+        label="医学标准术语:"
+        :prop="ruleLine+ind+'.basConceptId'"
+      >
+        <el-select
+          clearable
+          remote
+          filterable
+          :remote-method="searchConcept"
+          v-model.trim="groupData.basConceptId"
+          @change="conceptChange"
+        >
+          <el-option
+            v-for="item in conceptList"
+            :key="item.conceptId"
+            :label="item.conceptName"
+            :value="item.conceptId"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item
+        :key="5"
+        v-if="groupData.basType===2&&!onlyNum&&!onlyTxt"
+        label="选择类型:"
+        :prop="ruleLine+ind+'.dataType'"
+      >
+        <el-select
+          v-model="groupData.dataType"
+          placeholder="请选择"
+          size="small"
+          @change="dataTypeChange"
+        >
+          <el-option v-for="item in dataTypes" :key="item.id" :label="item.name" :value="item.id"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item
+        class="min-margin"
+        :key="6"
+        v-if="(!showRegx&&groupData.dataType==='1')||onlyNum"
+        label="最大值:"
+      >
+        <div class="select-item clearfix">
+          <el-col :span="3">
+            <el-form-item :prop="ruleLine+ind+'.maxOperator'">
+              <el-select v-model="groupData.maxOperator" placeholder="请选择" size="small" clearable>
+                <el-option
+                  v-for="item in operMaxList"
+                  :key="item.key"
+                  :label="item.name"
+                  :value="item.key"
+                ></el-option>
+              </el-select>
             </el-form-item>
-            <el-form-item label="基础依据类型:" :key="1" :prop="ruleLine+ind+'.basType'">
-                <el-select v-model="groupData.basType"
-                           id="basTypeRef"
-                           placeholder="请选择"
-                           size="small"
-                           @change="basTypeChange">
-                    <el-option
-                            v-for="item in baseTypes"
-                            :key="item.id"
-                            :label="item.name"
-                            :value="item.type">
-                    </el-option>
-                </el-select>
+          </el-col>
+          <el-col :span="3">
+            <el-form-item :prop="ruleLine+ind+'.maxVal'">
+              <el-input type="text" v-model="groupData.maxVal" placeholder="填写数值" />
             </el-form-item>
-            <el-form-item v-if="!showRegx" :key="2" label="基础依据术语类型:" :prop="ruleLine+ind+'.basLibType'">
-                <el-select v-model="groupData.basLibType"
-                           placeholder="请选择"
-                           size="small"
-                           :disabled="showRegx" @change="basLibTypeChange">
-                    <el-option
-                            v-for="item in baseTermTypeList"
-                            :key="item.id"
-                            :label="item.name"
-                            :value="Number(item.code)">
-                    </el-option>
-                </el-select>
+          </el-col>
+          <el-col :span="3">
+            <el-form-item prop="maxUnit">
+              <el-input type="text" v-model.trim="groupData.maxUnit" placeholder="填写单位" />
             </el-form-item>
-            <el-form-item v-if="showRegx" :key="3" label="基础依据术语类型:" class="is-required">
-                <el-input disabled v-model="basTypeName"></el-input>
-            </el-form-item>
-            <el-form-item v-if="!showRegx" :key="4" class="addDepartFormItem" label="医学标准术语:" :prop="ruleLine+ind+'.basConceptId'">
-                <el-select clearable remote filterable :remote-method="searchConcept" v-model.trim="groupData.basConceptId" @change="conceptChange">
-                    <el-option
-                            v-for="item in conceptList"
-                            :key="item.conceptId"
-                            :label="item.conceptName"
-                            :value="item.conceptId">
-                    </el-option>
-                </el-select>
-            </el-form-item>
-            <el-form-item :key="5" v-if="groupData.basType===2&&!onlyNum&&!onlyTxt" label="选择类型:" :prop="ruleLine+ind+'.dataType'">
-                <el-select v-model="groupData.dataType"
-                           placeholder="请选择"
-                           size="small" @change="dataTypeChange">
-                    <el-option
-                            v-for="item in dataTypes"
-                            :key="item.id"
-                            :label="item.name"
-                            :value="item.id">
-                    </el-option>
-                </el-select>
-            </el-form-item>
-            <el-form-item class="min-margin" :key="6" v-if="(!showRegx&&groupData.dataType==='1')||onlyNum" label="最大值:">
-                <div class="select-item clearfix">
-                    <el-col :span="3">
-                        <el-form-item :prop="ruleLine+ind+'.maxOperator'">
-                            <el-select v-model="groupData.maxOperator"
-                                       placeholder="请选择"
-                                       size="small" clearable>
-                                <el-option
-                                        v-for="item in operMaxList"
-                                        :key="item.key"
-                                        :label="item.name"
-                                        :value="item.key">
-                                </el-option>
-                            </el-select>
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="3">
-                        <el-form-item :prop="ruleLine+ind+'.maxVal'">
-                            <el-input type="text" v-model="groupData.maxVal" placeholder="填写数值"/>
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="3">
-                        <el-form-item prop="maxUnit">
-                            <el-input  type="text" v-model.trim="groupData.maxUnit" placeholder="填写单位"/>
-                        </el-form-item>
-                    </el-col>
-                </div>
-            </el-form-item>
-            <el-form-item class="min-margin" v-if="(!showRegx&&groupData.dataType==='1')||onlyNum" label="最小值:">
-                <div class="select-item clearfix">
-                    <el-col :span="3">
-                        <el-form-item :prop="ruleLine+ind+'.minOperator'">
-                            <el-select v-model="groupData.minOperator"
-                                       placeholder="请选择"
-                                       size="small" clearable>
-                                <el-option
-                                        v-for="item in operMinList"
-                                        :key="item.name"
-                                        :label="item.name"
-                                        :value="item.name">
-                                </el-option>
-                            </el-select>
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="3">
-                        <el-form-item :prop="ruleLine+ind+'.minVal'">
-                            <el-input type="text" v-model="groupData.minVal" placeholder="填写数值"/>
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="3">
-                        <el-form-item prop="minUnit">
-                            <el-input  type="text" v-model.trim="groupData.minUnit" placeholder="填写单位"/>
-                        </el-form-item>
-                    </el-col>
-                </div>
+          </el-col>
+        </div>
+      </el-form-item>
+      <el-form-item
+        class="min-margin"
+        v-if="(!showRegx&&groupData.dataType==='1')||onlyNum"
+        label="最小值:"
+      >
+        <div class="select-item clearfix">
+          <el-col :span="3">
+            <el-form-item :prop="ruleLine+ind+'.minOperator'">
+              <el-select v-model="groupData.minOperator" placeholder="请选择" size="small" clearable>
+                <el-option
+                  v-for="item in operMinList"
+                  :key="item.name"
+                  :label="item.name"
+                  :value="item.name"
+                ></el-option>
+              </el-select>
             </el-form-item>
-            <el-form-item v-if="showRegx" key="v11" label="正则表达式:" :prop="ruleLine+ind+'.eqValue'" class="discDesc">
-                <el-input type="textarea" rows="3" placeholder="请输入正则表达式" v-model.trim="groupData.eqValue"></el-input>
+          </el-col>
+          <el-col :span="3">
+            <el-form-item :prop="ruleLine+ind+'.minVal'">
+              <el-input type="text" v-model="groupData.minVal" placeholder="填写数值" />
             </el-form-item>
-            <el-form-item key="v13" v-if="(!onlyNum&&!showRegx&&groupData.basType===2&&groupData.dataType==='2')||onlyTxt" label="医学内容:" :prop="ruleLine+ind+'.eqValue'" class="discDesc">
-                <el-input placeholder="请输入医学内容" v-model.trim="groupData.eqValue"></el-input>
-                <span class="tip-text">注:可输入升高、降低、阴性、阳性等~</span>
+          </el-col>
+          <el-col :span="3">
+            <el-form-item prop="minUnit">
+              <el-input type="text" v-model.trim="groupData.minUnit" placeholder="填写单位" />
             </el-form-item>
+          </el-col>
         </div>
-        <!--</el-form>-->
+      </el-form-item>
+      <el-form-item
+        v-if="showRegx"
+        key="v11"
+        label="正则表达式:"
+        :prop="ruleLine+ind+'.eqValue'"
+        class="discDesc"
+      >
+        <el-input type="textarea" rows="3" placeholder="请输入正则表达式" v-model.trim="groupData.eqValue"></el-input>
+      </el-form-item>
+      <el-form-item
+        key="v13"
+        v-if="(!onlyNum&&!showRegx&&groupData.basType===2&&groupData.dataType==='2')||onlyTxt"
+        label="医学内容:"
+        :prop="ruleLine+ind+'.eqValue'"
+        class="discDesc"
+      >
+        <el-input placeholder="请输入医学内容" v-model.trim="groupData.eqValue"></el-input>
+        <span class="tip-text">注:可输入升高、降低、阴性、阳性等~</span>
+      </el-form-item>
     </div>
+    <!--</el-form>-->
+  </div>
 </template>
 <script>
-    import api from '@api/zskDiagBase.js';
-    export default {
-        name:'DiagBaseItem',
-        props:['groupData','ind','baseTypes','parInx','inx','hideDel'],
-        data(){
-            return {
-                dicts:{},
-                baseTermTypeList:[],
-                typeList:[],
-                numTypes:'',    //只有数值类型的类型id
-                //basTypeName:'',
-                operMaxList:[
-                    {name:'<=',key:'<='},
-                    {name:'<',key:'<'},
-                ],
-                operMinList:[{name:'>',key:'>'},
-                    {name:'>=',key:'>='},
-                ],
-                dataTypes:[{id:'1',name:'数值类型'},{id:'2',name:'文本类型'}],
-                conceptList:[],
-            }
-        },
-        created(){
-            this.dicts=JSON.parse(localStorage.getItem("zskDiagDicts")||'{}');
-            if(this.groupData){
-                if(this.groupData.maxOperator||this.groupData.minOperator){
-                    this.groupData.dataType='1';
-                }else if(this.groupData.eqValue){
-                    this.groupData.dataType='2';
-                }
-            }
-            this.conceptList=[{conceptName:this.groupData.basLibName,conceptId:this.groupData.basConceptId}];
-            if(this.groupData.basType){
-                const obj = this.baseTypes.find((it)=>it.type===this.groupData.basType);
-                this.baseTermTypeList = obj.subMenuList;
-            }
-        },
-        computed:{
-            basTypeName:function(){
-                return (this.baseTypes.find((it)=>it.type===this.groupData.basType)||{}).name;
-            },
-            onlyNum:function(){
-                const onlyNum =this.dicts['onlyNum']||'&';
-                const codes=onlyNum+',';
-                const type=this.groupData.basLibType;
-                return type&&codes.indexOf(this.groupData.basLibType+',')>-1;
-            },
-            onlyTxt:function(){
-                const onlyTxt =this.dicts['onlyTxt']||'&';
-                const codes=onlyTxt+',';
-                const type=this.groupData.basLibType;
-                return type&&codes.indexOf(this.groupData.basLibType+',')>-1;
-            },
-            ruleLine:function(){
-              return 'klDiagnoseTypeVO.'+this.parInx+'.groupVO.'+this.inx+'.klDiagnoseDetail.';
-            },
-            showRegx:function(){
-              return this.groupData.basType===3||this.groupData.basType===4;
-            },
-        },
-        methods:{
-            dataTypeChange(val){
-                this.groupData.eqOperator=(val==='2'?'=':'');
-                this.clearNumText();
-                delete this.groupData.dataType;     //触发更新
-                this.$set(this.groupData,'dataType',val);
-            },
-            basTypeChange(val){        //基础依据类型修改
-                if(!val){
-                    this.baseTermTypeList =[];
-                    return;
-                }
-                this.groupData.basLibType='';
-                this.groupData.dataType='';
-                this.clearConcept();    //清空医学标准术语
-                this.clearNumText();    //清空数值、医学内容
-                const obj = this.baseTypes.find((it)=>it.type===val);
-                this.baseTermTypeList = obj.subMenuList;
-            },
-            basLibTypeChange(val){        //基础依据术语类型修改
-                this.groupData.basLibType=val;
-                if((this.numTypes+',').indexOf(val+',')>-1){
-                    this.groupData.dataType='1';
-                }else{
-                    this.groupData.dataType='';
-                }
-                this.clearConcept();
-                this.clearNumText();
-            },
-            conceptChange(val){
-                this.groupData.basConceptId=val;
-                if(val){
-                    this.groupData.basLibName=this.conceptList.find((it)=>it.conceptId===val).conceptName;
-                }else{
-                    this.groupData.basLibName='';
-                }
-            },
-            clearConcept(){
-                this.groupData.basConceptId='';
-                this.groupData.basLibName='';
-                this.conceptList=[];
-            },
-            clearNumText(){
-                this.groupData.maxOperator='';
-                this.groupData.maxVal='';
-                this.groupData.maxUnit='';
-                this.groupData.minOperator='';
-                this.groupData.minVal='';
-                this.groupData.minUnit='';
-                this.groupData.eqValue='';
-                this.groupData.eqOperator='';
-            },
-            searchConcept(val){
-                const param = {
-                    excludedConceptIds:[this.groupData.basType],
-                    libType:this.groupData.basLibType,
-                    name:val,
-                };
-                api.searchConcept(param).then((res) => {
-                    if (res.data.code == '0') {
-                        const data = res.data.data;
-                        this.conceptList = data;
-                    }
-                }).catch((error) => {
-                    console.log(error);
-                });
-            },
-            /*addRule(){
+import api from '@api/zskDiagBase.js';
+export default {
+  name: 'DiagBaseItem',
+  props: ['groupData', 'ind', 'baseTypes', 'parInx', 'inx', 'hideDel'],
+  data() {
+    return {
+      dicts: {},
+      baseTermTypeList: [],
+      typeList: [],
+      numTypes: '', //只有数值类型的类型id
+      //basTypeName:'',
+      operMaxList: [
+        { name: '<=', key: '<=' },
+        { name: '<', key: '<' }
+      ],
+      operMinList: [
+        { name: '>', key: '>' },
+        { name: '>=', key: '>=' }
+      ],
+      dataTypes: [
+        { id: '1', name: '数值类型' },
+        { id: '2', name: '文本类型' }
+      ],
+      conceptList: []
+    };
+  },
+  created() {
+    this.dicts = JSON.parse(localStorage.getItem('zskDiagDicts') || '{}');
+    if (this.groupData) {
+      if (this.groupData.maxOperator || this.groupData.minOperator) {
+        this.groupData.dataType = '1';
+      } else if (this.groupData.eqValue) {
+        this.groupData.dataType = '2';
+      }
+    }
+    this.conceptList = [
+      {
+        conceptName: this.groupData.basLibName,
+        conceptId: this.groupData.basConceptId
+      }
+    ];
+    if (this.groupData.basType) {
+      const obj = this.baseTypes.find(it => it.type === this.groupData.basType);
+      this.baseTermTypeList = obj.subMenuList;
+    }
+  },
+  computed: {
+    basTypeName: function() {
+      return (
+        this.baseTypes.find(it => it.type === this.groupData.basType) || {}
+      ).name;
+    },
+    onlyNum: function() {
+      const onlyNum = this.dicts['onlyNum'] || '&';
+      const codes = onlyNum + ',';
+      const type = this.groupData.basLibType;
+      return type && codes.indexOf(this.groupData.basLibType + ',') > -1;
+    },
+    onlyTxt: function() {
+      const onlyTxt = this.dicts['onlyTxt'] || '&';
+      const codes = onlyTxt + ',';
+      const type = this.groupData.basLibType;
+      return type && codes.indexOf(this.groupData.basLibType + ',') > -1;
+    },
+    ruleLine: function() {
+      return (
+        'klDiagnoseTypeVO.' +
+        this.parInx +
+        '.groupVO.' +
+        this.inx +
+        '.klDiagnoseDetail.'
+      );
+    },
+    showRegx: function() {
+      return this.groupData.basType === 3 || this.groupData.basType === 4;
+    }
+  },
+  methods: {
+    dataTypeChange(val) {
+      this.groupData.eqOperator = val === '2' ? '=' : '';
+      this.clearNumText();
+      delete this.groupData.dataType; //触发更新
+      this.$set(this.groupData, 'dataType', val);
+    },
+    basTypeChange(val) {
+      //基础依据类型修改
+      if (!val) {
+        this.baseTermTypeList = [];
+        return;
+      }
+      this.groupData.basLibType = '';
+      this.groupData.dataType = '';
+      this.clearConcept(); //清空医学标准术语
+      this.clearNumText(); //清空数值、医学内容
+      const obj = this.baseTypes.find(it => it.type === val);
+      this.baseTermTypeList = obj.subMenuList;
+    },
+    basLibTypeChange(val) {
+      console.log(val)
+      //基础依据术语类型修改
+      this.groupData.basLibType = val;
+      console.log((this.numTypes + ',').indexOf(val + ','))
+      if ((this.numTypes + ',').indexOf(val + ',') > -1) {
+        this.groupData.dataType = '1';
+      } else {
+        this.groupData.dataType = '';
+      }
+      this.clearConcept();
+      this.clearNumText();
+    },
+    conceptChange(val) {
+      this.groupData.basConceptId = val;
+      if (val) {
+        this.groupData.basLibName = this.conceptList.find(
+          it => it.conceptId === val
+        ).conceptName;
+      } else {
+        this.groupData.basLibName = '';
+      }
+    },
+    clearConcept() {
+      this.groupData.basConceptId = '';
+      this.groupData.basLibName = '';
+      this.conceptList = [];
+    },
+    clearNumText() {
+      this.groupData.maxOperator = '';
+      this.groupData.maxVal = '';
+      this.groupData.maxUnit = '';
+      this.groupData.minOperator = '';
+      this.groupData.minVal = '';
+      this.groupData.minUnit = '';
+      this.groupData.eqValue = '';
+      this.groupData.eqOperator = '';
+    },
+    searchConcept(val) {
+      const param = {
+        excludedConceptIds: [this.groupData.basType],
+        libType: this.groupData.basLibType,
+        name: val
+      };
+      api
+        .searchConcept(param)
+        .then(res => {
+          if (res.data.code == '0') {
+            const data = res.data.data;
+            this.conceptList = data;
+          }
+        })
+        .catch(error => {
+          console.log(error);
+        });
+    },
+    /*addRule(){
                 this.$emit("addRule");
                 this.$emit('setRules');
             },*/
-            delRule(){
-                this.$emit("delRule",this.ind);
-                this.$emit('setRules');
-            },
-            warning(msg,type){
-                this.$message({
-                    showClose: true,
-                    message:msg,
-                    type:type||'warning'
-                })
-            },
-            showConfirmDialog(msg,resolve){
-                this.$alert(msg, '提示', {
-                    confirmButtonText: '确定',
-                    type: 'warning'
-                }).then(() => {
-                    resolve();
-                }).catch(() => {});
-            },
-        }
+    delRule() {
+      this.$emit('delRule', this.ind);
+      this.$emit('setRules');
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || 'warning'
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$alert(msg, '提示', {
+        confirmButtonText: '确定',
+        type: 'warning'
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
     }
+  }
+};
 </script>
 <style lang="less">
-    .groups-cont{
-        background: #fff;
-        border-bottom:2px solid #F5F5F5;
-        .conceptItem{
-            padding: 0 10px;
-            cursor: pointer;
-            height: 32px;
-            line-height: 32px;
-            &:hover{
-                background: #ebedf1;
-            }
-        }
-        .sub-condition-form{
-            padding:10px 20px 9px;
-            position: relative;
-            border-bottom:1px solid #F5F5F5;
-            .del-btn{
-                color: #FF5B5B;
-                cursor: pointer;
-                position: absolute;
-                right: 20px;
-                top:20px;
-                z-index: 1;
-                &.disable{
-                    color: #B8B8B8;
-                }
-            }
-        }
-        .el-input__icon{
-            line-height: 32px;
-        }
-        .select-item{
-            &>div{
-                float: left;
-                margin-right: 10px;
-            }
-            .el-input{
-                width: auto;
-            }
-            input{
-                width: 95px;
-                line-height: 32px;
-                height: 32px;
-            }
-        }
-        .el-input,.el-input__inner{
-            width: 190px;
-            line-height: 32px;
-            height: 32px;
-        }
-        .el-button--danger.is-plain{
-            background: none;
-        }
-        .itemList {
-            position: absolute;
-            // display: none;
-            background: #fff;
-            width: 188px;
-            max-height: 160px;
-            border: 1px solid #DCDFE6;
-            left: 0;
-            top: 37px;
-            z-index: 2;
-            overflow-y: auto;
-        }
-        .el-form-item{
-            margin-bottom: 6px;
-            &.min-margin{
-                margin-bottom: 0;
-                position: relative;
-                .el-form-item__content{
-                    position: unset;
-                }
-                .el-form-item__error{
-                    top:10px;
-                    left: 460px;
-                    white-space: normal;
-                    width: 260px;
-                }
-            }
-            .el-textarea + .el-form-item__error{
-                top:80px;
-                left: 0;
-            }
-            .tip-text + .el-form-item__error{
-                top:40px;
-                left: 0;
-            }
-        }
-
-        .el-input-number{
-            width: 95px;
-        }
-        .el-input-number.is-controls-right .el-input-number__decrease, .el-input-number.is-controls-right .el-input-number__increase{
-            width: 25px;
-            height: 15px;
-            line-height: 16px;
-        }
-        .el-col-3 {
-            width: 94px;
-        }
+.groups-cont {
+  background: #fff;
+  border-bottom: 2px solid #f5f5f5;
+  .conceptItem {
+    padding: 0 10px;
+    cursor: pointer;
+    height: 32px;
+    line-height: 32px;
+    &:hover {
+      background: #ebedf1;
+    }
+  }
+  .sub-condition-form {
+    padding: 10px 20px 9px;
+    position: relative;
+    border-bottom: 1px solid #f5f5f5;
+    .del-btn {
+      color: #ff5b5b;
+      cursor: pointer;
+      position: absolute;
+      right: 20px;
+      top: 20px;
+      z-index: 1;
+      &.disable {
+        color: #b8b8b8;
+      }
+    }
+  }
+  .el-input__icon {
+    line-height: 32px;
+  }
+  .select-item {
+    & > div {
+      float: left;
+      margin-right: 10px;
+    }
+    .el-input {
+      width: auto;
+    }
+    input {
+      width: 95px;
+      line-height: 32px;
+      height: 32px;
     }
+  }
+  .el-input,
+  .el-input__inner {
+    width: 190px;
+    line-height: 32px;
+    height: 32px;
+  }
+  .el-button--danger.is-plain {
+    background: none;
+  }
+  .itemList {
+    position: absolute;
+    // display: none;
+    background: #fff;
+    width: 188px;
+    max-height: 160px;
+    border: 1px solid #dcdfe6;
+    left: 0;
+    top: 37px;
+    z-index: 2;
+    overflow-y: auto;
+  }
+  .el-form-item {
+    margin-bottom: 6px;
+    &.min-margin {
+      margin-bottom: 0;
+      position: relative;
+      .el-form-item__content {
+        position: unset;
+      }
+      .el-form-item__error {
+        top: 10px;
+        left: 460px;
+        white-space: normal;
+        width: 260px;
+      }
+    }
+    .el-textarea + .el-form-item__error {
+      top: 80px;
+      left: 0;
+    }
+    .tip-text + .el-form-item__error {
+      top: 40px;
+      left: 0;
+    }
+  }
+
+  .el-input-number {
+    width: 95px;
+  }
+  .el-input-number.is-controls-right .el-input-number__decrease,
+  .el-input-number.is-controls-right .el-input-number__increase {
+    width: 25px;
+    height: 15px;
+    line-height: 16px;
+  }
+  .el-col-3 {
+    width: 94px;
+  }
+}
 </style>

+ 149 - 140
src/components/knowledgeExtra/DiagBaseType.vue

@@ -1,148 +1,157 @@
 <template>
-    <!--<el-form ref="form" class="add-new-form" label-width="130px" :model="data">-->
-   <div class="add-new-form">
-        <el-form-item label="诊断依据类型:" :prop="'klDiagnoseTypeVO.'+inx+'.conditionType'" class="diag-type">
-            <el-select v-model="data.conditionType"
-                       placeholder="请选择"
-                       size="small">
-                <el-option
-                        v-for="item in typeList"
-                        :key="item.ruleType"
-                        :label="item.name"
-                        :value="item.ruleType">
-                </el-option>
-            </el-select>
-            <span class="tip-text">注:选择诊断依据类型后才能展示基础依据类型~</span>
-        </el-form-item>
-        <DiagBaseGroup v-for="(group,i) in data.groupVO"
-                   ref="groups"
-                   :data="group"
-                   :diagTypeList="baseTypeList"
-                   :inx="i"
-                   :parInx="inx"
-                   :isLast="isLast&&data.groupVO.length===1"
-                   @setRules="setRules"
-                   @addGroup="addGroup"
-                   @delGroup="delGroup"></DiagBaseGroup>
+  <!--<el-form ref="form" class="add-new-form" label-width="130px" :model="data">-->
+  <div class="add-new-form">
+    <el-form-item
+      label="诊断依据类型:"
+      :prop="'klDiagnoseTypeVO.'+inx+'.conditionType'"
+      class="diag-type"
+    >
+      <el-select v-model="data.conditionType" placeholder="请选择" size="small">
+        <el-option
+          v-for="item in typeList"
+          :key="item.ruleType"
+          :label="item.name"
+          :value="item.ruleType"
+        ></el-option>
+      </el-select>
+      <span class="tip-text">注:选择诊断依据类型后才能展示基础依据类型~</span>
+    </el-form-item>
+    <DiagBaseGroup
+      v-for="(group,i) in data.groupVO"
+      ref="groups"
+      :data="group"
+      :diagTypeList="baseTypeList"
+      :inx="i"
+      :parInx="inx"
+      :isLast="isLast&&data.groupVO.length===1"
+      @setRules="setRules"
+      @addGroup="addGroup"
+      @delGroup="delGroup"
+    ></DiagBaseGroup>
     <div class="group-oper">
-        <el-button size="small" @click="addDiag">+新增依据</el-button>
-        <el-button size="small" class="copy-btn" @click="copyDiag"><img src="../../images/copy.png" alt="">复制依据</el-button>
-        <el-button :disabled="isLast" size="small" type="danger" plain @click="delDiag">-删除依据</el-button>
+      <el-button size="small" @click="addDiag">+新增依据</el-button>
+      <el-button size="small" class="copy-btn" @click="copyDiag">
+        <img src="../../images/copy.png" alt />复制依据
+      </el-button>
+      <el-button :disabled="isLast" size="small" type="danger" plain @click="delDiag">-删除依据</el-button>
     </div>
-          </div>
-       <!-- </el-form>-->
-      </template>
+  </div>
+  <!-- </el-form>-->
+</template>
       <script>
-          import DiagBaseGroup from './DiagBaseGroup';
-          import util from '../../api/utils.js'
-          export default {
-              name:'DiagBaseType',
-              props:['data','isLast','inx'],
-              data(){
-                  return {
-                      form:{},
-                      conditionType:'',
-                      typeObj:{},
-                      typeList:[],
-                      /*rules:{
+import DiagBaseGroup from './DiagBaseGroup';
+import util from '../../api/utils.js';
+export default {
+  name: 'DiagBaseType',
+  props: ['data', 'isLast', 'inx'],
+  data() {
+    return {
+      form: {},
+      conditionType: '',
+      typeObj: {},
+      typeList: []
+      /*rules:{
                           conditionType:[]
                       }*/
-                  }
-              },
-              computed:{
-                baseTypeList:function(){
-                    return this.typeObj[this.data.conditionType];
-                }
-              },
-              created(){
-                  this.getTypeList();
-              },
-              methods:{
-                  setRules(){
-                      this.$emit('setRules');
-                  },
-                  getTypeList(){
-                      const typeListData = JSON.parse(localStorage.getItem("zskDiagList"));
-                      this.typeObj=util.formatObj(typeListData,'ruleType');
-                      this.typeList = typeListData;
-                  },
-                  addDiag(){
-                      this.$emit("addDiag",this.inx);
-                  },
-                  delDiag(){
-                      this.$emit("delDiag",this.inx);
-                  },
-                  copyDiag(){
-                      this.$emit("copyDiag",this.inx);
-                  },
-                  addGroup(i){
-                      const temp={
-                          "baseGroup": '',
-                          "conditionGroup": '',
-                          "fitNo": '',
-                          "klDiagnoseDetail": [{
-                              "basConceptId": '',
-                              "basDescription": "",
-                              "basLename": "",
-                              "basLibName": "",
-                              "basLibType": null,
-                              "basType": '',
-                              "eqOperator": "",
-                              "eqUnit": "",
-                              "eqValue": "",
-                              "maxOperator": "",
-                              "maxUnit": "",
-                              "maxVal": "",
-                              "minOperator": "",
-                              "minUnit": "",
-                              "minVal": ""
-                          }]
-                      };
-                      this.data.groupVO.splice(i+1,0,temp);
-                      this.$emit('setRules');
-                  },
-                  delGroup(i){
-                      if(i===0&&this.data.groupVO.length===1){
-                          this.$emit("delDiag",this.inx);
-                          return;
-                      }
-                      this.data.groupVO.splice(i,1);
-                  }
-              },
-              components:{
-                  DiagBaseGroup
-              }
+    };
+  },
+  computed: {
+    baseTypeList: function() {
+      return this.typeObj[this.data.conditionType];
+    }
+  },
+  created() {
+    console.log(this.data)
+    this.getTypeList();
+  },
+  methods: {
+    setRules() {
+      this.$emit('setRules');
+    },
+    getTypeList() {
+      const typeListData = JSON.parse(localStorage.getItem('zskDiagList'));
+      this.typeObj = util.formatObj(typeListData, 'ruleType');
+      this.typeList = typeListData;
+    },
+    addDiag() {
+      this.$emit('addDiag', this.inx);
+    },
+    delDiag() {
+      this.$emit('delDiag', this.inx);
+    },
+    copyDiag() {
+      this.$emit('copyDiag', this.inx);
+    },
+    addGroup(i) {
+      const temp = {
+        baseGroup: '',
+        conditionGroup: '',
+        fitNo: '',
+        klDiagnoseDetail: [
+          {
+            basConceptId: '',
+            basDescription: '',
+            basLename: '',
+            basLibName: '',
+            basLibType: null,
+            basType: '',
+            eqOperator: '',
+            eqUnit: '',
+            eqValue: '',
+            maxOperator: '',
+            maxUnit: '',
+            maxVal: '',
+            minOperator: '',
+            minUnit: '',
+            minVal: ''
           }
-      </script>
+        ]
+      };
+      this.data.groupVO.splice(i + 1, 0, temp);
+      this.$emit('setRules');
+    },
+    delGroup(i) {
+      if (i === 0 && this.data.groupVO.length === 1) {
+        this.$emit('delDiag', this.inx);
+        return;
+      }
+      this.data.groupVO.splice(i, 1);
+    }
+  },
+  components: {
+    DiagBaseGroup
+  }
+};
+</script>
       <style lang="less" scoped>
-          .add-new-form{
-              background: #E3EAF4;
-              padding: 20px 0;
-          }
-          /deep/ .diag-type .el-form-item__error{
-              top: 35px!important;
-              left: 0!important;
-              background: none!important;
-          }
-          .diag-type{
-              background: #fff;
-              margin: 0 20px;
-              padding: 8px 0 15px;
-          }
-          .group-oper{
-              margin: 20px 20px 0 20px;
-              background: #fff;
-              padding: 8px 0 8px 205px;;
-              /*text-align: center;*/
-              .el-button{
-                  margin-right: 60px;
-              }
-              .copy-btn{
-                  border-color:#666;
-                  color: #666;
-                  img{
-                      margin-right: 5px;
-                  }
-              }
-          }
-      </style>
+.add-new-form {
+  background: #e3eaf4;
+  padding: 20px 0;
+}
+/deep/ .diag-type .el-form-item__error {
+  top: 35px !important;
+  left: 0 !important;
+  background: none !important;
+}
+.diag-type {
+  background: #fff;
+  margin: 0 20px;
+  padding: 8px 0 15px;
+}
+.group-oper {
+  margin: 20px 20px 0 20px;
+  background: #fff;
+  padding: 8px 0 8px 205px;
+  /*text-align: center;*/
+  .el-button {
+    margin-right: 60px;
+  }
+  .copy-btn {
+    border-color: #666;
+    color: #666;
+    img {
+      margin-right: 5px;
+    }
+  }
+}
+</style>

+ 0 - 449
src/components/knowledgeExtra/SubConditions.vue

@@ -1,449 +0,0 @@
-<template>
-    <div class="groups-cont">
-        <el-form ref="groupData" label-width="150px" class="sub-condition-form" :model="groupData" :rules="rules">
-            <span v-if="!disabled&&!isLast" class="del-btn"  @click="delRule">删除</span><!--:class="isLast?'disable del-btn':'del-btn'"-->
-            <el-form-item label="基础规则名称:" prop="subDescription">
-                <el-input v-model.trim = "groupData.subDescription" :disabled="disabled"></el-input>
-            </el-form-item>
-            <el-form-item label="基础规则类型:" prop="subType">
-                <el-select v-model="groupData.subType"
-                           :disabled="disabled"
-                           placeholder="请选择"
-                           size="small"
-                           @change="subTypeChange">
-                    <el-option
-                            v-for="item in baseTypes"
-                            :key="item.id"
-                            :label="item.name"
-                            :value="item.type">
-                    </el-option>
-                </el-select>
-            </el-form-item>
-            <el-form-item label="基础规则术语类型:" prop="subLenCode">
-                <el-select v-model="groupData.subLenCode"
-                           :disabled="disabled"
-                           placeholder="请选择"
-                           size="small" @change="subCodeChange">
-                    <el-option
-                            v-for="item in baseTermTypeList"
-                            :key="item.id"
-                            :label="item.name"
-                            :value="item.code">
-                    </el-option>
-                </el-select>
-            </el-form-item>
-            <el-form-item  class="addDepartFormItem" label="医学标准术语:" prop="subConceptId">
-                <el-select clearable remote filterable :disabled="disabled" :remote-method="searchConcept" v-model.trim="groupData.subConceptId">
-                    <el-option
-                            v-for="item in conceptList"
-                            :key="item.conceptId"
-                            :label="item.conceptName"
-                            :value="item.conceptId">
-                    </el-option>
-                </el-select>
-            </el-form-item>
-            <el-form-item v-if="groupData.subType===2&&showDataType" label="选择类型:" prop="dataType">
-                <el-select v-model="groupData.dataType"
-                           placeholder="请选择"
-                           size="small" @change="dataTypeChange">
-                    <el-option
-                            v-for="item in dataTypes"
-                            :key="item.id"
-                            :label="item.name"
-                            :value="item.id">
-                    </el-option>
-                </el-select>
-            </el-form-item>
-            <el-form-item class="min-margin" v-if="groupData.dataType==='1'" label="最大值:">
-                <div class="select-item clearfix">
-                    <el-col :span="3">
-                        <el-form-item prop="subMaxOperator">
-                            <el-select v-model="groupData.subMaxOperator"
-                                       placeholder="请选择"
-                                       size="small" clearable>
-                                <el-option
-                                        v-for="item in operMaxList"
-                                        :key="item.key"
-                                        :label="item.name"
-                                        :value="item.key">
-                                </el-option>
-                            </el-select>
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="3">
-                        <el-form-item prop="subMaxValue">
-                            <el-input type="text" v-model="groupData.subMaxValue" placeholder="填写数值"/>
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="3">
-                        <el-form-item prop="subMaxUnit">
-                            <el-input  type="text" v-model.trim="groupData.subMaxUnit" placeholder="填写单位"/>
-                        </el-form-item>
-                    </el-col>
-                </div>
-            </el-form-item>
-            <el-form-item class="min-margin" v-if="groupData.dataType==='1'" label="最小值:">
-                <div class="select-item clearfix">
-                    <el-col :span="3">
-                        <el-form-item prop="subMinOperator">
-                            <el-select v-model="groupData.subMinOperator"
-                                       placeholder="请选择"
-                                       size="small" clearable>
-                                <el-option
-                                        v-for="item in operMinList"
-                                        :key="item.name"
-                                        :label="item.name"
-                                        :value="item.name">
-                                </el-option>
-                            </el-select>
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="3">
-                        <el-form-item prop="subMinValue">
-                            <el-input type="text" v-model="groupData.subMinValue" placeholder="填写数值"/>
-                        </el-form-item>
-                    </el-col>
-                    <el-col :span="3">
-                        <el-form-item prop="subMinUnit">
-                            <el-input  type="text" v-model.trim="groupData.subMinUnit" placeholder="填写单位"/>
-                        </el-form-item>
-                    </el-col>
-                </div>
-            </el-form-item>
-            <el-form-item v-if="groupData.subType!==6&&groupData.dataType==='2'" label="医学内容:" prop="subEqValue" class="discDesc is-required">
-                <el-input type="textarea" rows="3" placeholder="请输入医学内容" v-model.trim="groupData.subEqValue"></el-input>
-            </el-form-item>
-            <el-form-item v-if="groupData.subType===6" label="正则表达式:" prop="subEqValue" class="discDesc is-required">
-                <el-input type="textarea" rows="3" placeholder="请输入正则表达式" v-model.trim="groupData.subEqValue"></el-input>
-            </el-form-item>
-        </el-form>
-        <div class="inner-oper" v-if="showAdd">
-            <span>新增规则:</span>
-            <span class="add-btn" @click="addRule"><img src="../../images/add.png" alt="新增规则"></span>
-        </div>
-    </div>
-</template>
-<script>
-    import api from '@api/knowledgeLib.js';
-    export default {
-        name:'subCondititons',
-        props:['groupData','ind','isLast','baseTypes','firstPlace','disabled','showAdd'],
-        data(){
-            return {
-                //baseTermTypeList:[],
-                typeList:[],
-                numTypes:'',    //只有数值类型的类型id
-                operMaxList:[
-                    {name:'<=',key:'<='},
-                    {name:'<',key:'<'},
-                ],
-                operMinList:[{name:'>',key:'>'},
-                    {name:'>=',key:'>='},
-                ],
-                dataTypes:[{id:'1',name:'数值类型'},{id:'2',name:'文本类型'}],
-                conceptList:[],
-                rules:{
-                    subDescription:[{ required: true, message: '请输入基础规则名称',trigger: ['blur'] },{
-                        validator: (rule,value,callback)=>{
-                            if(value&&value.length>100){
-                                callback(new Error('规则名称不能超过100字'));
-                            }else{
-                                callback();
-                            }}, trigger: 'change'
-                    }],
-                    subType:[{ required: true, message: '请选择基础规则类型',trigger: ['change'] }],
-                    subLenCode:[{ required: true, message: '请选择基础规则术语类型',trigger: ['change'] }],
-                    subConceptId:[{ required: true, message: '请输入医学标准术语',trigger: ['blur'] }],
-                    dataType:[{ required: true, message: '请选择类型',trigger: ['change'] }],
-                    subMaxOperator:[{
-                        validator: (rule,value,callback)=>{
-                            const {subMaxValue,subMinOperator,subMinValue}=this.groupData;
-                            const val=value+subMinOperator+subMinValue+subMaxValue;
-                            if(!val||(!value&&subMaxValue!=='')){
-                                callback(new Error('最大值和最小值至少完整填写一个,单位不必填'));
-                            }else{
-                                callback();
-                            }}, trigger: 'blur'
-                    }],
-                    subMinOperator:[{
-                        validator: (rule,value,callback)=>{
-                            const {subMaxValue,subMaxOperator,subMinValue}=this.groupData;
-                            const val=value+subMaxOperator+subMinValue+subMaxValue;
-                            if(!val||(!value&&subMinValue!=='')){
-                                callback(new Error('最大值和最小值至少完整填写一个,单位不必填'));
-                            }else{
-                                callback();
-                            }}, trigger: 'blur'
-                    }],
-                    subMaxValue:[{
-                        validator: (rule,value,callback)=>{
-                            const {subMaxOperator,subMinOperator,subMinValue}=this.groupData;
-                            const val=value+subMaxOperator+subMinValue+subMinOperator;
-                            const isNum=/^(\-|\+)?\d+(\.\d+)?$/.test(value);
-                            if(!val||(value==''&&subMaxOperator)){
-                                callback(new Error('最大值和最小值至少完整填写一个,单位不必填'));
-                            }else if(value!==''&&!isNum){
-                                callback(new Error('只能输入数字'));
-                            }else{
-                                callback();
-                            }}, trigger: 'blur'
-                    }],
-                    subMinValue:[{
-                        validator: (rule,value,callback)=>{
-                            const {subMaxValue,subMinOperator,subMaxOperator}=this.groupData;
-                            const val=value+subMaxOperator+subMaxValue+subMinOperator;
-                            const isNum=/^(\-|\+)?\d+(\.\d+)?$/.test(value);
-                            if(!val||(value==''&&subMinOperator)){
-                                callback(new Error('最大值和最小值至少完整填写一个,单位不必填'));
-                            }else if(value!==''&&!isNum){
-                                callback(new Error('只能输入数字'));
-                            }else{
-                                callback();
-                            }}, trigger: 'blur'
-                    }],
-                    subEqValue:[{
-                        validator: (rule,value,callback)=>{
-                            if(value===''){
-                                callback(new Error('请输入'+this.textName));
-                            }else if(value.length>200){
-                                callback(new Error(this.textName+'不能超过200字'));
-                            }else{
-                                callback();
-                            }}, trigger: 'blur'
-                    }],
-                },
-            }
-        },
-        watch:{
-            'groupData':{
-                handler:function(val){
-                    this.$emit("changeVal",val,this.ind);
-                },
-                deep:true
-            },
-            /*'baseTypes':{
-                handler:function(val){
-                    if(!this.groupData.subType){
-                        this.baseTermTypeList =[];
-                        return;
-                    }
-                    const obj = val.find((it)=>it.type===this.groupData.subType);
-                    this.baseTermTypeList = obj.subMenuList;
-                },
-                deep:true
-            },*/
-            'firstPlace':{
-                handler:function(val) {
-                    if (this.ind!==0||!val) return;
-                    const dict = localStorage.getItem("zskDicts").match(new RegExp(val.checkedType+'-\\d+','g'))||[];
-                    const types = dict[0].split("-");
-                    this.groupData.subType = +types[2];
-                    this.groupData.subLenCode = types[1];
-                    this.conceptList = [val];
-                    this.groupData.subDescription = val.conceptName;
-                    this.groupData.subConceptId = val.conceptId;
-                    this.groupData.subConceptName = val.conceptName;
-                },
-                deep:true
-            }
-        },
-        created(){
-            this.numTypes = localStorage.getItem("zskNumDict");
-            this.conceptList=[{conceptName:this.groupData.subLibName||this.groupData.subConceptName,conceptId:this.groupData.subConceptId}];
-        },
-        computed:{
-            baseTermTypeList:function(){
-                if(!this.baseTypes.length){
-                    return [];
-                }
-                const sub = this.baseTypes.find((it) => it.type === this.groupData.subType)||{};
-                return sub.subMenuList;
-            },
-            showDataType:function(){
-               return (this.numTypes+',').indexOf(this.groupData.subLenCode+',')===-1;
-            },
-            textName:function(){
-                return this.groupData.subType!==6&&this.groupData.dataType==='2'?'医学内容':'正则表达式';
-            }
-        },
-        methods:{
-            dataTypeChange(val){
-                this.groupData.subEqOperator=(val==='2'?'=':'');
-                this.clearNumText();
-                delete this.groupData.dataType;     //触发更新
-                this.$set(this.groupData,'dataType',val);
-            },
-            subTypeChange(val){        //基础规则类型修改
-                this.groupData.subLenCode='';
-                this.groupData.dataType='';
-                this.clearConcept();
-                this.clearNumText();
-            },
-            subCodeChange(val){        //基础规则术语类型修改
-                this.groupData.subLenCode=val;
-                if((this.numTypes+',').indexOf(val+',')>-1){
-                    this.groupData.dataType='1';
-                }else{
-                    this.groupData.dataType='';
-                }
-                this.clearConcept();
-                this.clearNumText();
-            },
-            clearConcept(){
-              this.groupData.subConceptId='';
-              this.conceptList=[];
-            },
-            clearNumText(){
-                this.groupData.subMaxOperator='';
-                this.groupData.subMaxValue='';
-                this.groupData.subMaxUnit='';
-                this.groupData.subMinOperator='';
-                this.groupData.subMinValue='';
-                this.groupData.subMinUnit='';
-                this.groupData.subEqValue='';
-                this.groupData.subEqOperator='';
-            },
-            searchConcept(val){
-                const param = {
-                    excludedConceptIds:[this.groupData.subType],
-                    libType:this.groupData.subLenCode,
-                    name:val,
-                };
-                api.searchConcept(param).then((res) => {
-                    if (res.data.code == '0') {
-                        const data = res.data.data;
-                        this.conceptList = data;
-                    }
-                }).catch((error) => {
-                    console.log(error);
-                });
-            },
-            addRule(){
-                this.$emit("addRule");
-            },
-            delRule(){
-                if(this.isLast){
-                    this.warning("初始状态规则不能删除~");
-                    return;
-                }
-                //this.showConfirmDialog("是否删除该条规则,可能对现有系统会造成影响",()=>{
-                    this.$emit("delRule",this.ind);
-                //});
-
-            },
-            warning(msg,type){
-                this.$message({
-                    showClose: true,
-                    message:msg,
-                    type:type||'warning'
-                })
-            },
-            showConfirmDialog(msg,resolve){
-                this.$alert(msg, '提示', {
-                    confirmButtonText: '确定',
-                    type: 'warning'
-                }).then(() => {
-                    resolve();
-                }).catch(() => {});
-            },
-        }
-    }
-</script>
-<style lang="less">
-    .groups-cont{
-        background: #fff;
-        .conceptItem{
-            padding: 0 10px;
-            cursor: pointer;
-            height: 32px;
-            line-height: 32px;
-            &:hover{
-                background: #ebedf1;
-            }
-        }
-        .inner-oper{
-            padding: 15px 0 15px 21px;
-            .add-btn {
-                cursor: pointer;
-                img {
-                    vertical-align: middle;
-                }
-            }
-        }
-        .sub-condition-form{
-            padding: 20px;
-            position: relative;
-            border-bottom:2px solid #F5F5F5;
-            .del-btn{
-                color: #FF5B5B;
-                cursor: pointer;
-                position: absolute;
-                right: 20px;
-                top:20px;
-                z-index: 1;
-                &.disable{
-                    color: #B8B8B8;
-                }
-            }
-        }
-        .el-input__icon{
-            line-height: 32px;
-        }
-        .select-item{
-            &>div{
-                float: left;
-                margin-right: 10px;
-            }
-            .el-input{
-                width: auto;
-            }
-            input{
-                width: 95px;
-                line-height: 32px;
-                height: 32px;
-            }
-        }
-        .el-input,.el-input__inner{
-            width: 190px;
-            line-height: 32px;
-            height: 32px;
-        }
-        .el-button--danger.is-plain{
-            background: none;
-        }
-        .itemList {
-            position: absolute;
-            // display: none;
-            background: #fff;
-            width: 188px;
-            max-height: 160px;
-            border: 1px solid #DCDFE6;
-            left: 0;
-            top: 37px;
-            z-index: 2;
-            overflow-y: auto;
-        }
-        .el-form-item{
-            margin-bottom: 22px;
-            &.min-margin{
-                margin-bottom: 0;
-            }
-        }
-        .el-form-item__error{
-            top: auto;
-            white-space: nowrap;
-            background: #fff;
-        }
-        .el-input-number{
-            width: 95px;
-        }
-        .el-input-number.is-controls-right .el-input-number__decrease, .el-input-number.is-controls-right .el-input-number__increase{
-            width: 25px;
-            height: 15px;
-            line-height: 16px;
-        }
-        .el-col-3 {
-            width: 94px;
-        }
-    }
-</style>

+ 0 - 117
src/components/knowledgeExtra/SubRulesGroup.vue

@@ -1,117 +0,0 @@
-<template>
-    <div class="sub-groups" v-if="data">
-        <SubConditions v-for="(rules,i) in data"
-                       ref="group"
-                       :groupData="rules"
-                       :isLast="data.length===1"
-                       :ind="i"
-                       :showAdd="data.length<maxNum"
-                       :baseTypes="baseTypes"
-                       :firstPlace="firstPlace"
-                       :disabled="i===0&&disable"
-                       @changeVal="handleInput"
-                       @addRule="addRule"
-                       @delRule="delRule"></SubConditions>
-        <div class="group-oper">
-            <el-button size="small" @click="addGroup">+新增分组</el-button>
-            <el-button :disabled="isLast" size="small" type="danger" plain @click="delGroup">-删除分组</el-button>
-        </div>
-    </div>
-</template>
-<script>
-    import SubConditions from './SubConditions.vue';
-    export default {
-        name:'SubRulesGroup',
-        props:['data','inx','isLast','baseTypes','maxNum','firstPlace'],
-        data(){
-            return {
-            }
-        },
-        computed:{
-          'disable':function(){
-              return Object.keys(this.firstPlace||{}).length>0;
-          }
-        },
-        methods:{
-            handleInput(val,i){
-                this.data[i]=val;
-            },
-            addRule(){
-                let temp={
-                    subDescription:'',
-                    subConceptId:'',
-                    subType:'',
-                    subLenName:'',
-                    subLenCode:'',
-                    subLibName:'',
-                    subMaxOperator:'',
-                    subMaxUnit:'',
-                    subMaxValue:'',
-                    subMinOperator:'',
-                    subMinUnit:'',
-                    subMinValue:'',
-                    subEqValue:'',
-                    dataType:'',
-                };
-                this.data.push(temp);
-            },
-            delRule(i){
-                if(i===0&&this.data.length===1){
-                    this.$emit("delGroup",this.inx);
-                    return;
-                }
-                this.data.splice(i,1);
-            },
-            addGroup(){
-                this.$emit("addGroup");
-            },
-            delGroup(){
-               this.$emit("delGroup",this.inx);
-            },
-            warning(msg,type){
-                this.$message({
-                    showClose: true,
-                    message:msg,
-                    type:type||'warning'
-                })
-            },
-            showConfirmDialog(msg,resolve){
-                this.$alert(msg, '提示', {
-                    confirmButtonText: '确定',
-                    type: 'warning'
-                }).then(() => {
-                    resolve();
-                }).catch(() => {
-                    this.warning("删除失败,请重试!")
-                });
-            },
-        },
-        components:{
-            SubConditions
-        }
-    }
-</script>
-<style lang="less" scoped>
-    .sub-groups{
-        background: #F5F5F5;
-        padding: 20px;
-    }
-    .group-oper{
-        text-align: center;
-        padding: 11px 0;
-        border-top: 4px solid #F5F5F5;
-        background: #fff;
-    }
-    .el-button--danger.is-plain:focus, .el-button--danger.is-plain:hover{
-        color: #fbc4c4;
-        border-color:#fbc4c4;
-    }
-    .el-button--danger.is-plain{
-        background: none;
-        &.is-disabled{
-            color: #f9a7a7;
-            background-color: #fef0f0;
-            border-color: #fde2e2;
-        }
-    }
-</style>

+ 635 - 0
src/components/knowledgeExtra/_AddNewRule.vue

@@ -0,0 +1,635 @@
+<template>
+  <div>
+    <crumbs
+      :title="title"
+      :param="$route.params"
+      linkTo="ZskRuleManager"
+    ></crumbs>
+    <div class="contents">
+      <div class="content2">
+        <el-form
+          ref="form"
+          :label-position="labelPosition"
+          class="add-new-form"
+          label-width="130px"
+          :model="form"
+          :rules="rules"
+        >
+          <div class="table_header">
+            <el-form-item label="规则名称:" prop="parDescription">
+              <el-input v-model.trim="form.parDescription"></el-input>
+            </el-form-item>
+            <el-form-item label="规则类型:" prop="parRuleType">
+              <el-select
+                v-model="form.parRuleType"
+                placeholder="请选择"
+                size="small"
+                @change="ruleTypeChange"
+              >
+                <el-option
+                  v-for="item in ruleTypeList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                >
+                </el-option>
+              </el-select>
+              <div class="tip-text">
+                注:更改规则类型,将会清空已填写的规则内容~
+              </div>
+            </el-form-item>
+            <el-form-item label="规则术语类型:" prop="parLenCode">
+              <el-select
+                v-model="form.parLenCode"
+                placeholder="请选择"
+                size="small"
+                @change="ruleTermChange"
+              >
+                <el-option
+                  v-for="item in ruleTermTypeList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.code"
+                >
+                </el-option>
+              </el-select>
+              <div class="tip-text">
+                注:更改规则术语类型,将会清空已填写的规则内容~
+              </div>
+            </el-form-item>
+            <el-form-item
+              class="addDepartFormItem"
+              label="医学标准术语:"
+              prop="parConceptId"
+            >
+              <el-select
+                clearable
+                filterable
+                remote
+                :remote-method="searchConcept"
+                v-model.trim="form.parConceptId"
+              >
+                <el-option
+                  v-for="item in conceptList"
+                  :key="item.conceptId"
+                  :label="item.conceptName"
+                  :value="item.conceptId"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item
+              v-if="showHasSub"
+              label="有无子条件:"
+              prop="parHasSub"
+            >
+              <el-select
+                v-model="form.parHasSub"
+                placeholder="请选择"
+                size="small"
+                @change="hasSubChange"
+              >
+                <el-option
+                  v-for="item in hasSub"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item
+              v-if="showMsg"
+              label="附加信息:"
+              prop="parMsg"
+              class="parMsg"
+              style="flex: 1"
+            >
+              <el-input
+                type="textarea"
+                :rows="3"
+                placeholder="请输入附加信息"
+                v-model.trim="form.parMsg"
+              ></el-input>
+            </el-form-item>
+          </div>
+
+          <el-form-item
+            v-if="form.parHasSub === 1"
+            prop="remind"
+            label-width="0"
+            class="discDesc"
+          >
+            <h4>规则内容</h4>
+            <SubRulesGroup
+              v-for="(group, i) in subGroups"
+              ref="groups"
+              :key="i"
+              :data="group"
+              :baseTypes="baseTypeList"
+              :inx="i"
+              :maxNum="subRuleMaxNum"
+              :firstPlace="firstPlace"
+              :isLast="subGroups.length === 1"
+              @addGroup="addGroup"
+              @delGroup="delGroup"
+            ></SubRulesGroup>
+          </el-form-item>
+          <el-button
+            class="disclButn"
+            size="small"
+            type="primary"
+            @click="confirm"
+            >保存</el-button
+          >
+        </el-form>
+      </div>
+    </div>
+  </div>
+</template>
+<script type="text/javascript">
+import api from "@api/knowledgeLib.js";
+import SubRulesGroup from "./SubRulesGroup";
+import ComTable from "./table";
+export default {
+  name: "AddRule",
+  data() {
+    return {
+      labelPosition: "left",
+      isFirst: true,
+      isCopy: false,
+      dict: "", //规则内容固定的类型
+      msgDict: "", //显示附加信息的类型
+      title: "规则维护-添加规则",
+      ruleTermTypeList: [],
+      ruleTypeList: [],
+      conceptList: [],
+      baseTypeList: [],
+      conceptName: "",
+      subRuleMaxNum: null, //规则内容中规则的限制个数
+      firstPlace: null,
+      subGroups: [
+        [
+          {
+            subDescription: "",
+            parRuleType: "",
+            subConceptId: "",
+            subType: "",
+            subMaxOperator: "",
+            subMaxUnit: "",
+            subMaxValue: "",
+            subMinOperator: "",
+            subMinUnit: "",
+            subMinValue: "",
+            subEqValue: "",
+            subLenCode: "",
+            dataType: ""
+          }
+        ]
+      ],
+      form: {
+        parDescription: "",
+        parRuleType: "",
+        parConceptId: "",
+        parlibName: "",
+        parLenName: "",
+        parHasSub: undefined,
+        parLenCode: "",
+        parMsg: "",
+        klRuleInfoSaveSub: []
+      },
+      parId: null,
+      rules: {
+        parDescription: [
+          { required: true, message: "请输入规则名称", trigger: ["blur"] },
+          {
+            validator: (rule, value, callback) => {
+              if (value.length > 100) {
+                callback(new Error("规则名称不能超过100字"));
+              } else {
+                callback();
+              }
+            },
+            trigger: "change"
+          }
+        ],
+        parRuleType: [
+          { required: true, message: "请选择规则类型", trigger: ["change"] }
+        ],
+        parLenCode: [
+          { required: true, message: "请选择规则术语类型", trigger: ["change"] }
+        ],
+        parConceptId: [
+          { required: true, message: "请输入医学标准术语", trigger: ["blur"] }
+        ],
+        parHasSub: [
+          { required: true, message: "请选择有无子条件", trigger: ["change"] }
+        ],
+        parMsg: [
+          { required: true, message: "请输入附加信息", trigger: ["change"] },
+          {
+            validator: (rule, value, callback) => {
+              if (value.length > 100) {
+                callback(new Error("附加信息不能超过100字"));
+              } else {
+                callback();
+              }
+            },
+            trigger: "change"
+          }
+        ]
+      },
+      hasSub: [
+        { name: "有", id: 1 },
+        { name: "无", id: 0 }
+      ]
+    };
+  },
+  updated() {
+    console.log(JSON.stringify(this.subGroups));
+  },
+  created() {
+    this.getTypeList();
+    this.setDict();
+    const param = this.$route.params;
+    let info = param.data;
+    if (info) {
+      this.parId = info.parId;
+      this.isCopy = param.copy;
+      this.title = "规则维护-" + (this.isCopy ? "复制" : "修改") + "规则";
+      this.form = Object.assign({}, this.form, info);
+      this.conceptList = [
+        { conceptName: this.form.parlibName, conceptId: this.form.parConceptId }
+      ];
+      this.subGroups = this.formatGroupDatas(info.klRuleByIdSub);
+    }
+  },
+  watch: {
+    "form.parRuleType": function (val) {
+      const obj = this.ruleTypeList.find((it) => it.id === val);
+      this.ruleTermTypeList = obj.subMenuList;
+    },
+    "form.parLenCode": function (val) {
+      if (!val) {
+        this.baseTypeList = [];
+        return;
+      }
+      const obj = this.ruleTermTypeList.find((it) => it.code === val);
+      this.baseTypeList = obj.subMenuList;
+      this.subRuleMaxNum = obj.number;
+    },
+    "form.parConceptId": function (val) {
+      if (val && this.checkFirstPlace && this.conceptList) {
+        this.firstPlace = this.conceptList.find((it) => it.conceptId === val);
+        this.firstPlace["checkedType"] = this.ruleTermCodeStr;
+      } else if (!val) {
+        this.setInitGroupData();
+        this.firstPlace = null;
+      } else {
+        this.firstPlace = null;
+      }
+    }
+  },
+  components: {
+    SubRulesGroup,
+    ComTable
+  },
+  computed: {
+    ruleTermCodeStr: function () {
+      return this.form.parRuleType + "-" + this.form.parLenCode;
+    },
+    checkFirstPlace: function () {
+      return this.dict.indexOf(this.ruleTermCodeStr) > -1;
+    },
+    showMsg: function () {
+      return (
+        this.ruleTermCodeStr.length > 1 &&
+        this.msgDict.indexOf(this.ruleTermCodeStr) > -1
+      );
+    },
+    showHasSub: function () {
+      return this.subDict.indexOf(this.ruleTermCodeStr) > -1;
+    }
+  },
+  methods: {
+    hasSubChange(val) {
+      if (val) {
+        this.subGroups = [
+          [
+            {
+              subDescription: "",
+              parRuleType: "",
+              subConceptId: "",
+              subType: "",
+              subMaxOperator: "",
+              subMaxUnit: "",
+              subMaxValue: "",
+              subMinOperator: "",
+              subMinUnit: "",
+              subMinValue: "",
+              subEqValue: "",
+              subLenCode: "",
+              dataType: ""
+            }
+          ]
+        ];
+      }
+    },
+    setDict() {
+      this.dict = localStorage.getItem("zskDicts");
+      this.msgDict = localStorage.getItem("zskMsgDict");
+      this.subDict = localStorage.getItem("zskSubDict");
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$alert(msg, "提示", {
+        confirmButtonText: "确定",
+        type: "warning"
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    },
+    formatGroupDatas(data) {
+      let arr = [];
+      data.map((it) => {
+        if (!arr[it.groupType]) {
+          arr[it.groupType] = [];
+        }
+        if (it.subMaxOperator || it.subMinOperator) {
+          it.dataType = "1";
+        } else if (it.subEqValue) {
+          it.dataType = "2";
+        }
+        arr[it.groupType].push(it);
+      });
+      arr = arr.filter((it) => {
+        if (it) return it;
+      });
+      return arr;
+    },
+    searchConcept(val) {
+      const param = {
+        excludedConceptIds: [this.form.parRuleType],
+        libType: this.form.parLenCode,
+        name: val
+      };
+      api
+        .searchConcept(param)
+        .then((res) => {
+          if (res.data.code == "0") {
+            const data = res.data.data;
+            this.conceptList = data;
+          }
+        })
+        .catch((error) => {
+          console.log(error);
+        });
+    },
+    ruleTypeChange(val) {
+      //规则类型选中
+      this.form.parRuleType = val;
+      this.form.parLenCode = "";
+      this.form.parMsg = "";
+      const obj = this.ruleTypeList.find((it) => it.id === val); //console.log(val)
+      this.ruleTermTypeList = obj.subMenuList;
+      this.setInitGroupData();
+    },
+    ruleTermChange(val) {
+      //规则术语类型选中
+      this.form.parLenCode = val;
+      this.form.parMsg = "";
+      const obj = this.ruleTermTypeList.find((it) => it.code === val);
+      this.form.parLenName = obj.name;
+      this.baseTypeList = obj.subMenuList;
+      this.subRuleMaxNum = obj.number;
+      this.setInitGroupData();
+      this.form.parHasSub = obj.subMenuList.length ? 1 : 0;
+    },
+    getTypeList() {
+      const typeListData = JSON.parse(localStorage.getItem("zskTypesList"));
+      this.ruleTypeList = typeListData;
+    },
+    setInitGroupData() {
+      this.subGroups = [
+        [
+          {
+            subDescription: "",
+            parRuleType: "",
+            subConceptId: "",
+            subType: "",
+            subMaxOperator: "",
+            subMaxUnit: "",
+            subMaxValue: "",
+            subMinOperator: "",
+            subMinUnit: "",
+            subMinValue: "",
+            subEqValue: "",
+            subLenCode: "",
+            dataType: ""
+          }
+        ]
+      ];
+      this.form.parConceptId = ""; //医学标准术语清空
+      this.conceptList = []; //下拉列表清空
+    },
+    addGroup() {
+      let temp = {
+        subDescription: "",
+        subConceptId: "",
+        subType: "",
+        subLenCode: "",
+        dataType: "",
+        subMaxOperator: "",
+        subMaxUnit: "",
+        subMaxValue: "",
+        subMinOperator: "",
+        subMinUnit: "",
+        subMinValue: "",
+        subEqValue: ""
+      };
+      if (this.checkFirstPlace) {
+        const obj = this.subGroups[0][0];
+        temp = {
+          subDescription: obj.subConceptName,
+          subConceptId: obj.subConceptId,
+          subConceptName: obj.subConceptName,
+          subLenCode: this.form.parLenCode,
+          subLenName: this.form.parLenName,
+          subLibName: this.form.parlibName,
+          subType: obj.subType,
+          dataType: "",
+          subMaxOperator: "",
+          subMaxUnit: "",
+          subMaxValue: "",
+          subMinOperator: "",
+          subMinUnit: "",
+          subMinValue: "",
+          subEqValue: ""
+        };
+      }
+      this.subGroups.push([temp]);
+    },
+    delGroup(i) {
+      //this.subGroups.splice(i,1);
+      this.$set(this.subGroups, i, null);
+    },
+    saveRule(params) {
+      api.saveRule(params).then((res) => {
+        if (res.data.code == 0) {
+          this.$message({
+            message: "操作成功",
+            type: "success"
+          });
+          this.$router.push({
+            name: "ZskRuleManager",
+            params: Object.assign({}, this.$route.params, { currentPage: 1 })
+          });
+        } else {
+          this.$message({
+            message: res.data.msg,
+            type: "warning"
+          });
+        }
+      });
+    },
+    formatGroups() {
+      let obj = [];
+      this.subGroups.map((item, i) => {
+        item &&
+          item.map((it) => {
+            obj.push({ ...it, groupType: i + 1 });
+          });
+      });
+      return obj;
+    },
+    validateForms(callBack) {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          const groupsRef = this.$refs["groups"];
+          if (!groupsRef || groupsRef.length === 0) {
+            callBack();
+            return;
+          }
+          let groupRef = null,
+            goOn = true;
+          for (let i = 0; i < groupsRef.length; i++) {
+            groupRef = groupsRef[i].$refs["group"];
+            for (let j = 0; j < groupRef.length; j++) {
+              groupRef[j].$refs["groupData"].validate((valid) => {
+                if (!valid) {
+                  goOn = false;
+                }
+              });
+            }
+          }
+          if (goOn) {
+            callBack();
+          }
+        } else {
+          return false;
+        }
+      });
+    },
+    confirm() {
+      const _this = this;
+      this.validateForms(function () {
+        delete _this.form.klRuleByIdSub;
+        _this.form.klRuleInfoSaveSub = _this.form.parHasSub
+          ? _this.formatGroups()
+          : undefined;
+        let params = _this.form;
+        if (_this.parId) {
+          //修改/复制
+          params = Object.assign({}, _this.form, {
+            parId: _this.isCopy ? undefined : _this.parId,
+            parStatus: _this.isCopy ? 1 : _this.form.parStatus
+          });
+        }
+        console.log(params);
+        _this.saveRule(params);
+      });
+    }
+  }
+};
+</script>
+<style lang="less" scoped>
+@import "../../less/admin.less";
+.content2 {
+  background-color: #dee2ea;
+  // padding: 20px 20px 30px;
+  //   padding: 20px 20px 50px;
+  color: #545455;
+  min-width: 980px;
+  position: relative;
+  .tip-text {
+    color: #f56c6c;
+    font-size: 12px;
+    margin-left: -80px;
+  }
+  .conceptItem {
+    padding: 0 10px;
+    cursor: pointer;
+    height: 32px;
+    line-height: 32px;
+    &:hover {
+      background: #ebedf1;
+    }
+  }
+  .discDesc {
+    margin-bottom: 20px;
+  }
+  .disclButn {
+    position: absolute;
+    right: 80px;
+    bottom: 10px;
+  }
+}
+.add-new-form {
+  .el-form-item__label {
+    text-align: right;
+  }
+  .addDepartFormItem {
+    position: relative;
+  }
+  .itemList {
+    position: absolute;
+    // display: none;
+    background: #fff;
+    width: 188px;
+    max-height: 160px;
+    border: 1px solid #dcdfe6;
+    left: 0;
+    top: 37px;
+    z-index: 2;
+    overflow-y: auto;
+  }
+  .indexList {
+    left: 42px;
+    top: 78px;
+  }
+  .el-input__prefix,
+  .el-input__suffix {
+    /*top:-2px;*/
+    right: 3px;
+  }
+  .el-input--suffix .el-input__inner {
+    padding-right: 22px;
+  }
+  .el-input,
+  .el-input__inner {
+    width: 190px;
+    line-height: 32px;
+    height: 32px;
+  }
+  .el-input__icon {
+    line-height: 32px;
+  }
+}
+.table_header {
+  background: #fff;
+  padding: 20px;
+  display: flex;
+  flex-wrap: wrap;
+}
+</style>

+ 635 - 0
src/components/knowledgeExtra/_SubConditions.vue

@@ -0,0 +1,635 @@
+<template>
+  <div class="groups-cont">
+    <el-form
+      ref="groupData"
+      label-width="150px"
+      class="sub-condition-form"
+      :model="groupData"
+      :rules="rules"
+    >
+      <span v-if="!disabled && !isLast" class="del-btn" @click="delRule"
+        >删除</span
+      ><!--:class="isLast?'disable del-btn':'del-btn'"-->
+      <el-form-item label="基础规则名称:" prop="subDescription">
+        <el-input
+          v-model.trim="groupData.subDescription"
+          :disabled="disabled"
+        ></el-input>
+      </el-form-item>
+      <el-form-item label="基础规则类型:" prop="subType">
+        <el-select
+          v-model="groupData.subType"
+          :disabled="disabled"
+          placeholder="请选择"
+          size="small"
+          @change="subTypeChange"
+        >
+          <el-option
+            v-for="item in baseTypes"
+            :key="item.id"
+            :label="item.name"
+            :value="item.type"
+          >
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="基础规则术语类型:" prop="subLenCode">
+        <el-select
+          v-model="groupData.subLenCode"
+          :disabled="disabled"
+          placeholder="请选择"
+          size="small"
+          @change="subCodeChange"
+        >
+          <el-option
+            v-for="item in baseTermTypeList"
+            :key="item.id"
+            :label="item.name"
+            :value="item.code"
+          >
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item
+        class="addDepartFormItem"
+        label="医学标准术语:"
+        prop="subConceptId"
+      >
+        <el-select
+          clearable
+          remote
+          filterable
+          :disabled="disabled"
+          :remote-method="searchConcept"
+          v-model.trim="groupData.subConceptId"
+        >
+          <el-option
+            v-for="item in conceptList"
+            :key="item.conceptId"
+            :label="item.conceptName"
+            :value="item.conceptId"
+          >
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item
+        v-if="groupData.subType === 2 && showDataType"
+        label="选择类型:"
+        prop="dataType"
+      >
+        <el-select
+          v-model="groupData.dataType"
+          placeholder="请选择"
+          size="small"
+          @change="dataTypeChange"
+        >
+          <el-option
+            v-for="item in dataTypes"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id"
+          >
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item
+        class="min-margin"
+        v-if="groupData.dataType === '1'"
+        label="最大值:"
+      >
+        <div class="select-item clearfix">
+          <el-col :span="3">
+            <el-form-item prop="subMaxOperator">
+              <el-select
+                v-model="groupData.subMaxOperator"
+                placeholder="请选择"
+                size="small"
+                clearable
+              >
+                <el-option
+                  v-for="item in operMaxList"
+                  :key="item.key"
+                  :label="item.name"
+                  :value="item.key"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="3">
+            <el-form-item prop="subMaxValue">
+              <el-input
+                type="text"
+                v-model="groupData.subMaxValue"
+                placeholder="填写数值"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="3">
+            <el-form-item prop="subMaxUnit">
+              <el-input
+                type="text"
+                v-model.trim="groupData.subMaxUnit"
+                placeholder="填写单位"
+              />
+            </el-form-item>
+          </el-col>
+        </div>
+      </el-form-item>
+      <el-form-item
+        class="min-margin"
+        v-if="groupData.dataType === '1'"
+        label="最小值:"
+      >
+        <div class="select-item clearfix">
+          <el-col :span="3">
+            <el-form-item prop="subMinOperator">
+              <el-select
+                v-model="groupData.subMinOperator"
+                placeholder="请选择"
+                size="small"
+                clearable
+              >
+                <el-option
+                  v-for="item in operMinList"
+                  :key="item.name"
+                  :label="item.name"
+                  :value="item.name"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="3">
+            <el-form-item prop="subMinValue">
+              <el-input
+                type="text"
+                v-model="groupData.subMinValue"
+                placeholder="填写数值"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="3">
+            <el-form-item prop="subMinUnit">
+              <el-input
+                type="text"
+                v-model.trim="groupData.subMinUnit"
+                placeholder="填写单位"
+              />
+            </el-form-item>
+          </el-col>
+        </div>
+      </el-form-item>
+      <el-form-item
+        v-if="groupData.subType !== 6 && groupData.dataType === '2'"
+        label="医学内容:"
+        prop="subEqValue"
+        class="discDesc is-required"
+      >
+        <el-input
+          type="textarea"
+          rows="3"
+          placeholder="请输入医学内容"
+          v-model.trim="groupData.subEqValue"
+        ></el-input>
+      </el-form-item>
+      <el-form-item
+        v-if="groupData.subType === 6"
+        label="正则表达式:"
+        prop="subEqValue"
+        class="discDesc is-required"
+      >
+        <el-input
+          type="textarea"
+          rows="3"
+          placeholder="请输入正则表达式"
+          v-model.trim="groupData.subEqValue"
+        ></el-input>
+      </el-form-item>
+    </el-form>
+    <div class="inner-oper" v-if="showAdd">
+      <span>新增规则:</span>
+      <span class="add-btn" @click="addRule"
+        ><img src="../../images/add.png" alt="新增规则"
+      /></span>
+    </div>
+  </div>
+</template>
+<script>
+import api from "@api/knowledgeLib.js";
+export default {
+  name: "subCondititons",
+  props: [
+    "groupData",
+    "ind",
+    "isLast",
+    "baseTypes",
+    "firstPlace",
+    "disabled",
+    "showAdd"
+  ],
+  data() {
+    return {
+      //baseTermTypeList:[],
+      typeList: [],
+      numTypes: "", //只有数值类型的类型id
+      operMaxList: [
+        { name: "<=", key: "<=" },
+        { name: "<", key: "<" }
+      ],
+      operMinList: [
+        { name: ">", key: ">" },
+        { name: ">=", key: ">=" }
+      ],
+      dataTypes: [
+        { id: "1", name: "数值类型" },
+        { id: "2", name: "文本类型" }
+      ],
+      conceptList: [],
+      rules: {
+        subDescription: [
+          { required: true, message: "请输入基础规则名称", trigger: ["blur"] },
+          {
+            validator: (rule, value, callback) => {
+              if (value && value.length > 100) {
+                callback(new Error("规则名称不能超过100字"));
+              } else {
+                callback();
+              }
+            },
+            trigger: "change"
+          }
+        ],
+        subType: [
+          { required: true, message: "请选择基础规则类型", trigger: ["change"] }
+        ],
+        subLenCode: [
+          {
+            required: true,
+            message: "请选择基础规则术语类型",
+            trigger: ["change"]
+          }
+        ],
+        subConceptId: [
+          { required: true, message: "请输入医学标准术语", trigger: ["blur"] }
+        ],
+        dataType: [
+          { required: true, message: "请选择类型", trigger: ["change"] }
+        ],
+        subMaxOperator: [
+          {
+            validator: (rule, value, callback) => {
+              const {
+                subMaxValue,
+                subMinOperator,
+                subMinValue
+              } = this.groupData;
+              const val = value + subMinOperator + subMinValue + subMaxValue;
+              if (!val || (!value && subMaxValue !== "")) {
+                callback(
+                  new Error("最大值和最小值至少完整填写一个,单位不必填")
+                );
+              } else {
+                callback();
+              }
+            },
+            trigger: "blur"
+          }
+        ],
+        subMinOperator: [
+          {
+            validator: (rule, value, callback) => {
+              const {
+                subMaxValue,
+                subMaxOperator,
+                subMinValue
+              } = this.groupData;
+              const val = value + subMaxOperator + subMinValue + subMaxValue;
+              if (!val || (!value && subMinValue !== "")) {
+                callback(
+                  new Error("最大值和最小值至少完整填写一个,单位不必填")
+                );
+              } else {
+                callback();
+              }
+            },
+            trigger: "blur"
+          }
+        ],
+        subMaxValue: [
+          {
+            validator: (rule, value, callback) => {
+              const {
+                subMaxOperator,
+                subMinOperator,
+                subMinValue
+              } = this.groupData;
+              const val = value + subMaxOperator + subMinValue + subMinOperator;
+              const isNum = /^(\-|\+)?\d+(\.\d+)?$/.test(value);
+              if (!val || (value == "" && subMaxOperator)) {
+                callback(
+                  new Error("最大值和最小值至少完整填写一个,单位不必填")
+                );
+              } else if (value !== "" && !isNum) {
+                callback(new Error("只能输入数字"));
+              } else {
+                callback();
+              }
+            },
+            trigger: "blur"
+          }
+        ],
+        subMinValue: [
+          {
+            validator: (rule, value, callback) => {
+              const {
+                subMaxValue,
+                subMinOperator,
+                subMaxOperator
+              } = this.groupData;
+              const val = value + subMaxOperator + subMaxValue + subMinOperator;
+              const isNum = /^(\-|\+)?\d+(\.\d+)?$/.test(value);
+              if (!val || (value == "" && subMinOperator)) {
+                callback(
+                  new Error("最大值和最小值至少完整填写一个,单位不必填")
+                );
+              } else if (value !== "" && !isNum) {
+                callback(new Error("只能输入数字"));
+              } else {
+                callback();
+              }
+            },
+            trigger: "blur"
+          }
+        ],
+        subEqValue: [
+          {
+            validator: (rule, value, callback) => {
+              if (value === "") {
+                callback(new Error("请输入" + this.textName));
+              } else if (value.length > 200) {
+                callback(new Error(this.textName + "不能超过200字"));
+              } else {
+                callback();
+              }
+            },
+            trigger: "blur"
+          }
+        ]
+      }
+    };
+  },
+  watch: {
+    groupData: {
+      handler: function (val) {
+        this.$emit("changeVal", val, this.ind);
+      },
+      deep: true
+    },
+    /*'baseTypes':{
+                handler:function(val){
+                    if(!this.groupData.subType){
+                        this.baseTermTypeList =[];
+                        return;
+                    }
+                    const obj = val.find((it)=>it.type===this.groupData.subType);
+                    this.baseTermTypeList = obj.subMenuList;
+                },
+                deep:true
+            },*/
+    firstPlace: {
+      handler: function (val) {
+        if (this.ind !== 0 || !val) return;
+        const dict =
+          localStorage
+            .getItem("zskDicts")
+            .match(new RegExp(val.checkedType + "-\\d+", "g")) || [];
+        const types = dict[0].split("-");
+        this.groupData.subType = +types[2];
+        this.groupData.subLenCode = types[1];
+        this.conceptList = [val];
+        this.groupData.subDescription = val.conceptName;
+        this.groupData.subConceptId = val.conceptId;
+        this.groupData.subConceptName = val.conceptName;
+      },
+      deep: true
+    }
+  },
+  created() {
+    this.numTypes = localStorage.getItem("zskNumDict");
+    this.conceptList = [
+      {
+        conceptName: this.groupData.subLibName || this.groupData.subConceptName,
+        conceptId: this.groupData.subConceptId
+      }
+    ];
+  },
+  computed: {
+    baseTermTypeList: function () {
+      if (!this.baseTypes.length) {
+        return [];
+      }
+      const sub =
+        this.baseTypes.find((it) => it.type === this.groupData.subType) || {};
+      return sub.subMenuList;
+    },
+    showDataType: function () {
+      return (
+        (this.numTypes + ",").indexOf(this.groupData.subLenCode + ",") === -1
+      );
+    },
+    textName: function () {
+      return this.groupData.subType !== 6 && this.groupData.dataType === "2"
+        ? "医学内容"
+        : "正则表达式";
+    }
+  },
+  methods: {
+    dataTypeChange(val) {
+      this.groupData.subEqOperator = val === "2" ? "=" : "";
+      this.clearNumText();
+      delete this.groupData.dataType; //触发更新
+      this.$set(this.groupData, "dataType", val);
+    },
+    subTypeChange(val) {
+      //基础规则类型修改
+      this.groupData.subLenCode = "";
+      this.groupData.dataType = "";
+      this.clearConcept();
+      this.clearNumText();
+    },
+    subCodeChange(val) {
+      //基础规则术语类型修改
+      this.groupData.subLenCode = val;
+      if ((this.numTypes + ",").indexOf(val + ",") > -1) {
+        this.groupData.dataType = "1";
+      } else {
+        this.groupData.dataType = "";
+      }
+      this.clearConcept();
+      this.clearNumText();
+    },
+    clearConcept() {
+      this.groupData.subConceptId = "";
+      this.conceptList = [];
+    },
+    clearNumText() {
+      this.groupData.subMaxOperator = "";
+      this.groupData.subMaxValue = "";
+      this.groupData.subMaxUnit = "";
+      this.groupData.subMinOperator = "";
+      this.groupData.subMinValue = "";
+      this.groupData.subMinUnit = "";
+      this.groupData.subEqValue = "";
+      this.groupData.subEqOperator = "";
+    },
+    searchConcept(val) {
+      const param = {
+        excludedConceptIds: [this.groupData.subType],
+        libType: this.groupData.subLenCode,
+        name: val
+      };
+      api
+        .searchConcept(param)
+        .then((res) => {
+          if (res.data.code == "0") {
+            const data = res.data.data;
+            this.conceptList = data;
+          }
+        })
+        .catch((error) => {
+          console.log(error);
+        });
+    },
+    addRule() {
+      this.$emit("addRule");
+    },
+    delRule() {
+      if (this.isLast) {
+        this.warning("初始状态规则不能删除~");
+        return;
+      }
+      //this.showConfirmDialog("是否删除该条规则,可能对现有系统会造成影响",()=>{
+      this.$emit("delRule", this.ind);
+      //});
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning"
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$alert(msg, "提示", {
+        confirmButtonText: "确定",
+        type: "warning"
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {});
+    }
+  }
+};
+</script>
+<style lang="less">
+.groups-cont {
+  background: #fff;
+  .conceptItem {
+    padding: 0 10px;
+    cursor: pointer;
+    height: 32px;
+    line-height: 32px;
+    &:hover {
+      background: #ebedf1;
+    }
+  }
+  .inner-oper {
+    padding: 15px 0 15px 21px;
+    .add-btn {
+      cursor: pointer;
+      img {
+        vertical-align: middle;
+      }
+    }
+  }
+  .sub-condition-form {
+    padding: 20px;
+    position: relative;
+    border-bottom: 2px solid #f5f5f5;
+    .del-btn {
+      color: #ff5b5b;
+      cursor: pointer;
+      position: absolute;
+      right: 20px;
+      top: 20px;
+      z-index: 1;
+      &.disable {
+        color: #b8b8b8;
+      }
+    }
+  }
+  .el-input__icon {
+    line-height: 32px;
+  }
+  .select-item {
+    & > div {
+      float: left;
+      margin-right: 10px;
+    }
+    .el-input {
+      width: auto;
+    }
+    input {
+      width: 95px;
+      line-height: 32px;
+      height: 32px;
+    }
+  }
+  .el-input,
+  .el-input__inner {
+    width: 190px;
+    line-height: 32px;
+    height: 32px;
+  }
+  .el-button--danger.is-plain {
+    background: none;
+  }
+  .itemList {
+    position: absolute;
+    // display: none;
+    background: #fff;
+    width: 188px;
+    max-height: 160px;
+    border: 1px solid #dcdfe6;
+    left: 0;
+    top: 37px;
+    z-index: 2;
+    overflow-y: auto;
+  }
+  .el-form-item {
+    margin-bottom: 22px;
+    &.min-margin {
+      margin-bottom: 0;
+    }
+  }
+  .el-form-item__error {
+    top: auto;
+    white-space: nowrap;
+    background: #fff;
+  }
+  .el-input-number {
+    width: 95px;
+  }
+  .el-input-number.is-controls-right .el-input-number__decrease,
+  .el-input-number.is-controls-right .el-input-number__increase {
+    width: 25px;
+    height: 15px;
+    line-height: 16px;
+  }
+  .el-col-3 {
+    width: 94px;
+  }
+}
+</style>

+ 129 - 0
src/components/knowledgeExtra/_SubRulesGroup.vue

@@ -0,0 +1,129 @@
+<template>
+  <div class="sub-groups" v-if="data">
+    <SubConditions
+      v-for="(rules, i) in data"
+      :key="i"
+      ref="group"
+      :groupData="rules"
+      :isLast="data.length === 1"
+      :ind="i"
+      :showAdd="data.length < maxNum"
+      :baseTypes="baseTypes"
+      :firstPlace="firstPlace"
+      :disabled="i === 0 && disable"
+      @changeVal="handleInput"
+      @addRule="addRule"
+      @delRule="delRule"
+    ></SubConditions>
+    <div class="group-oper">
+      <el-button size="small" @click="addGroup">+新增分组</el-button>
+      <el-button
+        :disabled="isLast"
+        size="small"
+        type="danger"
+        plain
+        @click="delGroup"
+        >-删除分组</el-button
+      >
+    </div>
+  </div>
+</template>
+<script>
+import SubConditions from "./_SubConditions.vue";
+export default {
+  name: "SubRulesGroup",
+  props: ["data", "inx", "isLast", "baseTypes", "maxNum", "firstPlace"],
+  data() {
+    return {};
+  },
+  computed: {
+    disable: function () {
+      return Object.keys(this.firstPlace || {}).length > 0;
+    }
+  },
+  methods: {
+    handleInput(val, i) {
+      this.data[i] = val;
+    },
+    addRule() {
+      let temp = {
+        subDescription: "",
+        subConceptId: "",
+        subType: "",
+        subLenName: "",
+        subLenCode: "",
+        subLibName: "",
+        subMaxOperator: "",
+        subMaxUnit: "",
+        subMaxValue: "",
+        subMinOperator: "",
+        subMinUnit: "",
+        subMinValue: "",
+        subEqValue: "",
+        dataType: ""
+      };
+      this.data.push(temp);
+    },
+    delRule(i) {
+      if (i === 0 && this.data.length === 1) {
+        this.$emit("delGroup", this.inx);
+        return;
+      }
+      this.data.splice(i, 1);
+    },
+    addGroup() {
+      this.$emit("addGroup");
+    },
+    delGroup() {
+      this.$emit("delGroup", this.inx);
+    },
+    warning(msg, type) {
+      this.$message({
+        showClose: true,
+        message: msg,
+        type: type || "warning"
+      });
+    },
+    showConfirmDialog(msg, resolve) {
+      this.$alert(msg, "提示", {
+        confirmButtonText: "确定",
+        type: "warning"
+      })
+        .then(() => {
+          resolve();
+        })
+        .catch(() => {
+          this.warning("删除失败,请重试!");
+        });
+    }
+  },
+  components: {
+    SubConditions
+  }
+};
+</script>
+<style lang="less" scoped>
+.sub-groups {
+  background: #f5f5f5;
+  padding: 20px;
+}
+.group-oper {
+  text-align: center;
+  padding: 11px 0;
+  border-top: 4px solid #f5f5f5;
+  background: #fff;
+}
+.el-button--danger.is-plain:focus,
+.el-button--danger.is-plain:hover {
+  color: #fbc4c4;
+  border-color: #fbc4c4;
+}
+.el-button--danger.is-plain {
+  background: none;
+  &.is-disabled {
+    color: #f9a7a7;
+    background-color: #fef0f0;
+    border-color: #fde2e2;
+  }
+}
+</style>

+ 89 - 0
src/components/knowledgeExtra/rules.js

@@ -0,0 +1,89 @@
+export const formRules =  {
+  parDescription: [
+    { required: true, message: "请输入规则名称", trigger: ["blur"] },
+    {
+      validator: (rule, value, callback) => {
+        if (value.length > 100) {
+          callback(new Error("规则名称不能超过100字"));
+        } else {
+          callback();
+        }
+      },
+      trigger: "change"
+    }
+  ],
+  parRuleType: [
+    { required: true, message: "请选择规则类型", trigger: ["change"] }
+  ],
+  parLenCode: [
+    { required: true, message: "请选择规则术语类型", trigger: ["change"] }
+  ],
+  parConceptId: [
+    { required: true, message: "请输入医学标准术语", trigger: ["blur"] }
+  ],
+  parHasSub: [
+    { required: true, message: "请选择有无子条件", trigger: ["change"] }
+  ],
+  parMsg: [
+    { required: true, message: "请输入附加信息", trigger: ["change"] },
+    {
+      validator: (rule, value, callback) => {
+        if (value.length > 100) {
+          callback(new Error("附加信息不能超过100字"));
+        } else {
+          callback();
+        }
+      },
+      trigger: "change"
+    }
+  ],
+
+}
+
+export const tableRules = {
+  subDescription: [
+    { required: true, message: "请输入基础规则名称", trigger: ["blur"] },
+    {
+      validator: (rule, value, callback) => {
+        if (value && value.length > 100) {
+          callback(new Error("规则名称不能超过100字"));
+        } else {
+          callback();
+        }
+      },
+      trigger: "change"
+    }
+  ],
+  subType: [
+    { required: true, message: "请选择基础规则类型", trigger: ["change"] }
+  ],
+  subLenCode: [
+    {
+      required: true,
+      message: "请选择基础规则术语类型",
+      trigger: ["change"]
+    }
+  ],
+  subConceptId: [
+    { required: true, message: "请输入医学标准术语", trigger: ["blur"] }
+  ],
+  dataType: [
+    { required: true, message: "请选择类型", trigger: ["change"] }
+  ],
+  
+  
+  subEqValue: [
+    {
+      validator: (rule, value, callback) => {
+        if (value === "") {
+          callback(new Error("请输入" + this.textName));
+        } else if (value.length > 200) {
+          callback(new Error(this.textName + "不能超过200字"));
+        } else {
+          callback();
+        }
+      },
+      trigger: "blur"
+    }
+  ]
+}

+ 125 - 0
src/components/knowledgeExtra/table.vue

@@ -0,0 +1,125 @@
+<template>
+  <!-- <el-form
+    ref="groupData"
+    label-width="150px"
+    class="sub-condition-form"
+    :model="groupData"
+    :rules="rules"
+  >
+    <el-table :data="formatList" style="width: 100%">
+      <el-table-column prop="TableId" label="TableId" width="180">
+      </el-table-column>
+      <el-table-column prop="TableRowId" label="TableRowId" width="180">
+      </el-table-column>
+    </el-table>
+  </el-form> -->
+  <div>
+    <table border="1">
+      <thead>
+        <tr>
+          <th>头</th>
+          <th>头</th>
+          <th>头</th>
+          <th>头</th>
+          <th>头</th>
+        </tr>
+      </thead>
+      <tbody>
+        <form action=""> 
+          <tr>
+            <td>com</td>
+            <td>com1</td>
+            <td>com2</td>
+            <td>com3</td>
+            <td>com4</td>
+          </tr>
+        </form>
+        <form action="">
+          <tr>
+            <td>com</td>
+            <td>com1</td>
+            <td>com2</td>
+            <td>com3</td>
+            <td>com4</td>
+          </tr>
+        </form>
+      </tbody>
+    </table>
+    <div class="c_table">
+      <div class="c_row">
+        <form action="">
+          <div class="c_cell">张三</div>
+          <div class="c_cell">李四</div>
+          <div class="c_cell">王五</div>
+          <div class="c_cell">王五</div>
+        </form>
+      </div>
+      <form action="">
+        <div>
+          <div>
+            <ul>
+              <li>
+                <div class="c_row">
+                  <div class="c_cell">
+                    <div>
+                      <input type="text" name="" id="" />
+                    </div>
+                  </div>
+                  <div class="c_cell">张三</div>
+                  <div class="c_cell">李四</div>
+                  <div class="c_cell">王五</div>
+                </div>
+              </li>
+            </ul>
+          </div>
+        </div>
+      </form>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  props: ["list"],
+  data() {
+    return {};
+  },
+  computed: {
+    formatList() {
+      let list = JSON.parse(JSON.stringify(this.list));
+      let newList = [];
+      list.forEach((item, index) => {
+        item.forEach((ite, i) => {
+          ite.TableId = index + 1;
+          ite.TableRowId = i + 1;
+        });
+        newList.push(...item);
+      });
+      console.log("newList", newList);
+      return newList;
+    }
+  }
+};
+</script>
+
+<style lang="less" scoped>
+.c_table {
+  display: table;
+  border: 1px solid #cccccc;
+  margin: 5px;
+  /*display: table时padding会失效*/
+}
+
+.c_row {
+  display: table-row;
+  border: 1px solid #cccccc;
+  /*display: table-row时margin、padding同时失效*/
+}
+
+.c_cell {
+  display: table-cell;
+  border: 1px solid #cccccc;
+  padding: 5px;
+  /*display: table-cell时margin会失效*/
+}
+</style>

二进制
src/images/add-new-rule-del.png


二进制
src/images/add-new-rule-sub.png


二进制
src/images/icon-add.png


二进制
src/images/icon-copy.png


二进制
src/images/icon-delete.png


二进制
src/images/tips.png


文件差异内容过多而无法显示
+ 8617 - 0
yarn.lock