|
@@ -82,7 +82,8 @@ function notTextLabel(label){
|
|
|
* 入参:arr源数组,
|
|
|
* noPre是否不添加前置文本标签,默认false即添加
|
|
|
* noEnd是否不添加后置文本标签,默认false即添加
|
|
|
-* ifEmpty是否添加空标签,默认true即添加,传false添加逗号,如查体
|
|
|
+* ifEmpty是否添加空标签,默认true即添加,传false添加逗号,如查体,
|
|
|
+* showInCheck是否默认在查体中展开
|
|
|
* */
|
|
|
export const fullfillText = (arr,noPre=false,noEnd=false,ifEmpty=true)=>{
|
|
|
let newArr =[],
|
|
@@ -92,19 +93,21 @@ export const fullfillText = (arr,noPre=false,noEnd=false,ifEmpty=true)=>{
|
|
|
notText = true,
|
|
|
saveText=[],
|
|
|
tempText = '',
|
|
|
- value = '';
|
|
|
+ value = '',
|
|
|
+ item={};
|
|
|
arr.map((it,i)=>{
|
|
|
notText = notTextLabel(it);
|
|
|
value = it.value||'';
|
|
|
- textLabel = JSON.parse(config.textLabel);
|
|
|
- _textLabel = JSON.parse(config._textLabel);
|
|
|
+ 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);
|
|
|
if(i===0){
|
|
|
//第一个标签不是文本标签时在前面添加文本标签
|
|
|
if(!noPre&¬Text){
|
|
|
newArr.push(textLabel);
|
|
|
saveText.push('');
|
|
|
}
|
|
|
- newArr.push(it);
|
|
|
+ item = ifEmpty?it:Object.assign({},it,{showInCheck:true});
|
|
|
+ newArr.push(item);
|
|
|
if(it.tagType != 3){
|
|
|
tempText = value?it.labelPrefix+value+it.labelSuffix:'';
|
|
|
tempText = notText?tempText:it.value||it.name;
|
|
@@ -114,10 +117,11 @@ 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;
|
|
|
//如果本身不是文本标签且前面一个也不是文本标签,该标签前面添加文本标签
|
|
|
if(notTextLabel(pre)&¬Text){
|
|
|
// newArr.push(textLabel,it);
|
|
|
- ifEmpty?newArr.push(textLabel,it):newArr.push(_textLabel,it);
|
|
|
+ ifEmpty?newArr.push(textLabel,it):newArr.push(_textLabel,item);
|
|
|
if(it.tagType != 3) {
|
|
|
tempText = value ? it.labelPrefix + value + it.labelSuffix : '';
|
|
|
}else{
|
|
@@ -130,7 +134,7 @@ export const fullfillText = (arr,noPre=false,noEnd=false,ifEmpty=true)=>{
|
|
|
saveText.push("");
|
|
|
}*/
|
|
|
}else{ //本身是或者前面是文本标签时,前面不添加文本标签
|
|
|
- newArr.push(it);
|
|
|
+ newArr.push(item);
|
|
|
if(it.tagType != 3) {
|
|
|
tempText = value ? it.labelPrefix + value + it.labelSuffix : '';
|
|
|
// tempText = notText?tempText:it.value||it.name;
|