|
@@ -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;})));*/
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -390,6 +390,10 @@ export const changeLabelVal = (state,action)=>{
|
|
|
const newVal = changeVal;
|
|
|
let labText = totalVal?totalVal:newVal;
|
|
|
let item = res.data[index];
|
|
|
+ const next = res.data[+index+1];
|
|
|
+ const nextVal = next.value||next.name;
|
|
|
+ //标签后是不是标点符号标签,是的话删除本标签时一起删除
|
|
|
+ let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
|
|
|
if(labText.trim()){
|
|
|
if(item){
|
|
|
item.value = newVal;
|
|
@@ -398,7 +402,8 @@ export const changeLabelVal = (state,action)=>{
|
|
|
res.saveText[index] = labText;
|
|
|
}
|
|
|
}else{//删除完标签内容则删除该标签
|
|
|
- res.data.splice(index,1);
|
|
|
+ const num = nextIsDot?2:1;
|
|
|
+ res.data.splice(index,num);
|
|
|
res.saveText = fullfillText(res.data).saveText;
|
|
|
}
|
|
|
res.update = Math.random();
|
|
@@ -412,6 +417,10 @@ export const changeNumLabelVal = (state,action)=>{
|
|
|
const index = ikey;
|
|
|
const newVal = changeVal;
|
|
|
let item = res.data[index];
|
|
|
+ const next = res.data[+index+1];
|
|
|
+ const nextVal = next.value||next.name;
|
|
|
+ //标签后是不是标点符号标签,是的话删除本标签时一起删除
|
|
|
+ let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
|
|
|
let labText = totalVal?totalVal:newVal; //如单选没有前后缀
|
|
|
if(labText.trim()){
|
|
|
if(item){
|
|
@@ -421,7 +430,8 @@ export const changeNumLabelVal = (state,action)=>{
|
|
|
}
|
|
|
res.saveText[index] = labText;
|
|
|
}else{//删除完标签内容则删除该标签
|
|
|
- res.data.splice(index,1);
|
|
|
+ const num = nextIsDot?2:1;
|
|
|
+ res.data.splice(index,num);
|
|
|
res.saveText = fullfillText(res.data).saveText;
|
|
|
}
|
|
|
res.update = Math.random();
|
|
@@ -498,6 +508,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 +528,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));
|
|
|
- // +3是因为插入一个文本标签加一个符号标签
|
|
|
- resData.splice(focusIndex+3,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;
|
|
@@ -597,11 +653,13 @@ export function backspaceText(state,action){
|
|
|
// data[delIndex].value = text;
|
|
|
}else if(data[delIndex-1].tagType==8){
|
|
|
data.splice(delIndex,1);
|
|
|
+ res.saveText.splice(delIndex,1);
|
|
|
}
|
|
|
else{
|
|
|
data.splice(delIndex-1,2);
|
|
|
+ res.saveText.splice(delIndex-1,2);
|
|
|
}
|
|
|
- res.saveText = fullfillText(data).saveText;
|
|
|
+ // res.saveText = fullfillText(data).saveText;
|
|
|
res.update = Math.random();
|
|
|
return res;
|
|
|
}
|
|
@@ -616,9 +674,27 @@ export function removeId(state,action){
|
|
|
if(ids.includes(id)){
|
|
|
ids.splice(ids.indexOf(id),1);
|
|
|
}
|
|
|
- data[index].id = "";
|
|
|
- data[index].name = text;
|
|
|
- data[index].value = text;
|
|
|
+ if(!data[index].value && data[index-1].tagType==8){
|
|
|
+ data.splice(index,1);
|
|
|
+ res.saveText.splice(index,1);
|
|
|
+ }else{
|
|
|
+ data[index].id = "";
|
|
|
+ data[index].name = text;
|
|
|
+ data[index].value = text;
|
|
|
+ }
|
|
|
+ //console.log(345,action,res);
|
|
|
+ res.update = Math.random();
|
|
|
+ return res;
|
|
|
+}
|
|
|
+
|
|
|
+// 单列多选
|
|
|
+export function multipleComfirn(state,action){
|
|
|
+ let res = Object.assign({},state);
|
|
|
+ const {ikey,seleData} = action.data;
|
|
|
+ let data = res.data;
|
|
|
+ data[ikey].value = seleData;
|
|
|
+ res.saveText[ikey] = seleData;
|
|
|
+ res.selecteds[ikey] = action.data;
|
|
|
res.update = Math.random();
|
|
|
return res;
|
|
|
}
|