|
@@ -95,12 +95,14 @@ export const fullfillText = (arr,noPre=false,noEnd=false,ifEmpty=true)=>{
|
|
|
tempText = '',
|
|
|
value = '',
|
|
|
item={},
|
|
|
- checkHiddenDefault=false;
|
|
|
+ cNum = 0,
|
|
|
+ checkHiddenDefault=false;//console.log(arr)
|
|
|
arr&&arr.map((it,i)=>{
|
|
|
notText = notTextLabel(it);
|
|
|
+ cNum = i;
|
|
|
value = it.value||'';
|
|
|
textLabel = !ifEmpty&&i==0?Object.assign({},JSON.parse(config.textLabel),{showInCheck:true}):JSON.parse(config.textLabel);
|
|
|
- _textLabel = !ifEmpty&&i<config.showCheckNum+1?Object.assign({},JSON.parse(config._textLabel),{showInCheck:true}):JSON.parse(config._textLabel);
|
|
|
+ _textLabel = !ifEmpty&&cNum<config.showCheckNum+1?Object.assign({},JSON.parse(config._textLabel),{showInCheck:true}):JSON.parse(config._textLabel);
|
|
|
if(i===0){
|
|
|
//第一个标签不是文本标签时在前面添加文本标签
|
|
|
if(!noPre&¬Text){
|
|
@@ -118,9 +120,9 @@ export const fullfillText = (arr,noPre=false,noEnd=false,ifEmpty=true)=>{
|
|
|
saveText.push(tempText);
|
|
|
}else{
|
|
|
pre = arr[i-1];
|
|
|
- item = !ifEmpty&&i<config.showCheckNum?Object.assign({},it,{showInCheck:true}):it;
|
|
|
+ item = !ifEmpty&&cNum<config.showCheckNum?Object.assign({},it,{showInCheck:true}):it;
|
|
|
//判断单选项是否有默认选中,位置在隐藏区域时,查体所有标签展示
|
|
|
- if(!ifEmpty&&!checkHiddenDefault&&i>config.showCheckNum&&+it.tagType===1&&(+it.controlType===0||+it.controlType===1)){
|
|
|
+ if(!ifEmpty&&!checkHiddenDefault&&cNum>config.showCheckNum&&+it.tagType===1&&(+it.controlType===0||+it.controlType===1)){
|
|
|
if(it.questionDetailList.find((it)=>it.defaultSelect=='1')){
|
|
|
checkHiddenDefault=true;
|
|
|
}
|
|
@@ -148,7 +150,7 @@ export const fullfillText = (arr,noPre=false,noEnd=false,ifEmpty=true)=>{
|
|
|
}
|
|
|
if(notText&&!noEnd&&i===arr.length-1){//最后一个非文本标签,后面添加一个文本标签
|
|
|
//不能用上面的变量textLabel,因为上一个if可能也进了,这样就是同一个对象,值改变时会同步
|
|
|
- newArr.push(JSON.parse(config.textLabel));
|
|
|
+ newArr.push(ifEmpty?textLabel:_textLabel);
|
|
|
saveText.push("");
|
|
|
}
|
|
|
}
|