Browse Source

Squashed commit of the following:

commit 9035ef946c9d7c6bf25fde25a5af5a36822a12a7
Author: liucf <liucf@zjlantone.com>
Date:   Sun Sep 29 15:24:20 2019 +0800

    填写单选伴时搜索结果为伴
liucf 5 years ago
parent
commit
9fd10fac4f

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

@@ -41,8 +41,8 @@ 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});
+      const {cliIndex,chooseSearch,clearSearch,onSelect,ban} = this.props;
+      chooseSearch&&chooseSearch({item:item,cliIndex:cliIndex,ban:JSON.stringify(ban)=='{}'?false:true});
       onSelect();//上一级的“确定”事件
       clearSearch&&clearSearch();
       this.textInput.current.value = "";

+ 2 - 2
src/components/SpreadDrop/index.jsx

@@ -434,7 +434,7 @@ class ListItems extends Component{
     }
   }
   render (){
-    const {handleClear,handleConfirm,order,parDiv,boxMark,tagType,show,cliIndex} = this.props;
+    const {handleClear,handleConfirm,order,parDiv,boxMark,tagType,show,cliIndex,ban} = this.props;
     return <div className={style["drop-list"]} ref={parDiv} style={this.getStyle()} contentEditable="false" onClick={(e)=>{e.stopPropagation();}}>
         <p className={style['orderTips']}>按{order?'从左到右从上到下':'点击'}顺序成文</p>
         {this.getLabels()}
@@ -445,7 +445,7 @@ class ListItems extends Component{
 
         {boxMark==1 && tagType==11 && <div className="search">
                   <div className={style["line"]}></div>
-                  <SearchBox show={show} cliIndex={cliIndex} onSelect={handleConfirm} onRef={(child)=>{this.child = child;}}/>
+                  <SearchBox show={show} cliIndex={cliIndex} onSelect={handleConfirm} onRef={(child)=>{this.child = child;}} ban={ban}/>
                 </div>}
       </div>
   }

+ 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

+ 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);