瀏覽代碼

Merge branch 'dev/new1' into dev/zhangxc1

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

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

@@ -43,14 +43,14 @@ class DropList extends Component{
     onSelect&&onSelect(undefined);
   }
   render(){
-    const {data} = this.props;
+    const {data,hideTag} = this.props;
     const domNode = document.getElementById('root');
     return ReactDom.createPortal(
       <div className={this.getClass()} style={this.getStyle()} contentEditable='false'>
         <ul>
           {data&&data.map((it)=>{
             /*return <li onClick={(e)=>this.handleSelect(e,it)} className={it.selected||(it.selected!==false&&+it.defaultSelect===1)?style['selected']:''}>{it.labelPrefix}{it.questionDetailList&&it.questionDetailList.length>0?it.questionDetailList[0].name:it.name}{it.labelSuffix}</li>*/
-            return <li onClick={(e)=>this.handleSelect(e,it)} className={it.selected||(it.selected!==false&&+it.defaultSelect===1)?style['selected']:''}>{it.labelPrefix}{it.name}{it.labelSuffix}</li>
+            return <li onClick={(e)=>this.handleSelect(e,it)} className={it.selected||(!hideTag&&it.selected!==false&&+it.defaultSelect===1)?style['selected']:''}>{it.labelPrefix}{it.name}{it.labelSuffix}</li>
           })}
           <li onClick={(e)=>this.handleClear(e)} className='red'>清空选项</li>
         </ul>

+ 7 - 11
src/components/NumberDrop/index.jsx

@@ -52,16 +52,11 @@ class NumberDrop extends Component{
         placeholder:this.props.placeholder
       });
     }else{
-      //console.log(text,isNaN(+text),max<+text)
       if(needCompare){
-        /*if(text!=''&&(isNaN(+text)||max<+text)){    //数值过大
-          this.beyondArea();
-          return;
-        }*/
         const that = this;
         const isFine = this.validSymbols(text,min,max);      //有~或/时是否合理
         const hasSymbol = /[\/|\~]/g.test(text);           //是否有~或/
-        const singleFine = !isNaN(+text)&&max!=undefined&&min<text&&text<max;   //无~或/时是否合理
+        const singleFine = !isNaN(+text)&&min<text&&text<max;   //无~或/时是否合理
         timer = setTimeout(function(){
           clearTimeout(that.state.sltTimer);
           if(text!=''&&(!hasSymbol&&!singleFine)||(hasSymbol&&!isFine)){
@@ -139,11 +134,12 @@ class NumberDrop extends Component{
     //输入只有一个~或/时判断两边是否为合理数字,有多个为不合理
     const index1 = txt.indexOf('~');
     const index2 = txt.indexOf('/');
+    const needCompare = min!=undefined&&max!=undefined;
     let arr1=[],arr2=[];
     if(index1!=-1&&index1==txt.lastIndexOf('~')&&index1!=txt.length-1){   //有且只有一个~,且不在最后
       arr1 = txt.split('~');
       //~的范围在合理范围内为合理值
-      if(!isNaN(+arr1[0])&&!isNaN(+arr1[1])&&+arr1[0]>min&&+arr1[1]<max){
+      if(!isNaN(+arr1[0])&&!isNaN(+arr1[1])&&((!needCompare)||(needCompare&&min<arr1[0]&&arr1[0]<max&&min<arr1[1]&&arr1[1]<max))){
         return true
       }
       return false;
@@ -151,7 +147,7 @@ class NumberDrop extends Component{
     if(index2!=-1&&index2==txt.lastIndexOf('/')&&index2!=txt.length-1){   //有且只有一个~,且不在最后
       arr2 = txt.split('/');
       // /两边的数字分别在合理范围内为合理值
-      if(!isNaN(+arr2[0])&&!isNaN(+arr2[1])&&min<arr2[0]&&arr2[0]<max&&min<arr2[1]&&arr2[1]<max){
+      if(!isNaN(+arr2[0])&&!isNaN(+arr2[1])&&((!needCompare)||(needCompare&&min<arr2[0]&&arr2[0]<max&&min<arr2[1]&&arr2[1]<max))){
         return true
       }
       return false;
@@ -166,16 +162,16 @@ class NumberDrop extends Component{
     }
     //输入超出合理范围或输入不是数字提示且清空
     const needCompare=min!=undefined&&max!=undefined;
-    if(needCompare){
+    //if(needCompare){
       const txt = e.target.innerText.trim();
       const isFine = this.validSymbols(txt,min,max);      //有~或/时是否合理
       const hasSymbol = /[\/|\~]/g.test(txt);           //是否有~或/
-      const singleFine = !isNaN(+txt)&&min<txt&&txt<max;   //无~或/时是否合理
+      const singleFine = (!isNaN(+txt)&&!needCompare)||(!isNaN(+txt)&&needCompare&&min<txt&&txt<max);   //无~或/时是否合理
       if(txt!=''&&(!hasSymbol&&!singleFine)||(hasSymbol&&!isFine)){
         this.beyondArea();
         return;
       }
-    }
+    //}
 
     //输入为空时显示placeholder
     if(!e.target.innerText.trim()){

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

@@ -142,7 +142,7 @@ class RadioDrop extends Component{
     handleDbclick&&handleDbclick({id:patId||id});
   }
   render(){
-    const {data,prefix,suffix,placeholder,show,value} = this.props;
+    const {data,prefix,suffix,placeholder,show,value,hideTag} = this.props;
     const {boxLeft,boxTop} = this.state;
     return <div className={style['container']} ref = {this.$cont}>
       {prefix}
@@ -155,7 +155,7 @@ class RadioDrop extends Component{
         {value||placeholder}
       </div>
       {suffix}
-      <DropList onSelect={this.handleSelect} data={data} left={boxLeft} top={boxTop} show={show}/>
+      <DropList onSelect={this.handleSelect} data={data} left={boxLeft} top={boxTop} show={show} hideTag={hideTag}/>
     </div>
   }
 }

+ 3 - 2
src/containers/SpreadDrop.js

@@ -483,7 +483,7 @@ function mapDispatchToProps(dispatch,store){
           // let pushDataList = result.data.symptom;
           let bigDataList = result.data.symptom;
           let pushDataList = [];
-          if(bigDataList.length>0){//剔除没有id
+          if(bigDataList&&bigDataList.length>0){//剔除没有id
             pushDataList = bigDataList.filter(function(item){
               return item.id
             });
@@ -509,7 +509,7 @@ function mapDispatchToProps(dispatch,store){
             // return
           }*/
           //推送无数据显示空下拉并提示暂无推送--1.9/1.18
-          if(pushDataList.length == 0){Notify.info("暂无推送");}
+          if(!pushDataList || pushDataList.length == 0){Notify.info("暂无推送");}
           if(obj.type == 1){// 主诉--添加症状
               dispatch({
                 type:GET_BIGDATAPUSH,
@@ -525,6 +525,7 @@ function mapDispatchToProps(dispatch,store){
             }
         }else{
           console.log(result.msg);
+          Notify.info("暂无推送");
           // 接口请求失败,不往下执行显示下拉
           return
         }

+ 2 - 0
src/store/actions/checkBody.js

@@ -440,10 +440,12 @@ export function backspaceText(state,action){
     // 前一个是文本标签或者子模板 不做处理
   }else if(data[delIndex-1].tagType==8){
     data.splice(delIndex,1);
+    res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
     res.saveText.splice(delIndex,1);
   }
   else{
     data.splice(delIndex-1,2);
+    res.selecteds.splice(delIndex-1,2);      //杂音类样式选中状态对应
     res.saveText.splice(delIndex-1,2);
   }
   // res.saveText = fullfillText(data).saveText;