Parcourir la source

化验辅检时间加上时分秒

Luolei il y a 6 ans
Parent
commit
e27b2f581b

+ 1 - 1
src/common/components/Calendar/index.jsx

@@ -139,7 +139,7 @@ class Calendar extends React.Component {
         <Content selectTime={this.state.select} year={this.state.year} month={this.state.month} day={this.state.day} handleClick={(info) => this.handleChange(info)} canSelectFuture={this.props.canSelectFuture} />
         {this.genTimeComponent()}
         {
-          this.props.sure ? <div className={style.timeSure} onClick={() => this.timeSure({})}>确定</div> : ''
+          this.props.sure ? <div className={style.timeSure} onClick={() => this.timeSure({})} id="getSureTime">确定</div> : ''
         }
       </div>
     )

+ 21 - 2
src/components/AddAssistCheck/index.jsx

@@ -1,5 +1,5 @@
 import React from 'react';
-import { SearchOption, Calendar, ConfirmModal, Notify, Add ,DelToast} from '@commonComp';
+import { SearchOption, Calendar, ConfirmModal, Notify, Add ,DelToast,getCurrentDate} from '@commonComp';
 import styles from './index.less';
 import $ from 'jquery';
 import Textarea from './Textarea';
@@ -26,6 +26,7 @@ class AddAssistCheck extends React.Component {
     this.handleDelClick = this.handleDelClick.bind(this)
     this.delConfirm = this.delConfirm.bind(this)
     this.handleCancel = this.handleCancel.bind(this)
+    this.timeSure = this.timeSure.bind(this)
   }
 
   handleDelClick(id,item) {
@@ -140,12 +141,30 @@ class AddAssistCheck extends React.Component {
       }
     </ul>
   }
+  handleChangeDate(){}
+  timeSure(date,idx){
+    this.props.handleChangeDate(date,idx)
+    this.setState({ date: false })
+  }
   getAssistLabel() {
     const { assistLabel, handleChangeAssistValue, handleChangeDate, isRead, handlePush, winWidth,getInfomation } = this.props;
     const { visible,activeName,id,date } = this.state;
     return <ul className={styles.labelWrap} id="datePick">
       {
         assistLabel.map((item, idx) => {
+          let staticTime = {}
+          if(item.time){
+            let tmp1 = (item.time).split(' ')[0].split('-')
+            let tmp2 = (item.time).split(' ').length>1&&(item.time).split(' ')[1].split(':')
+            staticTime = {
+              year: tmp1[0]-0,
+              month: tmp1[1]-0,
+              day: tmp1[2]-0,
+              hour: tmp2[0],
+              minute: tmp2[1],
+              second: tmp2[2]
+            }
+          }
           return (<li key={item.questionId} className={`${styles.assistLists} ${styles.clearfix}`}>
             <span className={styles.assistName} style={{ width: winWidth < 1200 ? '120px' : 'auto' }}>
               <span className={styles.tagSpan}>
@@ -162,7 +181,7 @@ class AddAssistCheck extends React.Component {
               {/*<a href="javascript:void(0);" onClick={() => { this.handleDelClick(idx,item) }}><img src={close} alt="" /></a>*/}
               <span className={styles.closeIcon} id="assiClose" onClick={() => { this.handleDelClick(idx,item) }}></span>
               {
-                this.state.date && idx == this.state.active ?<Calendar handleChange={(info) => { handleChangeDate(info, idx); this.setState({ date: false }) }} top={30}></Calendar>:null
+                this.state.date && idx == this.state.active ?<Calendar timeLis={staticTime} isShow={true} timeSure={(date)=>this.timeSure(date,idx)} needTime={true} sure={true} handleChange={(info) => { this.handleChangeDate(info, idx) }} top={30}></Calendar>:null
               }
             </div>
           <DelToast show={idx==id?visible:false}

+ 7 - 3
src/components/AddAssistCheck/index.less

@@ -39,12 +39,14 @@
         clear: both;
         border-radius: 4px;
         .pointerFinger {
-            width: 222px;
+            width: 260px;
             position: absolute;
             right: 0;
             top: 10px;
             i {
                 display: inline-block;
+                position: absolute;
+                right: 15px;
                 width: 25px;
                 height: 25px;
                 cursor: pointer;
@@ -81,7 +83,9 @@
                 span {
                     border-bottom: 1px dashed #333; 
                     box-sizing: border-box;
-                    margin-right: 0;               
+                    margin-right: 0;    
+                    display: inline-block;
+                    width: 140px;           
                 }
             }
         }
@@ -93,7 +97,7 @@
             position: relative;
         }
         .textareaWrap {
-          padding-right: 215px;
+          padding-right: 250px;
           width: 100%;
         }
     }

+ 1 - 1
src/components/AddInspect/SlideExcel/index.jsx

@@ -31,7 +31,7 @@ class SlideExcel extends Component {
     })
   }
   render() {
-    const {items,item,idx,dateTime,getInfomation} = this.props;
+    const {items,item,idx,getInfomation,dateTime} = this.props;
     const {show} = this.state;
     return (
       <li className={`${styles.excelDataLis} clearfix`} style={{border:items.lisExcelRes.length-1 == idx? 0:''}}>

+ 39 - 14
src/components/AddInspect/SlideSelect/index.jsx

@@ -4,31 +4,39 @@ import { normalVal,timestampToTime } from '@utils/tools';
 import { InspectCommon, Calendar,DelToast} from '@commonComp';
 import slideUp from "@common/images/slide-up.png";
 import slideDown from "@common/images/slide-down.png";
+import $ from 'jquery';
 import date1 from '../img/date1.png';
 import close from '../img/close.png';
 
 class SlideSelect extends Component {
   constructor(props) {
     super(props);
-    const date = new Date();
     this.state = {
       show:false,
       activeInd:false,
       activeName:'',
-      timeLis: {
-        year: date.getFullYear(),
-        month: date.getMonth() + 1,
-        day: date.getDate(),
-        hour: '00',
-        minute: '00',
-        second: '00'
-      },
     };
     this.toTime = this.toTime.bind(this)
     this.handleSlide = this.handleSlide.bind(this)
     this.handleDel = this.handleDel.bind(this)
     this.handleCancel = this.handleCancel.bind(this)
     this.delConfirm = this.delConfirm.bind(this)
+    this.timeSure = this.timeSure.bind(this)
+  }
+  handleChangeDate(date) {
+    // console.log(date,'外')
+  }
+  componentDidMount() {
+    $(document).click((event) => {
+      let inspectToggleDate = document.getElementById("inspectToggleDate")
+      let timeIcon = document.getElementById("timeIcon")
+      let calendarDate = document.getElementById("calendarDate")
+      if (calendarDate) {
+        if (inspectToggleDate != event.target && timeIcon != event.target && !calendarDate.contains(event.target)) {
+          this.props.handleShowDate();
+        }
+      }
+    });
   }
   toTime(time){
     let tmpTim = time.split(',').join('')-0
@@ -71,12 +79,26 @@ class SlideSelect extends Component {
     })
   }
   timeSure(date){
-    console.log(date)
+    const {handleChangeDate} = this.props;
+    handleChangeDate&&handleChangeDate(date)
   }
   render() {
     const {getInfomation,handleConfirm,changeActivePart,handleDelClick,getItemList,date,item,idx,handleFillShow,showDetails,handleLabelSub,showFill,changeShowFill,handlePush,dateTime,currentIdx,currentData,fillActive,handleShowDate,handleChangeDate,showToast} = this.props;
-    const {show,activeInd,activeName,timeLis} = this.state;
+    const {show,activeInd,activeName} = this.state;
     let numPlus = 0,numPlus1 = 0;
+    let staticTime = {}
+    if(dateTime){
+      let tmp1 = dateTime.split(' ')[0].split('-')            
+      let tmp2 = (item.time).split(' ').length>1&&(item.time).split(' ')[1].split(':')
+      staticTime = {
+        year: tmp1[0]-0,
+        month: tmp1[1]-0,
+        day: tmp1[2]-0,
+        hour: tmp2[0],
+        minute: tmp2[1],
+        second: tmp2[2]
+      }
+    }
     return (
       <li key={item.questionId} className={styles.slideLi}> 
         {
@@ -175,15 +197,18 @@ class SlideSelect extends Component {
                     >
                     
                         <div className={styles.searchResultT}>
-                            <img style={{"position":"absolute","top":"8px","right":"8px",cursor:"pointer"}} src={date1} alt="" onClick={handleShowDate}/>
-                            <p style={{position:"absolute",right:"25px",top:"4px",lineHeight:"28px",cursor:"pointer",paddingRight:"10px"}} onClick={handleShowDate}>
+                            <img style={{"position":"absolute","top":"8px","right":"8px",cursor:"pointer"}} onClick={handleShowDate} src={date1} alt="" id="inspectToggleDate"/>
+                            <p style={{position:"absolute",right:"25px",top:"4px",lineHeight:"28px",cursor:"pointer",paddingRight:"10px"}} onClick={handleShowDate} id="timeIcon">
                                 {
                                   dateTime
                                 }
                             </p>
                             <div style={{display:date?"block":"none",position:"relative"}}>
                                 {/* 日期组件 */}
-                                <Calendar timeLis={timeLis} isShow={true} timeSure={this.timeSure} needTime={true} sure={true} handleChange={handleChangeDate}></Calendar>
+                                {
+                                  date?<Calendar timeLis={staticTime} isShow={true} timeSure={this.timeSure} needTime={true} sure={true} handleChange={this.handleChangeDate}></Calendar>:null
+                                }
+                                {/* <Calendar timeLis={staticTime} isShow={true} timeSure={this.timeSure} needTime={true} sure={true} handleChange={handleChangeDate}></Calendar> */}
                             </div>
                         </div>
                             {/* 填写单内容显示 */}

+ 8 - 8
src/components/AddInspect/index.jsx

@@ -82,9 +82,9 @@ class Inspect extends React.Component {
   }
   componentDidMount() {
     $(document).click((event) => {
-      let searchWrap = $('#searchWrap')[0];   // 搜索按钮
-      let searchOption = $('#searchOption')[0];   // 搜索列表
-      let inspectFill = $('#inspectFill')[0];         // 公共填写单
+      let searchWrap = document.getElementById("searchWrap");   // 搜索按钮
+      let searchOption = document.getElementById("searchOption");   // 搜索列表
+      let inspectFill = document.getElementById("inspectFill");         // 公共填写单
 
       let _del = $('#delBox')[0];       // 删除弹窗  
       let _impClose = $('#impClose')[0];         // 导入删除按钮
@@ -96,7 +96,7 @@ class Inspect extends React.Component {
         }
       }
       if (inspectFill) {
-        if (event.target.getAttribute('data-flg') != 'current' && inspectFill != event.target && !$.contains(inspectFill, event.target)) { // Mark 1
+        if ($(event.target).attr('id') != "getSureTime"&&event.target.getAttribute('data-flg') != 'current' && inspectFill != event.target && !$.contains(inspectFill, event.target)) { // Mark 1
           this.setState({ showFill: false, date: false });
         }
       }
@@ -110,7 +110,7 @@ class Inspect extends React.Component {
         }
       }
     });
-    this.setState({ dateTime: getCurrentDate(1) })
+    // this.setState({ dateTime: getCurrentDate(1) })
   }
   componentWillReceiveProps(nextProps) {
     if (nextProps.fillActive.name != this.props.fillActive.name) {
@@ -121,9 +121,9 @@ class Inspect extends React.Component {
     this.setState({ showFill: false })
   }
   handleChangeDate(info) {
-    let date = info.year+'-'+info.month.toString().padStart(2,'0')+'-'+info.day.toString().padStart(2,'0')
-    // let date = info.year+'-'+info.month.toString().padStart(2,'0')+'-'+info.day.toString().padStart(2,'0')+' '+h.toString().padStart(2,'0')+m.toString().padStart(2,'0')+s.toString().padStart(2,'0');
-    // this.setState({ dateTime: date, date: false })
+    // let date = info.year+'-'+info.month.toString().padStart(2,'0')+'-'+info.day.toString().padStart(2,'0')
+    let date = info.year+'-'+info.month.toString().padStart(2,'0')+'-'+info.day.toString().padStart(2,'0')+' '+info.hour.toString().padStart(2,'0')+':'+info.minute.toString().padStart(2,'0')+':'+info.second.toString().padStart(2,'0');
+    this.setState({ dateTime: date, date: false })
   }
   handleSearchShow(e) {
     let tmpShow = this.state.show;

+ 11 - 1
src/components/Inspect/index.jsx

@@ -7,7 +7,7 @@ import Notify from '@commonComp/Notify';
 import store from '@store';
 import $ from 'jquery';
 import { host, prefix } from '@utils/config.js';
-import { isIE, getUrlArgObject } from '@utils/tools.js';
+import { isIE, getUrlArgObject,getCurrentDate } from '@utils/tools.js';
 import { dragBox } from '@utils/drag';
 import WrapModalBody from '../WrapModalBody';
 
@@ -117,6 +117,16 @@ class Inspect extends React.Component {
                   let res = JSON.parse(xhr.response);
                   if(res.code == 0){
                     let message = res.data.messages;
+                    if(res.data.lisExcelRes){
+                      for(let i = 0;i < res.data.lisExcelRes.length;i++){
+                        let tmpLisExcelItem = res.data.lisExcelRes[i]
+                        if(tmpLisExcelItem.lisExcelItem){
+                          for(let j = 0;j < tmpLisExcelItem.lisExcelItem.length;j++){
+                            tmpLisExcelItem.lisExcelItem[j].time = tmpLisExcelItem.lisExcelItem[j].time||getCurrentDate(1)
+                          }
+                        }
+                      }
+                    }
                     store.dispatch(getExcelList(res.data));
                     fetchPushInfos && fetchPushInfos();
                     if (message && message.length != 0) {

+ 1 - 1
src/containers/AssistCheck.js

@@ -66,7 +66,7 @@ function mapDispatchToProps(dispatch, store) {
             dispatch(changeAssistVal(val,idx))
         },
         handleChangeDate(info,idx){
-            let date = info.year+'-'+(info.month<10?'0'+info.month:info.month)+'-'+(info.day<10?'0'+info.day:info.day);
+            let date = info.year+'-'+info.month.toString().padStart(2,'0')+'-'+info.day.toString().padStart(2,'0')+' '+info.hour.toString().padStart(2,'0')+':'+info.minute.toString().padStart(2,'0')+':'+info.second.toString().padStart(2,'0');
             dispatch(changeDate(date,idx))
         },
         //右侧推送

+ 1 - 2
src/modules/HomePage/index.jsx

@@ -55,8 +55,7 @@ class HomePage extends Component {
     }
     render() {
         const {flag,setPushEmergencyIdx,sysConfig} = this.props;
-        return <div className={style['home-page']}>
-        {/* return <div className={style['home-page']} onClick={this.props.hideAllDrop}> */}
+        return <div className={style['home-page']} onClick={this.props.hideAllDrop}>
             <BannerContainer />
             {/* <InfoTitle /> */}
             <BodyContainer></BodyContainer>

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

@@ -29,15 +29,8 @@ const initSearchList = {
     patientNum:''
   }
 }
+import { getCurrentDate} from '@utils/tools';
 
-function 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;
-}
 export default (state = initSearchList, action) => {
 
   if (action.type == SHOW_IN_ICSSS) {
@@ -235,7 +228,7 @@ export default (state = initSearchList, action) => {
     }
     for (let i = 0; i < tempArr.length; i++) {
       if (tempArr[i].questionId == action.id && i == action.idx) {
-        tempArr[i].time = getCurrentDate();
+        tempArr[i].time = getCurrentDate(1);
         tempArrs.push(tempArr[i]);
         newState.assistLabel = [...tempArrs];
       }