import React, { Component } from "react"; import styles from "./index.less"; import { normalVal,timestampToTime,getPageCoordinate,setPosition } 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 ScrollArea from 'react-scrollbar'; class SlideSelect extends Component { constructor(props) { super(props); this.state = { show:false, activeInd:false, activeName:'', }; 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); this.handleLabelSub = this.handleLabelSub.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 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; } } handleSlide(){ let tmpShow = this.state.show this.setState({ show:!tmpShow }) } handleDel(){ const {handleDelClick,idx,item} = this.props; this.setState({ activeInd:true, activeName:item.name }) handleDelClick&&handleDelClick(1,idx); } handleCancel(){ this.setState({ activeInd:false, activeName:'' }) } delConfirm(){ const {handleDelConfirm} = this.props; handleDelConfirm&&handleDelConfirm(); this.setState({ activeInd:false, activeName:'' }) } timeSure(date){ const {handleChangeDate} = this.props; handleChangeDate&&handleChangeDate(date) } handleLabelSub(e,questionId,idx){ const {handleLabelSub,handleFillShow,setHighter,refreshScroller} = this.props; handleLabelSub(e,questionId,idx); handleFillShow(e,idx); //弹窗高度超出屏幕,增加页面高度 setPosition(e,"#inspectFill",setHighter); /*setTimeout(function(){//如果化验下面有很多数据,则会跳过头 refreshScroller()&&refreshScroller().scrollYTo(290); })*/ } render() { const {windowWidth,getInfomation,handleConfirm,changeActivePart,getItemList,date,item,idx,showDetails,showFill,changeShowFill,handlePush,dateTime,currentIdx,currentData,fillActive,handleShowDate,showToast} = this.props; const {show,activeInd,activeName} = this.state; let numPlus = 0,numPlus1 = 0; let staticTime = {} if(dateTime){ let tmp1 = dateTime.split(' ')[0].split('-') let tmp2 = (dateTime).split(' ').length>1&&(dateTime).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] } } const contStyle={ opacity:'0.4', right:'0', top:'6px', zIndex:'15', width:'14px', background:'#f1f1f1'}; const barStyle={background:'#777',width:'100%'}; const listLen = currentData.details&¤tData.details.length; const stopScroll =(windowWidth<1300&&listLen>12)||(windowWidth>1299&&listLen>24); return (
this.handleLabelSub(e,item.questionId,idx)}> {item.name} getInfomation({name:item.uniqueName || '', position: 1, type: 12})}>
:this.handleLabelSub(e,item.questionId,idx)}> {item.name} getInfomation({name:item.uniqueName || '', position: 1, type: 12})}>
} { item.details && item.details.map((val)=>{ if(val.value && val.value != ''){ numPlus = ++numPlus } }) } { item.show ?{val.name} getInfomation({name:val.uniqueName || '', position: 1, type: 12})}> | {showDetails(val)}{val.questionDetailList.length > 0?'':normalVal(val.minValue,val.maxValue)} | {'化验时间:'+item.time} |
{val.name} getInfomation({name:val.uniqueName || '', position: 1, type: 12})}> | {showDetails(val)}{val.questionDetailList.length > 0?'':normalVal(val.minValue,val.maxValue)} | {'化验时间:'+item.time} |
{ dateTime }