Przeglądaj źródła

中医诊断编辑-未完

zhouna 4 lat temu
rodzic
commit
cee9ee7538

+ 26 - 9
src/components/DiagnosticList/index.jsx

@@ -30,6 +30,7 @@ class DiagnosticList extends Component {
     constructor(props) {
         super(props);
         this.state = {
+            editStatus:[],      //是否被编辑过
             visible: false,
             delItem: {},
             treatTitle: '',
@@ -95,10 +96,21 @@ class DiagnosticList extends Component {
     }
     handleBlur(e,delItem,idxNum){
       const { delDiagnostic,isTcm } = this.props;
-      let name = e.target.value
-      if(name.trim() == ''){
-        delDiagnostic && delDiagnostic(delItem,idxNum,isTcm);
+      let name = e.target.value;
+      if(isTcm){
+          if(!delItem.tcmDiag.trim()&&!delItem.tcmSyndrome){
+              const arr = [...this.state.editStatus];
+              arr.splice(idxNum,1);
+              this.setState({editStatus:arr})
+              delDiagnostic && delDiagnostic(delItem,idxNum,isTcm);
+          }
+          return;
+      }else{
+          if(name.trim() == ''){
+              delDiagnostic && delDiagnostic(delItem,idxNum,isTcm);
+          }
       }
+
     }
     handleTcmShowSearch(e) {
         this.props.showTcm ? this.hideTcmSearch() : this.showTcmSearch()
@@ -331,6 +343,11 @@ class DiagnosticList extends Component {
       const {editDiagName,getBilling} = this.props;
       let name = (e.target.value).trim()
       editDiagName(index,name,isTcm)
+      if(isTcm){
+          const arr = [...this.state.editStatus];
+          arr[index] = true;
+          this.setState({editStatus:arr})
+      }
       //右侧推送--延时推送
       const stimer = this.state.timer;
       clearTimeout(stimer);
@@ -343,7 +360,7 @@ class DiagnosticList extends Component {
     render(){
         const { list,tcmList, treatment,pushMessage, loading,refreshScroller,windowHeight,setHighter,isTcm} = this.props;
         const {showTipsDetails,tipsDetails,showAllName}=pushMessage;
-        const {visible, treatTitle,  hasOndel, hasOnIndex,delItem} = this.state;
+        const {visible, treatTitle,  hasOndel, hasOnIndex,delItem,editStatus} = this.state;
         const diagList = isTcm?tcmList:list;
         if(isTcm){      //中医,添加中医诊断后才显示中医症候添加按钮
             return(
@@ -355,15 +372,15 @@ class DiagnosticList extends Component {
                             {diagList.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => {this.downDiagnostic(index)}} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown}/></span>}
                             <span className={style['diag-number']} style={{fontWeight:index === 0 ?'bold':'normal'}}>{index === 0 ? '1' : index+1}</span>
 
-                                {tcmDiag?<span className={style['diag-name']}>
+                                {editStatus[index]||tcmDiag?<span className={style['diag-name']}>
                                       <span title={tcmDiag} className={style['diag-name-box']} style={{'max-width': '300px'}}>
-                                        <input type="text" value={tcmDiag}  onFocus={(e)=>{this.handleFocus(true)}} onBlur={(e)=>{this.handleBlur(e,item,index)}} onInput={(e)=>this.handleInput(e,index,'tcmDiag')}/>
+                                        <input type="text" value={tcmDiag}  onFocus={(e)=>{this.handleFocus(true)}} onBlur={(e)=>{this.handleBlur(e,item,index,'tcmDiag')}} onInput={(e)=>this.handleInput(e,index,'tcmDiag')}/>
                                       </span>
 
                                     </span>:<Add showText="添加中医诊断结果" isTcm={isTcm} handleClick={this.handleTcmShowSearch} id="addTcmDiag" height="50px" />}
-                            {tcmSyndrome?<span className={style['diag-name']}>
+                            {editStatus[index]||tcmSyndrome?<span className={style['diag-name']}>
                                       <span title={tcmSyndrome} className={style['diag-name-box']} style={{'max-width': '300px'}}>
-                                        <input type="text" value={tcmSyndrome}  onFocus={(e)=>{this.handleFocus(true)}} onBlur={(e)=>{this.handleBlur(e,item,index)}} onInput={(e)=>this.handleInput(e,index,'tcmSyndrome')}/>
+                                        <input type="text" value={tcmSyndrome}  onFocus={(e)=>{this.handleFocus(true)}} onBlur={(e)=>{this.handleBlur(e,item,index,'tcmSyndrome')}} onInput={(e)=>this.handleInput(e,index,'tcmSyndrome')}/>
                                       </span>
 
                                     </span>:(tcmDiag?<Add showText="添加中医证候" isTcm={isTcm} handleClick={this.handleSymShowSearch} id="addSymDiag" height="50px" />:'')}
@@ -375,7 +392,7 @@ class DiagnosticList extends Component {
                                         isTcm={isTcm}
                                         height={150}>
                                     </DiagResultSearch>}
-                                {tcmDiag&&tcmSyndrome?<span className={style['treat']}
+                                {editStatus[index]||(tcmDiag&&tcmSyndrome)?<span className={style['treat']}
                                   onClick={() =>{this.showTreat(item, index)}}>
                                           <img src={item.hasTreat?singleB:singleL} alt=""/>
                                           治疗方案

+ 1 - 1
src/containers/DiagnosticList.js

@@ -87,7 +87,7 @@ function mapDispatchToProps(dispatch) {
                 type: GET_DIAGNOSTIC_STR,
                 isTcm
             });
-            dispatch(embedPush({action: "diag",isTcm:true}))
+            dispatch(embedPush({action: "diag",isTcm}))
         },
         delReact: (item) => {
             dispatch({

+ 1 - 2
src/store/actions/diagnosticList.js

@@ -3,12 +3,11 @@ export const editDiagMsg = (state, action) => {
     const {name,isTcm,idx}  = action;
     if(isTcm){
         res.tcmList[idx][isTcm]=name;
-        if(res.tcmList[idx].hasTreat){
+        if(res.otherIndex&&res.tcmList[idx].hasTreat){
             res.otherIndex[isTcm]=name;
         }
         return res;
     }
-    console.log(action)
     let tmpLis = res.diagnosticList
     for(let i = 0;i < tmpLis.length;i++){
         if(action.idx == i){

+ 1 - 1
src/store/actions/diagnosticSearch.js

@@ -25,7 +25,7 @@ export const showTcmSearch = (state,action) => {
     return res;
 }
 
-export const showSymSearch = (state,action) => {console.log(action)
+export const showSymSearch = (state,action) => {
     const res = Object.assign({}, state);
     res.show = false;
     res.showTcm = false;

+ 1 - 1
src/store/actions/print.js

@@ -42,7 +42,7 @@ export const clearSearchParam=(state,action)=>{
   return res;
 };
 // 推送保存mrid信息
-export const setMrId=(state,action)=>{console.log(action)
+export const setMrId=(state,action)=>{
   const res=Object.assign({},state);
   const {update} = res.mrInfo;
   res.mrInfo.update = +update+1;