Parcourir la source

模板添加检索功能

luolei il y a 5 ans
Parent
commit
b8e4f33192

+ 5 - 0
src/components/PushContainer/index.jsx

@@ -54,11 +54,15 @@ class PushContainer extends Component {
     this.handleDelList = this.handleDelList.bind(this)
     this.makeSure = this.makeSure.bind(this)
     this.handleClose = this.handleClose.bind(this);
+    this.templateSearch = this.templateSearch.bind(this);
   }
   componentDidMount() {
     // const height = getWindowInnerHeight()-160;
     // this.$cont.current.style.height = height+"px";
   }
+  templateSearch(name){
+    store.dispatch(initItemList(1,name));
+  }
   /**
    * 
    * @param {tab组件切换id} id
@@ -268,6 +272,7 @@ class PushContainer extends Component {
             handleMangerTemplate={this.handleMangerTemplate}
             handleAllCheckbox={this.handleAllCheckbox}
             handleClickGetMore={this.handleClickGetMore}
+            templateSearch={this.templateSearch}
           ></TemplateItems>
           <MedicalInfoContainer></MedicalInfoContainer>
           <ScaleSearchContainer></ScaleSearchContainer>

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

@@ -58,7 +58,7 @@
       height: 100%;
       vertical-align: top;
     //   margin-top: 3px;
-    padding: 0 5px;
+    // padding: 0 5px;
       max-width: 150px;
       overflow: hidden;
       text-overflow: ellipsis;
@@ -90,6 +90,7 @@
       display: none;
       width: 20px;
       height: 20px;
+      margin-left: 5px;
     }
     
     .quote {

+ 12 - 2
src/components/TemplateItems/index.jsx

@@ -12,14 +12,16 @@ class TemplateItems extends React.Component {
     constructor(props) {
         super(props);
         this.$cont = React.createRef();
+        this.$search = React.createRef();
         this.genItems = this.genItems.bind(this);
+        this.templateSearch = this.templateSearch.bind(this);
     }  
     componentDidMount(){
-        const height = getWindowInnerHeight()-206;
+        const height = getWindowInnerHeight()-226;
         this.$cont.current.style.height = height+"px";
         windowEventHandler('resize', ()=>{
             if(this.$cont.current){
-                const height = getWindowInnerHeight()-206;
+                const height = getWindowInnerHeight()-226;
                 this.$cont.current.style.height = height+"px";
             }
         });
@@ -49,6 +51,10 @@ class TemplateItems extends React.Component {
             return check_circle;
         }
     }
+    templateSearch(){
+        const {templateSearch} = this.props
+        templateSearch(this.$search.current.value)
+    }
     render() {
         const { allCheckShow, handleMangerTemplate,handleClickGetMore, handleDelList, handleAllCheckbox, items,checkItems,current,hasMore } = this.props;
         // console.log(hasMore,current,7877877)
@@ -68,6 +74,10 @@ 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>
+                            </div>
                             <span className={`${style['fr-element']} ${style['manger']}`} onClick={handleMangerTemplate}>管理</span>
                     </div>) : <div style={{height:'36px'}}></div>
                 }

+ 26 - 2
src/components/TemplateItems/index.less

@@ -1,17 +1,21 @@
 @import "~@less/mixin.less";
 
 .wrapper{
-    background-color: @gray-background-color;
+    // background-color: @gray-background-color;
     user-select: none;
     position: relative;
+    // padding: 0 15px;
+    // border: 1px solid #EAEDF1;
     .tempLists {
         overflow-y: auto;
         background-color: #fff;
+        margin-top: 15px;
     }
     .wrapperTop {
         height: 36px;
         padding: 0 20px;
-        background-color: #EAEDF1;
+        margin-top: 15px;
+        // background-color: #EAEDF1;
         cursor: pointer;
         .check-box {
             height: 18px;
@@ -58,5 +62,25 @@
       cursor: pointer;
       margin-top: 15px;
     }
+    .templateSearch {
+        display: inline-block;
+        input {
+            height: 35px;
+            line-height: 35px;
+            border: 1px solid #CECECE;
+            box-sizing: border-box;
+            width: 270px;
+            padding: 0 10px;
+        }
+        .search {
+            display: inline-block;
+            width: 80px;
+            text-align: center;
+            background-color: #2A9BD5;
+            color: #fff;
+            height: 35px;
+            line-height: 35px;
+        }
+    }
 }
 

+ 1 - 1
src/containers/PushItemsContainer.js

@@ -9,7 +9,7 @@ import { HIDEDROP } from '@store/types/homePage.js';
 
 function mapStateToProps(state) {//console.log(state)
   const {pushMessage,diagnosticList,inspect} = state;
-        return {
+    return {
         pushMessage: pushMessage,
         tipsDiscalimer:  state.copyRight.disContent,
         chronicMagItem: diagnosticList.chronicMagItem,

+ 3 - 2
src/store/async-actions/tabTemplate.js

@@ -16,7 +16,7 @@ import {
   pushAllDataList
 } from '@utils/tools';
 
-export const initItemList = (current,flg) => { //初始化数据
+export const initItemList = (current,name,flg) => { //初始化数据
   let baseList = store.getState();
   let state = baseList.patInfo.message;
 
@@ -27,7 +27,8 @@ export const initItemList = (current,flg) => { //初始化数据
       "hospitalId": state.hospitalId,
       "current": current,
       "sex":[1,2,3],
-      "size": 9999
+      "size": 9999,
+      "name":name||''
     }).then((res) => {
       const data = res.data;
       if (data.code == 0) {

+ 2 - 2
src/utils/config.js

@@ -1,8 +1,8 @@
 // const host='http://192.168.3.1:5050';//赵
 // const host='http://192.168.3.100:5050';//王峰
-// const host='http://192.168.2.236:5050';//后端接口访问地址
+const host='http://192.168.2.236:5050';//后端接口访问地址
 // const host='http://192.168.2.121:5050';//后端接口访问地址
-const host='http://192.168.2.241:5050';//后端接口访问地址
+// const host='http://192.168.2.241:5050';//后端接口访问地址
 // const host='http://192.168.3.11:5050';//王宇
 //const host='http://192.168.2.164:8080';
 // const host='http://192.168.3.117:5050'; //周铁刚