瀏覽代碼

右侧推送的化验辅检选中后点击开单添加到左侧化验辅检项

Luolei 6 年之前
父節點
當前提交
83f935a450

+ 5 - 1
src/components/AddAssistCheck/Textarea/index.jsx

@@ -47,6 +47,11 @@ class Textarea extends Component {
     const isRead = this.props.isRead;
     if(next.isRead != isRead){
       this.$dom.current.innerText?(this.$dom.current.innerText = next.value||'') : (this.$dom.current.innerHTML = next.value||'')
+      if(next.value && next.value.trim()){
+        this.$dom.current.nextSibling.innerText = ''
+      }else{
+        this.$dom.current.nextSibling.innerHTML = '报告描述或意见'
+      }
     }
   }
   componentDidMount(){
@@ -76,5 +81,4 @@ class Textarea extends Component {
     );
   }
 }
-
 export default Textarea;

+ 1 - 1
src/components/AddAssistCheck/index.jsx

@@ -107,7 +107,7 @@ class AddAssistCheck extends React.Component {
         const {assistLabel,handleChangeAssistValue,handleChangeDate,isRead,handlePush,winWidth} = this.props;
         return <ul className={styles.labelWrap} id="datePick">
             {
-                assistLabel.map((item,idx) => {
+              assistLabel.map((item,idx) => {
                     return (<li key={item.id} className={styles.assistLists}>
                         <span className={styles.assistName} style={{width:winWidth < 1200?'120px':'auto'}}>{item.name}:</span>
                         <div className={styles.textareaWrap}>

+ 52 - 8
src/components/PushItems/index.jsx

@@ -10,8 +10,10 @@ import hideImg from "../../common/images/close.png";
 import DetailsModal from './DetailsModal';
 import PushDiag from "./PushDiag";
 import DiagnosticItem from "@containers/DiagnosticItem";
-import $ from "jquery";
+import store from "@store";
 import { getWindowInnerHeight } from "@common/js/func";
+import {addLabel} from '@store/actions/inspect';
+import {addAssistLabel} from '@store/actions/assistCheck';
 import {windowEventHandler} from '@utils/tools'
 
 class PushItems extends Component {
@@ -41,19 +43,61 @@ class PushItems extends Component {
     this.setState({ [type]: false });
   }
 
+  getCurrentDate(){
+    let myDate = new Date();
+    let year = myDate.getFullYear();       //获取完整的年份(4位,1970-????)
+    let mon = myDate.getMonth()-0+1;       //获取当前月份(0-11,0代表1月)
+    let day = myDate.getDate();            //获取当前日(1-31)
+    let date = year+'-'+(mon<10?'0'+mon:mon)+'-'+(day<10?'0'+day:day);
+    return date;
+  }
+
   billing() {
     const { assay, check } = this.props.pushMessage;
     const checkedAssay = assay.filter(item => item.checked);
     const checkedCheck = check.filter(item => item.checked);
     this.props.billing(checkedAssay, checkedCheck);
-    if(checkedAssay.length > 0 || checkedCheck.length > 0) {
-      const Height = $(".src-components-BodyContainer-2SgEx").height();
-      const adviceHeight = $(".src-common-components-ItemBox-1Bpz3").height();
-      const winHeight = window.innerHeight;
-      const scrollTop = Height;
-      $('#addScrollEvent').scrollTop(100000)
+    // if(checkedAssay.length > 0 || checkedCheck.length > 0) {
+    //   const Height = $(".src-components-BodyContainer-2SgEx").height();
+    //   const adviceHeight = $(".src-common-components-ItemBox-1Bpz3").height();
+    //   const winHeight = window.innerHeight;
+    //   const scrollTop = Height;
+    //   $('#addScrollEvent').scrollTop(100000)
+    // }
+    let obj = {   //添加化验
+      details: [],
+      name: '',
+      questionId: '',
+      showType: 1,
+    }
+    let obj1 = {  //添加辅检
+      name: '',
+      questionId: '',
+      showType: 1,
+      time:this.getCurrentDate(),
+      value:''
+    }
+    if(checkedAssay.length > 0){
+      let assayArr = []
+      for(let i = 0;i < checkedAssay.length;i++){
+        let tmpObj = JSON.parse(JSON.stringify(obj));
+        tmpObj.questionId = checkedAssay[i].id
+        tmpObj.name = checkedAssay[i].name
+        tmpObj.details = checkedAssay[i].questionMapping
+        assayArr.push(tmpObj)
+      }
+      store.dispatch(addLabel(assayArr))
+    }
+    if(checkedCheck.length > 0){
+      let checkArr = []
+      for(let i = 0;i < checkedCheck.length;i++){
+        let tmpObj = JSON.parse(JSON.stringify(obj1));
+        tmpObj.questionId = checkedCheck[i].id
+        tmpObj.name = checkedCheck[i].name
+        checkArr.push(tmpObj)
+      }
+      store.dispatch(addAssistLabel(checkArr))
     }
-    
   }
 
   changeAssay(item) {

+ 5 - 1
src/containers/AssistCheck.js

@@ -5,9 +5,10 @@ import {
 import AssistCheck from '@components/AssistCheck';
 import { assistLable,delAssistLabel,changeAssistVal,changeDate } from '@store/actions/assistCheck';
 import { getSearchList } from '@store/async-actions/assistCheck';
+import {ISREAD} from '@store/types/homePage.js';
 import {billing} from '@store/async-actions/pushMessage';
 
-function mapStateToProps(state) {
+function mapStateToProps(state) {//console.log(state.assistCheck)
     return {
         list:state.assistCheck.list,
         assistLabel:state.assistCheck.assistLabel,
@@ -26,6 +27,9 @@ function mapDispatchToProps(dispatch, store) {
         },
         handleDelAssist(idx){
             dispatch(delAssistLabel(idx))
+            dispatch({
+              type:ISREAD
+            })
         },
         handleChangeAssistValue(val,idx){
             dispatch(changeAssistVal(val,idx))

+ 5 - 1
src/store/actions/assistCheck.js

@@ -1,4 +1,4 @@
-import {GET_ASSIST_SEARCH_LIST,GET_ASSIST_LABEL,DEL_ASSIST_LABEL,CHANGE_ASSIST_VAL,CHANGE_DATE,CLEAR_ASSIST_DATA} from '../types/assistCheck';
+import {GET_ASSIST_SEARCH_LIST,GET_ASSIST_LABEL,DEL_ASSIST_LABEL,CHANGE_ASSIST_VAL,CHANGE_DATE,CLEAR_ASSIST_DATA,ADD_ASSIST_LABEL} from '../types/assistCheck';
 
 export const searchList = (list) => ({         //获取搜索数据
     type:GET_ASSIST_SEARCH_LIST,
@@ -9,6 +9,10 @@ export const assistLable = (id,idx) => ({         //添加数据
     id,
     idx
 })
+export const addAssistLabel = (lis) => ({         //右侧推送交到左侧
+    type:ADD_ASSIST_LABEL,
+    lis
+})
 export const delAssistLabel = (idx) => ({         //删除数据
     type:DEL_ASSIST_LABEL,
     idx

+ 5 - 1
src/store/actions/inspect.js

@@ -1,4 +1,4 @@
-import {SEARCH_LIST,SET_LABEL,FILL_ACTIVE,FILL_ACTIVE_DETAIL,GET_EXCEL,CHECK_VALUE_IS_CHANGE,CLEAR_LABEL,RESET_LABEL,CLEAR_ALL_LABEL,DEL_PART_ITEM,DEL_EXCEL_LIST} from '../types/inspect';
+import {ADD_LABEL,SEARCH_LIST,SET_LABEL,FILL_ACTIVE,FILL_ACTIVE_DETAIL,GET_EXCEL,CHECK_VALUE_IS_CHANGE,CLEAR_LABEL,RESET_LABEL,CLEAR_ALL_LABEL,DEL_PART_ITEM,DEL_EXCEL_LIST} from '../types/inspect';
 
 export const searchList = (list) => ({         //初始化数据
     type:SEARCH_LIST,
@@ -9,6 +9,10 @@ export const setLabel = (idx) => ({          //搜索后点击选中的结果
     type:SET_LABEL,
     idx
 })
+export const addLabel = (lis) => ({          //右侧开单
+    type:ADD_LABEL,
+    lis
+})
 export const resetLabel = (list) => ({          //搜索后点击选中的结果重组
     type:RESET_LABEL,
     list

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

@@ -176,33 +176,33 @@ export const addBilling = (state, action) => {
 		item.checked = false
 		return item
 	})
-	res.advice.assay = res.advice.assay || '';
-	res.advice.check = res.advice.check || '';
-	for (let i = 0; i < assay.length; i++) {
-		if ( res.advice.assay === '') { //如果最后一个,则不需要逗号
-			res.advice.assay = res.advice.assay + assay[i].name
-		} else {
-			if( i === 0 && res.advice.check !== '') {
-				res.advice.assay = res.advice.assay  +  assay[i].name
-			} else {
-				res.advice.assay = res.advice.assay + ', ' + assay[i].name
-			}
-		}
+	// res.advice.assay = res.advice.assay || '';
+	// res.advice.check = res.advice.check || '';
+	// for (let i = 0; i < assay.length; i++) {
+	// 	if ( res.advice.assay === '') { //如果最后一个,则不需要逗号
+	// 		res.advice.assay = res.advice.assay + assay[i].name
+	// 	} else {
+	// 		if( i === 0 && res.advice.check !== '') {
+	// 			res.advice.assay = res.advice.assay  +  assay[i].name
+	// 		} else {
+	// 			res.advice.assay = res.advice.assay + ', ' + assay[i].name
+	// 		}
+	// 	}
 		
-	}
-	for (let i = 0; i < check.length; i++) {
-		if ( res.advice.check === '') { //如果最后一个,则不需要逗号
-			res.advice.check = res.advice.check + check[i].name
-		} else {
-			res.advice.check = res.advice.check + ', '+ check[i].name 
-		}
-	}
-	if(res.advice.assay  && res.advice.check !== '') {
-			if(res.advice.assay.substring(res.advice.assay.length-2,res.advice.assay.length-1) !== ',') {
-				res.advice.assay = res.advice.assay + ', '
-			} 
-	}
-	res.AdviceStr = getAdviceStr(res.advice)
+	// }
+	// for (let i = 0; i < check.length; i++) {
+	// 	if ( res.advice.check === '') { //如果最后一个,则不需要逗号
+	// 		res.advice.check = res.advice.check + check[i].name
+	// 	} else {
+	// 		res.advice.check = res.advice.check + ', '+ check[i].name 
+	// 	}
+	// }
+	// if(res.advice.assay  && res.advice.check !== '') {
+	// 		if(res.advice.assay.substring(res.advice.assay.length-2,res.advice.assay.length-1) !== ',') {
+	// 			res.advice.assay = res.advice.assay + ', '
+	// 		} 
+	// }
+	// res.AdviceStr = getAdviceStr(res.advice)
 	return res;
 }
 export const clearAllPushMessage = (state, action) => {

+ 36 - 9
src/store/reducers/assistCheck.js

@@ -4,7 +4,8 @@ import {
     DEL_ASSIST_LABEL,
     CHANGE_ASSIST_VAL,
     CHANGE_DATE,
-    CLEAR_ASSIST_DATA
+    CLEAR_ASSIST_DATA,
+    ADD_ASSIST_LABEL
 } from '../types/assistCheck';
 
 const initSearchList = {
@@ -21,7 +22,26 @@ function getCurrentDate() {
     return date;
 }
 export default (state = initSearchList, action) => { 
-    if (action.type == GET_ASSIST_SEARCH_LIST) {
+    if (action.type == ADD_ASSIST_LABEL) {
+        const newState = Object.assign({}, state);
+        let tempArr = newState.assistLabel,tmpString='';
+        for(let i = 0;i <action.lis.length;i++){
+          tempArr.push(action.lis[i]);
+        }
+        
+        for (let i = 0; i < tempArr.length; i++) {
+          if (i == action.idx) {
+            tempArr[i].time = action.date
+            newState.assistLabel = [...tempArr]
+          }
+          let tmpVal = tempArr[i].value?tempArr[i].value.trim():tempArr[i].value;
+          tmpString += (tempArr[i].name+(tmpVal?(':'+tmpVal)+', ':': ')+(tempArr[i].time?'报告日期:'+tempArr[i].time:'')+';')
+        }
+        newState.assistLabel=[...tempArr]
+        newState.dataString = tmpString
+        return newState;
+    }
+    if (action.type == GET_ASSIST_SEARCH_LIST) {    //右侧推送添加到左侧
         const newState = Object.assign({}, state);
         newState.list = action.list
         return newState;
@@ -47,18 +67,25 @@ export default (state = initSearchList, action) => {
     }
     if (action.type == DEL_ASSIST_LABEL) {        //删除
         const newState = Object.assign({}, state);
-        const tempArr = newState.assistLabel;
+        let tempArr = newState.assistLabel,tempArrs=[];
         let tmpString = '';
-        tempArr.splice(action.idx, 1)
+        // tempArr.splice(action.idx, 1)
+        // let tempArrs = tempArr.slice()
+        for(let k = 0;k < tempArr.length;k++){
+          if(k != action.idx){
+            tempArrs.push(tempArr[k])
+          }
+        }
         if(tempArr == []){
-            tmpString == ''
-            return
+          tmpString == ''
+          return
         }
         for (let i = 0; i < tempArr.length; i++) {
-            let tmpVal = tempArr[i].value?tempArr[i].value.trim():tempArr[i].value;
-            tmpString += (tempArr[i].name+(tmpVal?(':'+tmpVal)+', ':': ')+(tempArr[i].time?'报告日期:'+tempArr[i].time:'')+';')
+          let tmpVal = tempArr[i].value?tempArr[i].value.trim():tempArr[i].value;
+          tmpString += (tempArr[i].name+(tmpVal?(':'+tmpVal)+', ':': ')+(tempArr[i].time?'报告日期:'+tempArr[i].time:'')+';')
         }
-        newState.assistLabel = [...tempArr]
+        newState.assistLabel = [...tempArrs]
+        // console.log(tempArrs)
         newState.dataString = tmpString
         return newState;
     }

+ 12 - 3
src/store/reducers/inspect.js

@@ -8,7 +8,8 @@ import {
     RESET_LABEL,
     CLEAR_ALL_LABEL,
     DEL_PART_ITEM,
-    DEL_EXCEL_LIST
+    DEL_EXCEL_LIST,
+    ADD_LABEL
 } from '../types/inspect';
 
 const initSearchList = {
@@ -30,7 +31,7 @@ export default (state = initSearchList, action) => {
         newState.list = action.list
         return newState;
     }
-    if (action.type == SET_LABEL) {             //选中的结果
+    if (action.type == SET_LABEL) {             //选中的结果    
         const newState = Object.assign({}, state);
         const tempArr = newState.list;
         const tempArrs = newState.labelList;
@@ -48,6 +49,15 @@ export default (state = initSearchList, action) => {
         tempArr[tempArr.length-1].details = action.list;
         return newState;
     } 
+    if (action.type == ADD_LABEL) {             //右侧推送的化验辅检项,点击开单放到左侧化验辅检的位置上
+        const newState = Object.assign({}, state);
+        const tempArr = newState.labelList;
+        for(let i = 0;i <action.lis.length;i++){
+          tempArr.push(action.lis[i]);
+        }
+        newState.labelList = [...tempArr]
+        return newState;
+    } 
     if (action.type == FILL_ACTIVE) {                        //点击标签放到暂存里
         const newState = Object.assign({}, state);
         const tempArr = newState.labelList;
@@ -92,7 +102,6 @@ export default (state = initSearchList, action) => {
         let tempArr1 = newState.getExcelDataList;
         newState.pushItem = getPushList(tempArr1,tempArr2);
         newState.inspectStrPlus = getStringPlus(newState.pushItem)
-
         return newState;
     }
     if (action.type == CHECK_VALUE_IS_CHANGE) {     //数据添加后显示与否

+ 1 - 0
src/store/types/assistCheck.js

@@ -4,3 +4,4 @@ export const DEL_ASSIST_LABEL = 'DEL_ASSIST_LABEL';
 export const CHANGE_ASSIST_VAL = 'CHANGE_ASSIST_VAL';
 export const CHANGE_DATE = 'CHANGE_DATE';
 export const CLEAR_ASSIST_DATA = 'CLEAR_ASSIST_DATA';
+export const ADD_ASSIST_LABEL = 'ADD_ASSIST_LABEL';

+ 1 - 0
src/store/types/inspect.js

@@ -10,3 +10,4 @@ export const RESET_LABEL = 'RESET_LABEL';
 export const CLEAR_ALL_LABEL = 'CLEAR_ALL_LABEL';
 export const DEL_PART_ITEM = 'DEL_PART_ITEM';
 export const DEL_EXCEL_LIST = 'DEL_EXCEL_LIST';
+export const ADD_LABEL = 'ADD_LABEL';