You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dashboard/src/views/KPI.jsx

46 lines
1.2 KiB
React

2 years ago
import { useEffect, useState } from 'react';
import { observer } from 'mobx-react';
import { Row, Col, Tabs } from 'antd';
import { KPIObjects } from './../libs/ht';
2 years ago
import BUPanel from './../components/kpi/BUPanel';
import OverviewPanel from './../components/kpi/OverviewPanel';
import './kpi.css';
2 years ago
const objectComponents = {
2 years ago
'overview': OverviewPanel,
'bu': BUPanel,
'dept': BUPanel,
'du': BUPanel,
'operator': BUPanel,
'destination': BUPanel,
'country': BUPanel,
};
export default observer((props) => {
2 years ago
// useEffect(() => {
// return () => {};
// }, []);
const [curObject, setCurObject] = useState('overview');
const onObjectChange = (object) => {
setCurObject(object);
};
return (
<>
2 years ago
<Row>
<Col span={24}>
<Tabs
2 years ago
onChange={onObjectChange}
2 years ago
type="card"
items={KPIObjects.map((ele, i) => {
2 years ago
const ItemComponent = objectComponents[ele.key];
2 years ago
return {
...ele,
2 years ago
children: <ItemComponent title={ele.label} {...{ curObject }} />,
2 years ago
};
})}
/>
</Col>
</Row>
</>
);
});