Selaa lähdekoodia

查体获取数据失败时可输入bug修改

zhouna 6 vuotta sitten
vanhempi
commit
2facfcb807

+ 4 - 1
src/common/components/EditableSpan/index.jsx

@@ -115,6 +115,9 @@ class EditableSpan extends Component{
     const ev = e||window.event;
     const target = ev.target||ev.srcElement;
     let innerVal = target.innerText;
+    /*if(this.props.full){
+      return false;
+    }*/
     //禁止回车事件
     if(ev.keyCode==13){return false;}
     //backspace事件
@@ -172,7 +175,7 @@ class EditableSpan extends Component{
   }
 
   render() {
-    return <span className={style['editable-span']}
+    return <span className={style['editable-span']+(this.props.full?' '+style['full']:'')}
                       contentEditable='true'
                       ref={this.$span}
                       onInput={this.onChange}

+ 1 - 1
src/common/components/ItemBox/index.jsx

@@ -49,7 +49,7 @@ class ItemBox extends Component {
   render(){
     const {title,children,editable,className,handleFocus,onchange,fuzhen,border,handleBlur,titleTop,backgroundColor} = this.props;
     return <div className={style["box"]+" "+"clearfix"} >
-      <div className={style["title"] + ' ' + className} style={{marginTop:titleTop?'22px':''}}>{title}</div>
+      <div className={style["title"] + ' '+(className||'')} style={{marginTop:titleTop?'22px':''}}>{title}</div>
       <div ref={this.$div} className={`${style["content"]} ${border?style["border"]:''} ${backgroundColor?style["noBorder"]:''}`} contentEditable={editable} style={this.getBoxStyle()} onFocus={handleFocus} onInput={this.handleInput} onClick={(e)=>{this.handleClick(e);}} onBlur={handleBlur}>
         {fuzhen?children||fuzhen:children}
       </div>

+ 3 - 1
src/common/components/NumberPan/index.jsx

@@ -49,7 +49,9 @@ class NumberPan extends Component{
   render(){
     const select = this.handleSelect.bind(this);
     const {show} = this.props;      //table onBlur阻止冒泡是为了修复multSpread中数字键盘点击触发最外层数字组件onBlur事件
-    return <div className={style['panBox']} onBlur={(e)=>e.stopPropagation()} style={{display:show?'table':'none'}}>
+    return <div className={style['panBox']}
+                onBlur={(e)=>e.stopPropagation()} style={{display:show?'table':'none'}}
+                onDoubleClick={(e)=>e.stopPropagation()}>
     <table className={style['pan']} >
       <tr>
         <td><button onClick={select}>1</button></td>

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

@@ -15,7 +15,7 @@ class CheckBody extends Component{
     this.handleClick = this.handleClick.bind(this);
     this.handleSearchSelect = this.handleSearchSelect.bind(this);
     this.getData = this.getData.bind(this);
-    this.handleInput = this.handleInput.bind(this);
+    //this.handleInput = this.handleInput.bind(this);
   }
   getLabels(){
     const {data,showArr,saveText,selecteds} = this.props;
@@ -38,6 +38,7 @@ class CheckBody extends Component{
     if(totalHide){
       return ;
     }
+
     let boxLeft = e.pageX -102 + 'px';
     let boxTop =  (+e.target.offsetTop+22)+'px';
     this.setState({
@@ -52,29 +53,23 @@ class CheckBody extends Component{
   }
   getData(){
     //第一次聚焦查体时,主诉有数据则调接口,主诉无数据则显示提示;其他时间查体模板数据不调接口
-    const {hasMain,saveText,data,fetchPushInfos} = this.props;
+    const {hasMain,saveText,data,isEmpty} = this.props;
     const hasData = saveText.join("")||data.length>0;
 
-    if(hasData){
+    if(!hasMain&&isEmpty){          //无主诉且本身无数据时,点击提示(空白页、清空)
+      Notify.error("无法操作,请先输入主诉");
       return ;
     }
-    if(hasMain){
+    //有主诉时且本身无数据,第一次点击获取数据,(不论获取成功与否)再点击不获取(直到刷新成空白页或清空)
+    if(hasMain&&isEmpty){
       this.props.getInit();
-    }else{
-      Notify.error("无法操作,请先输入主诉");
-    }
-
-  }
-  handleInput(e){  //主诉未填无法输入
-    if(!this.props.hasMain){
-      e.target.innerText='';
     }
   }
   render(){
     const {searchData,totalHide,data} = this.props;
     const {boxLeft,boxTop,boxMark} = this.state;
     return  <div className={style['container']}>
-      <ItemBox title='查体' editable={!data.length}  handleClick={this.handleClick} onchange={this.handleInput}>
+      <ItemBox title='查体' editable={!data.length}  handleClick={this.handleClick}>
         {this.getLabels()}
         <SearchDrop data={searchData} show={!totalHide} left={boxLeft} top={boxTop} onSelect={this.handleSearchSelect}></SearchDrop>
       </ItemBox>

+ 1 - 0
src/containers/CheckBody.js

@@ -10,6 +10,7 @@ function mapStateToProps(state){
   const hasMain = mainSuit.saveText.join('');//||mainSuit.data.length;
   return {
     data:checkBody.data,
+    isEmpty:checkBody.isEmpty,
     update:checkBody.update,   //用于触发更新
     showArr:homePage.showDrop,
     totalHide:homePage.totalHide,

+ 1 - 1
src/containers/eleType.js

@@ -122,7 +122,7 @@ export default function(params){
     case 6:
       return multCheckLabels(params,data.tagType);
     case 8:
-      return <EditableSpan {...params} value={data.value||data.name} update={Math.random()}/>;
+      return <EditableSpan {...params} value={data.value||data.name} full={data.full} update={Math.random()}/>;
     case 11://推送类型
       return multCheckLabels(params,data.tagType);
     default:

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

@@ -6,6 +6,7 @@ export function set(state,action){
   const {data} = action;
   res.data = [...data];
   res.update = Math.random();
+  res.isEmpty = false;
   return res;
 }
 //查体中数字键盘选中事件
@@ -188,6 +189,7 @@ export function clearCheckBody(state,action){  //清空
   let res = Object.assign({},state);
   res.data = action.data;
   res.saveText = action.saveText;
+  res.isEmpty = action.isEmpty;
   res.selecteds = action.selecteds?action.selecteds:[];
   return res;
 }

+ 9 - 1
src/store/async-actions/fetchModules.js

@@ -6,6 +6,7 @@ import store from '@store';
 import {getEMRParams} from '@utils/tools.js';
 import {Notify} from '@commonComp';
 import {SETOTHERHISTORY} from "../types/homePage";
+import config from "@config/index";
 
 const api={
   getSpreadModule:'/api/icss/questionInfo/getByIds',
@@ -106,9 +107,16 @@ export function getInitData(){
         const arr = fullfillText(JSON.parse(str)).newArr;
         dispatch({
           type:SET,
-          data:[...arr]
+          data:[...arr],
+          isEmpty:false
         });
       }else{
+        const block = Object.assign(JSON.parse(config.textLabel),{full:true});      //无数据时保留一个自由文本标签可输入
+        dispatch({
+          type:SET,
+          data:[block],
+          isEmpty:false
+        });
         Notify.error(res.data.msg);
       }
     });

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

@@ -3,13 +3,15 @@ import {SET,SETNUMBER4,SETSELECTED4,SETCHECKBOX,ADDLABELITEM,SETCHECKTEXT,SETSEA
 import {set,setNumberValue,setRadioValue,setCheckBoxValue,addLabelItem,setCheckText,setSearchData,insertLabelData,changeLabelVal,clearCheckBody,setInputLabel,backspaceText} from '../actions/checkBody.js';
 import config from '@config/index.js';
 
-const block = Object.assign(JSON.parse(config.textLabel),{full:true});
+//const block = Object.assign(JSON.parse(config.textLabel),{full:false});//空白时保留一个自由文本标签
 const initState = {
                 data:[],
                 saveText:[],    //saveText为生成的纯文本
                 searchData:[],
                 selecteds:[],
-                focusIndex:''};
+                focusIndex:'',
+                isEmpty:true      //是否为空白,需要请求数据
+          };
 export default function(state=initState,action){
   let res = Object.assign({},state);
   switch(action.type){

+ 2 - 1
src/utils/tools.js

@@ -8,6 +8,7 @@ import {clearAllLabel} from '@store/actions/inspect';
 import {CLEAR_ALL_DIAG} from '@store/types/diagnosticList';
 import {CLEAR_ALL_PUSH_MESSAGE, SET_TIPS} from '@store/types/pushMessage';
 import {ISREAD, SETREADDITEMS} from "../store/types/homePage";
+import config from '@config/index.js';
 
 /***
  * 工具函数
@@ -234,7 +235,7 @@ const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清
         store.dispatch({type: CLEAR_MAIN_SUIT,data:[],saveText:[],selecteds:[],editClear:true,mainIds:[]});
         store.dispatch({type: CLEAR_CURRENT_ILL,data:[],saveText:[],selecteds:[],editClear:true,symptomIds:[]});
         store.dispatch({type: CLEAROTHERHISTORY,data:[],saveText:[],selecteds:[],editClear:true});
-        store.dispatch({type: CLEARCHECKBODY,data:[],saveText:[],selecteds:[]});
+        store.dispatch({type: CLEARCHECKBODY,data:[],isEmpty:true,saveText:[],selecteds:[]});
         store.dispatch(clearAssistData([],''));
         store.dispatch(clearAllLabel([],[],''));
         store.dispatch({