Jelajahi Sumber

Merge remote-tracking branch 'origin/dev5.3.2' into dev5.3.2

zhouna 5 tahun lalu
induk
melakukan
826ce453fe

+ 9 - 9
src/common/components/SearchBox/index.jsx

@@ -10,7 +10,6 @@ import ScrollArea from 'react-scrollbar';
  * 主诉“添加症状”下拉中的:搜索框(含结果下拉)
  * 接收参数:
  * show:上级下拉是否隐藏,用于componentWillReceiveProps中
- * cliIndex:上级点击标签的index(如“添加症状”),用于选中数据插入的位置标识;
  */
 class SearchBox extends React.Component {
     constructor(props) {
@@ -41,29 +40,30 @@ class SearchBox extends React.Component {
     handleSearchSelect(e,item){
       e.stopPropagation();
       e.preventDefault();
-      const {cliIndex,chooseSearch,clearSearch,onSelect} = this.props;
-      chooseSearch&&chooseSearch({item:item,index:cliIndex});
-      onSelect();//上一级的“确定”事件
+      const {clearSearch,onSelect} = this.props;
+      onSelect(item);//上一级的“确定”事件
       clearSearch&&clearSearch();
       this.textInput.current.value = "";
     }
     handleInput(e){
       e.stopPropagation();
       e.preventDefault();
-      const { getSearchData ,mainIds} = this.props;
+      const { getSearchData ,mainIds,clearSearch,pushIds} = this.props;
+      const ids = [...mainIds,...pushIds];
         clearTimeout(this.state.timer);
         let timer = setTimeout(()=>{
             clearTimeout(this.state.timer);
             if(e.target.value.trim() == ''){
               this.setState({
                 showClear:false
-              })
+              });
+              clearSearch();
               return
             }
             this.setState({
               showClear:true
             })
-            getSearchData && getSearchData({inpStr:e.target.value.replace('<br>',''),boxMark:1,itemType:0,mainIds:mainIds});
+            getSearchData && getSearchData({inpStr:e.target.value.replace('<br>',''),boxMark:1,itemType:0,mainIds:ids});
         },config.delayTime);
         this.setState({
           timer
@@ -122,8 +122,8 @@ class SearchBox extends React.Component {
           background:'#f1f1f1'};
         const barStyle={background:'#777',width:'100%'};
         return (
-            <div className={classNames(styles['search'])} onClick={(e)=>{e.stopPropagation();}} onBlur={(e)=>{e.stopPropagation();}}>
-                <img className={styles.searchVal} src={search} alt="搜索" onClick={this.clickIcon}/>
+            <div className={classNames(styles['search'])} onClick={this.clickIcon} onBlur={(e)=>{e.stopPropagation();}}>
+                <img className={styles.searchVal} src={search} alt="搜索"/>
                 <img style={{display:showClear?'block':'none'}} className={styles.clearVal} src={clear} onClick={this.handleClearVal} alt="清空" />
                 <input
                     className={classNames(isShow,borderCor,showBd)}

+ 3 - 1
src/common/components/SearchBox/index.less

@@ -3,10 +3,12 @@
 .search {
     .contentZIndex1;
     width: 316px;
+    height: 50px;
     padding: 8px;
     box-sizing: border-box;
     position: relative;
     background-color: #fff;
+    margin-left: 78px;
     .autoList {
       position: absolute;
       width: 300px;
@@ -39,7 +41,7 @@
         top: 15px;
     }
     .searchVal {
-        left: 18px;
+        left: 14px;
         cursor: pointer;
     }
     .clearVal{

+ 39 - 18
src/components/SpreadDrop/index.jsx

@@ -210,7 +210,7 @@ class SpreadDrop extends Component{
     //点确定后隐藏弹窗
     this.props.handleHide();
   }
-  handleSelect(item,isExclu,joint,listIndex,selected){//console.log(item,selected)
+  handleSelect(item,isExclu,joint,listIndex,selected){
     let {withOn,withs,noneOn,exclusion,exists,nowOn,nones,noneIds,ban} = this.state;
     /*if(this.props.selecteds)
     console.log(exists,this.props.selecteds.exists,exists===this.props.selecteds.exists)*/
@@ -360,7 +360,7 @@ class SpreadDrop extends Component{
     }
   }*/
   render(){
-    const {placeholder,value,show,data,order,type,tagType,ikey} = this.props;
+    const {placeholder,value,show,data,order,type,tagType,ikey,pos} = this.props;
     const {tmpDom,left} = this.state
     const clickIndx = ikey.split('-')[1];//展开下拉的index
     if(!show&&tmpDom){
@@ -381,8 +381,8 @@ class SpreadDrop extends Component{
         onInput={this.onChange}
         onkeydown={handleEnter}
         >{value||placeholder}</div>
-          <ListItems parDiv={this.$list} data={data} order={order} left={left} boxMark={type} tagType={tagType}
-             show={show} cliIndex={clickIndx} handleSelect={this.handleSelect} handleConfirm={this.handleConfirm} handleClear={this.handleClear} {...this.state}></ListItems>
+          <ListItems parDiv={this.$list} 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>
   }
 }
@@ -424,7 +424,7 @@ class ListItems extends Component{
   clickConfirm(){
     const {handleConfirm} = this.props;
     this.child&&this.child.reset();//重置搜索框中的数据
-    handleConfirm();
+    handleConfirm();   
   }
   getStyle(){
     const {show,left} = this.props;
@@ -433,20 +433,35 @@ class ListItems extends Component{
       left:left
     }
   }
+  searchSelect(item){
+    const {handleSelect,handleConfirm} = this.props;
+    //添加id字段,用于调尾巴
+    const it = Object.assign({id:item.questionId},item);
+    handleSelect&&handleSelect(it);     //添加到大数据推送一起选中
+    handleConfirm&&handleConfirm();       //确定事件
+  }
+  getPushItemIds(list){         //获取推送症状的id数组,去重用
+    return list&&list.map((it)=>{
+      return it.conceptId;
+    })||[];
+  }
   render (){
-    const {handleClear,handleConfirm,order,parDiv,boxMark,tagType,show,cliIndex} = this.props;
+    const {handleClear,order,parDiv,boxMark,tagType,show,data,pos} = this.props;
+    const pushUl = data.find((it)=>it.controlType===99);
+    const pushList = pushUl&&pushUl.questionDetailList;
+    //推送标签没有推送结果时不显示顺序说明
+    const noPush = tagType===11&&(!pushList||pushList.length===0);
+    const noSearch = boxMark==1 && tagType==11 && !pos;       //非第一病程添加症状标签不显示搜索
     return <div className={style["drop-list"]} ref={parDiv} style={this.getStyle()} contentEditable="false" onClick={(e)=>{e.stopPropagation();}}>
-        <p className={style['orderTips']}>按{order?'从左到右从上到下':'点击'}顺序成文</p>
+      {noPush?'':<p className={style['orderTips']}>按{order?'从左到右从上到下':'点击'}顺序成文</p>}
         {this.getLabels()}
+        {noSearch && <div className="search">
+          <SearchBox show={show} pushIds={this.getPushItemIds(pushList)} onSelect={this.searchSelect.bind(this)} onRef={(child)=>{this.child = child;}}/>
+        </div>}
         <div className="oper clearfix">
           <span className={style['clear']} onClick={handleClear}>清空选项</span>
           <span className={style['confirm']} onClick={this.clickConfirm}>确定</span>
         </div>
-
-        {boxMark==1 && tagType==11 && <div className="search">
-                  <div className={style["line"]}></div>
-                  <SearchBox show={show} cliIndex={cliIndex} onSelect={handleConfirm} onRef={(child)=>{this.child = child;}}/>
-                </div>}
       </div>
   }
 }
@@ -517,6 +532,9 @@ class ListItem extends Component{
       width:'6px',
       background:'#f1f1f1'};
     const barStyle={background:'#777',width:'100%'};
+    if(!datas||datas.length===0){
+      return <li className={style['no-push-data']}>暂无推送</li>
+    }
     if(datas&&datas.length>11){
       return <ScrollArea speed={0.8}
                     horizontal={false}
@@ -544,9 +562,12 @@ class ListItem extends Component{
 
   getMainData(){//主诉添加症状-带搜索框
     const {datas,isSpecialPos} = this.props;
+    if(!datas||datas.length===0){
+      return <li className={style['no-push-data']}>暂无推送数据,可通过搜索查找更多内容~ </li>
+    }
     return datas&&datas.map((it,i)=>{
-      return <li onClick={(e)=>this.handleClick(e,it,i)}
-            className={this.getClass(it.id)}
+      return <li onClick={(e)=>this.handleClick(e,it,i)} 
+            className={this.getClass(it.id)} 
             title={it.name.length>4?it.name:''}
             style={{'width':'55px','display':'inline-block'}}>
             {it.name&&it.name.length>4?it.name.slice(0,4)+'...':it.name}
@@ -555,12 +576,12 @@ class ListItem extends Component{
   }
 
   render(){
-    const {datas,isSpecialPos,boxMark,tagType,listIndex,isSingle} = this.props;
-    const pos = isSpecialPos?style['independent']:'';
-    const ifMainSear = boxMark==1 && tagType==11?true:false;
+    const {datas,isSpecialPos,boxMark,tagType,listIndex,isSingle,pos} = this.props;
+    const posit = isSpecialPos?style['independent']:'';
+    const ifMainSear = boxMark==1 && tagType==11 && !pos?true:false;
     // 单列直接设置宽度,多列则第二列设置(伴字ul不设置宽度)
     const main = ifMainSear&&!isSingle&&listIndex==1?style['mainUl']:(ifMainSear&&isSingle?style['mainUl']:'');
-    return  <ul className={classNames(style['row'],pos,main)} onBlur={(e)=>e.stopPropagation()}>
+    return  <ul className={classNames(style['row'],posit,main)} onBlur={(e)=>e.stopPropagation()}>
       {ifMainSear?this.getMainData():this.getData()}
     </ul>
   }

+ 5 - 7
src/components/SpreadDrop/index.less

@@ -26,12 +26,10 @@
     li{
       width: 99px !important;
     }
-  }
-  .line{
-    width: 100%;
-    height: 1px;
-    background: #EAEDF1;
-    margin: 20px 0 0 10px;
+    .no-push-data{
+      color:@disable-color;
+      width: auto !important;
+    }
   }
   li{
     padding-left: 20px;
@@ -47,7 +45,7 @@
     .select-li;
     background-image: url(../../common/images/then.png);
   }
-  .exclusion{
+  .no-push-data,.exclusion{
     color:@disable-color;
   }
 }

+ 1 - 2
src/containers/SearchBox.js

@@ -45,8 +45,7 @@ function mapDispatchToProps(dispatch){
       }
       dispatch({
         type: CHOOSE_SEARCH,
-        item:obj.item,
-        index:obj.index
+        info:obj
       })
       dispatch({    //自由文本标签数据更新
         type:ISREAD

+ 2 - 20
src/containers/SpreadDrop.js

@@ -509,26 +509,8 @@ function mapDispatchToProps(dispatch,store){
           }else{
             pushDataList = bigDataList;
           }
-          /*if(pushDataList.length > 0){
-            if(obj.type == 1){// 主诉--添加症状
-              dispatch({
-                type:GET_BIGDATAPUSH,
-                data:pushDataList,
-                info:obj
-              })
-            }else if(obj.type == 2){// 现病史--添加其他症状
-              dispatch({
-                type:CURRENT_GET_BIGDATAPUSH,
-                data:pushDataList,
-                info:obj
-              })
-            }
-          }else{
-            Notify.info("暂无推送");
-            // return
-          }*/
           //推送无数据显示空下拉并提示暂无推送--1.9/1.18
-          if(!pushDataList || pushDataList.length == 0){Notify.info("暂无推送");}
+          //if(!pushDataList || pushDataList.length == 0){Notify.info("暂无推送");}
           if(obj.type == 1){// 主诉--添加症状
               dispatch({
                 type:GET_BIGDATAPUSH,
@@ -544,7 +526,7 @@ function mapDispatchToProps(dispatch,store){
             }
         }else{
           console.log(result.msg);
-          Notify.info("暂无推送");
+          //Notify.info("暂无推送");
           // 接口请求失败,不往下执行显示下拉
           return
         }

+ 1 - 0
src/containers/eleType.js

@@ -141,6 +141,7 @@ function multCheckLabels(params,tagType){
   let isHigh=importLabel&&importLabel.includes(data.id);
   const showInx = boxMark+"-"+i+'-0';
   return <SpreadDrop data={data.questionMapping}
+                     pos={data.pos}
                      ikey={showInx}
                      setHighter={setHighter}
                      placeholder={data.name}

+ 3 - 4
src/store/actions/mainSuit.js

@@ -406,8 +406,8 @@ export const setSearch = (state,action)=>{
 // 主诉-添加症状-选中搜索结果
 export const chooseSearch = (state,action)=>{
   const res = Object.assign({},state);
-  const index = parseInt(action.index);
-  const item = action.item;
+  const {item,cliIndex,ban} = action.info;
+  const index = parseInt(cliIndex);
   let data = res.data;
   let text = {id:item.questionId,name:item.name,value:item.name,tagType:config.tagType,conceptId:item.conceptId};
   // 判断index前是saveText中是否有伴
@@ -415,7 +415,7 @@ export const chooseSearch = (state,action)=>{
   if(!data[index].pos){//第一病程
     const preText = res.saveText.slice(0,index);
     const ind = preText.indexOf("伴");
-    if(ind != -1){
+    if(ind != -1 || ban){
       nText = Object.assign({},text,{exist:2});
     }else{
       nText = Object.assign({},text,{exist:1});
@@ -442,7 +442,6 @@ export const chooseSearch = (state,action)=>{
     }
   }
   // 插入data中
-  // res.data.splice(index,0,nText);
   res.data.splice(index,0,Object.assign({},nText,{name:'、'+item.name,value:'、'+item.name}));
   res.saveText.splice(index,0,'、'+item.name);
   res.mainIds.push(item.conceptId);

+ 1 - 3
src/store/reducers/mainSuit.js

@@ -2,7 +2,7 @@ import {RECOVER_TAG_MAIN,COMM_SYMPTOMS,CLEAR_COMSYMPTOMS,SHOW_TAIL,INSERT_MAIN,
   SET_SEARCH,CLEAR_SEARCH,GET_BIGDATAPUSH,SET_MAINSUIT,MIX_CONFIRM,NUMBER_SELECT,
   RADIO_SELECT,COMM_CONFIRM,CHANGE_LABELVAL,SAVE_FREE,CLEAR_MAIN_SUIT,SET_DATA,
   INSERT_SEARCH,MAIN_FOCUS_INDEX,SETTEXTMODEVALUE,SETMAINTEXT,MAINADDLABELITEM,SETMAININPUT,DEL_MAIN,CHANGE_LABELVAL_NUMBER,
-  REMOVE_MAIN_ID,MAINSUIT_MUL,DEL_MAIN_LABLE,SET_FEATURE,SET_MS_RADIO_INPUT_VAL,SAVE_CHRONIC,MAIN_REMOVE_SPAN,SET_ADD_SEARCH,CLEAR_ADD_SEARCH,CHOOSE_SEARCH} from '../types/mainSuit'
+  REMOVE_MAIN_ID,MAINSUIT_MUL,DEL_MAIN_LABLE,SET_FEATURE,SET_MS_RADIO_INPUT_VAL,SAVE_CHRONIC,MAIN_REMOVE_SPAN,SET_ADD_SEARCH,CLEAR_ADD_SEARCH} from '../types/mainSuit'
 import {recoveTag,getCommSymptoms,handleTailClick,insertMain,setSearch,getBigSymptom,setMainMoudle,confirm,
   setNumberValue,setRadioValue,commConfirm,changeLabelVal,saveFreeVal,clearMainSuit,insertSearch,setTextModeValue,setCheckText,
   addLabelItem,setInputLabel,backspaceText,changeNumLabelVal,removeId,multipleComfirn,delSingleLable,
@@ -122,8 +122,6 @@ export default function(state=initState,action){
     case SET_ADD_SEARCH: //添加症状-搜索
       res.addSearchData = action.data;
       return res;
-    case CHOOSE_SEARCH:
-      return chooseSearch(state,action);
     case CLEAR_ADD_SEARCH://清空症状搜索结果
       res.addSearchData = [];
       return res;

+ 0 - 1
src/store/types/mainSuit.js

@@ -33,4 +33,3 @@ export const RECOVER_TAG_MAIN = 'RECOVER_TAG_MAIN';   //恢复已删除标签
 export const MAIN_REMOVE_SPAN = 'MAIN_REMOVE_SPAN';   //删除最后一个空span
 export const SET_ADD_SEARCH = 'SET_ADD_SEARCH';   //添加症状-搜索
 export const CLEAR_ADD_SEARCH = 'CLEAR_ADD_SEARCH';   //添加症状-搜索
-export const CHOOSE_SEARCH = 'CHOOSE_SEARCH';   //添加症状-搜索

+ 1 - 1
src/utils/tools.js

@@ -1204,7 +1204,7 @@ function getIds(data){
  */
 function getCalendarDate(info) {
   let conect = '-';
-  let date = info.year + conect + (info.month < 10 ? '0' + info.month : info.month) + conect + (info.day < 10 ? '0' + info.day : info.day) + ' '+ (info.hour < 10&&info.hour != 0 ? '0' + info.hour : info.hour)+':'+ (info.minute < 10&&info.minute != 0 ? '0' + info.minute : info.minute)+':'+ (info.second < 10&&info.second != 0 ? '0' + info.second : info.second);
+  let date = info.year + conect + (info.month < 10 ? '0' + info.month : info.month) + conect + (info.day < 10 ? '0' + info.day : info.day) + ' '+ (info.hour != 0&&(info.hour).toString().length<2 ? '0' + info.hour : info.hour)+':'+ (info.minute != 0&&(info.minute).toString().length<2 ? '0' + info.minute : info.minute)+':'+ (info.second&&(info.second).toString().length<2 ? '0' + info.second : info.second);
   return date;
 }