Pārlūkot izejas kodu

Merge branch 'ChronicMag' of http://192.168.2.236:10080/zhouna/newICSS into ChronicMag

liucf 6 gadi atpakaļ
vecāks
revīzija
16f4a9bd92

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

@@ -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&&notText){
@@ -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("");
       }
     }

+ 1 - 1
src/components/CheckBody/index.jsx

@@ -31,7 +31,7 @@ class CheckBody extends Component{
   }
   getLabels(){
     const {data,showArr,saveText,selecteds,importLabel} = this.props;
-    let arr = [],list=[];//console.log(data,saveText)
+    let arr = [],list=[];
     const {boxMark,showAll} = this.state;
     const moreNum =data.length-[...data].reverse().findIndex((it)=>it.showInCheck)-1;//被隐藏的位置
     const moreText = filterDataArr([...saveText].splice(moreNum+1));     //被收起的标签中是否有有值得,有则不能再收起showMoreBtn?more:''

+ 1 - 0
src/components/CheckBody/index.less

@@ -7,6 +7,7 @@
   /*float: right;*/
   position: absolute;
   right: 0;
+  background: #fff;
   img{
     vertical-align: text-top;
     width: 15px;

+ 3 - 3
src/store/async-actions/fetchModules.js

@@ -155,11 +155,11 @@ export function getInitData(){
     json(api.getBigPush,param).then((res)=>{
       if(+res.data.code === 0){
         const data = res.data.data&&res.data.data.vital;
-        //const str = JSON.stringify(data);
-        //const arr = fullfillText(JSON.parse(str),false,false,false).newArr;
+        const str = JSON.stringify(data);
+        const arr = fullfillText(JSON.parse(str),false,false,false).newArr;
         dispatch({
           type:SET,
-          data:[...data],
+          data:arr,
           isEmpty:false
         });
       }else{

+ 1 - 1
src/store/async-actions/homePage.js

@@ -21,7 +21,7 @@ function modulesParseJson(data){
   let json = {},obj={},saveTextJson={},moduleName={};
   data.map((it)=>{
     moduleName[config.moduleCP[it.type]] = it.name;//添加病情变化/病程变化子模板需要使用模板名称
-    obj = fullfillText(it.moduleDetailDTOList);
+    obj = it.type==4?fullfillText(it.moduleDetailDTOList,false,false,false):fullfillText(it.moduleDetailDTOList);
     json[config.moduleCP[it.type]] = formatContinueDots(obj.newArr);
     saveTextJson[config.moduleCP[it.type]] = obj.saveText;
   });