|
@@ -607,7 +607,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 基础规则类型切换
|
|
|
- subTypeChange(val, index) {
|
|
|
+ subTypeChange(val, index, groupId) {
|
|
|
// index
|
|
|
const dragDel =
|
|
|
localStorage
|
|
@@ -621,7 +621,10 @@ export default {
|
|
|
if (dragDel.length > 0) {
|
|
|
dragType = true;
|
|
|
const types = dragDel[0].split('-');
|
|
|
- if (this.dragArr && index > 0) {
|
|
|
+ const arr = this.form.klRuleByIdSub.filter((item, i) => {
|
|
|
+ return item.groupId == groupId;
|
|
|
+ });
|
|
|
+ if (this.dragArr && arr.length == 3) {
|
|
|
//获取互斥项code
|
|
|
const list = obj.subMenuList.filter(it => {
|
|
|
return it.code == this.dragVal && it.remark.split('|')[0] == 3;
|
|
@@ -639,19 +642,21 @@ export default {
|
|
|
if (item.remark == '') {
|
|
|
return item;
|
|
|
} else {
|
|
|
- return item.remark.split('|')[0] == index + 1;
|
|
|
+ return item.remark.split('|')[0] == (index % 3) + 1;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
let klRuleByIdSub = this.form.klRuleByIdSub;
|
|
|
- klRuleByIdSub.forEach((item, i, arr) => {
|
|
|
- if (arr[0].subType == 1) {
|
|
|
- const arr = this.baseTypeList.filter(it => {
|
|
|
+ klRuleByIdSub.forEach((item, i, list) => {
|
|
|
+ if (list[0].subType == 1) {
|
|
|
+ const arrList = this.baseTypeList.filter(it => {
|
|
|
return it.type == 1;
|
|
|
});
|
|
|
if (i > 0) {
|
|
|
- this.$set(item, 'baseTypes', arr);
|
|
|
+ this.$set(item, 'baseTypes', arrList);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ this.$set(item, 'baseTypes', this.baseTypeList);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -673,11 +678,10 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
this.$set(
|
|
|
this.form.klRuleByIdSub[index],
|
|
|
'baseTermTypeList',
|
|
|
- (isDel && val == 2) || dragType ? screenArr : obj.subMenuList
|
|
|
+ (isDel && val == 1) || dragType ? screenArr : obj.subMenuList
|
|
|
);
|
|
|
this.$set(this.form.klRuleByIdSub[index], 'subLenCode', '');
|
|
|
this.$set(this.form.klRuleByIdSub[index], 'dataType', '');
|
|
@@ -711,7 +715,6 @@ export default {
|
|
|
* arg:{index:添加规则用索引,groupId:添加分组用确切id}
|
|
|
*/
|
|
|
!date && (date = new Date().valueOf());
|
|
|
-
|
|
|
const obj = {
|
|
|
groupId: date,
|
|
|
groupChildId: 'child' + new Date().valueOf(),
|
|
@@ -735,6 +738,7 @@ export default {
|
|
|
if (typeof arg.index == 'number') {
|
|
|
// 添加规则 直接在当前位置之后添加
|
|
|
this.form.klRuleByIdSub.splice(arg.index + 1, 0, obj);
|
|
|
+ this.$set(obj, 'del', false);
|
|
|
const dragDel =
|
|
|
localStorage
|
|
|
.getItem('zskDragDict')
|
|
@@ -781,6 +785,8 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
this.form.klRuleByIdSub.splice(i + 1, 0, obj);
|
|
|
+ this.$set(obj, 'del', true);
|
|
|
+ this.dragArr = null;
|
|
|
}
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.tableView.scrollFun();
|
|
@@ -794,7 +800,7 @@ export default {
|
|
|
this.form.klRuleByIdSub = list;
|
|
|
},
|
|
|
// 删除规则
|
|
|
- delGroupChild(groupChildId, index) {
|
|
|
+ delGroupChild(groupChildId, index, groupId, del) {
|
|
|
let newGroupList;
|
|
|
const dragDel =
|
|
|
localStorage
|
|
@@ -802,33 +808,16 @@ export default {
|
|
|
.match(new RegExp(this.ruleTermCodeStrs, 'g')) || [];
|
|
|
let list;
|
|
|
if (dragDel.length > 0) {
|
|
|
- if (index == 0) {
|
|
|
- const date = new Date().valueOf();
|
|
|
- newGroupList = [
|
|
|
- {
|
|
|
- groupId: date,
|
|
|
- groupChildId: 'child' + new Date().valueOf(),
|
|
|
- baseTypes: this.baseTypeList,
|
|
|
- baseTermTypeList: [],
|
|
|
- conceptList: [],
|
|
|
- subDescription: '',
|
|
|
- parRuleType: '',
|
|
|
- subConceptId: '',
|
|
|
- subType: '',
|
|
|
- subMaxOperator: '',
|
|
|
- subMaxUnit: '',
|
|
|
- subMaxValue: '',
|
|
|
- subMinOperator: '',
|
|
|
- subMinUnit: '',
|
|
|
- subMinValue: '',
|
|
|
- subEqValue: '',
|
|
|
- subLenCode: '',
|
|
|
- dataType: ''
|
|
|
- }
|
|
|
- ];
|
|
|
- } else if (index == 0 || index == 1) {
|
|
|
+ const aa = this.form.klRuleByIdSub.filter((item, i) => {
|
|
|
+ return item.groupId == groupId;
|
|
|
+ });
|
|
|
+ if (del) {
|
|
|
newGroupList = this.form.klRuleByIdSub.filter((item, i) => {
|
|
|
- return i == 0;
|
|
|
+ return i != index && i != index + 1 && i != index + 2;
|
|
|
+ });
|
|
|
+ } else if (index % 3 == 0 || index % 3 == 1) {
|
|
|
+ newGroupList = this.form.klRuleByIdSub.filter((item, i) => {
|
|
|
+ return i != index;
|
|
|
});
|
|
|
} else {
|
|
|
newGroupList = this.form.klRuleByIdSub.filter(
|
|
@@ -935,26 +924,35 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- childSubCodeChange(val, index, numTypes) {
|
|
|
+ childSubCodeChange(val, index, numTypes, groupId) {
|
|
|
const dragDel =
|
|
|
localStorage
|
|
|
.getItem('zskDragDict')
|
|
|
.match(new RegExp(this.ruleTermCodeStrs, 'g')) || [];
|
|
|
- const inx = index == 1 ? index + 1 : index == 2 ? index - 1 : index;
|
|
|
const subobj = this.baseTypeList.find(it => it.type == 1);
|
|
|
let obj = this.form.klRuleByIdSub;
|
|
|
const mutex = obj.some((item, i, arr) => {
|
|
|
return item.subLenCode == '';
|
|
|
});
|
|
|
+ const len = this.form.klRuleByIdSub.filter((item, i) => {
|
|
|
+ return item.groupId == groupId;
|
|
|
+ });
|
|
|
+ const inx =
|
|
|
+ len.length % 3 == 2
|
|
|
+ ? index + 1
|
|
|
+ : len.length % 3 == 0
|
|
|
+ ? index + 1
|
|
|
+ : index;
|
|
|
//判断药品合理性总条数是否大于1条,是否存在第二条或第三条类型为1,存在触发互斥
|
|
|
if (
|
|
|
//判断3条规则是否都已选中
|
|
|
dragDel.length > 0 &&
|
|
|
+ len[0].subType == 1 &&
|
|
|
+ len.length > 2 &&
|
|
|
index > 0 &&
|
|
|
- this.form.klRuleByIdSub.length > 1 &&
|
|
|
this.form.klRuleByIdSub[0].subType == 1
|
|
|
) {
|
|
|
- if (this.form.klRuleByIdSub.length == 3 && !mutex) {
|
|
|
+ if (!mutex && len.length == 3) {
|
|
|
//判断是否存在符合互斥条件的两条出具,若存在,置空另一条出具
|
|
|
if (this.dragArr.indexOf(this.dragVal) > -1) {
|
|
|
//剂型给药途径互斥判断
|
|
@@ -995,7 +993,7 @@ export default {
|
|
|
ele => ele === item.code && item.remark.split('|')[0] == 3
|
|
|
)
|
|
|
);
|
|
|
- if (this.form.klRuleByIdSub[inx]) {
|
|
|
+ if (this.form.klRuleByIdSub[inx] ) {
|
|
|
this.$set(
|
|
|
this.form.klRuleByIdSub[inx],
|
|
|
'baseTermTypeList',
|