|
@@ -581,11 +581,12 @@ export function setCheckText(state,action) {
|
|
|
//搜索 插入标签数据
|
|
|
export function insertLabelData(state,action){
|
|
|
let res = Object.assign({},state);
|
|
|
- const {index,data,isReplace,span}=action;
|
|
|
+ const {index,data,isReplace,span}=action;console.log('现病史搜索数据',action);
|
|
|
let id = data.id;
|
|
|
let searchData = action.name;
|
|
|
- res.symptomIds.push(id);
|
|
|
+ // res.symptomIds.push(id);
|
|
|
const text = Object.assign(JSON.parse(config.textLabel),{name:searchData},{id:id});
|
|
|
+ const textEmpty = Object.assign({},JSON.parse(config.textLabel));
|
|
|
let focusIndex = res.focusIndex;
|
|
|
let saveText = res.saveText;
|
|
|
let banIdx = saveText.indexOf("伴");
|
|
@@ -602,55 +603,15 @@ export function insertLabelData(state,action){
|
|
|
res.saveText[focusIndex] = searchData;
|
|
|
}else{
|
|
|
let resData;
|
|
|
- // res.data.splice(index,0,data);
|
|
|
const searchStr = res.searchStr;
|
|
|
let innerText = span.current.innerText || span.current.innerHTML;
|
|
|
let strIndex = innerText.indexOf(searchStr);
|
|
|
const value = innerText.replace(searchStr,"");
|
|
|
- // 没有伴展开主诉symptomType=0/1的尾巴,有伴一>第一个点选上去的伴为依据,伴前展开主诉,伴后展开伴随;多余的伴以及手动输入的伴不做处理(2-25)
|
|
|
- if(banIdx==-1){
|
|
|
- // if(strIndex <= 1){//前
|
|
|
- if(strIndex < 1){//前
|
|
|
- res.data.splice(focusIndex,0,text);
|
|
|
- res.saveText.splice(focusIndex,0,searchData);
|
|
|
- res.data[focusIndex+1].value = value;
|
|
|
- res.saveText[focusIndex+1] = value;
|
|
|
- resData = JSON.parse(JSON.stringify(res.data));
|
|
|
- resData.splice(focusIndex+1,0,...(data.questionMapping.filter((item)=>{
|
|
|
- return item.symptomType==0||item.symptomType==1;
|
|
|
- })));
|
|
|
- }else{
|
|
|
- res.data.splice(focusIndex+1,0,text);
|
|
|
- res.saveText.splice(focusIndex+1,0,searchData);
|
|
|
- res.data[focusIndex].value = value;
|
|
|
- resData = JSON.parse(JSON.stringify(res.data));
|
|
|
- // +2是因为插入一个文本标签
|
|
|
- resData.splice(focusIndex+2,0,...(data.questionMapping.filter((item)=>{
|
|
|
- return item.symptomType==0||item.symptomType==1;
|
|
|
- })));
|
|
|
- }
|
|
|
- }else{
|
|
|
- if(focusIndex > banIdx){//伴后
|
|
|
- if(strIndex < 1){//前
|
|
|
- res.data.splice(focusIndex,0,text);
|
|
|
- res.saveText.splice(focusIndex,0,searchData);
|
|
|
- res.data[focusIndex+1].value = value;
|
|
|
- res.saveText[focusIndex+1] = value;
|
|
|
- resData = JSON.parse(JSON.stringify(res.data));
|
|
|
- resData.splice(focusIndex+1,0,...(data.questionMapping.filter((item)=>{
|
|
|
- return item.symptomType==0||item.symptomType==2;
|
|
|
- })));
|
|
|
- }else{
|
|
|
- res.data.splice(focusIndex+1,0,text);
|
|
|
- res.saveText.splice(focusIndex+1,0,searchData);
|
|
|
- res.data[focusIndex].value = value;
|
|
|
- resData = JSON.parse(JSON.stringify(res.data));
|
|
|
- // +2是因为插入一个文本标签
|
|
|
- resData.splice(focusIndex+2,0,...(data.questionMapping.filter((item)=>{
|
|
|
- return item.symptomType==0||item.symptomType==2;
|
|
|
- })));
|
|
|
- }
|
|
|
- }else{//伴前
|
|
|
+ if(data.itemType==0){//症状
|
|
|
+ res.symptomIds.push(id);
|
|
|
+ // 没有伴展开主诉symptomType=0/1的尾巴,有伴一>第一个点选上去的伴为依据,伴前展开主诉,伴后展开伴随;多余的伴以及手动输入的伴不做处理(2-25)
|
|
|
+ if(banIdx==-1){
|
|
|
+ // if(strIndex <= 1){//前
|
|
|
if(strIndex < 1){//前
|
|
|
res.data.splice(focusIndex,0,text);
|
|
|
res.saveText.splice(focusIndex,0,searchData);
|
|
@@ -664,20 +625,79 @@ export function insertLabelData(state,action){
|
|
|
res.data.splice(focusIndex+1,0,text);
|
|
|
res.saveText.splice(focusIndex+1,0,searchData);
|
|
|
res.data[focusIndex].value = value;
|
|
|
+ res.saveText[focusIndex] = value;
|
|
|
resData = JSON.parse(JSON.stringify(res.data));
|
|
|
// +2是因为插入一个文本标签
|
|
|
resData.splice(focusIndex+2,0,...(data.questionMapping.filter((item)=>{
|
|
|
return item.symptomType==0||item.symptomType==1;
|
|
|
})));
|
|
|
}
|
|
|
+ }else{
|
|
|
+ if(focusIndex > banIdx){//伴后
|
|
|
+ if(strIndex < 1){//前
|
|
|
+ res.data.splice(focusIndex,0,text);
|
|
|
+ res.saveText.splice(focusIndex,0,searchData);
|
|
|
+ res.data[focusIndex+1].value = value;
|
|
|
+ res.saveText[focusIndex+1] = value;
|
|
|
+ resData = JSON.parse(JSON.stringify(res.data));
|
|
|
+ resData.splice(focusIndex+1,0,...(data.questionMapping.filter((item)=>{
|
|
|
+ return item.symptomType==0||item.symptomType==2;
|
|
|
+ })));
|
|
|
+ }else{
|
|
|
+ res.data.splice(focusIndex+1,0,text);
|
|
|
+ res.saveText.splice(focusIndex+1,0,searchData);
|
|
|
+ res.data[focusIndex].value = value;
|
|
|
+ resData = JSON.parse(JSON.stringify(res.data));
|
|
|
+ // +2是因为插入一个文本标签
|
|
|
+ resData.splice(focusIndex+2,0,...(data.questionMapping.filter((item)=>{
|
|
|
+ return item.symptomType==0||item.symptomType==2;
|
|
|
+ })));
|
|
|
+ }
|
|
|
+ }else{//伴前
|
|
|
+ if(strIndex < 1){//前
|
|
|
+ res.data.splice(focusIndex,0,text);
|
|
|
+ res.saveText.splice(focusIndex,0,searchData);
|
|
|
+ res.data[focusIndex+1].value = value;
|
|
|
+ res.saveText[focusIndex+1] = value;
|
|
|
+ resData = JSON.parse(JSON.stringify(res.data));
|
|
|
+ resData.splice(focusIndex+1,0,...(data.questionMapping.filter((item)=>{
|
|
|
+ return item.symptomType==0||item.symptomType==1;
|
|
|
+ })));
|
|
|
+ }else{
|
|
|
+ res.data.splice(focusIndex+1,0,text);
|
|
|
+ res.saveText.splice(focusIndex+1,0,searchData);
|
|
|
+ res.data[focusIndex].value = value;
|
|
|
+ resData = JSON.parse(JSON.stringify(res.data));
|
|
|
+ // +2是因为插入一个文本标签
|
|
|
+ resData.splice(focusIndex+2,0,...(data.questionMapping.filter((item)=>{
|
|
|
+ return item.symptomType==0||item.symptomType==1;
|
|
|
+ })));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ res.data = fullfillText(resData).newArr;
|
|
|
+ res.saveText = fullfillText(resData).saveText;
|
|
|
+ }else{//标签
|
|
|
+ if(strIndex < 1){//前
|
|
|
+ res.data.splice(focusIndex,0,data,textEmpty);
|
|
|
+ res.saveText.splice(focusIndex,0,'','');
|
|
|
+ res.selecteds.splice(focusIndex,0,null,null);
|
|
|
+ res.data[focusIndex+1].value = value;
|
|
|
+ res.saveText[focusIndex+1] = value;
|
|
|
+ }else{
|
|
|
+ res.data.splice(focusIndex+1,0,data,textEmpty);
|
|
|
+ res.saveText.splice(focusIndex+1,0,'','');
|
|
|
+ res.selecteds.splice(focusIndex+1,0,null,null);
|
|
|
+ res.data[focusIndex].value = value;
|
|
|
+ res.saveText[focusIndex] = value;
|
|
|
}
|
|
|
}
|
|
|
- span.current.innerText?(span.current.innerText = value):(span.current.innerHTML = value);
|
|
|
- res.data = fullfillText(resData).newArr;
|
|
|
- res.saveText = fullfillText(resData).saveText;
|
|
|
+ // span.current.innerText?(span.current.innerText = value):(span.current.innerHTML = value);
|
|
|
+ // res.data = fullfillText(resData).newArr;
|
|
|
+ // res.saveText = fullfillText(resData).saveText;
|
|
|
}
|
|
|
res.searchData = []; //选中清空搜索内容(即关闭搜索弹窗)
|
|
|
- res.update = Math.random();//console.log(899,res,action);
|
|
|
+ res.update = Math.random();
|
|
|
return res;
|
|
|
}
|
|
|
|