Quellcode durchsuchen

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

zhouna vor 6 Jahren
Ursprung
Commit
fdfd012071

+ 45 - 21
src/components/AddInspect/index.jsx

@@ -1,6 +1,6 @@
 import React from 'react';
 import { SearchOption, InspectCommon, Calendar ,Notify,ConfirmModal,Add} from '@commonComp';
-import { deepClone,normalVal } from '@utils/tools';
+import { deepClone,normalVal,timestampToTime,filterDataArr } from '@utils/tools';
 import styles from './index.less';
 import date1 from './img/date1.png';
 import date2 from './img/date2.png';
@@ -131,7 +131,7 @@ class Inspect extends React.Component {
         this.setState({dateTime:date})
         return date;
     }
-    changeActivePart(idx,val){
+    changeActivePart(idx,val,clear){
         let nums = this.state.num;
         let fillActive;
         if(nums == 0){
@@ -142,22 +142,33 @@ class Inspect extends React.Component {
         ++nums;
         this.setState({num:nums});
         let tempArr = deepClone(fillActive);
-        let tempNumPlus = 0;
-        for (let i = 0; i < tempArr.details.length; i++) {
-            if (i == idx) {
-                tempArr.details[i].value = val
-            }
-            if(tempArr.details[i].value != undefined && tempArr.details[i].value != ''){
-                tempArr.show = true;
-            }else{
-                ++tempNumPlus;
-                if(tempNumPlus == tempArr.details.length){
-                    tempArr.show = false;
-                }
-            }
+        
+        if(clear){    //点击清空按钮,至清初输入的数字
+          for (let i = 0; i < tempArr.details.length; i++) {
+            tempArr.details[i].value = ''
+            tempArr.show = false;
+          }
+          tempArr.time = this.getCurrentDate();
+          this.setState({currentData:tempArr})
+          return;
+        }else{
+          let tempNumPlus = 0;
+          for (let i = 0; i < tempArr.details.length; i++) {
+              if (i == idx) {
+                  tempArr.details[i].value = val
+              }
+              if(tempArr.details[i].value != undefined && tempArr.details[i].value != ''){
+                  tempArr.show = true;
+              }else{
+                  ++tempNumPlus;
+                  if(tempNumPlus == tempArr.details.length){
+                      tempArr.show = false;
+                  }
+              }
+          }
+          tempArr.time = this.state.dateTime;
+          this.setState({currentData:tempArr})
         }
-        tempArr.time = this.state.dateTime;
-        this.setState({currentData:tempArr})
     }
     getItemList(){        //填写单展示
         let number = this.state.num;
@@ -242,6 +253,18 @@ class Inspect extends React.Component {
             return <td style={{width:'20%'}}><span className={(val.value - 0).toString() == 'NaN'?"red":(val.maxValue || val.minValue) ? (val.value > val.maxValue || val.value < val.minValue?"red":''):''}>{val.value}</span> { val.labelSuffix}</td>
         }
     }
+    toTime(time){
+      let tmpTim = time.split(',').join('')-0
+      if(time && tmpTim.toString() != 'NaN'){
+        let date = new Date('1900-01-01');
+        let dateTim = date.getTime();
+        let times = (tmpTim-2)*24*60*60*1000;
+        let result = timestampToTime(dateTim+times).split(' ')[0]
+        return result;
+      }else{
+        return time;
+      }
+    }
     render() {
         const { handleChangeValue, list, labelList,delPartItem, handleLabelSub, handleClear, handleConfirm, fillActive,getExcelDataList,handleCloseExcel,handlePush } = this.props;
         const {toastText,visible} = this.state;
@@ -269,7 +292,7 @@ class Inspect extends React.Component {
                                                                 <td style={{width:'25%'}}>
                                                                     {normalVal(value.min,value.max)}
                                                                 </td>
-                                                                <td style={{width:'25%'}}>{value.time == ''?('导入时间: '+this.state.dateTime):'化验时间: '+value.time}</td>
+                                                                <td style={{width:'25%'}}>{value.time == ''?('导入时间: '+this.state.dateTime):'化验时间: '+this.toTime(value.time)}</td>
                                                             </tr>
                                                         })
                                                     }
@@ -290,7 +313,7 @@ class Inspect extends React.Component {
                                         // 标签,血常规。。
                                         item.show ?
                                         <p className={styles.staticTagActive}>
-                                            <span data-flg="current" style={{color:"#333"}} onClick={(e) => { handleLabelSub(e, item.questionId,idx); this.handleFillShow(e,idx) }}>{item.name}</span>
+                                            <span data-flg="current" style={{color:"#000"}} onClick={(e) => { handleLabelSub(e, item.questionId,idx); this.handleFillShow(e,idx) }}>{item.name}</span>
                                         </p>:
                                         <p>
                                             <i data-flg="current" onClick={(e) => { handleLabelSub(e,item.questionId,idx); this.handleFillShow(e,idx) }}>{item.name}</i>
@@ -321,9 +344,10 @@ class Inspect extends React.Component {
                                                 <InspectCommon
                                                     showFill={this.state.showFill}
                                                     handleClear={(e)=>{
-                                                        handleClear(e,idx)
+                                                        // handleClear(e,idx)
+                                                        this.changeActivePart('','',true)
                                                         this.setState({
-                                                          currentData:fillActive
+                                                          // currentData:fillActive
                                                         })
                                                     }}
                                                     handleConfirm={(e)=>{

+ 2 - 0
src/components/HistoryCaseContainer/index.jsx

@@ -8,6 +8,7 @@ import store from '@store';
 import { ConfirmModal } from '@commonComp';
 import { pushAllDataList } from '@utils/tools';
 import { CONFIRM_TYPE } from "@store/types/typeConfig";
+import {billing} from '@store/async-actions/pushMessage';
 
 class HistoryCaseContainer extends React.Component {
     constructor(props){
@@ -24,6 +25,7 @@ class HistoryCaseContainer extends React.Component {
         store.dispatch(showHistory(false))
         store.dispatch({type: CONFIRM_TYPE, confirmType: baseObj.sign});
         pushAllDataList(baseObj.sign,'push',baseObj,'history')       //引用
+        store.dispatch(billing())
     }
     close(){
       store.dispatch(visibleHistory(false));

+ 18 - 50
src/components/Operation/index.jsx

@@ -114,36 +114,7 @@ class Operation extends Component {
       Notify.info('当前页面数据已清空');
     }
   }
-  isClear(){
-    let baseList = store.getState();
-    let jsonData = getAllDataList(baseList);
-    let jsonStr = getAllDataStringList(baseList);
-    if (      //结构化和文本数据都为空
-      JSON.stringify(jsonData.advice) == '{}' &&
-      jsonData.chief.length < 1 &&
-      jsonData.diag.length < 1 &&
-      jsonData.vital.length < 1 &&
-      jsonData.other.length < 1 &&
-      jsonData.pacs.length < 1 &&
-      jsonData.present.length < 1 &&
-      jsonData.lis.labelList.length < 1 &&
-      jsonData.lis.getExcelDataList.length < 1 &&
-      JSON.stringify(jsonData.advice) == '{}' && 
-      jsonStr.chief == '[]' && 
-      jsonStr.present == '[]' && 
-      jsonStr.other == '[]' && 
-      jsonData.vital.length < 1 && 
-      jsonData.diag.length < 1 && 
-      jsonData.pacs.length < 1 && 
-      jsonData.lis.labelList.length < 1 && 
-      jsonData.lis.getExcelDataList.length < 1
-    ) {
-      Notify.info('当前页面数据已清空');
-      return false;
-    }else{
-      return true;
-    }
-  }
+  
   onchange(val) {
     this.setState({
       title: val
@@ -187,34 +158,31 @@ class Operation extends Component {
     let jsonStr = getAllDataStringList(baseList);
     let whichSign = baseList.typeConfig.typeConfig;
     let tmpLis = baseList.tabTemplate.items;
-    console.log(jsonStr,'文本')
-    console.log(jsonData,'结构')       //测试需要用到,不要删了
+    // console.log(jsonStr,'文本')
+    // console.log(jsonData.chief,'结构')       //测试需要用到,不要删了
     for(let i = 0;i <tmpLis.length;i++){
       let dataStr = tmpLis[i].preview;
-      let jsStr = tmpLis[i].dataJson;
+      let dataJson = tmpLis[i].dataJson;
       // console.log(JSON.stringify(eval('('+JSON.parse(dataStr).chief+')')),111)
-      // if(JSON.stringify(eval('('+JSON.stringify(JSON.parse(dataStr))+')')) == JSON.stringify(jsonStr) && jsStr == JSON.stringify(jsonData)){
-      //   Notify.info('该模板已保存');
-      //   return false;
-      // }
+      console.log(JSON.stringify(jsonData.other) ,787878,JSON.stringify(JSON.parse(dataJson).other))
       if(
         jsonStr.chief == JSON.stringify(eval('('+JSON.parse(dataStr).chief+')')) && 
         jsonStr.present == JSON.stringify(eval('('+JSON.parse(dataStr).present+')')) && 
         jsonStr.other == JSON.stringify(eval('('+JSON.parse(dataStr).other+')')) && 
         jsonStr.vital == JSON.stringify(eval('('+JSON.parse(dataStr).vital+')'))  &&
-        JSON.stringify(jsonData.chief) == JSON.stringify(JSON.parse(jsStr).chief) &&    
-        JSON.stringify(jsonData.present) == JSON.stringify(JSON.parse(jsStr).present) &&    
-        JSON.stringify(jsonData.other) == JSON.stringify(JSON.parse(jsStr).other) &&      
-        JSON.stringify(jsonData.vital) == JSON.stringify(JSON.parse(jsStr).vital) &&   
-        JSON.stringify(jsonData.lis) == JSON.stringify(JSON.parse(jsStr).lis) &&  
-        JSON.stringify(jsonData.pacs) == JSON.stringify(JSON.parse(jsStr).pacs) &&     
-        JSON.stringify(jsonData.diag) == JSON.stringify(JSON.parse(jsStr).diag) &&    
-        JSON.stringify(jsonData.advice) == JSON.stringify(JSON.parse(jsStr).advice) &&      
-        JSON.stringify(jsonData.mainSuitSelecteds) == JSON.stringify(JSON.parse(jsStr).mainSuitSelecteds) &&      
-        JSON.stringify(jsonData.currentIllSelecteds) == JSON.stringify(JSON.parse(jsStr).currentIllSelecteds) &&     
-        JSON.stringify(jsonData.otherHistorySelecteds) == JSON.stringify(JSON.parse(jsStr).otherHistorySelecteds) && 
-        JSON.stringify(jsonData.checkBodySelecteds) == JSON.stringify(JSON.parse(jsStr).checkBodySelecteds) &&     
-        JSON.stringify(jsonData.addItems) == JSON.stringify(JSON.parse(jsStr).addItems)
+        JSON.stringify(jsonData.chief) == JSON.stringify(JSON.parse(dataJson).chief) &&    
+        JSON.stringify(jsonData.present) == JSON.stringify(JSON.parse(dataJson).present)  &&     
+        // JSON.stringify(jsonData.other) == JSON.stringify(JSON.parse(dataJson).other) &&      
+        JSON.stringify(jsonData.vital) == JSON.stringify(JSON.parse(dataJson).vital)  
+        // JSON.stringify(jsonData.lis) == JSON.stringify(JSON.parse(dataJson).lis) &&  
+        // JSON.stringify(jsonData.pacs) == JSON.stringify(JSON.parse(dataJson).pacs) &&     
+        // JSON.stringify(jsonData.diag) == JSON.stringify(JSON.parse(dataJson).diag) &&    
+        // JSON.stringify(jsonData.advice) == JSON.stringify(JSON.parse(dataJson).advice) &&    
+        // JSON.stringify(jsonData.mainSuitSelecteds) == JSON.stringify(JSON.parse(dataJson).mainSuitSelecteds) &&      
+        // JSON.stringify(jsonData.currentIllSelecteds) == JSON.stringify(JSON.parse(dataJson).currentIllSelecteds) &&     
+        // JSON.stringify(jsonData.otherHistorySelecteds) == JSON.stringify(JSON.parse(dataJson).otherHistorySelecteds) && 
+        // JSON.stringify(jsonData.checkBodySelecteds) == JSON.stringify(JSON.parse(dataJson).checkBodySelecteds) &&     
+        // JSON.stringify(jsonData.addItems) == JSON.stringify(JSON.parse(dataJson).addItems)
       ){
         Notify.info('该模板已保存');
         return false;

+ 2 - 0
src/components/PushContainer/index.jsx

@@ -7,6 +7,7 @@ import { initItemList,delItem,delBatchItem,changeTitleAsync,saveTemplateDetail }
 import { CHANGE_TYPE } from "@store/types/typeConfig";
 import { connect } from "react-redux";
 import store from '@store';
+import {billing} from '@store/async-actions/pushMessage';
 
 import TemplateContainer from '@components/TemplateContainer';
 import TemplateItems from '@components/TemplateItems';
@@ -223,6 +224,7 @@ class PushContainer extends Component {
                     let typeConfig = part.type;
                     store.dispatch(keepPushData(part,'part'))                 //引用数据的存储,用于保存模板是判断数据是否变化
                     pushAllDataList(typeConfig,'push',part,'template')       //引用
+                    store.dispatch(billing())
                 }
             })
             store.dispatch(changeVisible(false))

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

@@ -65,7 +65,7 @@ export default (state = initSearchList, action) => {
         let tmpArr = newState.getExcelDataList;
         let tmpArr2 = newState.labelList;
         for (let i = 0; i < tempArr.length; i++) {
-            tempArr[i].value = ''
+          // tempArr[i].value = ''
         }
         tempArrs.show = false;
         newState.pushItem = getPushList(tmpArr,tmpArr2);
@@ -97,6 +97,7 @@ export default (state = initSearchList, action) => {
     }
     if (action.type == CHECK_VALUE_IS_CHANGE) {     //数据添加后显示与否
         const newState = Object.assign({}, state);
+        // const tempArrAct = newState.fillActive;
         const tempArr = action.arr;
         tempArr.time = action.time;
         let tmpArr = newState.getExcelDataList;
@@ -104,6 +105,7 @@ export default (state = initSearchList, action) => {
         tempArrs[action.idx] = tempArr;
         newState.fillActive = tempArr;
         newState.labelList = tempArrs;
+        // tempArrAct.show = true;
         newState.pushItem = getPushList(tmpArr,tempArrs);
         newState.inspectStrPlus = getStringPlus(newState.pushItem)
         return newState;

+ 13 - 7
src/utils/tools.js

@@ -589,15 +589,10 @@ function isAllClear(jsonData,jsonStr,baseList){
     jsonData.pacs.length < 1 &&
     jsonData.lis.labelList.length < 1 &&
     jsonData.lis.getExcelDataList.length < 1 &&
-    JSON.stringify(jsonData.advice) == '{}' &&
     filterDataArr(JSON.parse(jsonStr.chief)) == '' &&
     filterDataArr(JSON.parse(jsonStr.present)) == '' &&
     filterDataArr(JSON.parse(jsonStr.other)) == '' &&           //这里都是filterDataArr不是filterArr,要去符号的
-    filterDataArr(JSON.parse(jsonStr.vital)) == '' &&
-    jsonData.diag.length < 1 &&
-    jsonData.pacs.length < 1 &&
-    jsonData.lis.labelList.length < 1 &&
-    jsonData.lis.getExcelDataList.length < 1
+    filterDataArr(JSON.parse(jsonStr.vital)) == ''
   ) {
     return false;
   }else{
@@ -631,6 +626,16 @@ function getPageCoordinate(event){
     }
     return obj;
 }
+function timestampToTime(timestamp) {     //excel导入2019年5月1日会转换成时间戳
+  var date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
+  var Y = date.getFullYear() + '-';
+  var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
+  var D = date.getDate() + ' ';
+  var h = date.getHours() + ':';
+  var m = date.getMinutes() + ':';
+  var s = date.getSeconds();
+  return Y+M+D+h+m+s;
+}
 module.exports = {
     checkType: Type.checkType,
     regexp,
@@ -656,5 +661,6 @@ module.exports = {
     isAllClear,
     normalVal,
     getPageCoordinate,
-    windowRemoveEventHandler
+    windowRemoveEventHandler,
+    timestampToTime
 };