luolei %!s(int64=4) %!d(string=hai) anos
pai
achega
b5523c3cd5

+ 7 - 6
src/components/DiagnosticList/index.jsx

@@ -77,9 +77,9 @@ class DiagnosticList extends Component {
         downDiagnostic && downDiagnostic(index)
     }
     deleteItem() {
-        const { delItem } = this.state;
+        const { delItem,idxNum } = this.state;
         const { delDiagnostic, delReact,delFollowUp } = this.props;
-        delDiagnostic && delDiagnostic(delItem);
+        delDiagnostic && delDiagnostic(delItem,idxNum);
         delReact && delReact(delItem);
         delFollowUp && delFollowUp(delItem);
         this.setState({
@@ -97,10 +97,11 @@ class DiagnosticList extends Component {
             visible: false
         })
     }
-    handleDeleteItem(item) {
+    handleDeleteItem(item,idx) {
         this.setState({
             visible: true,
             delItem: item,
+            idxNum:idx
         })
     }
     showTreat(item, idx) {
@@ -295,7 +296,7 @@ class DiagnosticList extends Component {
       this.setState({timer})
     }
     render(){
-        const { list, treatment,pushMessage, showReferRecord, showHistoryCase ,chronicMagItem,loading,refreshScroller,windowWidth,hideChronic} = this.props;
+        const { list, treatment,pushMessage,delDiagnostic, showReferRecord, showHistoryCase ,chronicMagItem,loading,refreshScroller,windowWidth,hideChronic} = this.props;
       const {showTipsDetails,tipsDetails,showAllName}=pushMessage;
         const {visible, treatTitle, showAssess, isAssessConfirm, assessId, disName, hasOndel, hasOnIndex,hasEnterItem,hasEnterImg,delItem} = this.state;
         const chronicList = JSON.parse(localStorage.getItem('chronic')||null);
@@ -319,7 +320,7 @@ class DiagnosticList extends Component {
                                        onMouseLeave = {this.handleMouseLeaveDrug.bind(this)}
                                     >
                                       <span title={item.name} className={style['diag-name-box']} style={{'max-width': '300px'}}>
-                                        <input type="text" value={item.name} onInput={(e)=>this.handleInput(e,index)}/>
+                                        <input type="text" value={item.name} onBlur={()=>{delDiagnostic(item,index)}} onInput={(e)=>this.handleInput(e,index)}/>
                                       </span>
                                       {/* <img className={`${style['info-img']}`}
                                           title='点击i图标可查看详细说明'
@@ -341,7 +342,7 @@ class DiagnosticList extends Component {
                                           onClick={this.showAssessFn.bind(this,item)}>
                                         管理评估
                                     </span>:''}*/}
-                                    <img className={style['diag-del']} src={hasOnIndex == index ? hasOndel ? del_on : del_icon : del_icon} onMouseEnter={this.handleEnterDel.bind(this,index)} onMouseLeave={this.handleLeaveDel.bind(this)} onClick={()=>{this.handleDeleteItem(item)}}/>
+                                    <img className={style['diag-del']} src={hasOnIndex == index ? hasOndel ? del_on : del_icon : del_icon} onMouseEnter={this.handleEnterDel.bind(this,index)} onMouseLeave={this.handleLeaveDel.bind(this)} onClick={()=>{this.handleDeleteItem(item,index)}}/>
                         </div>)
                     })}
                      {treatment&&<Treat title={treatTitle} refreshScroller={refreshScroller}></Treat>}

+ 3 - 2
src/containers/DiagnosticList.js

@@ -50,10 +50,11 @@ function mapDispatchToProps(dispatch) {
           name:disName
         });
       },
-        delDiagnostic: (item) => {
+        delDiagnostic: (item,idx) => {
             dispatch({
                 type: DEL_DIAGNOSTIC,
-                item: item
+                item: item,
+                idx:idx
             });
             dispatch({
                 type: GET_DIAGNOSTIC_STR

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

@@ -64,7 +64,11 @@ export const addDiagnostic = (state, action) => {
 
 export const delDiagnostic = (state, action) => {
     const res = JSON.parse(JSON.stringify(state));
-    res.diagnosticList = res.diagnosticList.filter(item => (item.conceptId !== action.item.conceptId || item.name !== action.item.name));
+    res.diagnosticList = res.diagnosticList.filter((item,idx) =>{
+        if(idx != action.idx){
+            return item
+        }
+    });
     let tmpLis = res.diagnosticList,num=0
     for(let i = 0;i < tmpLis.length;i++){
         if(!tmpLis[i].hasTreat){
@@ -79,6 +83,8 @@ export const delDiagnostic = (state, action) => {
             "uniqueName": tmpLis[0].uniqueName
         }
         res.diseaseName = obj
+    }else{
+        res.diseaseName = {}
     }
     res.diagnosticList = [...tmpLis]
     return res;

+ 1 - 1
src/utils/tools.js

@@ -926,7 +926,7 @@ function getEMRParams(){
   for(let i = 0; i < diagnosticList.diagnosticList.length; i++) {
     diag.push({"dateValue": "","name": diagnosticList.diagnosticList[i].name,"uniqueName": ""})
   }
-  diagnosticList.diseaseName.uniqueName = ''
+  if(diagnosticList.length>0)diagnosticList.diseaseName.uniqueName = ''
   let templis = (inspect.labelListSmall).concat(inspect.labelListBig)
   templis = templis.filter((item)=>!item.check)
   let temppacs = assistCheck.assistLabel