|
@@ -280,21 +280,26 @@ export function setNumberValue(state,action){
|
|
|
let labelInx = getLabelIndex(index);
|
|
|
const subInx = index.substr(index.length-1);
|
|
|
let item = res.data[labelInx];
|
|
|
- if(+item.tagType===1){
|
|
|
- item.value = param.text;
|
|
|
- res.saveText[labelInx] = param.text?item.labelPrefix+param.text+item.labelSuffix:'';
|
|
|
- }else{
|
|
|
- item.questionMapping[subInx].value = param.text;
|
|
|
- let hasValue = false;
|
|
|
- const sub = item.questionMapping.map((it)=>{
|
|
|
- if(it.value){ //至少有一个子值才黑显
|
|
|
- hasValue = true;
|
|
|
- }
|
|
|
- return (it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||'');
|
|
|
- });
|
|
|
- // res.saveText[labelInx] = sub.join(',');
|
|
|
- res.saveText[labelInx] = hasValue?sub.join(''):'';
|
|
|
- item.value = sub.join('');
|
|
|
+ if(param.text.trim()){
|
|
|
+ if(+item.tagType===1){
|
|
|
+ item.value = param.text;
|
|
|
+ res.saveText[labelInx] = param.text?item.labelPrefix+param.text+item.labelSuffix:'';
|
|
|
+ }else{
|
|
|
+ item.questionMapping[subInx].value = param.text;
|
|
|
+ let hasValue = false;
|
|
|
+ const sub = item.questionMapping.map((it)=>{
|
|
|
+ if(it.value){ //至少有一个子值才黑显
|
|
|
+ hasValue = true;
|
|
|
+ }
|
|
|
+ return (it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||'');
|
|
|
+ });
|
|
|
+ // res.saveText[labelInx] = sub.join(',');
|
|
|
+ res.saveText[labelInx] = hasValue?sub.join(''):'';
|
|
|
+ item.value = sub.join('');
|
|
|
+ }
|
|
|
+ }else{//删除完标签内容则删除该标签
|
|
|
+ res.data.splice(labelInx,1);
|
|
|
+ res.saveText = fullfillText(res.data).saveText;
|
|
|
}
|
|
|
res.update = Math.random();
|
|
|
return res;
|
|
@@ -354,10 +359,15 @@ export const changeLabelVal = (state,action)=>{
|
|
|
const index = action.data.ikey;
|
|
|
const newVal = action.data.changeVal;
|
|
|
let item = res.data[index];
|
|
|
- if(item){
|
|
|
- item.value = newVal;
|
|
|
- }
|
|
|
- res.saveText[index] = newVal;
|
|
|
+ if(newVal.trim()){
|
|
|
+ if(item){
|
|
|
+ item.value = newVal;
|
|
|
+ res.saveText[index] = newVal;
|
|
|
+ }
|
|
|
+ }else{//删除完标签内容则删除该标签
|
|
|
+ res.data.splice(index,1);
|
|
|
+ res.saveText = fullfillText(res.data).saveText;
|
|
|
+ }
|
|
|
res.update = Math.random();
|
|
|
return res;
|
|
|
}
|