Browse Source

杂音默认选中项等接口对接

zhouna 5 năm trước cách đây
mục cha
commit
ea85039811
2 tập tin đã thay đổi với 25 bổ sung10 xóa
  1. 22 9
      src/components/SpreadDrop/index.jsx
  2. 3 1
      src/containers/eleType.js

+ 22 - 9
src/components/SpreadDrop/index.jsx

@@ -32,16 +32,17 @@ class SpreadDrop extends Component{
   constructor(props){
     super(props);
     const {nones,noneOn,noneIds,withOn,exists,nowOn,withs,exclusion,excluName} = deepClone(props.selecteds||[]);
+    const initEx = this.getInitExclu();
     this.state = {
       nones:nones||'',       //无,字符串拼接
       exists:exists||[],      //主症状id
-      excluName:excluName||'',
+      excluName:excluName||initEx.excName,
       withs:withs||[],       //伴随 id
       noneIds:noneIds||[],
       noneOn:noneOn||false,       //无是否选中
       withOn:withOn||false,       //伴是否选中
       nowOn:nowOn||'',           //最近选中“无”还是“伴”
-      exclusion:exclusion||'',      //选中互斥项id
+      exclusion:exclusion||initEx.excluId,      //选中互斥项id
       timer:null,  //延时,区分单击双击
       ban:{},  //放'伴'字段
       editable:false,      //双击编辑
@@ -166,21 +167,33 @@ class SpreadDrop extends Component{
     this.setState({
       editable:false
     });
-
-
+  }
+  getInitExclu(){
+    const {defaulted,data,value} = this.props;
+    let excluId = '',excName='';
+    if(defaulted&&value===undefined){
+      const it = data[0];
+      excluId = it.exclusionType===1?it.questionDetailList[0].id:'';
+      excName = it.exclusionType===1?it.questionDetailList[0].name:'';
+    }
+    return {
+      excluId,
+      excName
+    }
   }
   setStateInit(){
     const {nones,noneOn,noneIds,withOn,exists,nowOn,withs,exclusion,excluName,ban} = deepClone(this.props.selecteds||[]);
+    const initEx = this.getInitExclu();
     this.setState({
       nones:nones||'',
       exists:exists||[],
-      excluName:excluName||'',
+      excluName:excluName||initEx.excName,
       withs:withs||[],
       noneIds:noneIds||[],
       noneOn:noneOn||false,
       withOn:withOn||false,
       nowOn:nowOn||'',
-      exclusion:exclusion||'',
+      exclusion:exclusion||initEx.excluId,
       ban:ban||{},
     });
   }
@@ -363,8 +376,8 @@ class SpreadDrop extends Component{
     }
   }*/
   render(){
-    const {placeholder,value,show,data,order,type,tagType,ikey,pos} = this.props;
-    const {tmpDom,left} = this.state
+    const {placeholder,value,show,data,order,type,tagType,ikey,pos,defaulted} = this.props;
+    const {tmpDom,left} = this.state;
     const clickIndx = ikey.split('-')[1];//展开下拉的index
     if(!show&&tmpDom){
       $(tmpDom).parent().prev().attr({"contentEditable":true})
@@ -384,7 +397,7 @@ class SpreadDrop extends Component{
         onInput={this.onChange}
         onkeydown={handleEnter}
         >{value||placeholder}</div>
-          <ListItems parDiv={this.$list} pos={pos} data={data} order={order} left={left} boxMark={type} tagType={tagType}
+          <ListItems parDiv={this.$list} defaulted={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>
   }

+ 3 - 1
src/containers/eleType.js

@@ -142,12 +142,14 @@ 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;
   return <SpreadDrop data={data.questionMapping}
                      pos={data.pos}
                      ikey={showInx}
+                     defaulted={data.selFlag}
                      setHighter={setHighter}
                      placeholder={data.name}
-                     value={data.value}
+                     value={showVal}
                      copyType={data.copyType}
                      isExtBlue={data.specFlag===4?true:false}
                      selecteds={data.selecteds}