/* eslint-disable */ /* eslint no-dupe-keys: 0, no-mixed-operators: 0 */ import React from 'react'; // import * as commonConfig from '../../utils/config'; // import * as commonServices from '../../services/services'; import { Menu, Dropdown } from 'antd'; import { CaretUpOutlined } from '@ant-design/icons'; import * as commonUtils from '../../utils/utils'; import ShowType from '../../components/Common/CommonComponent'; class OeeSearchComponent extends React.Component { constructor(props) { super(props); this.state = { onChangeValue: '', }; this.bFilterCondition = true; this.textInput = null; } // componentWillReceiveProps(nextProps) { // const { slaveConfig } = nextProps; // const iIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.bFind); // if (iIndex > -1) { // this.setState({ filterName: slaveConfig.gdsconfigformslave[iIndex].showName }); // } // } handleSearch = (name, sFieldName, changeValue) => { let { slaveFilterCondition } = this.state; !slaveFilterCondition && (slaveFilterCondition = []); const conIndex = slaveFilterCondition.findIndex(item => item.bFilterName === sFieldName); if (conIndex !== -1) { slaveFilterCondition.splice(conIndex, 1); } slaveFilterCondition.push({ bFilterName: sFieldName, bFilterCondition: 'like', bFilterValue: changeValue[sFieldName] }); this.setState({ [`onChangeValue${sFieldName}`]: changeValue[sFieldName], slaveFilterCondition, }); } /* 点按钮搜索 */ handleBtnSearch = () => { let { slaveFilterCondition } = this.state; const { slaveConfig } = this.props; if (commonUtils.isEmpty(slaveFilterCondition)) { slaveFilterCondition = []; } this.props.onGetData(slaveConfig, slaveFilterCondition); } render() { const { slaveConfig, app, sModelsId, } = this.props; const searchConfig = commonUtils.isNotEmptyObject(slaveConfig) ? slaveConfig.gdsconfigformslave.filter(item => item.bFind && item.bVisible) : []; let item, showTypeProps, searchConfig1; if (searchConfig.length) { item = searchConfig[0]; item.placeholder = item.showName; showTypeProps = { app, record: {}, sId: item.sId, /* 修改当前编号(数据格式:字符串) */ name: 'slave', form: this.props.form, formId: sModelsId, getSqlDropDownData: this.props.getSqlDropDownData, getSqlCondition: this.props.getSqlCondition, handleSqlDropDownNewRecord: this.props.handleSqlDropDownNewRecord, getFloatNum: this.props.getFloatNum, getDateFormat: this.props.getDateFormat, onChange: this.handleSearch, showConfig: item, formItemLayout: {}, textArea: false, enabled: true, dataValue: this.state[`onChangeValue${item.sName}`], bTable: true, onFilterDropDownData: this.props.onFilterDropDownData, onSaveState: this.props.onSaveState, formRoute: this.props.formRoute, }; searchConfig1 = [...searchConfig]; searchConfig1.shift(); } return (
{ searchConfig1 && searchConfig1.length ? (<>{}} > {searchConfig1.map((item) => { item.placeholder = item.showName; const showTypeProps = { app, record: {}, sId: item.sId, /* 修改当前编号(数据格式:字符串) */ name: 'slave', form: this.props.form, formId: sModelsId, getSqlDropDownData: this.props.getSqlDropDownData, getSqlCondition: this.props.getSqlCondition, handleSqlDropDownNewRecord: this.props.handleSqlDropDownNewRecord, getFloatNum: this.props.getFloatNum, getDateFormat: this.props.getDateFormat, onChange: this.handleSearch, showConfig: item, formItemLayout: {}, textArea: false, enabled: true, dataValue: this.state[`onChangeValue${item.sName}`], bTable: true, onFilterDropDownData: this.props.onFilterDropDownData, onSaveState: this.props.onSaveState, formRoute: this.props.formRoute, iColValue: 24, }; return (
); })} } >
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} this.handleBtnSearch()}> 查询
) : commonUtils.isNotEmptyArr(searchConfig) ? searchConfig.map((item) => { item.placeholder = item.showName; const showTypeProps = { app, record: {}, sId: item.sId, /* 修改当前编号(数据格式:字符串) */ name: 'slave', form: this.props.form, formId: sModelsId, getSqlDropDownData: this.props.getSqlDropDownData, getSqlCondition: this.props.getSqlCondition, handleSqlDropDownNewRecord: this.props.handleSqlDropDownNewRecord, getFloatNum: this.props.getFloatNum, getDateFormat: this.props.getDateFormat, onChange: this.handleSearch, showConfig: item, formItemLayout: {}, textArea: false, enabled: true, dataValue: this.state[`onChangeValue${item.sName}`], bTable: true, onFilterDropDownData: this.props.onFilterDropDownData, onSaveState: this.props.onSaveState, formRoute: this.props.formRoute, }; return (
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} this.handleBtnSearch()}> 查询
); }) : '' }
); } } export default OeeSearchComponent;