|
@@ -105,7 +105,11 @@ export function setRadioValue(state,action){
|
|
|
}
|
|
|
if(+item.tagType===1){ //独立单选组件
|
|
|
item.value = text;
|
|
|
- res.saveText[labelInx] = item.labelPrefix+text+item.labelSuffix;
|
|
|
+ const exist = JSON.parse(localStorage.getItem('radio'+item.id)||null);
|
|
|
+ if(exist){ //选中状态处理
|
|
|
+ exist[0].selected=exist[0].id==id;
|
|
|
+ localStorage.setItem('radio'+item.id,JSON.stringify(exist));
|
|
|
+ }
|
|
|
item.questionDetailList.map((its)=>{
|
|
|
if(its.id === id){
|
|
|
its.selected = true;
|
|
@@ -113,6 +117,7 @@ export function setRadioValue(state,action){
|
|
|
its.selected = false;
|
|
|
}
|
|
|
});
|
|
|
+ res.saveText[labelInx] = item.labelPrefix+text+item.labelSuffix;
|
|
|
}else{ //组合组件中的单选组件
|
|
|
item.questionMapping[subInx].value = text;
|
|
|
let hasValue = false;
|
|
@@ -316,6 +321,33 @@ export const changeLabelVal = (state,action)=>{//双击标签输入改变值
|
|
|
if(labText && labText.trim()){
|
|
|
if(item){
|
|
|
item.value = newVal;
|
|
|
+ const canAdd=hasNoSame(item.questionDetailList,labText);
|
|
|
+ //单选双击编辑的内容自动加到下拉选项中,双击编辑但未修改不添加
|
|
|
+ if(canAdd&&+item.tagType===1&&(+item.controlType===1||+item.controlType===0)){
|
|
|
+ const li = {
|
|
|
+ id:-Math.floor(Math.random()*1000),
|
|
|
+ name:labText,
|
|
|
+ questionId:item.id,
|
|
|
+ orderNo:0,
|
|
|
+ code:0,
|
|
|
+ defaultSelect:"0",
|
|
|
+ remark:null,
|
|
|
+ abnormal:0,
|
|
|
+ selected:true
|
|
|
+ };
|
|
|
+
|
|
|
+ const exist = JSON.parse(localStorage.getItem('radio'+item.id)||null);
|
|
|
+ //console.log(exist)
|
|
|
+ if(exist&&typeof exist=='object'){ //已添加过编辑的数据
|
|
|
+ //exist.push(li);
|
|
|
+ exist[0]=li; //暂限添1条
|
|
|
+ localStorage.setItem('radio'+item.id,JSON.stringify(exist));
|
|
|
+ }else{
|
|
|
+ localStorage.setItem('radio'+item.id,JSON.stringify([li]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //取消原选中状态
|
|
|
+ item.questionDetailList.find((it)=>it.selected==true).selected=false;
|
|
|
item.labelPrefix = prefix||'';
|
|
|
item.labelSuffix = suffix||'';
|
|
|
// res.saveText[index] = totalVal;
|
|
@@ -331,6 +363,10 @@ export const changeLabelVal = (state,action)=>{//双击标签输入改变值
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+function hasNoSame(arr,text){
|
|
|
+ return arr.findIndex((it)=>text==it.name)==-1;
|
|
|
+}
|
|
|
+
|
|
|
// 数字键盘较特殊,有直接输入
|
|
|
export const changeNumLabelVal = (state,action)=>{
|
|
|
const res = Object.assign({},state);
|