Преглед на файлове

右侧搜索样式统一修改

luolei преди 5 години
родител
ревизия
eb431168a9

+ 4 - 3
src/components/MedicalInfo/index.jsx

@@ -8,7 +8,7 @@ class MedicalInfo extends Component {
         super(props);
         this.$inp = React.createRef();
         this.$cont = React.createRef();
-      this.$ul = React.createRef();
+        this.$ul = React.createRef();
         this.state={
           val:'',
           hasSearch: false,
@@ -62,6 +62,7 @@ class MedicalInfo extends Component {
         hasSearch: false,
         msg: '',
       });
+      
       clearResult && clearResult();
     }
   }
@@ -78,6 +79,7 @@ class MedicalInfo extends Component {
         hasSearch: false,
         msg:''
       });
+      this.$inp.current.focus();
       clearResult&&clearResult();
   }
   componentDidMount(){
@@ -105,9 +107,8 @@ class MedicalInfo extends Component {
         return (
             <div className={style['search-cont']} ref={this.$cont}>
               <div className={style['search-box']}>
-                <p className={style['title']}>医学知识搜索</p>
                 <p className={style['cont']}>
-                  <input type="text" className={style['input']} ref={this.$inp} onInput={this.handleChange} onKeyUp={this.handleEnter}/>
+                  <input placeholder="医学知识搜索" type="text" className={style['input']} ref={this.$inp} onInput={this.handleChange} onKeyUp={this.handleEnter}/>
                   {val?<img src={delIcon} alt="清空" onClick={this.clear}/>:''}
                   <button onClick={this.search}>搜索</button>
                 </p>

+ 1 - 1
src/components/MedicalInfo/index.less

@@ -56,7 +56,7 @@
         border: none;
     }
     .result{
-        margin-top:78px;
+        margin-top:46px;
         padding: 0 5px 0 0;
         height: 100%;
         box-sizing: border-box;

+ 0 - 52
src/components/Operation/index.jsx

@@ -160,8 +160,6 @@ class Operation extends Component {
     // console.log(tmpLis,'接口返回的')
     for(let i = 0;i <tmpLis.length;i++){
       let dataStr = tmpLis[i].preview;
-      // let dataJson = tmpLis[i].dataJson;
-      // console.log(jsonStr.diag , JSON.parse(dataStr).diag)
       if(
         filterDataArr(JSON.parse(jsonStr.chief)) == filterDataArr(eval('('+JSON.parse(dataStr).chief+')')) && 
         filterDataArr(JSON.parse(jsonStr.present)) == filterDataArr(eval('('+JSON.parse(dataStr).present+')')) && 
@@ -175,56 +173,6 @@ class Operation extends Component {
         Notify.info('该模板已保存');
         return false;
       }
-      // if(whichSign == 0){
-      //   // console.log(filterDataArr(JSON.parse(jsonStr.present)) , filterDataArr(JSON.parse(JSON.parse(dataStr).present)))
-      //   if(
-      //     filterDataArr(JSON.parse(jsonStr.chief)) == filterDataArr(eval('('+JSON.parse(dataStr).chief+')')) && 
-      //     filterDataArr(JSON.parse(jsonStr.present)) == filterDataArr(eval('('+JSON.parse(dataStr).present+')')) && 
-      //     filterDataArr(JSON.parse(jsonStr.other)) == filterDataArr(eval('('+JSON.parse(dataStr).other+')')) && 
-      //     filterDataArr(JSON.parse(jsonStr.vital)) == filterDataArr(eval('('+JSON.parse(dataStr).vital+')')) &&
-      //     jsonStr.lis == JSON.parse(dataStr).lis &&
-      //     jsonStr.pacs == JSON.parse(dataStr).pacs &&
-      //     jsonStr.diag == JSON.parse(dataStr).diag &&
-      //     jsonStr.advice == JSON.parse(dataStr).advice
-      //     // JSON.stringify(jsonData.chief) == JSON.stringify(JSON.parse(dataJson).chief) &&    
-      //     // JSON.stringify(jsonData.checkedListImport) == JSON.stringify(JSON.parse(dataJson).checkedListImport) &&    
-      //     // JSON.stringify(jsonData.present) == JSON.stringify(JSON.parse(dataJson).present)  &&     
-      //     // JSON.stringify(jsonData.other) == JSON.stringify(JSON.parse(dataJson).other) &&
-      //     // JSON.stringify(jsonData.vital) == JSON.stringify(JSON.parse(dataJson).vital) && 
-      //     // JSON.stringify(jsonData.lis) == JSON.stringify(JSON.parse(dataJson).lis) &&  
-      //     // JSON.stringify(jsonData.pacs) == JSON.stringify(JSON.parse(dataJson).pacs) &&     
-      //     // JSON.stringify(jsonData.diag) == JSON.stringify(JSON.parse(dataJson).diag) &&    
-      //     // JSON.stringify(jsonData.advice) == JSON.stringify(JSON.parse(dataJson).advice) &&    
-      //     // JSON.stringify(jsonData.mainSuitSelecteds) == JSON.stringify(JSON.parse(dataJson).mainSuitSelecteds) &&      
-      //     // JSON.stringify(jsonData.currentIllSelecteds) == JSON.stringify(JSON.parse(dataJson).currentIllSelecteds) &&     
-      //     // JSON.stringify(jsonData.otherHistorySelecteds) == JSON.stringify(JSON.parse(dataJson).otherHistorySelecteds) && 
-      //     // JSON.stringify(jsonData.checkBodySelecteds) == JSON.stringify(JSON.parse(dataJson).checkBodySelecteds) &&     
-      //     // JSON.stringify(jsonData.addItems) == JSON.stringify(JSON.parse(dataJson).addItems)
-      //   ){
-      //     Notify.info('该模板已保存');
-      //     return false;
-      //   }
-      // }else if(whichSign == 1){
-      //   if(
-      //     jsonStr.chief == JSON.stringify(eval('('+JSON.parse(dataStr).chief+')')) && 
-      //     jsonStr.present == JSON.stringify(eval('('+JSON.parse(dataStr).present+')')) && 
-      //     jsonStr.other == JSON.stringify(eval('('+JSON.parse(dataStr).other+')')) && 
-      //     jsonStr.vital == JSON.stringify(eval('('+JSON.parse(dataStr).vital+')')) &&
-      //     jsonStr.lis == JSON.parse(dataStr).lis &&
-      //     jsonStr.pacs == JSON.parse(dataStr).pacs &&
-      //     jsonStr.diag == JSON.parse(dataStr).diag &&
-      //     jsonStr.advice == JSON.parse(dataStr).advice
-      //     // JSON.stringify(jsonData.vital) == JSON.stringify(JSON.parse(dataJson).vital) && 
-      //     // JSON.stringify(jsonData.lis) == JSON.stringify(JSON.parse(dataJson).lis) &&  
-      //     // JSON.stringify(jsonData.pacs) == JSON.stringify(JSON.parse(dataJson).pacs) &&     
-      //     // JSON.stringify(jsonData.diag) == JSON.stringify(JSON.parse(dataJson).diag) &&    
-      //     // JSON.stringify(jsonData.advice) == JSON.stringify(JSON.parse(dataJson).advice) &&        
-      //     // JSON.stringify(jsonData.addItems) == JSON.stringify(JSON.parse(dataJson).addItems)
-      //   ){
-      //     Notify.info('该模板已保存');
-      //     return false;
-      //   }
-      // }
     }
     return true;
   }

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

@@ -93,6 +93,7 @@ class ScaleSearch extends Component {
       hasSearch: false,
       msg:''
     });
+    this.$inp.current.focus();
     clearResult&&clearResult();
   }
   componentDidMount(){
@@ -120,9 +121,8 @@ class ScaleSearch extends Component {
     return (
         <div className={style['search-cont']} ref={this.$cont}>
           <div className={style['search-box']}>
-            <p className={style['title']}>量表搜索</p>
             <p className={style['cont']}>
-              <input type="text" className={style['input']} ref={this.$inp} onInput={this.handleChange} onKeyUp={this.handleEnter}/>
+              <input type="text" placeholder="量表搜索" className={style['input']} ref={this.$inp} onInput={this.handleChange} onKeyUp={this.handleEnter}/>
               {val?<img src={delIcon} alt="清空" onClick={this.clear}/>:''}
               <button onClick={this.search}>搜索</button>
             </p>

+ 1 - 1
src/components/ScaleSearch/index.less

@@ -52,7 +52,7 @@
     border: none;
   }
   .result{
-    margin-top:78px;
+    margin-top:46px;
     padding: 0 5px 0 0;
     height: 100%;
     overflow: auto;

+ 1 - 1
src/components/TemplateItems/TemplateItem/index.less

@@ -33,7 +33,7 @@
     position: relative;
     height: 45px;
     line-height: 45px;
-    padding: 0 20px;
+    padding: 0 15px;
     cursor: pointer;
     img {
         display: inline-block;

+ 55 - 13
src/components/TemplateItems/index.jsx

@@ -3,6 +3,7 @@ import React from "react"
 import style from "./index.less"
 import TemplateItem from './TemplateItem'
 import check_circle from './TemplateItem/img/check-circle.png';
+import delIcon from '@common/images/del_nor.png';
 import check_right from './TemplateItem/img/check-right.png';
 import Empty from '@components/Empty';
 import {windowEventHandler,getWindowInnerHeight} from '@utils/tools'
@@ -11,17 +12,24 @@ import {windowEventHandler,getWindowInnerHeight} from '@utils/tools'
 class TemplateItems extends React.Component {
     constructor(props) {
         super(props);
+        this.state = {
+            msg:'还没有保存模板',
+            val:''
+        }
         this.$cont = React.createRef();
         this.$search = React.createRef();
         this.genItems = this.genItems.bind(this);
         this.templateSearch = this.templateSearch.bind(this);
+        this.handleEnter = this.handleEnter.bind(this);
+        this.handleChange = this.handleChange.bind(this);
+        this.clear = this.clear.bind(this);
     }  
     componentDidMount(){
-        const height = getWindowInnerHeight()-226;
+        const height = getWindowInnerHeight()-235;
         this.$cont.current.style.height = height+"px";
         windowEventHandler('resize', ()=>{
             if(this.$cont.current){
-                const height = getWindowInnerHeight()-226;
+                const height = getWindowInnerHeight()-235;
                 this.$cont.current.style.height = height+"px";
             }
         });
@@ -54,7 +62,48 @@ class TemplateItems extends React.Component {
     templateSearch(){
         const {templateSearch} = this.props
         templateSearch(this.$search.current.value)
+        if(this.$search.current.value.trim()){
+            this.setState({
+                msg:'暂无模板信息'
+            })
+        }else{
+            this.setState({
+                msg:'还没有保存模板'
+            })
+        }
+    }
+    
+    handleEnter(e){
+        if(e.keyCode==13){
+            this.templateSearch();
+        }
     }
+    
+    handleChange(){
+        const value = (this.$search.current.value).substring(0,30);
+        // this.$search.current.value = value
+        setTimeout(() => {
+            
+            this.setState({
+                val: value
+            });
+        }, 30);
+        // if (value === '') {
+        //     this.setState({
+        //         val: ''
+        //     });
+        // }
+    }
+
+    clear(){
+        this.$search.current.value = '';
+        this.setState({
+            val:''
+        })
+        
+        this.$search.current.focus();
+    }
+
     render() {
         const { allCheckShow, handleMangerTemplate,handleClickGetMore, handleDelList, handleAllCheckbox, items,checkItems,current,hasMore } = this.props;
         // console.log(allCheckShow,7877877)
@@ -75,25 +124,18 @@ class TemplateItems extends React.Component {
                         </div> :
                         <div className={style.wrapperTop}>
                             <div className={style.templateSearch}>
-                                <input ref={this.$search} type="text" />
-                                <div className={style.search} onClick={this.templateSearch}>检索</div>
+                                <input placeholder="模板搜索" maxLength="30" ref={this.$search} type="text" onInput={this.handleChange} onPropertyChange={this.handleChange} onKeyUp={this.handleEnter}/>
+                                {this.state.val?<img src={delIcon} alt="清空" onClick={this.clear}/>:''}
+                                <div className={style.search} onClick={this.templateSearch}>搜索</div>
                             </div>
                             {
                                 items.length > 0&&<span className={`${style['fr-element']} ${style['manger']}`} onClick={handleMangerTemplate}>管理</span>
                             }
                     </div>) : <div style={{height:'36px'}}></div>
-                    // <div className={style.emptyWrap}>
-                    //     <div className={`${style.templateSearch}`}>
-                    //         <input ref={this.$search} type="text" />
-                    //         <div className={style.search} onClick={this.templateSearch}>检索</div>
-                            
-                    //     </div>
-                    //     <span className={`${style['fr-element']} ${style['manger']}`} onClick={handleMangerTemplate}>管理</span>
-                    // </div>
                 }
                 <div className={style.tempLists} ref={this.$cont}>
                     {
-                        this.genItems().length > 0?this.genItems(): <Empty message={'还没有保存模板'}></Empty>
+                        this.genItems().length > 0?this.genItems(): <Empty message={this.state.msg}></Empty>
                     }
                     {/* {//注释掉的暂时没有分也功能
                       hasMore?<p onClick={()=>handleClickGetMore(current)} className={style.loadMore}>点击查看更多</p>:null

+ 23 - 11
src/components/TemplateItems/index.less

@@ -9,7 +9,7 @@
     .tempLists {
         overflow-y: auto;
         background-color: #fff;
-        margin-top: 15px;
+        // margin-top: 15px;
     }
     .emptyWrap {
         padding: 0 20px;
@@ -23,9 +23,9 @@
         }
     }
     .wrapperTop {
-        height: 36px;
-        padding: 0 20px;
-        margin-top: 15px;
+        height: 46px;
+        padding: 0 15px;
+        margin-top: 10px;
         // background-color: #EAEDF1;
         cursor: pointer;
         .check-box {
@@ -33,21 +33,19 @@
             // width: 18px;
             margin-top: 10px;
             padding-right: 10px;
-            
             box-sizing: content-box;
             float: left;
         }
         .check-wrap{
             height: 36px;
             padding-right: 10px;
-            display: inline-block;
             float: left;
         }
         span {
-            display: inline-block;
             height: 36px;
             line-height: 36px;
             float: left;
+            // margin-top: 20px;
         }
         .fr-element {
             float: right;
@@ -75,13 +73,20 @@
     }
     .templateSearch {
         display: inline-block;
+        p {
+            font-size: 12px;
+            color: #979797;
+            margin-bottom: 10px;
+        }
         input {
-            height: 35px;
-            line-height: 35px;
-            border: 1px solid #CECECE;
             box-sizing: border-box;
             width: 270px;
-            padding: 0 10px;
+            display: inline-block;
+            line-height: 34px;
+            height: 34px;
+            padding: 5px 25px 5px 5px;
+            border: 1px #CECECE solid;
+            vertical-align: top;
         }
         .search {
             display: inline-block;
@@ -92,6 +97,13 @@
             height: 35px;
             line-height: 35px;
         }
+        img {
+            position: absolute;
+            width: 15px;
+            left: 264px;
+            top: 10px;
+            cursor: pointer;
+        }
     }
 }