|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="label-wrap" v-if="item">
|
|
|
- <span v-for="(it,index) in datas.questionMapping" :key="it.id" :class="['symp',{'check':it.select==1}]" @click="handleClick(it,index)">
|
|
|
+ <span v-for="(it,index) in datas.questionMapping" :key="it.id" :class="['symp',{'check':it.select==1},{'exclu':exclusion !==999 && it.exclusionType !== exclusion}]" @click="handleClick(it,index)">
|
|
|
<i>{{it.name}}</i>
|
|
|
<i v-if="it.select==1" @click="deletSymp($event,it,index)"><img src="../images/delete.png" alt=""></i>
|
|
|
</span>
|
|
@@ -20,20 +20,36 @@ import Toast from '../common/Toast.vue';
|
|
|
checkTxt:[],
|
|
|
showToast:false,
|
|
|
delText:"是否取消当前选中内容?",
|
|
|
- tempItem:{}
|
|
|
+ tempItem:{},
|
|
|
+ exclusion:999 //互斥
|
|
|
}
|
|
|
},
|
|
|
props:['item','moduleType','ppId'],
|
|
|
created(){
|
|
|
- this.datas = JSON.parse(JSON.stringify(this.item));
|
|
|
+ this.datas = this.item;
|
|
|
+ // 回读互斥项标识
|
|
|
+ const arr = this.datas.questionMapping;
|
|
|
+ const filArr = arr.filter(it=>it.select==1);
|
|
|
+ if(filArr.length > 0){
|
|
|
+ this.exclusion = filArr[0].exclusionType;
|
|
|
+ }
|
|
|
},
|
|
|
components:{
|
|
|
Toast
|
|
|
},
|
|
|
methods:{
|
|
|
handleClick(it,index){
|
|
|
- // store更新数据
|
|
|
- // this.$emit('updateOrig');
|
|
|
+ const arr = this.datas.questionMapping;
|
|
|
+ const excluArr = arr.filter(it=>it.exclusionType==1);
|
|
|
+ const filArr = arr.filter(it=>it.select==1);
|
|
|
+ if(excluArr.length>0){//有互斥
|
|
|
+ if(filArr.length>0){//有选中
|
|
|
+ if(it.exclusionType !== filArr[0].exclusionType){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.exclusion = it.exclusionType;
|
|
|
+ }
|
|
|
const newItem = Object.assign({},it,{select:1});
|
|
|
const origMapping = this.item.questionMapping;
|
|
|
let mapping = this.datas.questionMapping;
|
|
@@ -43,7 +59,7 @@ import Toast from '../common/Toast.vue';
|
|
|
}
|
|
|
}
|
|
|
// 存值到store
|
|
|
- this.$store.commit('setOrigin',{type:this.moduleType,data:newItem,pId:this.datas.id});
|
|
|
+ this.$store.commit('setDatas',{type:this.moduleType,data:newItem,pId:this.datas.id,ppId:this.ppId});
|
|
|
this.$store.commit('setText',{type:this.moduleType,text:it.name,pId:it.id});
|
|
|
if(it.questionMapping&&it.questionMapping.length>0){//有明细
|
|
|
this.$emit("setDetail",{detail:it,ppId:this.ppId})
|
|
@@ -56,15 +72,39 @@ import Toast from '../common/Toast.vue';
|
|
|
},
|
|
|
comfirnDel(){
|
|
|
const temp = this.tempItem;
|
|
|
- const newItem = Object.assign({},temp,{select:0});
|
|
|
- const origMapping = this.item.questionMapping;
|
|
|
- let mapping = this.datas.questionMapping;
|
|
|
- for(let i in origMapping){
|
|
|
- if(origMapping[i].id==temp.id){
|
|
|
- mapping.splice(i,1,newItem)
|
|
|
+ // 从store中取origin的值
|
|
|
+ let origin,newItem;
|
|
|
+ if(this.moduleType==2){
|
|
|
+ origin = this.$store.state.diagnose.origin
|
|
|
+ }else if(this.moduleType == 3){
|
|
|
+ origin = this.$store.state.others.origin
|
|
|
+ }
|
|
|
+ if(origin){
|
|
|
+ for(let i in origin){
|
|
|
+ if(origin[i].id==this.ppId){
|
|
|
+ let origItem = origin[i].questionMapping;
|
|
|
+ for(let j in origItem){
|
|
|
+ if(origItem[j].id==temp.id){
|
|
|
+ newItem = origItem[j];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let mapping = this.datas.questionMapping;
|
|
|
+ for(let n in mapping){
|
|
|
+ if(mapping[n].id==temp.id){
|
|
|
+ mapping.splice(n,1,newItem)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- this.$store.commit('setOrigin',{type:this.moduleType,data:newItem,pId:this.datas.id});
|
|
|
+ // 是否解除互斥
|
|
|
+ const arr = this.datas.questionMapping;
|
|
|
+ const filArr = arr.filter(it=>it.select==1);
|
|
|
+ if(filArr.length==0){
|
|
|
+ this.exclusion = 999;
|
|
|
+ }
|
|
|
+ //存值
|
|
|
+ this.$store.commit('setDatas',{type:this.moduleType,data:newItem,pId:this.datas.id,ppId:this.ppId});
|
|
|
this.$store.commit('delText',{type:this.moduleType,pId:temp.id});
|
|
|
this.cancelDel();
|
|
|
},
|
|
@@ -107,6 +147,9 @@ import Toast from '../common/Toast.vue';
|
|
|
box-shadow: 0 .08rem .16rem 0 rgba(79,129,255,0.40);
|
|
|
padding-right: 0.57rem;
|
|
|
}
|
|
|
+ .exclu{
|
|
|
+ background:#f0f1f5;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
</style>
|