import { inject, observer } from 'mobx-react'
import {
WeaTop,
WeaInput,
WeaEchart,
WeaRightMenu,
WeaRadioGroup,
WeaMoreButton,
WeaLocaleProvider,
WeaDialog
} from 'ecCom'
import {
WeaTableNew
} from 'comsMobx'
import { Row, Col, Tabs, Spin, Button } from 'antd'
import React from 'react'
import * as mobx from 'mobx'
import RadioGroupWrapper from './RadioGroupWrapper'
import ReportChart from './ReportChart'
import DataStatistics from './DataStatistics'
import More from './More'
import { addContentPath } from '../../util/index.js'
import '../../style/report.css'
import { i18n } from '../../public/i18n'
import { Authority } from '../../public/coms/index.js'
const toJS = mobx.toJS
const TabPane = Tabs.TabPane
const getLabel = WeaLocaleProvider.getLabel
const WeaTable = WeaTableNew.WeaTable;
@inject('hrmPerStatusReport')
@observer
class BasicConditionAnalysis extends React.Component {
constructor (props) {
super(props)
}
componentWillMount () {
this.pre()
}
componentDidMount () {
const { hrmPerStatusReport: store } = this.props
store.getRight().then(hasRight => {
hasRight && this.init()
})
}
componentWillReceiveProps (nextProps) {
const { hrmPerStatusReport } = this.props
if (this.props.location.key !== nextProps.location.key) {
this.pre(nextProps)
hrmPerStatusReport.optionReset()
hrmPerStatusReport.conditionReset()
hrmPerStatusReport.paramReset()
hrmPerStatusReport.apiFinishedStatusReset()
hrmPerStatusReport.getSearchCondition()
hrmPerStatusReport.tabKeyReset()
this.refs.page && this.refs.page.click()
this.init()
}
}
pre (nextProps) {
const { hrmPerStatusReport } = this.props
let pathname
if (!nextProps) {
pathname = this.props.location.pathname.split('/').pop()
} else {
pathname = nextProps.location.pathname.split('/').pop()
}
hrmPerStatusReport.optionReset()
hrmPerStatusReport.setPathName(pathname)
hrmPerStatusReport.pathToTitle()
hrmPerStatusReport.getCurWindowWidth()
}
init () {
const { hrmPerStatusReport } = this.props
const { pathname } = hrmPerStatusReport
hrmPerStatusReport.setKey('1')
if (pathname !== 'basicConditionAnalysis')
hrmPerStatusReport.setIntervalShow(false)
}
getTabPanes () {
const { hrmPerStatusReport } = this.props
const { tabKey } = hrmPerStatusReport
return (
{
hrmPerStatusReport.setKey(key)
hrmPerStatusReport.getData()
}}
type='card'
>
{this.getChart(hrmPerStatusReport.getTabName())}
)
}
getChart (tagName) {
const { hrmPerStatusReport } = this.props
const {
option1,
option2,
isIntervalShow,
interval,
tabKey,
pathname,
chartTitle1,
chartTitle2,
isEchartsShow,
isLeftEchartsShow,
isRightEchartsShow,
ids,
yAxisData,
linkList,
winWidth,
cmd
} = hrmPerStatusReport
return (
hrmPerStatusReport.setGap(val)}
getData={tag => hrmPerStatusReport.getData(tag)}
showDialog = {() => hrmPerStatusReport.setDialogVisible(true)}
/>
)
}
getDeadline () {
const { hrmPerStatusReport } = this.props
const { deadline } = hrmPerStatusReport
return (
)
}
search (v) {
const { hrmPerStatusReport } = this.props
hrmPerStatusReport.setSearchCondition(v)
hrmPerStatusReport.getData('search')
}
handleMenuClick (key) {
if (key == '0') this.refs.a.click()
}
render () {
const { hrmPerStatusReport } = this.props
const {
title,
pathname,
countDatas,
visible,
tableStore,
strokeColor,
href,
paramsStr,
isApiOneFinished,
isApiTwoFinished,
authorityStore,
dialogVisible
} = hrmPerStatusReport
const btn = [
,
,
]
const btn1 = btn.slice(0, 1)
const btn2 = btn.slice(1, 3)
const dropMenuDatas = [
{
key: '0',
content: i18n.button.export1(),
icon:
},
{
key: '1',
content: i18n.button.more(),
disabled: true,
icon:
}
]
const dropMenuDatas1 = dropMenuDatas.slice(0, 1)
const dropMenuDatas2 = dropMenuDatas.slice(1, 2)
return (
this.handleMenuClick(e)}
collectParams={{ favname: title, favouritetype: 5 }}
>
}
iconBgcolor='#217346'
loading={true}
buttons={
pathname == 'departmentStatistics' ||
pathname == 'postStatistics'
? btn1
: []
}
showDropIcon={true}
dropMenuDatas={
pathname == 'departmentStatistics' ||
pathname == 'postStatistics'
? dropMenuDatas1
: dropMenuDatas2
}
onDropMenuClick={e => this.handleMenuClick(e)}
>
{pathname == 'basicConditionAnalysis' ? this.getTabPanes() : ''}
{pathname !== 'basicConditionAnalysis' ? (
) : (
''
)}
{pathname !== 'basicConditionAnalysis' ? this.getChart() : ''}
{this.getDeadline()}
hrmPerStatusReport.setVisible(false)}
search={v => this.search(v)}
tableStore={tableStore}
loading={tableStore.loading}
strokeColor={'#6FBCEA'}
/>
hrmPerStatusReport.setDialogVisible(false)}
title={'明细数据'}
visible={dialogVisible}
style={{ width: 800, height: 500 }}
hasScroll
buttons={}
>
this.reRenderColumns(c)}
//onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)}
/>
)
}
}
export default BasicConditionAnalysis