|
@@ -255,8 +255,8 @@ export const confirm = (state,action) =>{
|
|
|
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,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;})));
|
|
|
+ withsArr.splice(parseInt(ikey)+length,0,banText,getLabel(withs[i].id,withs[i].questionMapping && withs[i].questionMapping.length==0?(withs[i].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;})));*/
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -498,6 +498,8 @@ export function insertLabelData(state,action){
|
|
|
res.symptomIds.push(id);
|
|
|
const text = Object.assign(JSON.parse(config.textLabel),{name:searchData},{id:id});
|
|
|
let focusIndex = res.focusIndex;
|
|
|
+ let saveText = res.saveText;
|
|
|
+ let banIdx = saveText.indexOf("伴");
|
|
|
|
|
|
if(isReplace){
|
|
|
span.current.innerText = '';
|
|
@@ -516,26 +518,70 @@ export function insertLabelData(state,action){
|
|
|
let innerText = span.current.innerText;
|
|
|
let strIndex = innerText.indexOf(searchStr);
|
|
|
const value = innerText.replace(searchStr,"");
|
|
|
- // let value;
|
|
|
- // 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==2;
|
|
|
- })));
|
|
|
+ // 没有伴展开主诉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{
|
|
|
- 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;
|
|
|
- })));
|
|
|
+ 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;
|
|
|
+ })));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
span.current.innerText = value;
|
|
|
res.data = fullfillText(resData).newArr;
|