|
@@ -24,6 +24,11 @@
|
|
.el-select {
|
|
.el-select {
|
|
width: 100%;
|
|
width: 100%;
|
|
}
|
|
}
|
|
|
|
+ .tip_text {
|
|
|
|
+ margin-top: -8px;
|
|
|
|
+ font-size: 12px;
|
|
|
|
+ color: red;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|
|
<template>
|
|
<template>
|
|
@@ -34,7 +39,7 @@
|
|
linkTo="ZskRuleManager"
|
|
linkTo="ZskRuleManager"
|
|
></crumbs>
|
|
></crumbs>
|
|
<div class="AddRuleContent">
|
|
<div class="AddRuleContent">
|
|
- <el-form ref="form" size="mini" :model="form" :rules="rules">
|
|
|
|
|
|
+ <el-form size="mini" :model="form" :rules="rules" ref="ruleForm">
|
|
<div class="table_form">
|
|
<div class="table_form">
|
|
<!-- 规则名称 -->
|
|
<!-- 规则名称 -->
|
|
<el-form-item
|
|
<el-form-item
|
|
@@ -65,9 +70,9 @@
|
|
>
|
|
>
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
- <!-- <div class="tip-text">
|
|
|
|
|
|
+ <div class="tip_text">
|
|
注:更改规则类型,将会清空已填写的规则内容~
|
|
注:更改规则类型,将会清空已填写的规则内容~
|
|
- </div> -->
|
|
|
|
|
|
+ </div>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<!-- 规则术语类型: -->
|
|
<!-- 规则术语类型: -->
|
|
<el-form-item
|
|
<el-form-item
|
|
@@ -89,9 +94,9 @@
|
|
>
|
|
>
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
- <!-- <div class="tip-text">
|
|
|
|
|
|
+ <div class="tip_text">
|
|
注:更改规则术语类型,将会清空已填写的规则内容~
|
|
注:更改规则术语类型,将会清空已填写的规则内容~
|
|
- </div> -->
|
|
|
|
|
|
+ </div>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<!-- 医学标准术语 -->
|
|
<!-- 医学标准术语 -->
|
|
<el-form-item
|
|
<el-form-item
|
|
@@ -106,6 +111,7 @@
|
|
remote
|
|
remote
|
|
:remote-method="searchConcept"
|
|
:remote-method="searchConcept"
|
|
v-model.trim="form.parConceptId"
|
|
v-model.trim="form.parConceptId"
|
|
|
|
+ @change="parConceptIdChange"
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
v-for="item in conceptList"
|
|
v-for="item in conceptList"
|
|
@@ -150,16 +156,21 @@
|
|
</div>
|
|
</div>
|
|
<!-- 表格 -->
|
|
<!-- 表格 -->
|
|
<AddNewRuleTable
|
|
<AddNewRuleTable
|
|
- v-if="form.parHasSub === 1"
|
|
|
|
- :klRuleInfoSaveSub="form.klRuleInfoSaveSub"
|
|
|
|
- :baseTermTypeList="baseTermTypeList"
|
|
|
|
|
|
+ v-if="form.parHasSub"
|
|
|
|
+ :klRuleByIdSub="form.klRuleByIdSub"
|
|
:maxNum="subRuleMaxNum"
|
|
:maxNum="subRuleMaxNum"
|
|
@subTypeChange="subTypeChange"
|
|
@subTypeChange="subTypeChange"
|
|
@searchConcept="searchConcept"
|
|
@searchConcept="searchConcept"
|
|
@addGroup="addGroup"
|
|
@addGroup="addGroup"
|
|
@delGroup="delGroup"
|
|
@delGroup="delGroup"
|
|
@delGroupChild="delGroupChild"
|
|
@delGroupChild="delGroupChild"
|
|
|
|
+ @setFormData="setFormData"
|
|
/>
|
|
/>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button type="primary" @click="submitForm('ruleForm')"
|
|
|
|
+ >立即创建</el-button
|
|
|
|
+ >
|
|
|
|
+ </el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -182,6 +193,7 @@ export default {
|
|
isCopy: false,
|
|
isCopy: false,
|
|
parId: null,
|
|
parId: null,
|
|
msgDict: "", //显示附加信息的类型
|
|
msgDict: "", //显示附加信息的类型
|
|
|
|
+ firstPlace: null,
|
|
form: {
|
|
form: {
|
|
parDescription: "",
|
|
parDescription: "",
|
|
parRuleType: "",
|
|
parRuleType: "",
|
|
@@ -191,7 +203,7 @@ export default {
|
|
parHasSub: undefined,
|
|
parHasSub: undefined,
|
|
parLenCode: "",
|
|
parLenCode: "",
|
|
parMsg: "",
|
|
parMsg: "",
|
|
- klRuleInfoSaveSub: []
|
|
|
|
|
|
+ klRuleByIdSub: []
|
|
},
|
|
},
|
|
rules: formRules
|
|
rules: formRules
|
|
};
|
|
};
|
|
@@ -205,15 +217,120 @@ export default {
|
|
this.parId = info.parId;
|
|
this.parId = info.parId;
|
|
this.isCopy = param.copy;
|
|
this.isCopy = param.copy;
|
|
this.title = "规则维护-" + (this.isCopy ? "复制" : "修改") + "规则";
|
|
this.title = "规则维护-" + (this.isCopy ? "复制" : "修改") + "规则";
|
|
|
|
+ this.form = JSON.parse(JSON.stringify(info));
|
|
|
|
+ // 编辑初始化选择框
|
|
|
|
+ this.initEdidData();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- computed: {},
|
|
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 编辑初始化
|
|
|
|
+ async initEdidData() {
|
|
|
|
+ // 规则术语类型初始化
|
|
|
|
+ const newruleTermTypeList = await this.ruleTypeList.find(
|
|
|
|
+ (it) => it.id == this.form.parRuleType
|
|
|
|
+ );
|
|
|
|
+ this.ruleTermTypeList = await newruleTermTypeList.subMenuList;
|
|
|
|
+ // 基础规则类型初始化
|
|
|
|
+ const obj = await this.ruleTermTypeList.find(
|
|
|
|
+ (it1) => it1.code == this.form.parLenCode
|
|
|
|
+ );
|
|
|
|
+ this.baseTypeList = obj.subMenuList;
|
|
|
|
+ this.subRuleMaxNum = obj.number;
|
|
|
|
+
|
|
|
|
+ this.conceptList = [
|
|
|
|
+ { conceptName: this.form.parlibName, conceptId: this.form.parConceptId }
|
|
|
|
+ ];
|
|
|
|
+ if (this.form.parConceptId && this.checkFirstPlace && this.conceptList) {
|
|
|
|
+ console.log("this.conceptList", this.conceptList);
|
|
|
|
+ this.firstPlace = this.conceptList.find(
|
|
|
|
+ (it) => it.conceptId === this.form.parConceptId
|
|
|
|
+ );
|
|
|
|
+ console.log("firstPlace", this.firstPlace);
|
|
|
|
+ if (this.firstPlace) {
|
|
|
|
+ this.firstPlace["checkedType"] = this.ruleTermCodeStr;
|
|
|
|
+ }
|
|
|
|
+ } else if (!this.form.parConceptId) {
|
|
|
|
+ this.setInitGroupData();
|
|
|
|
+ this.firstPlace = null;
|
|
|
|
+ } else {
|
|
|
|
+ this.firstPlace = null;
|
|
|
|
+ }
|
|
|
|
+ await this.form.klRuleByIdSub.forEach((item, i, arr) => {
|
|
|
|
+ item.groupId = "groupId" + item.groupType;
|
|
|
|
+ item.groupChildId = "child" + item.subId;
|
|
|
|
+ //TODO => 赋值时一定要注意set更新页面
|
|
|
|
+ this.$set(item, "baseTypes", [...this.baseTypeList]);
|
|
|
|
+ this.$set(
|
|
|
|
+ item,
|
|
|
|
+ "baseTermTypeList",
|
|
|
|
+ item.baseTypes.find((it2) => it2.type === item.subType).subMenuList
|
|
|
|
+ );
|
|
|
|
+ this.$set(item, "conceptList", [
|
|
|
|
+ {
|
|
|
|
+ conceptName: item.subLibName || item.subConceptName,
|
|
|
|
+ conceptId: item.subConceptId
|
|
|
|
+ }
|
|
|
|
+ ]);
|
|
|
|
+ if (item.subMaxOperator || item.subMinOperator) {
|
|
|
|
+ item.dataType = "1";
|
|
|
|
+ } else if (item.subEqValue) {
|
|
|
|
+ item.dataType = "2";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // disable
|
|
|
|
+ console.log(this.form.parHasSub, 1312321, this.firstPlace);
|
|
|
|
+ if (arr[i - 1] && arr[i - 1].groupId == item.groupId) {
|
|
|
|
+ this.$set(item, "disabled", false);
|
|
|
|
+ } else {
|
|
|
|
+ this.$set(item, "disabled", true);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 提交
|
|
|
|
+ submitForm(formName) {
|
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ let params = JSON.parse(JSON.stringify(this.form));
|
|
|
|
+ params.klRuleInfoSaveSub = params.klRuleByIdSub;
|
|
|
|
+ delete params.klRuleByIdSub;
|
|
|
|
+ params.klRuleInfoSaveSub.forEach((item, i, arr) => {
|
|
|
|
+ if (i === 0) {
|
|
|
|
+ item.groupType = 1;
|
|
|
|
+ } else {
|
|
|
|
+ if (item.groupId == arr[i - 1].groupId) {
|
|
|
|
+ item.groupType = arr[i - 1].groupType;
|
|
|
|
+ } else {
|
|
|
|
+ item.groupType = arr[i - 1].groupType + 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ params.klRuleInfoSaveSub.forEach((ite) => {
|
|
|
|
+ delete ite.groupId;
|
|
|
|
+ delete ite.groupChildId;
|
|
|
|
+ delete ite.baseTypes;
|
|
|
|
+ delete ite.baseTermTypeList;
|
|
|
|
+ delete ite.conceptList;
|
|
|
|
+ });
|
|
|
|
+ if (this.parId) {
|
|
|
|
+ params.parId = this.isCopy ? undefined : this.parId;
|
|
|
|
+ params.parStatus = this.isCopy ? 1 : this.form.parStatus;
|
|
|
|
+ }
|
|
|
|
+ console.log(params);
|
|
|
|
+ this.saveRule(params);
|
|
|
|
+ } else {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 子集修改父级的数组
|
|
|
|
+ setFormData(index, data) {
|
|
|
|
+ this.form.klRuleByIdSub[index].conceptList = data;
|
|
|
|
+ },
|
|
// table_form 规则类型选中
|
|
// table_form 规则类型选中
|
|
ruleTypeChange(val) {
|
|
ruleTypeChange(val) {
|
|
this.form.parLenCode = "";
|
|
this.form.parLenCode = "";
|
|
this.form.parMsg = "";
|
|
this.form.parMsg = "";
|
|
- const obj = this.ruleTypeList.find((it) => it.id === val); //console.log('???',val,obj)
|
|
|
|
|
|
+ const obj = this.ruleTypeList.find((it) => it.id === val);
|
|
this.ruleTermTypeList = obj.subMenuList;
|
|
this.ruleTermTypeList = obj.subMenuList;
|
|
this.subRuleMaxNum = undefined;
|
|
this.subRuleMaxNum = undefined;
|
|
this.setInitGroupData();
|
|
this.setInitGroupData();
|
|
@@ -225,18 +342,66 @@ export default {
|
|
this.form.parLenName = obj.name;
|
|
this.form.parLenName = obj.name;
|
|
this.baseTypeList = obj.subMenuList;
|
|
this.baseTypeList = obj.subMenuList;
|
|
this.subRuleMaxNum = obj.number;
|
|
this.subRuleMaxNum = obj.number;
|
|
- this.setInitGroupData();
|
|
|
|
this.form.parHasSub = obj.subMenuList.length ? 1 : 0;
|
|
this.form.parHasSub = obj.subMenuList.length ? 1 : 0;
|
|
|
|
+ this.setInitGroupData();
|
|
|
|
+ },
|
|
|
|
+ // 医学标准术语
|
|
|
|
+ parConceptIdChange(val) {
|
|
|
|
+ console.log(this.form.klRuleByIdSub);
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ if (val && this.checkFirstPlace && this.conceptList) {
|
|
|
|
+ console.log("this.conceptList", this.conceptList);
|
|
|
|
+ this.firstPlace = this.conceptList.find((it) => it.conceptId === val);
|
|
|
|
+ console.log("firstPlace", this.firstPlace);
|
|
|
|
+ if (this.firstPlace) {
|
|
|
|
+ this.firstPlace["checkedType"] = this.ruleTermCodeStr;
|
|
|
|
+ }
|
|
|
|
+ } else if (!val) {
|
|
|
|
+ this.setInitGroupData();
|
|
|
|
+ this.firstPlace = null;
|
|
|
|
+ } else {
|
|
|
|
+ this.firstPlace = null;
|
|
|
|
+ }
|
|
|
|
+ if (this.form.parHasSub && this.firstPlace) {
|
|
|
|
+ const dict =
|
|
|
|
+ localStorage
|
|
|
|
+ .getItem("zskDicts")
|
|
|
|
+ .match(new RegExp(this.firstPlace.checkedType + "-\\d+", "g")) ||
|
|
|
|
+ [];
|
|
|
|
+ const types = dict[0].split("-");
|
|
|
|
+ let obj = this.form.klRuleByIdSub;
|
|
|
|
+ obj.forEach((item, i, arr) => {
|
|
|
|
+ if (arr[i - 1] && arr[i - 1].groupId == item.groupId) {
|
|
|
|
+ this.$set(item, "disabled", false);
|
|
|
|
+ } else {
|
|
|
|
+ this.$set(item, "disabled", true);
|
|
|
|
+ this.$set(item, "subType", parseInt(types[2]));
|
|
|
|
+ const subobj = this.baseTypeList.find(
|
|
|
|
+ (it) => it.type == types[2]
|
|
|
|
+ );
|
|
|
|
+ console.log("adwafvadc", subobj);
|
|
|
|
+ this.$set(item, "baseTermTypeList", subobj.subMenuList);
|
|
|
|
+ this.$set(item, "subLenCode", types[1]);
|
|
|
|
+ this.$set(item, "subDescription", this.firstPlace.conceptName);
|
|
|
|
+ this.$set(item, "subConceptId", this.firstPlace.conceptId);
|
|
|
|
+ this.$set(item, "subConceptName", this.firstPlace.conceptName);
|
|
|
|
+ this.$set(item, "conceptList", [this.firstPlace]);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ this.$set(this.form, "klRuleByIdSub", obj);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 初始化表格
|
|
// 初始化表格
|
|
setInitGroupData() {
|
|
setInitGroupData() {
|
|
const date = new Date().valueOf();
|
|
const date = new Date().valueOf();
|
|
- this.form.klRuleInfoSaveSub = [
|
|
|
|
|
|
+ this.$set(this.form, "klRuleByIdSub", [
|
|
{
|
|
{
|
|
groupId: date,
|
|
groupId: date,
|
|
groupChildId: "child" + new Date().valueOf(),
|
|
groupChildId: "child" + new Date().valueOf(),
|
|
baseTypes: this.baseTypeList,
|
|
baseTypes: this.baseTypeList,
|
|
baseTermTypeList: [],
|
|
baseTermTypeList: [],
|
|
|
|
+ conceptList: [],
|
|
subDescription: "",
|
|
subDescription: "",
|
|
parRuleType: "",
|
|
parRuleType: "",
|
|
subConceptId: "",
|
|
subConceptId: "",
|
|
@@ -251,44 +416,41 @@ export default {
|
|
subLenCode: "",
|
|
subLenCode: "",
|
|
dataType: ""
|
|
dataType: ""
|
|
}
|
|
}
|
|
- ];
|
|
|
|
|
|
+ ]);
|
|
this.form.parConceptId = ""; //医学标准术语清空
|
|
this.form.parConceptId = ""; //医学标准术语清空
|
|
this.conceptList = []; //下拉列表清空
|
|
this.conceptList = []; //下拉列表清空
|
|
},
|
|
},
|
|
// 有无子条件切换
|
|
// 有无子条件切换
|
|
hasSubChange(val) {
|
|
hasSubChange(val) {
|
|
if (val) {
|
|
if (val) {
|
|
- console.log(val);
|
|
|
|
this.setInitGroupData();
|
|
this.setInitGroupData();
|
|
} else {
|
|
} else {
|
|
- this.form.klRuleInfoSaveSub = [];
|
|
|
|
|
|
+ this.form.klRuleByIdSub = [];
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 基础规则类型切换
|
|
// 基础规则类型切换
|
|
subTypeChange(val, index) {
|
|
subTypeChange(val, index) {
|
|
// index
|
|
// index
|
|
const obj = this.baseTypeList.find((it) => it.type === val);
|
|
const obj = this.baseTypeList.find((it) => it.type === val);
|
|
- console.log("subMenuList", obj.subMenuList);
|
|
|
|
- console.log("baseTermTypeList", this.form.klRuleInfoSaveSub[index]);
|
|
|
|
- this.form.klRuleInfoSaveSub[index].baseTermTypeList = obj.subMenuList;
|
|
|
|
- this.form.klRuleInfoSaveSub[index].subLenCode = "";
|
|
|
|
- this.form.klRuleInfoSaveSub[index].dataType = "";
|
|
|
|
|
|
+ this.form.klRuleByIdSub[index].baseTermTypeList = obj.subMenuList;
|
|
|
|
+ this.form.klRuleByIdSub[index].subLenCode = "";
|
|
|
|
+ this.form.klRuleByIdSub[index].dataType = "";
|
|
this.clearConcept(index);
|
|
this.clearConcept(index);
|
|
this.clearNumText(index);
|
|
this.clearNumText(index);
|
|
},
|
|
},
|
|
clearConcept(index) {
|
|
clearConcept(index) {
|
|
- this.form.klRuleInfoSaveSub[index].subConceptId = "";
|
|
|
|
|
|
+ this.form.klRuleByIdSub[index].subConceptId = "";
|
|
this.conceptList = [];
|
|
this.conceptList = [];
|
|
},
|
|
},
|
|
clearNumText(index) {
|
|
clearNumText(index) {
|
|
- this.form.klRuleInfoSaveSub[index].subMaxOperator = "";
|
|
|
|
- this.form.klRuleInfoSaveSub[index].subMaxValue = "";
|
|
|
|
- this.form.klRuleInfoSaveSub[index].subMaxUnit = "";
|
|
|
|
- this.form.klRuleInfoSaveSub[index].subMinOperator = "";
|
|
|
|
- this.form.klRuleInfoSaveSub[index].subMinValue = "";
|
|
|
|
- this.form.klRuleInfoSaveSub[index].subMinUnit = "";
|
|
|
|
- this.form.klRuleInfoSaveSub[index].subEqValue = "";
|
|
|
|
- this.form.klRuleInfoSaveSub[index].subEqOperator = "";
|
|
|
|
|
|
+ this.form.klRuleByIdSub[index].subMaxOperator = "";
|
|
|
|
+ this.form.klRuleByIdSub[index].subMaxValue = "";
|
|
|
|
+ this.form.klRuleByIdSub[index].subMaxUnit = "";
|
|
|
|
+ this.form.klRuleByIdSub[index].subMinOperator = "";
|
|
|
|
+ this.form.klRuleByIdSub[index].subMinValue = "";
|
|
|
|
+ this.form.klRuleByIdSub[index].subMinUnit = "";
|
|
|
|
+ this.form.klRuleByIdSub[index].subEqValue = "";
|
|
|
|
+ this.form.klRuleByIdSub[index].subEqOperator = "";
|
|
},
|
|
},
|
|
// 添加分组 || 规则
|
|
// 添加分组 || 规则
|
|
addGroup(date, arg = { index: null, groupId: null }) {
|
|
addGroup(date, arg = { index: null, groupId: null }) {
|
|
@@ -303,6 +465,7 @@ export default {
|
|
groupChildId: "child" + new Date().valueOf(),
|
|
groupChildId: "child" + new Date().valueOf(),
|
|
baseTypes: this.baseTypeList,
|
|
baseTypes: this.baseTypeList,
|
|
baseTermTypeList: [],
|
|
baseTermTypeList: [],
|
|
|
|
+ conceptList: [],
|
|
subDescription: "",
|
|
subDescription: "",
|
|
parRuleType: "",
|
|
parRuleType: "",
|
|
subConceptId: "",
|
|
subConceptId: "",
|
|
@@ -319,34 +482,52 @@ export default {
|
|
};
|
|
};
|
|
if (typeof arg.index == "number") {
|
|
if (typeof arg.index == "number") {
|
|
// 添加规则 直接在当前位置之后添加
|
|
// 添加规则 直接在当前位置之后添加
|
|
- this.form.klRuleInfoSaveSub.splice(arg.index + 1, 0, obj);
|
|
|
|
|
|
+ this.form.klRuleByIdSub.splice(arg.index + 1, 0, obj);
|
|
} else {
|
|
} else {
|
|
// 添加分组 在列表中相同groupId之后添加
|
|
// 添加分组 在列表中相同groupId之后添加
|
|
|
|
+ // 添加分组时判断是否需要加disabled和添加默认值
|
|
|
|
+
|
|
|
|
+ if (this.form.parHasSub && this.firstPlace) {
|
|
|
|
+ obj.disabled = true;
|
|
|
|
+ const dict =
|
|
|
|
+ localStorage
|
|
|
|
+ .getItem("zskDicts")
|
|
|
|
+ .match(new RegExp(this.firstPlace.checkedType + "-\\d+", "g")) ||
|
|
|
|
+ [];
|
|
|
|
+ const types = dict[0].split("-");
|
|
|
|
+ this.$set(obj, "disabled", true);
|
|
|
|
+ this.$set(obj, "subType", parseInt(types[2]));
|
|
|
|
+ const subobj = this.baseTypeList.find((it) => it.type == types[2]);
|
|
|
|
+ console.log("adwafvadc", subobj);
|
|
|
|
+ this.$set(obj, "baseTermTypeList", subobj.subMenuList);
|
|
|
|
+ this.$set(obj, "subLenCode", types[1]);
|
|
|
|
+ this.$set(obj, "subDescription", this.firstPlace.conceptName);
|
|
|
|
+ this.$set(obj, "subConceptId", this.firstPlace.conceptId);
|
|
|
|
+ this.$set(obj, "subConceptName", this.firstPlace.conceptName);
|
|
|
|
+ this.$set(obj, "conceptList", [this.firstPlace]);
|
|
|
|
+ }
|
|
var i = -1;
|
|
var i = -1;
|
|
- this.form.klRuleInfoSaveSub.forEach((item, inx) => {
|
|
|
|
- console.log("look", item.groupId, arg.groupId);
|
|
|
|
|
|
+ this.form.klRuleByIdSub.forEach((item, inx) => {
|
|
if (item.groupId === arg.groupId) {
|
|
if (item.groupId === arg.groupId) {
|
|
i = inx;
|
|
i = inx;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- console.log("inx", i);
|
|
|
|
- this.form.klRuleInfoSaveSub.splice(i + 1, 0, obj);
|
|
|
|
|
|
+ this.form.klRuleByIdSub.splice(i + 1, 0, obj);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 删除分组
|
|
// 删除分组
|
|
delGroup(groupId) {
|
|
delGroup(groupId) {
|
|
- console.log("groupId", groupId);
|
|
|
|
- const list = this.form.klRuleInfoSaveSub.filter(
|
|
|
|
|
|
+ const list = this.form.klRuleByIdSub.filter(
|
|
(item) => item.groupId != groupId
|
|
(item) => item.groupId != groupId
|
|
);
|
|
);
|
|
- this.form.klRuleInfoSaveSub = list;
|
|
|
|
|
|
+ this.form.klRuleByIdSub = list;
|
|
},
|
|
},
|
|
// 删除规则
|
|
// 删除规则
|
|
delGroupChild(groupChildId) {
|
|
delGroupChild(groupChildId) {
|
|
- const newGroupList = this.form.klRuleInfoSaveSub.filter(
|
|
|
|
|
|
+ const newGroupList = this.form.klRuleByIdSub.filter(
|
|
(item) => item.groupChildId != groupChildId
|
|
(item) => item.groupChildId != groupChildId
|
|
);
|
|
);
|
|
- this.form.klRuleInfoSaveSub = newGroupList;
|
|
|
|
|
|
+ this.form.klRuleByIdSub = newGroupList;
|
|
},
|
|
},
|
|
setDict() {
|
|
setDict() {
|
|
this.dict = localStorage.getItem("zskDicts");
|
|
this.dict = localStorage.getItem("zskDicts");
|
|
@@ -383,7 +564,6 @@ export default {
|
|
},
|
|
},
|
|
getTypeList() {
|
|
getTypeList() {
|
|
this.ruleTypeList = JSON.parse(localStorage.getItem("zskTypesList"));
|
|
this.ruleTypeList = JSON.parse(localStorage.getItem("zskTypesList"));
|
|
- console.log("ruleTypeList", this.ruleTypeList);
|
|
|
|
},
|
|
},
|
|
saveRule(params) {
|
|
saveRule(params) {
|
|
api.saveRule(params).then((res) => {
|
|
api.saveRule(params).then((res) => {
|
|
@@ -406,6 +586,9 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
|
|
+ disable: function () {
|
|
|
|
+ return Object.keys(this.firstPlace || {}).length > 0;
|
|
|
|
+ },
|
|
ruleTermCodeStr: function () {
|
|
ruleTermCodeStr: function () {
|
|
return this.form.parRuleType + "-" + this.form.parLenCode;
|
|
return this.form.parRuleType + "-" + this.form.parLenCode;
|
|
},
|
|
},
|
|
@@ -417,12 +600,16 @@ export default {
|
|
},
|
|
},
|
|
showHasSub() {
|
|
showHasSub() {
|
|
return this.subDict.indexOf(this.ruleTermCodeStr) > -1;
|
|
return this.subDict.indexOf(this.ruleTermCodeStr) > -1;
|
|
|
|
+ },
|
|
|
|
+ checkFirstPlace: function () {
|
|
|
|
+ return this.dict.indexOf(this.ruleTermCodeStr) > -1;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
// "form.parRuleType": function (val) {
|
|
// "form.parRuleType": function (val) {
|
|
// const obj = this.ruleTypeList.find((it) => it.id === val);
|
|
// const obj = this.ruleTypeList.find((it) => it.id === val);
|
|
// this.ruleTermTypeList = obj.subMenuList;
|
|
// this.ruleTermTypeList = obj.subMenuList;
|
|
|
|
+ // console.log("this.ruleTermTypeList", this.ruleTermTypeList);
|
|
// },
|
|
// },
|
|
// "form.parLenCode": function (val) {
|
|
// "form.parLenCode": function (val) {
|
|
// if (!val) {
|
|
// if (!val) {
|
|
@@ -433,9 +620,55 @@ export default {
|
|
// this.baseTypeList = obj.subMenuList;
|
|
// this.baseTypeList = obj.subMenuList;
|
|
// this.subRuleMaxNum = obj.number;
|
|
// this.subRuleMaxNum = obj.number;
|
|
// },
|
|
// },
|
|
|
|
+ // firstPlace: {
|
|
|
|
+ // handler: function (val) {
|
|
|
|
+ // console.log(val);
|
|
|
|
+ // console.log(this.form.klRuleByIdSub);
|
|
|
|
+ // if (!val) return;
|
|
|
|
+ // const dict =
|
|
|
|
+ // localStorage
|
|
|
|
+ // .getItem("zskDicts")
|
|
|
|
+ // .match(new RegExp(val.checkedType + "-\\d+", "g")) || [];
|
|
|
|
+ // const types = dict[0].split("-");
|
|
|
|
+ // console.log('types',types);
|
|
|
|
+ // this.form.klRuleByIdSub.forEach((item,i,arr)=>{
|
|
|
|
+ // if (!arr[i - 1]) {
|
|
|
|
+ // // item.disabled = true;
|
|
|
|
+ // this.$set(item, "subType", parseInt(types[2]));
|
|
|
|
+ // this.$set(item, "subLenCode", types[1]);
|
|
|
|
+ // this.$set(item, "subDescription", val.conceptName);
|
|
|
|
+ // this.$set(item, "subConceptId", val.conceptId);
|
|
|
|
+ // this.$set(item, "subConceptName", val.conceptName);
|
|
|
|
+ // this.$set(item, "conceptList", [val]);
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // },
|
|
|
|
+ // deep: true
|
|
|
|
+ // },
|
|
// "form.parConceptId": function (val) {
|
|
// "form.parConceptId": function (val) {
|
|
|
|
+ // // setTimeout(() => {
|
|
|
|
+ // if (val && this.checkFirstPlace && this.conceptList) {
|
|
|
|
+ // console.log("this.conceptList", this.conceptList);
|
|
|
|
+ // this.firstPlace = this.conceptList.find((it) => it.conceptId === val);
|
|
|
|
+ // console.log("firstPlace", this.firstPlace);
|
|
|
|
+ // if (this.firstPlace) {
|
|
|
|
+ // this.firstPlace["checkedType"] = this.ruleTermCodeStr;
|
|
|
|
+ // }
|
|
|
|
+ // } else if (!val) {
|
|
|
|
+ // this.setInitGroupData();
|
|
|
|
+ // this.firstPlace = null;
|
|
|
|
+ // } else {
|
|
|
|
+ // this.firstPlace = null;
|
|
|
|
+ // }
|
|
|
|
+ // // }, 500);
|
|
|
|
+ // }
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ // this.$watch("form.parConceptId", function (val) {
|
|
// if (val && this.checkFirstPlace && this.conceptList) {
|
|
// if (val && this.checkFirstPlace && this.conceptList) {
|
|
|
|
+ // console.log("this.conceptList", this.conceptList);
|
|
// this.firstPlace = this.conceptList.find((it) => it.conceptId === val);
|
|
// this.firstPlace = this.conceptList.find((it) => it.conceptId === val);
|
|
|
|
+ // console.log("firstPlace", this.firstPlace);
|
|
// this.firstPlace["checkedType"] = this.ruleTermCodeStr;
|
|
// this.firstPlace["checkedType"] = this.ruleTermCodeStr;
|
|
// } else if (!val) {
|
|
// } else if (!val) {
|
|
// this.setInitGroupData();
|
|
// this.setInitGroupData();
|
|
@@ -443,7 +676,7 @@ export default {
|
|
// } else {
|
|
// } else {
|
|
// this.firstPlace = null;
|
|
// this.firstPlace = null;
|
|
// }
|
|
// }
|
|
- // }
|
|
|
|
|
|
+ // });
|
|
},
|
|
},
|
|
components: { AddNewRuleTable }
|
|
components: { AddNewRuleTable }
|
|
};
|
|
};
|