Преглед изворни кода

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

zhouna пре 6 година
родитељ
комит
8911ac8887

+ 8 - 1
src/components/DiagnosticItem/index.jsx

@@ -1,6 +1,7 @@
 import React, { Component } from 'react';
 import style from './index.less';
 import {ConfirmModal} from '@commonComp';
+import Notify from '@commonComp/Notify';
 
 class DiagnosticItem extends Component{
     constructor(props){
@@ -45,7 +46,13 @@ class DiagnosticItem extends Component{
         //     this.setState({
         //         visible: false,
         //     },()=>{
-                const { addDiagnostic, clearInput, hideSearch } = this.props;
+                const { diagnosticList, addDiagnostic, clearInput, hideSearch } = this.props;
+                for (let i = 0; i < diagnosticList.length; i++) {
+                    if(diagnosticList[i].id === item.id && diagnosticList[i].name === item.name) {
+                        Notify.info('该诊断已存在');
+                        return
+                    }
+                }
                 addDiagnostic&&addDiagnostic(item);
                 clearInput&&clearInput();
                 hideSearch&&hideSearch()

+ 1 - 1
src/containers/DiagnosticItem.js

@@ -10,7 +10,7 @@ import {billing, getTips} from '../store/async-actions/pushMessage';
 
 function mapStateToProps(state) {
     return {
-
+        diagnosticList: state.diagnosticList.diagnosticList
     }
 }
 

+ 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.item.id && item.name !== action.item.name && item.retrievalName !== action.item.retrievalName));
+    res.diagnosticList = res.diagnosticList.filter(item => (item.id !== action.item.id && item.name !== action.item.name));
     return res;
 }
 

+ 2 - 2
src/store/actions/pushMessage.js

@@ -89,10 +89,10 @@ export const addScheme = (state, action) => {
     }
   })
   if (isRepeat) {
-   //将同类药添加到一起
+	 //将同类药添加到一起
 	for (let i = 0; i < scheme[RepeatIndex].treatment.length; i++) {
 		for (let j = 0; j < treatment.length; j++) {
-			if (scheme[RepeatIndex].treatment[i].id === treatment[j].id) {
+			if (scheme[RepeatIndex].treatment[i].id === treatment[j].id && scheme[RepeatIndex].treatment[i].bigdrugsName === treatment[j].bigdrugsName) {
 				for(let z = 0; z < treatment[j].medicitionsList.length; z++) {
 					if(treatment[j].medicitionsList[z].selected) {
 						if(scheme[RepeatIndex].treatment[i].treatmentStr !== '') {