// 核心库 import React from 'react' import { connect } from 'dva' // 组件库 import { Form, Select, Table,Icon } from 'antd' import { Search, LayoutCard } from '@woowalker/feui' import CommonChart from '../../Chart/CommonChart' import KpiCascader from './KpiCascader' import EnergyIcon from '../../../utils/energyIcon' import TransferModal from './TransferModal' // 工具库 import { initFilter, addRuleAndGroups } from '../../../utils/common' const { Option } = Select class EaKpiTeamPage extends React.Component { constructor (props) { super(props) this.state = { option: [], type: '', head: [], data: [], parameter2: '', chartData: {} } } componentDidMount () { this.getTpye() } getTpye = () => { const { login, dispatch } = this.props const json = initFilter(login.OrgId) dispatch({ type: 'app/getDataByPost', url: 'KR/Statistics/GetEnergyType', payload: json, onlyData: false, onComplete: (res) => { if (res && res.IsSuccessful && res.Data && res.Data) { this.setState({ option: res.Data.option }) } } }) } onModalRef = (ref) => { this.modalChild = ref } showModal = () => { this.modalChild.showModal() } onCascaderChange = (value) => { this.setState({ parameter2: value }) } handleSearch = (value) => { value.rules.push({ field: 'Parameter2', operator: 0, value: this.state.parameter2, isCustom: true, isSysParam: false, }) value.rules.push({ field: 'Parameter3', operator: 0, value: this.state.type, isCustom: true, isSysParam: false, }) this.setState({ searchRules: value }, () => { this.getData(value) }) } getData = (value) => { const { login, dispatch } = this.props const json = initFilter(login.OrgId) addRuleAndGroups(json, value) dispatch({ type: 'app/getDataByPost', url: 'EA/AdjustAccounts/GetTeamData', payload: json }).then(res => { if (res) { const { chartData, head, data } = res this.setState({ head, data, chartData: { xAxis: chartData?.XAxis[0].Data, yAxis: chartData?.YAxis, data: chartData?.Data } }) } }) } handleTypeChange = (value) => { this.setState({ type: value }) } render () { const { formParam, formId, formCode, login, dispatch } = this.props const { option, type, head, data, chartData } = this.state let columns = [] head.forEach((n, i) => { const item = { title: n.Title, dataIndex: n.DataIndex, key: n.DataIndex } if (i < 2) { item.render = (value, row) => { return { children: value, props: { rowSpan: Number(row.RowSpan) } } } } columns.push(item) }) return ( <> this.handleSearch(this.state.searchRules)} /> , ]} iconEle={
{/* */}
} /> this.handleSearch(this.state.searchRules)} login={login} formParam={formParam} dispatch={dispatch} /> ) } } export default connect(({ login, app }) => ({ login, app }))(EaKpiTeamPage)