瀏覽代碼

Merge branch 'optimize' into optimize-zxc

zhangxc 6 年之前
父節點
當前提交
f832d410f0

+ 12 - 2
src/components/AssessResult/ScaleItem/index.jsx

@@ -75,12 +75,22 @@ class ScaleItem extends Component {
       radioVal:Object.assign({},radioVal,{[parent.conceptId]:item.detailName})
     })
   }
+  handleReg(e){   //只能输入数字和特殊符号
+    const key = e.key;
+    if(key!='Backspace'&&((/[^\d|.\/%*~]/.test(key)))){
+      e.preventDefault();
+    }
+  }
   handleInputformula(id,calcuContent,i,e) {
     const {calcuValues} = this.state;
     let obj = deepClone(calcuValues);
     let values = (obj&&obj[id])||deepClone(calcuContent);
-    values[i].value = e.target.value;
+    const txt = e.target.value;
+    values[i].value = txt.replace(/[\u4e00-\u9fa5]|[^\d|.\/%*~]/g,'');       //处理中文输入法的情况
     obj[id] = values;
+    if(/[\u4e00-\u9fa5]|[^\d|.\/%*~]/g.test(txt)){
+      e.target.value = txt.replace(/[\u4e00-\u9fa5]|[^\d|.\/%*~]/g,'');
+    }
     this.setState({
       isCalculated:false,
       calcuValues:obj
@@ -218,7 +228,7 @@ class ScaleItem extends Component {
                                 <span>{'请输入'+item1.name+':'}</span>
                               </td>
                               <td>
-                                {disabled?item1.value:<input type="text" placeholder="请输入"  value={item1.value} onInput={(e)=>this.handleInputformula(item.conceptId,details,idd,e)}/>}
+                                {disabled?item1.value:<input type="text" placeholder="请输入"  value={item1.value} onKeyDown={this.handleReg.bind(this)} onInput={(e)=>this.handleInputformula(item.conceptId,details,idd,e)}/>}
                               </td>
                               <td>
                                 <span>{item1.uint}</span>

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

@@ -35,7 +35,7 @@ import { host, prefix } from '@utils/config.js';
 // };
 // let numFlg = 0;
 class AssistCheck extends React.Component {
-    constructor(props){
+  constructor(props){
         super(props);
         this.state={
           val: '',

+ 8 - 12
src/components/CheckBody/index.jsx

@@ -26,8 +26,13 @@ class CheckBody extends Component{
     this.showHide = this.showHide.bind(this);
     //this.handleInput = this.handleInput.bind(this);
   }
-  componentWillReceiveProps(nextProps){
-    this.setState({boxLeft:nextProps.boxLeft})
+  componentWillReceiveProps(next){
+    if((this.props.defaultShowAll&&!next.defaultShowAll)||(!this.props.defaultShowAll&&next.defaultShowAll)||(!this.props.isEmpty&&next.isEmpty)){
+      this.setState({
+        showAll:next.defaultShowAll
+      })
+    }
+    this.setState({boxLeft:next.boxLeft})
   }
   getLabels(){
     const {data,showArr,saveText,selecteds,importLabel} = this.props;
@@ -105,23 +110,14 @@ class CheckBody extends Component{
       showAll:!this.state.showAll
     });
   }
-  componentWillUpdate(next){
-    if((this.props.defaultShowAll&&!next.defaultShowAll)||(!this.props.defaultShowAll&&next.defaultShowAll)||(!this.props.isEmpty&&next.isEmpty)){
-      this.setState({
-        showAll:next.defaultShowAll
-      })
-    }
-  }
   render(){
     const {searchData,totalHide,data,boxLeft,boxTop,saveText} = this.props;
 
-    return  <div className={style['container']}>
-      <ItemBox title='查体' handleClick={this.handleClick}>
+    return <ItemBox title='查体' handleClick={this.handleClick}>
         {this.getLabels()}
         {/*{showMoreBtn?more:''}*/}
         {searchData && searchData.length>0?<SearchDrop data={searchData} show={!totalHide} left={boxLeft} top={boxTop} onSelect={this.handleSearchSelect}></SearchDrop>:''}
       </ItemBox>
-    </div>
   }
 }
 

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

@@ -221,7 +221,7 @@ class ChronicInfo extends React.Component{
     this.closeFormula(it);
     chronicMagItem&&this.handleAddAssessItem(v,pIndex,i);
   }
-  handleReg(e){   //只能输入数字
+  handleReg(e){   //只能输入数字和特殊符号
     //const hasDot = e.target.value.indexOf('.')!=-1;
     const key = e.key;
     if(key!='Backspace'&&((/[^\d|.\/%*~]/.test(key)))){

+ 0 - 2
src/components/Diagnosis/index.jsx

@@ -42,8 +42,6 @@ class Diagnosis extends Component {
   }
 
   render() {
-
-
     return (<div id="diagnosisResult">
       <ItemBox id="diagnosis" title='诊断' boxHeight='auto' titleTop='22px' marginTop='9px' backgroundColor='#EAF7FD'>
         <DiagnosticList></DiagnosticList>

+ 3 - 1
src/components/EMRContainer/index.jsx

@@ -41,7 +41,9 @@ class EMRContainer extends Component {
                 <MainSuit></MainSuit>
                 <CurrentIll></CurrentIll>
                 <OtherHistory></OtherHistory>
-                <CheckBody></CheckBody>
+                <div>
+                  <CheckBody></CheckBody>
+                </div>
                 <Inspect></Inspect>
                 <AssistCheck></AssistCheck>
                 <Diagnosis></Diagnosis>

+ 8 - 5
src/components/MedicalInfo/index.jsx

@@ -10,7 +10,8 @@ class MedicalInfo extends Component {
         this.$cont = React.createRef();
         this.state={
           val:'',
-          hasSearch: false
+          hasSearch: false,
+          msg:''
         };
         this.search = this.search.bind(this);
         this.handleChange = this.handleChange.bind(this);
@@ -31,7 +32,8 @@ class MedicalInfo extends Component {
     search(){
       if(this.state.hasSearch === false) {
         this.setState({
-          hasSearch: true
+          hasSearch: true,
+          msg:'暂无搜索结果!'
         })
       }
       const {handleChangeValue} = this.props;
@@ -53,7 +55,8 @@ class MedicalInfo extends Component {
       this.$inp.current.value = '';
       this.setState({
         val:'',
-        hasSearch: false
+        hasSearch: false,
+        msg:''
       });
       clearResult&&clearResult();
   }
@@ -74,7 +77,7 @@ class MedicalInfo extends Component {
   }
     render() {
         const {searchResult} = this.props;
-        const {val, hasSearch} = this.state;
+        const {val, hasSearch,msg} = this.state;
         return (
             <div className={style['search-cont']} ref={this.$cont}>
               <div className={style['search-box']}>
@@ -90,7 +93,7 @@ class MedicalInfo extends Component {
                     <ul>
                       {this.getSearchList()}
                     </ul>
-              </div>:<p className={style['no-data']}>{hasSearch?'搜索中...':'暂无搜索结果!'}</p>}
+              </div>:<p className={style['no-data']}>{hasSearch?'搜索中...':msg}</p>}
              </div>
 
 

+ 5 - 2
src/components/NumberDrop/index.jsx

@@ -256,8 +256,11 @@ class NumberDrop extends Component{
     const spanWidth = window.getComputedStyle(this.$span.current).width;
     this.$span.current.style.minWidth=spanWidth;
     //保存输入框dom以便聚焦
-    const {saveDoms} = this.props;
-    saveDoms&&saveDoms(this.$span);
+    const that = this;
+    setTimeout(function(){        //多个其他史/现病史bug修改
+      const {saveDoms} = that.props;
+      saveDoms&&saveDoms(that.$span);
+    })
   }
   render(){
     const {prefix,suffix,show,value,handleHide,allClick} = this.props;

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

@@ -125,7 +125,7 @@ class PreviewBody extends Component {
               }
               {dataJson.advice.commontreatment && dataJson.advice.commontreatment.length > 0 && <p  className={style.pushMessageTitle}><span>一般治疗</span></p>}
               {
-                dataJson.advice.commontreatment && <div className={style.pushMessageDes}>{dataJson.advice.commontreatment}</div>
+                dataJson.advice.commontreatment && <div dangerouslySetInnerHTML={{__html: dataJson.advice.commontreatment}} className={style.pushMessageDes}></div>
               }
               {dataJson.advice.followUp && dataJson.advice.followUp.length > 0 && <p className={style.pushMessageTitle}><span>回访时间:<span className={style['bbtm']}>{dataJson.advice.followUp}</span> 后回访,不适随诊</span></p>}
               {dataJson.advice.scheme && dataJson.advice.scheme.length > 0 && <p className={style.pushMessageTitle}><span>治疗方案</span></p>}

+ 8 - 5
src/components/ScaleSearch/index.jsx

@@ -10,7 +10,8 @@ class ScaleSearch extends Component {
     this.$cont = React.createRef();
     this.state={
       val:'',
-      hasSearch: false
+      hasSearch: false,
+      msg:''
     };
     this.search = this.search.bind(this);
     this.handleChange = this.handleChange.bind(this);
@@ -46,7 +47,8 @@ class ScaleSearch extends Component {
   search(){
     if(this.state.hasSearch === false){
       this.setState({
-        hasSearch: true
+        hasSearch: true,
+        msg:'暂无搜索结果!'
       })
     }
     const {handleChangeValue} = this.props;
@@ -68,7 +70,8 @@ class ScaleSearch extends Component {
     this.$inp.current.value = '';
     this.setState({
       val:'',
-      hasSearch: false
+      hasSearch: false,
+      msg:''
     });
     clearResult&&clearResult();
   }
@@ -89,7 +92,7 @@ class ScaleSearch extends Component {
   }
   render() {
     const {searchResult} = this.props;
-    const {val, hasSearch} = this.state;
+    const {val, hasSearch,msg} = this.state;
     return (
         <div className={style['search-cont']} ref={this.$cont}>
           <div className={style['search-box']}>
@@ -105,7 +108,7 @@ class ScaleSearch extends Component {
             <ul>
               {this.getSearchList()}
             </ul>
-          </div>:<p className={style['no-data']}>{hasSearch?'搜索中...':'暂无搜索结果!'}</p>}
+          </div>:<p className={style['no-data']}>{hasSearch?'搜索中...':msg}</p>}
         </div>
     )
 

+ 20 - 15
src/store/actions/mainSuit.js

@@ -345,6 +345,7 @@ export const setSearch = (state,action)=>{
   let searchData = action.data;
   res.searchDatas = searchData;
   res.searchStr = action.inpStr;
+  res.isEnd = action.isEnd;
   return res;
 }
 
@@ -406,25 +407,29 @@ export const insertSearch = (state,action)=>{
     
     // 从新插入一个span标签
     const searchStr = res.searchStr;
+    const isEnd = res.isEnd;
     let innerText = span.current.innerText || span.current.innerHTML;
-    const value = innerText.replace(searchStr,"");
-    let index = innerText.indexOf(searchStr);
-    if(index < 1){//前
-      if(data[focusIndex].value==searchStr){//为空标签则替换
+    if(!isEnd){//前
+      const reg = new RegExp("^"+searchStr)
+      const value = innerText.replace(reg,"");
+      res.data.splice(focusIndex,0,nText);
+      res.saveText.splice(focusIndex,0,searchData);
+      res.data[focusIndex+1].value = value;
+      res.saveText[focusIndex+1] = value;
+      span.current.innerText?(span.current.innerText = value):(span.current.innerHTML=value); 
+    }else{
+      const reg = new RegExp(searchStr+"$")
+      const value = innerText.replace(reg,"");
+      if(data[focusIndex].value.trim()==searchStr){//为空标签则替换-否则会多一个空标签
         res.data.splice(focusIndex,1,nText);
         res.saveText.splice(focusIndex,1,searchData);
       }else{
-        res.data.splice(focusIndex,0,nText);
-        res.saveText.splice(focusIndex,0,searchData);
-        res.data[focusIndex+1].value = value;
-        res.saveText[focusIndex+1] = value;
-      }  
-    }else{
-      res.data.splice(focusIndex+1,0,nText);
-      res.saveText.splice(focusIndex+1,0,searchData);
-      res.data[focusIndex].value = value;
-    }
-    span.current.innerText?(span.current.innerText = value):(span.current.innerHTML=value);
+        res.data.splice(focusIndex+1,0,nText);
+        res.saveText.splice(focusIndex+1,0,searchData);
+        res.data[focusIndex].value = value;
+      }
+      span.current.innerText?(span.current.innerText = value):(span.current.innerHTML=value);
+    } 
     res.mainIds.push(ids);
     if(id){
       res.mainTailIds.push(id);

+ 3 - 1
src/store/async-actions/pushMessage.js

@@ -7,6 +7,7 @@ import {SET_IMPORT_CHECKBODY_LABEL,PRESET} from "../types/checkBody";
 import dataLis from '@components/EmergencyProcedure/emergency';
 import { Notify} from '@commonComp';
 import {pregetCheckbodyData} from '@store/async-actions/fetchModules';
+import {tabChange} from '@store/actions/tabTemplate';
 const api={
   push:'/push/pushInner',
   getTableList:'/scale/getList', //获取量表列表
@@ -137,7 +138,8 @@ export const getConceptDetail = (item) => {
 
         json(api.getConceptDetail, params).then((res) => {
             if(res.data.code == '0'&& res.data.data.details && res.data.data.details.length > 0) {
-                if(item.position == '1') {  //右侧提示信息
+              dispatch(tabChange(0));     //tab跳回推送
+              if(item.position == '1') {  //右侧提示信息
                     dispatch({
                         type: SET_CLICK_DIAG,
                         clickDiag: item

+ 4 - 2
src/store/reducers/assessResult.js

@@ -97,8 +97,10 @@ export default (state=init,action)=>{
           });
           return subInx!=-1;
         });
-        const trueInx = res.wholeIndexs[inx].findIndex((i)=>i==subInx);
-        res.wholeIndexs[inx].splice(trueInx,1);
+        if(inx!=-1){
+          const trueInx = inx!=-1&&res.wholeIndexs[inx].findIndex((i)=>i==subInx);
+          res.wholeIndexs[inx].splice(trueInx,1);
+        }
       }else{
         res.addedScaleIds.push(action.id);
       }

+ 1 - 1
src/utils/tools.js

@@ -241,7 +241,7 @@ const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清
         store.dispatch({
             type: SET_TIPS,
             tips: {}
-          })
+        })
         store.dispatch({
             type: CLEAR_ALL_DIAG,
             data:[],