Просмотр исходного кода

Merge remote-tracking branch 'origin/dev/zhangxc1' into dev/new1

# Conflicts:
#	src/components/PushContainer/index.less
zhouna 6 лет назад
Родитель
Сommit
a3c649762a

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

@@ -12,7 +12,7 @@ class DiagnosticList extends Component {
         super(props);
         this.state = {
             visible: false,
-            delId: '',
+            delItem: {},
             treatTitle: ''
         }
         this.deleteItem = this.deleteItem.bind(this);
@@ -38,9 +38,9 @@ class DiagnosticList extends Component {
         downDiagnostic && downDiagnostic(index)
     }
     deleteItem() {
-        const { delId } = this.state;
+        const { delItem } = this.state;
         const { delDiagnostic } = this.props;
-        delDiagnostic && delDiagnostic(delId);
+        delDiagnostic && delDiagnostic(delItem);
         this.setState({
             visible: false,
         })
@@ -56,10 +56,10 @@ class DiagnosticList extends Component {
             visible: false
         })
     }
-    handleDeleteItem(id) {
+    handleDeleteItem(item) {
         this.setState({
             visible: true,
-            delId: id,
+            delItem: item,
         })
     }
     showTreat(item) {
@@ -95,7 +95,7 @@ class DiagnosticList extends Component {
                                           onClick={() =>{hasTreat && this.showTreat(item)}}>
                                           治疗方案
                                     </span>
-                                    <img className={style['diag-del']} src={del_icon} onClick={()=>{this.handleDeleteItem(item.id)}}/>
+                                    <img className={style['diag-del']} src={del_icon} onClick={()=>{this.handleDeleteItem(item)}}/>
                         </div>)
                     })}
                      {treatment&&<Treat title={treatTitle}></Treat>}

+ 2 - 2
src/containers/DiagnosticList.js

@@ -20,10 +20,10 @@ function mapStateToProps(state) {
 
 function mapDispatchToProps(dispatch) {
     return {
-        delDiagnostic: (id) => {
+        delDiagnostic: (item) => {
             dispatch({
                 type: DEL_DIAGNOSTIC,
-                id: id
+                item: item
             });
             dispatch(getSearchResult)
             

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

@@ -6,7 +6,7 @@ export const addDiagnostic = (state, action) => {
 
 export const delDiagnostic = (state, action) => {
     const res = JSON.parse(JSON.stringify(state));
-    res.diagnosticList = res.diagnosticList.filter(item => item.id !== action.id);
+    res.diagnosticList = res.diagnosticList.filter(item => (item.id !== action.item.id && item.name !== action.item.name && item.retrievalName !== action.item.retrievalName));
     return res;
 }