|
@@ -207,32 +207,34 @@ function getLabel(lid,lname){
|
|
// 多选展开确定事件--主、伴、无
|
|
// 多选展开确定事件--主、伴、无
|
|
export const confirm = (state,action) =>{
|
|
export const confirm = (state,action) =>{
|
|
let res = Object.assign({},state);
|
|
let res = Object.assign({},state);
|
|
- let length1 = res.data.length;console.log(123,action);
|
|
|
|
|
|
+ let length1 = res.data.length;
|
|
let arr = JSON.parse(JSON.stringify(res.data));
|
|
let arr = JSON.parse(JSON.stringify(res.data));
|
|
const {nones,exists,withs,ikey,exclusion,excluName,ban,noneIds} = action.data;
|
|
const {nones,exists,withs,ikey,exclusion,excluName,ban,noneIds} = action.data;
|
|
- let existsId = getIds(exists);
|
|
|
|
- let withsId = getIds(withs);
|
|
|
|
|
|
+ let existsId = exists && exists.length>0?getIds(exists):[];
|
|
|
|
+ let withsId = withs && withs.length>0?getIds(withs):[];
|
|
res.symptomIds = res.symptomIds.concat(existsId,withsId,noneIds);//搜索去重
|
|
res.symptomIds = res.symptomIds.concat(existsId,withsId,noneIds);//搜索去重
|
|
// 伴 标签
|
|
// 伴 标签
|
|
const banText = JSON.stringify(ban)=='{}'?'':{id:ban.id,name:ban.name,value:ban.name,tagType:config.tagType};
|
|
const banText = JSON.stringify(ban)=='{}'?'':{id:ban.id,name:ban.name,value:ban.name,tagType:config.tagType};
|
|
-
|
|
|
|
|
|
+
|
|
// 处理主症状标签及尾巴展开symptomType=1
|
|
// 处理主症状标签及尾巴展开symptomType=1
|
|
- if(exists.length>0){
|
|
|
|
- for(let i in exists){
|
|
|
|
- arr.splice(ikey,0,getLabel(exists[i].id,exists[i].questionMapping.length==0?exists[i].name+',':exists[i].name),...(exists[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==1;})));
|
|
|
|
|
|
+ if(exists && exists.length>0){
|
|
|
|
+ // for(let i in exists){//ie8不支持for in循环
|
|
|
|
+ for(let i=0;i<exists.length; i++){
|
|
|
|
+ arr.splice(ikey,0,getLabel(exists[i].id,exists[i].questionMapping && exists[i].questionMapping.length==0?exists[i].name+',':exists[i].name),...(exists[i].questionMapping && exists[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==1;})));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
let length = arr.length - length1;
|
|
let length = arr.length - length1;
|
|
let withsArr = JSON.parse(JSON.stringify(arr));
|
|
let withsArr = JSON.parse(JSON.stringify(arr));
|
|
// 伴 伴随症状标签及尾巴展开symptomType=2
|
|
// 伴 伴随症状标签及尾巴展开symptomType=2
|
|
- if(withs.length>0){
|
|
|
|
- for(let i in withs){
|
|
|
|
|
|
+ if(withs && withs.length>0){
|
|
|
|
+ // for(let i in withs){
|
|
|
|
+ for(let i=0;i<withs.length; i++){
|
|
// withsArr.splice(parseInt(ikey)+length,0,banText,getLabel(withs[i].id,withs[i].name),...(withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;})));
|
|
// withsArr.splice(parseInt(ikey)+length,0,banText,getLabel(withs[i].id,withs[i].name),...(withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;})));
|
|
- withsArr.splice(parseInt(ikey)+length,0,getLabel(withs[i].id,withs[i].questionMapping.length==0?(ban.name+withs[i].name+','):(ban.name+withs[i].name)),...(withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;})));
|
|
|
|
|
|
+ withsArr.splice(parseInt(ikey)+length,0,getLabel(withs[i].id,withs[i].questionMapping && withs[i].questionMapping.length==0?(ban.name+withs[i].name+','):(ban.name+withs[i].name)),...(withs[i].questionMapping && withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;})));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// 无 不用展开
|
|
// 无 不用展开
|
|
let lengthN = withsArr.length - length1;
|
|
let lengthN = withsArr.length - length1;
|
|
let noneArr = JSON.parse(JSON.stringify(withsArr));
|
|
let noneArr = JSON.parse(JSON.stringify(withsArr));
|
|
@@ -247,7 +249,7 @@ export const confirm = (state,action) =>{
|
|
// res.data = resData;
|
|
// res.data = resData;
|
|
res.data = fullfillText(resData).newArr;
|
|
res.data = fullfillText(resData).newArr;
|
|
res.saveText = fullfillText(resData).saveText;
|
|
res.saveText = fullfillText(resData).saveText;
|
|
- res.update=Math.random();
|
|
|
|
|
|
+ res.update=Math.random();
|
|
return res;
|
|
return res;
|
|
};
|
|
};
|
|
|
|
|