|
@@ -25,15 +25,13 @@ import Toast from '../common/Toast.vue';
|
|
|
},
|
|
|
props:['item','moduleType','ppId'],
|
|
|
created(){
|
|
|
- this.datas = JSON.parse(JSON.stringify(this.item));
|
|
|
+ this.datas = this.item;
|
|
|
},
|
|
|
components:{
|
|
|
Toast
|
|
|
},
|
|
|
methods:{
|
|
|
handleClick(it,index){
|
|
|
- // store更新数据
|
|
|
- // this.$emit('updateOrig');
|
|
|
const newItem = Object.assign({},it,{select:1});
|
|
|
const origMapping = this.item.questionMapping;
|
|
|
let mapping = this.datas.questionMapping;
|
|
@@ -43,7 +41,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 +54,32 @@ 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});
|
|
|
+ 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();
|
|
|
},
|