|
@@ -22,9 +22,31 @@ export const setMainMoudle = (state,action) => {
|
|
|
const res = Object.assign({},state);
|
|
|
// const emptySpan = JSON.parse(config.textLabel);
|
|
|
// let data = action.data.push(emptySpan);
|
|
|
- res.moduleData = action.data;
|
|
|
+ // 处理tagType=4的类型
|
|
|
+ // const originalData = JSON.parse(JSON.stringify(action.data));
|
|
|
+ const originalData = action.data;
|
|
|
+ const originalSonData = action.addSymptom;
|
|
|
+ let spreadLabels=[];
|
|
|
+ let sonSpreadLabels=[];//子模板
|
|
|
+ for(let i=0; i<originalData.length;i++){
|
|
|
+ if(originalData[i].tagType==4){
|
|
|
+ spreadLabels.push(...originalData[i].questionMapping);
|
|
|
+ }else{
|
|
|
+ spreadLabels.push(originalData[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for(let j=0; j<originalSonData.length;j++){
|
|
|
+ if(originalSonData[j].tagType==4){
|
|
|
+ sonSpreadLabels.push(...originalSonData[j].questionMapping);
|
|
|
+ }else{
|
|
|
+ sonSpreadLabels.push(originalSonData[j]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // res.moduleData = action.data;
|
|
|
+ // res.addSmoduleData = action.addSymptom;
|
|
|
+ res.moduleData = spreadLabels;
|
|
|
res.saveText = res.save||[];
|
|
|
- res.addSmoduleData = action.addSymptom;
|
|
|
+ res.addSmoduleData = sonSpreadLabels;
|
|
|
res.addModuleName = action.addModuleName;
|
|
|
res.update=Math.random();
|
|
|
return res;
|
|
@@ -167,16 +189,19 @@ export const confirm = (state,action) =>{
|
|
|
// 第二病程-伴位置处理
|
|
|
let forwardId;
|
|
|
let text;
|
|
|
- for(let n=labelIndx-1; n>0; n--){
|
|
|
+ for(let n=labelIndx-1; n>=0; n--){
|
|
|
// if(arr[n].id==8){
|
|
|
if(arr[n].flag && arr[n].flag==1){//添加症状打标flag=1
|
|
|
forwardId = n;
|
|
|
- continue;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
if(forwardId){
|
|
|
text = saveText.slice(forwardId,labelIndx);
|
|
|
let index = text.indexOf('伴');
|
|
|
+ let sliceArr = arr.slice(forwardId,labelIndx);
|
|
|
+ let newSliceArr = JSON.parse(JSON.stringify(sliceArr));
|
|
|
+
|
|
|
if(index==-1){//没有伴,直接插入ikey前
|
|
|
if(exists.length > 0){
|
|
|
let withsAddP = addPoint(exists,1);
|
|
@@ -200,17 +225,27 @@ export const confirm = (state,action) =>{
|
|
|
}
|
|
|
}else{//有伴
|
|
|
if(exists.length > 0){
|
|
|
- for(let i=0; i<exists.length; i++){
|
|
|
- let pos = index + i;
|
|
|
- arr.splice(pos,0,getTextLabel(exists[i].id,'、'+exists[i].name,1));
|
|
|
- res.saveText[pos] = exists[i].name;
|
|
|
+ // 判断前面是否已有主症状--是否加顿号、
|
|
|
+ let existsAddP,startInd;
|
|
|
+ for(let m=0; m<newSliceArr.length; m++){
|
|
|
+ if(newSliceArr[m].exist && newSliceArr[m].exist==1){
|
|
|
+ startInd = 0;
|
|
|
+ break;
|
|
|
+ }else{
|
|
|
+ startInd = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ existsAddP = addPoint(exists,startInd);
|
|
|
+ for(let i=0; i<existsAddP.length; i++){
|
|
|
+ let pos = forwardId + index + i;
|
|
|
+ arr.splice(pos,0,getTextLabel(existsAddP[i].id,existsAddP[i].name,1));
|
|
|
+ res.saveText[pos] = existsAddP[i].name;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(withs.length>0){//有伴插到ikey前既可
|
|
|
let withsAddP = addPoint(withs,0);
|
|
|
for(let j=0; j<withsAddP.length; j++){
|
|
|
- // let withsPos = labelIndx + j;
|
|
|
let withsPos = labelIndx +length + j;
|
|
|
arr.splice(withsPos,0,getTextLabel(withsAddP[j].id,withsAddP[j].name,2));
|
|
|
res.saveText[withsPos] = withsAddP[j].name;
|
|
@@ -229,9 +264,6 @@ export const confirm = (state,action) =>{
|
|
|
}
|
|
|
}
|
|
|
if(withs.length > 0){
|
|
|
- /*for(let k=1; k<withs.length; k++){
|
|
|
- withs[k].name = '、'+ withs[k].name;
|
|
|
- }*/
|
|
|
let withsAddP = addPoint(withs,1);
|
|
|
let newWiths = JSON.parse(JSON.stringify(withsAddP));
|
|
|
if(banText){
|
|
@@ -255,7 +287,6 @@ export const confirm = (state,action) =>{
|
|
|
if(withs.length>0){//有伴插到ikey前既可
|
|
|
let withsAddP = addPoint(withs,0);
|
|
|
for(let j=0; j<withsAddP.length; j++){
|
|
|
- // let withsPos = labelIndx + j;
|
|
|
let withsPos = labelIndx +length + j;
|
|
|
arr.splice(withsPos,0,getTextLabel(withsAddP[j].id,withsAddP[j].name,2));
|
|
|
res.saveText[withsPos] = withsAddP[j].name;
|
|
@@ -384,19 +415,22 @@ export const insertSearch = (state,action)=>{
|
|
|
if(index < 1){//前
|
|
|
if(data[focusIndex].value==searchStr){//为空标签则替换
|
|
|
res.data.splice(focusIndex,1,nText);
|
|
|
+ res.saveText.splice(focusIndex,1,searchData);
|
|
|
}else{
|
|
|
res.data.splice(focusIndex,0,nText);
|
|
|
+ res.saveText.splice(focusIndex,0,searchData);
|
|
|
res.data[focusIndex+1].value = value;
|
|
|
res.saveText[focusIndex+1] = value;
|
|
|
}
|
|
|
}else{
|
|
|
res.data.splice(focusIndex+1,0,nText);
|
|
|
+ res.saveText.splice(focusIndex+1,0,searchData);
|
|
|
res.data[focusIndex].value = value;
|
|
|
}
|
|
|
span.current.innerText?(span.current.innerText = value):(span.current.innerHTML=value);
|
|
|
res.mainIds.push(id);
|
|
|
}
|
|
|
- res.saveText = fullfillText(res.data).saveText;
|
|
|
+ // console.log(456,res,action);
|
|
|
res.update=Math.random();
|
|
|
return res;
|
|
|
}
|
|
@@ -488,8 +522,13 @@ export function setRadioValue(state,action){
|
|
|
export const setRadioInputValue = (state,action)=>{
|
|
|
const res = Object.assign({},state);
|
|
|
const {ikey,values,id} = action.data;
|
|
|
- const item = res.data[ikey];
|
|
|
- let str='',temp='',obj=res.data[ikey].questionDetailList;
|
|
|
+ let index = getLabelIndex(ikey);
|
|
|
+ let innerInx = ikey.substr(ikey.length-1);
|
|
|
+ let item = res.data[index];
|
|
|
+ if(item.tagType!=1){ //在组合项中
|
|
|
+ item = res.data[index].questionMapping[innerInx];
|
|
|
+ }
|
|
|
+ let str='',temp='',obj=item.questionDetailList;
|
|
|
if(!values){ //清空
|
|
|
let sld=obj.find((item)=>{
|
|
|
return item.selected==true;
|
|
@@ -497,7 +536,18 @@ export const setRadioInputValue = (state,action)=>{
|
|
|
sld?sld.selected=false:'';
|
|
|
item.vals = null;
|
|
|
item.value = '';
|
|
|
- res.saveText[ikey] = '';
|
|
|
+ if(res.data[index].tagType!=1){
|
|
|
+ let hasValue = false;
|
|
|
+ const sub = res.data[index].questionMapping.map((it)=>{
|
|
|
+ if(it.value){ //至少有一个子值才黑显
|
|
|
+ hasValue = true;
|
|
|
+ }
|
|
|
+ return (it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||'');
|
|
|
+ });
|
|
|
+ res.saveText[index] = hasValue?sub.join(''):'';
|
|
|
+ }else{
|
|
|
+ res.saveText[index] = '';
|
|
|
+ }
|
|
|
res.update = Math.random();
|
|
|
return res;
|
|
|
}
|
|
@@ -521,7 +571,15 @@ export const setRadioInputValue = (state,action)=>{
|
|
|
}
|
|
|
item.vals = values;
|
|
|
item.value = str;
|
|
|
- res.saveText[ikey] = str;
|
|
|
+ if(res.data[index].tagType!=1){
|
|
|
+ let hasValue = false;
|
|
|
+ const sub = res.data[index].questionMapping.map((it)=>{
|
|
|
+ return (it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||'');
|
|
|
+ });
|
|
|
+ res.saveText[index] = sub.join('');
|
|
|
+ }else {
|
|
|
+ res.saveText[ikey] = str;
|
|
|
+ }
|
|
|
res.update = Math.random();
|
|
|
return res;
|
|
|
}
|