import React, { Component } from "react"; import styles from "./index.less"; 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 date1 from '../img/date1.png'; import close from '../img/close.png'; 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) } 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:'' }) } 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} = this.state; let numPlus = 0,numPlus1 = 0; return (
  • { // 标签,血常规。。 item.show ?

    { handleLabelSub(e, item.questionId,idx); handleFillShow(e,idx) }}> {item.name} getInfomation(item.questionId,item.name)}>

    :

    { handleLabelSub(e,item.questionId,idx); handleFillShow(e,idx) }}> {item.name} getInfomation(item.questionId,item.name)}>

    } { item.details && item.details.map((val)=>{ if(val.value && val.value != ''){ numPlus = ++numPlus } }) } { item.show ? { show?(item.details.map((val)=>{ if(val.value && val.value != ''){ return {showDetails(val)} } })):(item.details.map((val,num)=>{ if(val.value && val.value != '' ){ ++numPlus1; if(numPlus1 < 5){ return {showDetails(val)} } } })) }
    {val.name} getInfomation(val.id)}> {normalVal(val.minValue,val.maxValue)} {'化验时间:'+item.time}
    {val.name} getInfomation(val.id)}> {normalVal(val.minValue,val.maxValue)} {'化验时间:'+item.time}
    :null } { numPlus > 4 ?
    { show ? 收起 :剩余{numPlus-4} }
    :null }
    { showFill && fillActive.id == item.id && idx == currentIdx ? { changeActivePart('','',true) }} handleConfirm={(e)=>{ if(JSON.stringify(currentData) == '{}'){ handleConfirm(e,idx,dateTime,fillActive); }else{ handleConfirm(e,idx,dateTime,currentData); } changeShowFill() handlePush&&handlePush(); //右侧推送 }} >

    { dateTime }

    {/* 日期组件 */}
    {/* 填写单内容显示 */} { getItemList() }
    : null }
    {/*删除项{handleDelClick(1,idx)}}/>*/}
  • ); } } export default SlideSelect;