salary-management-front/pc4mobx/hrmSalary/pages/intelligentCalculateSalaryS.../index.js

76 lines
2.7 KiB
JavaScript

import React, { Component } from "react";
import { WeaLocaleProvider, WeaReqTop } from "ecCom";
import { Button } from "antd";
import EnableSettings from "./components/enableSettings";
import InsufficientTrafficAlert from "./components/insufficientTrafficAlert";
import TrafficUsageRecords from "./components/trafficUsageRecords";
import InterfaceFlowStatistics from "./components/interfaceFlowStatistics";
import "./index.less";
const getLabel = WeaLocaleProvider.getLabel;
const tabs = [
{ key: "ENABLE_SETTINGS", title: getLabel(111, "启用设置") },
{ key: "INTERFACE_FLOW_STATISTICS", title: getLabel(111, "接口流量统计") },
{ key: "INSUFFICIENT_TRAFFIC_ALERT", title: getLabel(111, "流量不足提醒") },
{ key: "TRAFFIC_USAGE_RECORD", title: getLabel(111, "流量使用记录") }
];
class Index extends Component {
constructor(props) {
super(props);
this.state = {
selectedKey: "ENABLE_SETTINGS", lastUpdateTime: ""
};
}
renderChildren = () => {
const { selectedKey } = this.state;
let CurrentDom = null;
switch (selectedKey) {
case "ENABLE_SETTINGS":
CurrentDom = <EnableSettings/>;
break;
case "INTERFACE_FLOW_STATISTICS":
CurrentDom =
<InterfaceFlowStatistics updateTime={(data) => this.setState({ lastUpdateTime: data.lastUpdateTime })}/>;
break;
case "INSUFFICIENT_TRAFFIC_ALERT":
CurrentDom = <InsufficientTrafficAlert/>;
break;
case "TRAFFIC_USAGE_RECORD":
CurrentDom = <TrafficUsageRecords/>;
break;
default:
CurrentDom = null;
break;
}
return CurrentDom;
};
render() {
const { selectedKey, lastUpdateTime } = this.state;
const buttons = selectedKey === "INSUFFICIENT_TRAFFIC_ALERT" ?
[<Button type="primary">{getLabel(537558, "保存")}</Button>] :
selectedKey === "TRAFFIC_USAGE_RECORD" ?
[<Button type="primary">{getLabel(17416, "导出")}</Button>] :
selectedKey === "INTERFACE_FLOW_STATISTICS" ? [
<span className="statistic-time">
<span className="label">{getLabel(111, "最后统计时间:")}</span>
<span className="value">{lastUpdateTime}</span>
</span>
] : [];
return (
<WeaReqTop
title={getLabel(111, "智能算薪")} selectedKey={selectedKey}
icon={<i className="icon-coms-fa"/>} iconBgcolor="#F14A2D"
tabDatas={tabs} onChange={selectedKey => this.setState({ selectedKey })}
buttons={buttons} className="intelligentSetting-layout"
>
<div style={{ height: "100%", background: "#f6f6f6", padding: 16 }}>{this.renderChildren()}</div>
</WeaReqTop>
);
}
}
export default Index;