Quellcode durchsuchen

查体标签显示隐藏bug修改

zhouna vor 6 Jahren
Ursprung
Commit
dac6a83c22
1 geänderte Dateien mit 5 neuen und 3 gelöschten Zeilen
  1. 5 3
      src/common/js/func.js

+ 5 - 3
src/common/js/func.js

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