Переглянути джерело

全部量表-接口未对

zhouna 6 роки тому
батько
коміт
f1c7b1934d

+ 6 - 4
src/components/PushContainer/index.jsx

@@ -12,7 +12,8 @@ import TemplateItems from '@components/TemplateItems';
 import PushItemsContainer from '@containers/PushItemsContainer';
 import { pushAllDataList,getWindowInnerHeight } from '@utils/tools';
 import CopyRightContainer from "@containers/CopyRightContainer";
-import MedicalInfoContainer from '@containers/MedicalInfoContainer'
+import MedicalInfoContainer from '@containers/MedicalInfoContainer';
+import ScaleSearchContainer from '@containers/ScaleSearchContainer';
 class PushContainer extends Component {
     constructor(props) {
         super(props);
@@ -27,9 +28,9 @@ class PushContainer extends Component {
             {
                 title: '医学知识',
             },
-              /*{
-                title: '全部量表',
-              }*/
+            {
+              title: '全部量表',
+            }
             ],
             visible:false,
             message:'',                 //提示的内容
@@ -259,6 +260,7 @@ class PushContainer extends Component {
                         handleAllCheckbox={this.handleAllCheckbox}
                     ></TemplateItems>
                     <MedicalInfoContainer></MedicalInfoContainer>
+                    <ScaleSearchContainer></ScaleSearchContainer>
                 </TemplateContainer>
             </Tab>
             <ConfirmModal 

+ 82 - 0
src/components/ScaleSearch/index.jsx

@@ -0,0 +1,82 @@
+import React, { Component } from 'react';
+import style from './index.less';
+import delIcon from '@common/images/del_nor.png';
+import {windowEventHandler,getCurrentDate,getWindowInnerHeight} from '@utils/tools'
+
+class ScaleSearch extends Component {
+  constructor(props) {
+    super(props);
+    this.$inp = React.createRef();
+    this.$cont = React.createRef();
+    this.state={
+      val:''
+    };
+    this.search = this.search.bind(this);
+    this.handleChange = this.handleChange.bind(this);
+    this.clear = this.clear.bind(this);
+  }
+  getSearchList() {
+    const { getAllConceptDetail,searchResult } = this.props;
+    return searchResult && searchResult.map((item) => {
+      return <li key={item.conceptId} onClick={() =>getAllConceptDetail({name: item.name, type: item.type})}>
+        <span>{item.name}</span>
+        <i>( {item.libTypeName} )</i>
+        <button>查看</button>
+      </li>;
+    });
+  }
+  search(){
+    const {handleChangeValue} = this.props;
+    const val = this.$inp.current.value;
+    handleChangeValue&&handleChangeValue(val);
+  }
+  handleChange(){
+    this.setState({
+      val:this.$inp.current.value
+    });
+  }
+  clear(){
+    this.$inp.current.value = '';
+    this.setState({
+      val:''
+    });
+  }
+  componentDidMount(){
+    const height = getWindowInnerHeight()-170;
+    this.$cont.current.style.height = height+"px";
+    if(this.$cont.current){
+      windowEventHandler('resize', ()=>{
+        const height = getWindowInnerHeight()-170;
+        this.$cont.current.style.height = height+"px";
+      });
+    }
+  }
+  render() {
+    const {searchResult} = this.props;
+    const {val} = this.state;
+    return (
+      <div className={style['mefical-info-wrapper']} ref={this.$cont}>
+        <div className={style['search-cont']}>
+          <p className={style['title']}>量表搜索</p>
+          <p className={style['cont']}>
+            <input type="text" className={style['input']} ref={this.$inp} onChange={this.handleChange}/>
+            {val?<img src={delIcon} alt="清空" onClick={this.clear}/>:''}
+            <button onClick={this.search}>搜索</button>
+          </p>
+          {searchResult&&searchResult.length>0?<div className={style['result']}>
+            <p className={style['title']}>查询内容</p>
+            <ul>
+              {this.getSearchList()}
+            </ul>
+          </div>:<p className={style['no-data']}>暂无搜索结果!</p>}
+        </div>
+      </div>
+
+    )
+
+
+
+  }
+}
+
+export default ScaleSearch;

+ 78 - 0
src/components/ScaleSearch/index.less

@@ -0,0 +1,78 @@
+@import "~@less/variables.less";
+.mefical-info-wrapper {
+  padding: 0px 15px;
+  line-height: 20px;
+  width: @push-width;
+  overflow: hidden;
+  position: relative;
+}
+.search-cont{
+  .cont{
+    position: relative;
+    img{
+      position: absolute;
+      width: 15px;
+      left: 266px;
+      top: 9px;
+      cursor: pointer;
+    }
+  }
+  .title{
+    font-size: 12px;
+    color:#979797;
+    margin-bottom: 10px;
+  }
+  .input{
+    display: inline-block;
+    width: 300px;
+    height: 34px;
+    padding: 5px;
+    border:1px #CECECE solid;
+    vertical-align: top
+  }
+  button{
+    display: inline-block;
+    width: 80px;
+    height: 34px;
+    line-height: 34px;
+    color: #fff;
+    background: #2A9BD5;
+    border:1px #2A9BD5 solid;
+    text-align: center;
+    border: none;
+  }
+  .result{
+    margin-top: 15px;
+    li{
+      border-bottom:1px #CECECE solid;
+      line-height: 42px;
+      span{
+        font-size: 14px;
+        color: #000;
+      }
+      i{
+        font-size: 12px;
+        color: #2A9BD5;
+      }
+      button{
+        float: right;
+        border:1px #2A9BD5 solid;
+        text-align: center;
+        width: 56px;
+        height: 26px;
+        line-height: 26px;
+        color: #2A9BD5;
+        border-radius: 3px;
+        background: none;
+        margin-top: 8px;
+        outline: none;
+      }
+    }
+  }
+  .no-data{
+    width: 380px;
+    color:#979797;
+    text-align: center;
+    line-height: 40px;
+  }
+}

+ 27 - 0
src/containers/ScaleSearchContainer.js

@@ -0,0 +1,27 @@
+import React from 'react';
+import { connect } from 'react-redux';
+import { getSearchList } from '@store/async-actions/ScaleSearch';
+import ScaleSearch from '@components/ScaleSearch';
+
+function mapStateToProps(state) {
+    return{
+        searchResult: state.scaleSearch.searchResult,
+    }
+}
+
+function mapDispatchToProps(dispatch) {
+    return {
+        handleChangeValue(val){
+            dispatch(getSearchList(val))
+        },
+        getAllConceptDetail(item) {
+            //dispatch(getAllConceptDetail(item))
+        }
+    }
+}
+const ScaleSearchContainer = connect(
+    mapStateToProps,
+    mapDispatchToProps
+)(ScaleSearch);
+
+export default ScaleSearchContainer

+ 28 - 0
src/store/async-actions/scaleSearch.js

@@ -0,0 +1,28 @@
+import { json } from "@utils/ajax";
+import { GET_SCALE_SEARCH_RESULT } from '@store/types/scaleSearch';
+
+
+export const getSearchList = (val) => {
+    if(val.trim() == ''){
+        const data = [];
+        return (dispatch) =>  dispatch({
+            type: GET_SCALE_SEARCH_RESULT,
+            data: []
+        })
+    }
+   
+    return (dispatch, getState) => {
+        json('/retrieval/getStaticKnowledge',{
+            inputStr:val,
+            inputIds:[]
+        })
+        .then((res)=>{
+            const data = res.data.data;
+            dispatch({
+                type: GET_SCALE_SEARCH_RESULT,
+                data: data
+            })
+        })
+    }
+};
+

+ 2 - 1
src/store/index.js

@@ -28,6 +28,7 @@ import currentIll from './reducers/currentIll';
 import assessResult from './reducers/assessResult';
 import assessResultHis from './reducers/assessResultHis';
 import medicalInfo from './reducers/medicalInfo';
+import scaleSearch from './reducers/scaleSearch';
 
 
 const composeEnhancers =
@@ -58,7 +59,7 @@ const rootReducer = combineReducers({
     assistCheck,
     checkBody,
     getInfoByUuid,
-	checkBody,
+    scaleSearch,
     currentIll,
     assessResult,
     assessResultHis,

+ 16 - 0
src/store/reducers/scaleSearch.js

@@ -0,0 +1,16 @@
+import { GET_SCALE_SEARCH_RESULT } from '../types/scaleSearch.js';
+
+const initState = {
+    searchResult: []
+}
+
+export default function (state=initState, action) {
+    const res = Object.assign({},state);
+    switch(action.type) {
+        case GET_SCALE_SEARCH_RESULT:
+            res.searchResult = data;
+            return res;
+        default: 
+            return res;
+    }
+}

+ 1 - 0
src/store/types/scaleSearch.js

@@ -0,0 +1 @@
+export const GET_SCALE_SEARCH_RESULT = 'GET_SCALE_SEARCH_RESULT';