import React from 'react'; import { SearchOption, InspectCommon, Calendar, Notify, ConfirmModal, Add, DelToast } from '@commonComp'; import SlideExcel from './SlideExcel'; import SlideSelect from './SlideSelect'; import { deepClone, getPageCoordinate, getStatusImg ,getCurrentDate,setPosition} from '@utils/tools'; import styles from './index.less'; import ScrollArea from 'react-scrollbar'; import store from '@store'; import $ from 'jquery'; class Inspect extends React.Component { constructor(props) { super(props); this.state = { show: false, showFill: false, date: false, currentIdx: '', dateTime: "", currentData: {}, numPlus: 0, //判断是否所有的填写单都是空 num: 0, //暂存数据,获取一次,不能每次都是新的数据 type: null, id: null, pageTop: '', // tmpIds: [], //内层外层 impId: null } this.$ul = React.createRef(); this.handleChangeDate = this.handleChangeDate.bind(this) this.handleShowDate = this.handleShowDate.bind(this) this.getItemList = this.getItemList.bind(this) this.getSearchList = this.getSearchList.bind(this) this.getCommonList = this.getCommonList.bind(this) this.changeActivePart = this.changeActivePart.bind(this) this.showDetails = this.showDetails.bind(this) this.delConfirm = this.delConfirm.bind(this) this.handleCancel = this.handleCancel.bind(this) this.handleSearchShow = this.handleSearchShow.bind(this) this.changeShowFill = this.changeShowFill.bind(this) this.handleFillShow = this.handleFillShow.bind(this) this.handleDelClick = this.handleDelClick.bind(this) } delConfirm() {//弹窗确定 const { delPartItem, handleCloseExcel, handlePush } = this.props; const { type, id, impId } = this.state; if (type == 1) { delPartItem(id) } else if (type == 2) { handleCloseExcel(impId) } this.setState({ type: null, id: null, impId: null }) Notify.success("删除成功"); handlePush && handlePush(); //右侧推送 } handleDelClick(type, idx) { if (type == 2) { this.setState({ impId: idx, type: type, id: null }) } else { this.setState({ type: type, id: idx, impId: null }) } } handleCancel() { this.setState({ type: null, id: null, impId: null }) } componentDidMount() { $(document).click((event) => { let searchWrap = document.getElementById("searchWrap"); // 搜索按钮 let searchOption = document.getElementById("searchOption"); // 搜索列表 let inspectFill = document.getElementById("inspectFill"); // 公共填写单 let _del = $('#delBox')[0]; // 删除弹窗 let _impClose = $('#impClose')[0]; // 导入删除按钮 let _addClose = $('#addClose')[0]; // 添加删除按钮 let _closeTil = $('#delTit')[0]; // 弹窗标题 if (searchOption) { if (searchOption != event.target && searchWrap != event.target && searchWrap != event.target.parentNode && !$.contains(searchOption, event.target)) { // Mark 1 if(this.state.show){ this.props.setHighter(48) } this.setState({ show: false }); } } if (inspectFill) { if ($(event.target).attr('id') != "getSureTime"&&event.target.getAttribute('data-flg') != 'current' && inspectFill != event.target && !$.contains(inspectFill, event.target)) { // Mark 1 if(this.state.showFill){ this.props.setHighter(48) } this.setState({ showFill: false, date: false }); } } if (_del) { if (!event.target.isEqualNode(_impClose) && !event.target.isEqualNode(_addClose) && !event.target.isEqualNode(_del) && event.target.parentNode != _del && !event.target.isEqualNode(_closeTil)) { this.setState({ id: null, impId: null }) } } }); // this.setState({ dateTime: getCurrentDate(1) }) } componentWillReceiveProps(nextProps) { if (nextProps.fillActive.name != this.props.fillActive.name) { this.setState({ num: 0 }) } } changeShowFill() { this.setState({ showFill: false }) this.props.setHighter(48) } 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')+' '+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; this.setState({ show: !tmpShow, pageTop: getPageCoordinate(e).boxTop }) // e.stopPropagation(); setPosition(e,"#searchOption",this.props.setHighter); } handleFillShow(e, idx) { let tmpShow = this.state.showFill; let baseList = store.getState().inspect.fillActive; this.setState({ showFill: !tmpShow, currentIdx: idx, currentData: baseList, dateTime: baseList.time ? baseList.time : getCurrentDate(1) }) e.stopPropagation(); } handleShowDate() { this.setState({ date: !this.state.date }) } changeActivePart(idx, val, clear) { let nums = this.state.num; let fillActive; if (nums == 0) { fillActive = this.props.fillActive; } else { fillActive = this.state.currentData; } ++nums; this.setState({ num: nums }); let tempArr = deepClone(fillActive); if (clear) { //点击清空按钮,至清初输入的数字 for (let i = 0; i < tempArr.details.length; i++) { tempArr.details[i].value = '' tempArr.show = false; } tempArr.time = getCurrentDate(1); 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 }) } } getItemList() { //填写单展示 let number = this.state.num; let fillActive; if (number == 0) { fillActive = this.props.fillActive; } else { fillActive = this.state.currentData; } return
{item.labelSuffix}
暂无筛选项
)} { (list && list.length > 0) || (inspectVal != '') || (inspectList&&inspectList.length==0) ? '' :常用化验项