|
@@ -731,15 +731,21 @@ export function insertLabelData(state,action){
|
|
|
let focusIndex = res.focusIndex;
|
|
|
let saveText = res.saveText;
|
|
|
let banIdx = saveText.indexOf("伴");
|
|
|
-
|
|
|
+ //伴随展开数据-过滤了连续标点
|
|
|
+ const FilteredDotMapping2=formatContinueDots(data.questionMapping.filter((item)=>{
|
|
|
+ return item.symptomType==0||item.symptomType==2;
|
|
|
+ }));
|
|
|
+ //主症状展开数据-过滤连续了标点
|
|
|
+ const FilteredDotMapping1=formatContinueDots(data.questionMapping.filter((item)=>{
|
|
|
+ return item.symptomType==0||item.symptomType==1;
|
|
|
+ }));
|
|
|
if(isReplace){
|
|
|
span.current.innerText?(span.current.innerText = ''):(span.current.innerHTML = '');
|
|
|
// res.data.splice(focusIndex,1,text,data);
|
|
|
// 搜索结果展开伴随symptomType==2的尾巴
|
|
|
+
|
|
|
let resData = JSON.parse(JSON.stringify(res.data));
|
|
|
- resData.splice(focusIndex,1,text,...(data.questionMapping.filter((item)=>{
|
|
|
- return item.symptomType==0||item.symptomType==2;
|
|
|
- })));
|
|
|
+ resData.splice(focusIndex,1,text,...(FilteredDotMapping2));
|
|
|
res.data = fullfillText(resData).newArr;
|
|
|
res.saveText[focusIndex] = searchData;
|
|
|
}else{
|
|
@@ -753,55 +759,45 @@ export function insertLabelData(state,action){
|
|
|
res.symptomIds.push(id);
|
|
|
// 没有伴展开主诉symptomType=0/1的尾巴,有伴一>第一个点选上去的伴为依据,伴前展开主诉,伴后展开伴随;多余的伴以及手动输入的伴不做处理(2-25)
|
|
|
if(banIdx==-1){
|
|
|
+
|
|
|
// if(strIndex <= 1){//前
|
|
|
if(strIndex < 1){//前
|
|
|
- res.data.splice(index,1,text,...(data.questionMapping.filter((item)=>{
|
|
|
- return item.symptomType==0||item.symptomType==1;
|
|
|
- })),pText);
|
|
|
+ res.data.splice(index,1,text,...(FilteredDotMapping1),pText);
|
|
|
res.saveText = fullfillText(res.data).saveText;
|
|
|
- res.selecteds.splice(index,1,null,...new Array(data.questionMapping.length).fill(null),null);
|
|
|
+ res.selecteds.splice(index,1,null,...new Array(FilteredDotMapping1.length).fill(null),null);
|
|
|
}else{
|
|
|
- res.data.splice(index,1,pText,text,...(data.questionMapping.filter((item)=>{
|
|
|
- return item.symptomType==0||item.symptomType==1;
|
|
|
- })));
|
|
|
+ res.data.splice(index,1,pText,text,...(FilteredDotMapping1));
|
|
|
res.saveText = fullfillText(res.data).saveText;
|
|
|
- res.selecteds.splice(index,1,null,null,...new Array(data.questionMapping.length).fill(null));
|
|
|
+ res.selecteds.splice(index,1,null,null,...new Array(FilteredDotMapping1.length).fill(null));
|
|
|
}
|
|
|
}else{
|
|
|
if(focusIndex > banIdx){//伴后
|
|
|
if(strIndex < 1){//前
|
|
|
- res.data.splice(index,1,text,...(data.questionMapping.filter((item)=>{
|
|
|
- return item.symptomType==0||item.symptomType==2;
|
|
|
- })),pText);
|
|
|
+ res.data.splice(index,1,text,...(FilteredDotMapping2),pText);
|
|
|
res.saveText = fullfillText(res.data).saveText;
|
|
|
- res.selecteds.splice(index,1,null,...new Array(data.questionMapping.length).fill(null),null);
|
|
|
+ res.selecteds.splice(index,1,null,...new Array(FilteredDotMapping2.length).fill(null),null);
|
|
|
}else{
|
|
|
- res.data.splice(index,1,pText,text,...(data.questionMapping.filter((item)=>{
|
|
|
- return item.symptomType==0||item.symptomType==2;
|
|
|
- })));
|
|
|
+ res.data.splice(index,1,pText,text,...(FilteredDotMapping2));
|
|
|
res.saveText = fullfillText(res.data).saveText;
|
|
|
- res.selecteds.splice(index,1,null,null,...new Array(data.questionMapping.length).fill(null));
|
|
|
+ res.selecteds.splice(index,1,null,null,...new Array(FilteredDotMapping2.length).fill(null));
|
|
|
}
|
|
|
}else{//伴前
|
|
|
if(strIndex < 1){//前
|
|
|
- res.data.splice(index,1,text,...(data.questionMapping.filter((item)=>{
|
|
|
- return item.symptomType==0||item.symptomType==1;
|
|
|
- })),pText);
|
|
|
+ res.data.splice(index,1,text,...(FilteredDotMapping1),pText);
|
|
|
res.saveText = fullfillText(res.data).saveText;
|
|
|
- res.selecteds.splice(index,1,null,...new Array(data.questionMapping.length).fill(null),null);
|
|
|
+ res.selecteds.splice(index,1,null,...new Array(FilteredDotMapping1.length).fill(null),null);
|
|
|
}else{
|
|
|
- res.data.splice(index,1,pText,text,...(data.questionMapping.filter((item)=>{
|
|
|
- return item.symptomType==0||item.symptomType==1;
|
|
|
- })));
|
|
|
+ res.data.splice(index,1,pText,text,...(FilteredDotMapping1));
|
|
|
res.saveText = fullfillText(res.data).saveText;
|
|
|
- res.selecteds.splice(index,1,null,null,...new Array(data.questionMapping.length).fill(null));
|
|
|
+ res.selecteds.splice(index,1,null,null,...new Array(FilteredDotMapping1.length).fill(null));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
res.data = fullfillText(res.data).newArr;
|
|
|
res.saveText = fullfillText(res.data).saveText;
|
|
|
}else{//标签
|
|
|
- const spreadLabels = data.tagType==4?fullfillText(data.questionMapping).newArr:[data];
|
|
|
+ const arr=fullfillText(data.questionMapping).newArr; //过滤连续标点
|
|
|
+ const spreadLabels = data.tagType==4?formatContinueDots(arr):[data];
|
|
|
if(strIndex < 1){//前
|
|
|
// 判断前一个是否为文本标签,是直接插入标签,不是则在前面插入一个空文本标签
|
|
|
const preItem = res.data[index-1];
|
|
@@ -845,10 +841,12 @@ export const clearCurrentEdit = (state,action)=>{
|
|
|
export function addLabelItem(state,action){
|
|
|
let res = Object.assign({},state);
|
|
|
const {data,i} = action;
|
|
|
- const textLabel = JSON.parse(config.textLabel);
|
|
|
+ const textLabel = Object.assign({},JSON.parse(config._textLabel),{showInCheck:JSON.parse(data).showInCheck});
|
|
|
//使用Object.assign({},data)拷贝操作时复制项和原项会同步修改
|
|
|
if(!data) return res;
|
|
|
- res.data.splice(i+1,0,JSON.parse(data),textLabel);
|
|
|
+ res.data.splice(+i+2,0,JSON.parse(data),textLabel);
|
|
|
+ res.saveText.splice(+i+2,0,'','');
|
|
|
+ res.selecteds.splice(+i+2,0,null,null);
|
|
|
res.update = Math.random();
|
|
|
return res;
|
|
|
}
|