Sfoglia il codice sorgente

其他史默认值配置项生效

zhouna 5 anni fa
parent
commit
3d41b20155

+ 2 - 3
src/components/OtherHistory/index.jsx

@@ -25,11 +25,10 @@ class OtherHistory extends Component{
     fetchModules&&fetchModules({id:questionId,index:focusTextIndex,name,span,searchInEnd});
   }
   getLabels(){
-    const {data,showArr,saveText,readConfig,docConfig} = this.props;
-    const configs = readConfig===null||readConfig ===-1?docConfig:readConfig;
+    const {data,showArr,saveText} = this.props;
     const {boxMark} = this.state;
     let list = data.map((item,i)=>{
-      return chooseType({item,boxMark,i,hideTag:false,showArr,saveText,configs});
+      return chooseType({item,boxMark,i,hideTag:false,showArr,saveText});
     });
     return list;
   }

+ 8 - 21
src/components/SpreadDrop/index.jsx

@@ -169,9 +169,9 @@ class SpreadDrop extends Component{
     });
   }
   getInitExclu(){
-    const {defaulted,data,value} = this.props;
+    const {defaulted,labelDefault,data,value} = this.props;
     let excluId = '',excName='';
-    if(defaulted&&value===undefined){
+    if(labelDefault&&defaulted&&value===undefined){
       const it = data[0];
       excluId = it.exclusionType===1?it.questionDetailList[0].id:'';
       excName = it.exclusionType===1?it.questionDetailList[0].name:'';
@@ -201,8 +201,6 @@ class SpreadDrop extends Component{
     this.setState({
       nones:'',
       exists:[],
-      //existsName:{},
-      //withsName:{},
       withs:[],
       noneIds:[],
       noneOn:false,
@@ -282,11 +280,8 @@ class SpreadDrop extends Component{
     if(+item.code===1){     //操作“伴”类型
       this.setState({
         withOn:!withOn,
-        // withs:withOn?[]:[...withs,id],     //取消“伴”选中,伴随症状全部取消选中    
-        // withs:withOn?[]:[...withs,{id:item.id,name:name}],
         withs:withOn?[]:withs,
         ban:withOn?{}:{id:id,name:name,value:name},
-        //withsName:withOn?"":withsName+name,     //取消“伴”选中,伴随症状全部取消选中
         nowOn:withOn?(noneOn?'none':''):'with'
       });
       return;
@@ -329,10 +324,8 @@ class SpreadDrop extends Component{
         nones += name+'、';
         noneIds.push(id);
       }else if(nowOn=='with'){
-        // withs.push({id:id,name:name,questionId:item.questionId});
         withs.push({id:id,name:name,questionId:item.questionId,conceptId:item.conceptId});
       }else{
-        // exists.push({id:id,name:name,listIndex,questionId:item.questionId});
         exists.push({id:id,name:name,listIndex,questionId:item.questionId,conceptId:item.conceptId});
       }
     }
@@ -347,7 +340,7 @@ class SpreadDrop extends Component{
     });
   }
   getClass(){
-    const {isImports,show,value,isExtBlue} = this.props;
+    const {isImports,show,value,isExtBlue,defaulted,labelDefault} = this.props;
     const blueBorder = this.state.editable?style['blue-border']:'';
     const orgBorder = isImports&&!value?style['orange-border']:'';
     const ext = isExtBlue?style['ext']:'';
@@ -356,7 +349,7 @@ class SpreadDrop extends Component{
     }else{
       $(this.$div.current).removeClass(style['borderd']);
     }
-    if(value){
+    if(value||(labelDefault&&value===undefined&&defaulted)){
       return classNames(style['selected-tag'],blueBorder);
     }
     return classNames(style['tag'],orgBorder,ext);
@@ -369,16 +362,10 @@ class SpreadDrop extends Component{
       },this);
     }
   }
-  /*componentWillReceiveProps(nextProps){
-    const {setHighter} = this.props;
-    if(!nextProps.show){console.log(22)
-      setHighter&&setHighter(48);
-    }
-  }*/
   render(){
-    const {placeholder,value,show,data,order,type,tagType,ikey,pos,defaulted} = this.props;
+    const {placeholder,value,show,data,order,type,tagType,ikey,pos,defaulted,labelDefault,showVal} = this.props;
     const {tmpDom,left} = this.state;
-    const clickIndx = ikey.split('-')[1];//展开下拉的index
+    let showV = labelDefault&&value===undefined?showVal:value;       //未选中过值时展示默认选中
     if(!show&&tmpDom){
       $(tmpDom).parent().prev().attr({"contentEditable":true})
     }
@@ -396,8 +383,8 @@ class SpreadDrop extends Component{
         onBlur={this.handleBlur}
         onInput={this.onChange}
         onkeydown={handleEnter}
-        >{value||placeholder}</div>
-          <ListItems parDiv={this.$list} defaulted={defaulted} pos={pos} data={data} order={order} left={left} boxMark={type} tagType={tagType}
+        >{showV||placeholder}</div>
+          <ListItems parDiv={this.$list} defaulted={labelDefault&&defaulted} pos={pos} data={data} order={order} left={left} boxMark={type} tagType={tagType}
              show={show} handleSelect={this.handleSelect} handleConfirm={this.handleConfirm} handleClear={this.handleClear} {...this.state}></ListItems>
       </div>
   }

+ 0 - 2
src/containers/OtherHistory.js

@@ -27,8 +27,6 @@ function mapStateToProps(state){
     editClear:otherHistory.editClear,       //编辑状态
     isRead:state.homePage.isRead,
     readMode:typeConfig.readMode,       //回读回来的模式(与当前模式并存)
-    readConfig:typeConfig.readConfig,
-    docConfig:typeConfig.typeConfig,
   }
 }
 

+ 8 - 3
src/containers/SpreadDrop.js

@@ -15,10 +15,15 @@ import {filterArr,didPushParamChange,filterDataArr,getLabelIndex,fullfillText,ch
 import config from '@config/index.js';
 
 function mapStateToProps(state) {//console.log(state);
+  const {typeConfig,mainSuit,homePage} = state;
+  const hasReadMode = typeConfig.readConfig!==-1&&typeConfig.readConfig[2]!==null;
+  const docOtherMode = typeConfig.typeConfig[2];
+  const curOtherMode =hasReadMode?typeConfig.readConfig[2]:docOtherMode;
   return {
-    mainSaveText:state.mainSuit.saveText,
-    mainData:state.mainSuit.data,
-    windowWidth:state.homePage.windowWidth
+    mainSaveText:mainSuit.saveText,
+    mainData:mainSuit.data,
+    windowWidth:homePage.windowWidth,
+    labelDefault:+curOtherMode===1,
   }
 }
 

+ 9 - 3
src/containers/eleType.js

@@ -142,14 +142,20 @@ function multCheckLabels(params,tagType){
   const {i,boxMark,showArr,importLabel,setHighter} = params;
   let isHigh=importLabel&&importLabel.includes(data.id);
   const showInx = boxMark+"-"+i+'-0';
-  const showVal = data.value!==undefined?data.value:data.selFlag===1?data.remark:undefined;
+  const defaulted =data.selFlag===1;
+  let showVal = '';
+  if(defaulted){
+    const item0 = data.questionMapping[0];
+    showVal = item0.exclusionType===1?item0.questionDetailList[0].name:'';
+  }
   return <SpreadDrop data={data.questionMapping}
                      pos={data.pos}
                      ikey={showInx}
-                     defaulted={data.selFlag}
+                     defaulted={defaulted}
+                     showVal={showVal}
                      setHighter={setHighter}
                      placeholder={data.name}
-                     value={showVal}
+                     value={data.value}
                      copyType={data.copyType}
                      isExtBlue={data.specFlag===4?true:false}
                      selecteds={data.selecteds}

+ 2 - 1
src/store/actions/otherHistory.js

@@ -23,9 +23,10 @@ export const confirm = (state,action) =>{
     return res;
   }
   //只有无的项目选中
-  if(+copyType===0) {      //原标签保留
+  if(+copyType===0) {      //原标签保留
     arr.splice(ikey,1);
   }
+  arr[ikey].selFlag=0;      //已展开的既往史类标签,默认选中状态去掉
   if(arr[ikey].value)  arr[ikey].value= '';
   let preText = arr[ikey-1].value!==undefined?arr[ikey-1].value:arr[ikey-1].name||'';
   let newPreText =preText +nones;//console.log(arr[ikey-1],newPreText)