mh-sms-web/src/components/CustomPages/BI/BI011FormRunAnalysis.js

779 lines
24 KiB
JavaScript
Raw Normal View History

import React from "react";
import { connect } from "dva";
import { initFilter, extendRule, extendOrder } from "../../../utils/common";
import { ChartPieShow, ChartBarShow } from "../../../utils/commonEcharsShow";
import {
Table,
Button,
Input,
Row,
Col,
Modal,
Icon,
Progress,
Divider,
} from "antd";
import echarts from "echarts";
import styles from "../HI/StepForm1.css";
import moment from "moment";
import { T } from "antd/lib/upload/utils";
import FormPage from "../../FormPage";
2024-01-22 09:18:38 +08:00
class BI011FormRunAnalysis extends React.Component {
constructor(props) {
super(props);
this.state = {
visible: false,
loading: false,
noticeTitle: "",
2024-01-22 09:18:38 +08:00
tmpData: {},
tableKey: "1",
startTime: moment(new Date().setDate(1))
.subtract(5, "months")
.format("YYYY-MM-DD"),
endTime: moment(new Date()).format("YYYY-MM-DD"),
timeType: 5,
totalCount: 0,
finishCount: 0,
overtimeCount: 0,
unfinishCount: 0,
dtotalCount: 0,
dfinishCount: 0,
dovertimeCount: 0,
dunfinishCount: 0,
inputText: this.props.login.user.NAME,
drate: "0%",
dnormalRate: "0%",
weekColor: "black",
monthColor: "orange",
threeMonthColor: "black",
sixMonthColor: "black",
yearColor: "black",
retData: [],
groupData: [],
detailData: [],
newData: [],
detailDataH: [],
displayHr: "none",
displaydetail: "none",
columns: [
{
width: "30px",
title: "月份",
dataIndex: "MONTHStr",
key: "MONTHStr",
// render: (text, record) => (
// <span>
// <a onClick={() => this.showEditModal(record.DEPARTMENT_ID,record.DEPARTMENT_NAME)}>{record.DEPARTMENT_NAME}</a>
// </span>
// ),
},
{
width: "30px",
title: "任务数",
dataIndex: "TOTAL_QTY",
key: "TOTAL_QTY",
},
{
width: "30px",
title: "完成率",
dataIndex: "FINISH_RATE",
key: "FINISH_RATE",
render: (text, record) => (
<Progress percent={record.FINISH_RATE.split("%")[0]} />
// <span>
// <a onClick={() => this.showEditModal(record.DEPARTMENT_ID,record.DEPARTMENT_NAME)}>{record.DEPARTMENT_NAME}</a>
// </span>
),
},
{
width: "30px",
title: "及时完成率",
dataIndex: "NORMAL_FINISH_RATE",
key: "NORMAL_FINISH_RATE",
render: (text, record) => (
<Progress
percent={record.NORMAL_FINISH_RATE.split("%")[0]}
strokeColor={{
from: "rgba(82, 196, 26)",
to: "rgba(82, 196, 26)",
}}
/>
// <span>
// <a onClick={() => this.showEditModal(record.DEPARTMENT_ID,record.DEPARTMENT_NAME)}>{record.DEPARTMENT_NAME}</a>
// </span>
),
},
2024-01-22 09:18:38 +08:00
],
detailColumns: [
// {
// width: "55px",
// title: '序号',
// dataIndex: 'NUM',
// key: 'NUM',
// },
{
width: "100px",
title: "模块名称",
dataIndex: "MOUDLE_NAME",
key: "MOUDLE_NAME",
// render: (text, record) => (
// <span>
// <a onClick={() => this.showFormModal(record.MOUDLE_NAME)}>{record.MOUDLE_NAME}</a>
// </span>
// ),
},
{
width: "60px",
title: "总任务数",
dataIndex: "TOTAL_QTY",
key: "TOTAL_QTY",
},
{
width: "60px",
title: "正常已办",
dataIndex: "FINISH_QTY",
key: "FINISH_QTY",
},
{
width: "60px",
title: "超时已办",
dataIndex: "OVER_FINISH_QTY",
key: "OVER_FINISH_QTY",
},
{
width: "50px",
title: "未完成",
dataIndex: "UNFINISH_QTY",
key: "UNFINISH_QTY",
},
{
width: "50px",
title: "完成率",
dataIndex: "FINISH_RATE",
key: "FINISH_RATE",
},
{
width: "70px",
title: "及时完成率",
dataIndex: "NORMAL_FINISH_RATE",
key: "NORMAL_FINISH_RATE",
render: (text, record) => (
<span>
{record.NORMAL_FINISH_RATE}
{"%"}
</span>
),
},
],
};
}
2024-01-22 09:18:38 +08:00
componentDidMount() {
this.loadData();
}
2024-01-22 09:18:38 +08:00
showEditModal = (departmentId, departmentName) => {
const newtmpData = {
data: {
id: departmentId,
name: departmentName,
onCancel: this.handleCancel,
tableKey: this.state.tableKey,
homeReload: true,
2024-01-22 09:18:38 +08:00
},
formCode: "BI007_RUNANALYSIS",
};
this.setState(
{
id: departmentId,
name: departmentName,
noticeTitle: departmentName + "安全生产标准化运行情况",
tmpData: newtmpData,
currActivatedMenu: "",
},
() =>
this.setState({
visible: true,
})
);
};
showFormModal = (mouldName) => {
2024-01-22 09:18:38 +08:00
const newtmpData = {
data: {
name: mouldName,
onCancel: this.handleCancel,
tableKey: this.state.tableKey,
homeReload: true,
2024-01-22 09:18:38 +08:00
},
formCode: "BI008_RUNANALYSIS",
};
this.setState(
{
name: mouldName,
noticeTitle: mouldName + "安全生产标准化运行情况",
tmpData: newtmpData,
currActivatedMenu: "",
},
() =>
this.setState({
visible: true,
})
);
};
2024-01-22 09:18:38 +08:00
// showEditModal = (dataId, formCode, TaskID, title, taskCode) => {
// const newtmpData = {
// data: {
// id: dataId, TaskID: TaskID, onCancel: this.handleCancel, taskCode: taskCode, tableKey: this.state.tableKey,
// homeReload: true
// },
// formCode: formCode,
// }
// this.setState({
// noticeTitle: title,
// taskCode: taskCode,
// tmpData: newtmpData,
// currActivatedMenu: ''
// }, () => this.setState({
// visible: true
// }));
// }
2024-01-22 09:18:38 +08:00
//加载数据赋值
loadData = () => {
// this.ksRun();
this.getMould(this.props.login.user.NAME);
// this.getDepartment();
};
2024-01-22 09:18:38 +08:00
//矿山
ksRun = (data) => {
// let data = {
// "IsSuccessful": true, "Data": [{ "DEPARTMENT_ID": "e3061909-1a7e-b60c-bc71-1845b79c4a11", "MONTH": "2021-08-01 00:00:00", "MONTHStr": "2023年1月", "C_COUNT": 90, "D_COUNT":80},
// {"DEPARTMENT_ID": "e3061909-1a7e-b60c-bc71-1845b79c4a11", "MONTH": "2021-09-01 00:00:00", "MONTHStr": "2023年2月", "C_COUNT": 70, "D_COUNT": 60},
// { "DEPARTMENT_ID": "e3061909-1a7e-b60c-bc71-1845b79c4a11", "MONTH": "2021-10-01 00:00:00", "MONTHStr": "2023年3月", "C_COUNT": 70, "D_COUNT": 60},
// { "DEPARTMENT_ID": "e3061909-1a7e-b60c-bc71-1845b79c4a11", "MONTH": "2021-11-01 00:00:00", "MONTHStr": "2023年4月", "C_COUNT": 70, "D_COUNT": 60},
// { "DEPARTMENT_ID": "e3061909-1a7e-b60c-bc71-1845b79c4a11", "MONTH": "2021-12-01 00:00:00", "MONTHStr": "2023年5月", "C_COUNT": 70, "D_COUNT": 60},
// {"DEPARTMENT_ID": "e3061909-1a7e-b60c-bc71-1845b79c4a11", "MONTH": "2021-09-01 00:00:00", "MONTHStr": "2023年6月", "C_COUNT": 70, "D_COUNT": 60},
// { "DEPARTMENT_ID": "e3061909-1a7e-b60c-bc71-1845b79c4a11", "MONTH": "2021-10-01 00:00:00", "MONTHStr": "2023年7月", "C_COUNT": 70, "D_COUNT": 60},
// { "DEPARTMENT_ID": "e3061909-1a7e-b60c-bc71-1845b79c4a11", "MONTH": "2021-11-01 00:00:00", "MONTHStr": "2023年8月", "C_COUNT": 70, "D_COUNT": 60},
// { "DEPARTMENT_ID": "e3061909-1a7e-b60c-bc71-1845b79c4a11", "MONTH": "2021-12-01 00:00:00", "MONTHStr": "2023年9月","C_COUNT": 70, "D_COUNT": 60},
// { "DEPARTMENT_ID": "e3061909-1a7e-b60c-bc71-1845b79c4a11", "MONTH": "2021-11-01 00:00:00", "MONTHStr": "2023年10月", "C_COUNT": 70, "D_COUNT": 60},
// { "DEPARTMENT_ID": "e3061909-1a7e-b60c-bc71-1845b79c4a11", "MONTH": "2021-12-01 00:00:00", "MONTHStr": "2023年11月", "C_COUNT": 70, "D_COUNT": 60 },
// { "DEPARTMENT_ID": "e3061909-1a7e-b60c-bc71-1845b79c4a11", "MONTH": "2022-01-01 00:00:00", "MONTHStr": "2023年12月", "C_COUNT": 70, "D_COUNT": 60 }], "TotalCount": 0, "ErrorMessage": null
// }
if (data) {
let month = [];
let company = [];
let department = [];
let color = [
"#0090FF",
"#36CE9E",
"#FFC005",
"#FF515A",
"#8B5CFF",
"#00CA69",
];
const hexToRgba = (hex, opacity) => {
let rgbaColor = "";
let reg = /^#[\da-f]{6}$/i;
if (reg.test(hex)) {
rgbaColor = `rgba(${parseInt("0x" + hex.slice(1, 3))},${parseInt(
"0x" + hex.slice(3, 5)
)},${parseInt("0x" + hex.slice(5, 7))},${opacity})`;
}
return rgbaColor;
};
data.forEach((item) => {
2024-01-22 09:18:38 +08:00
month.push(item.MONTHStr);
company.push(item.FINISH_RATE);
department.push(item.NORMAL_FINISH_RATE);
});
let myChart = echarts.init(document.getElementById("ksRun"));
2024-01-22 09:18:38 +08:00
myChart.setOption({
color: color,
2024-01-22 09:18:38 +08:00
title: {
text: "任务及时完成率近6个月",
left: "center",
top: "2%",
},
2024-01-22 09:18:38 +08:00
tooltip: {
trigger: "axis",
2024-01-22 09:18:38 +08:00
formatter: function (params) {
let temp = "";
params.forEach((t) => {
temp =
temp + t.marker + t.seriesName + ":" + t.value + "%" + "<br />";
});
2024-01-22 09:18:38 +08:00
return temp;
},
2024-01-22 09:18:38 +08:00
},
grid: {
left: "10%",
right: "5%",
2024-01-22 09:18:38 +08:00
},
legend: {
left: "center",
align: "left",
bottom: "2%",
textStyle: {
color: "#000",
},
itemWidth: 10,
itemHeight: 10,
2024-01-22 09:18:38 +08:00
},
xAxis: {
type: "category",
2024-01-22 09:18:38 +08:00
data: month,
boundaryGap: false,
axisLabel: {
textStyle: {
color: "#333",
},
2024-01-22 09:18:38 +08:00
},
axisLine: {
lineStyle: {
color: "#D9D9D9",
},
2024-01-22 09:18:38 +08:00
},
},
yAxis: {
type: "value",
axisLabel: {
textStyle: {
color: "#666",
},
},
nameTextStyle: {
color: "#666",
fontSize: 12,
lineHeight: 40,
},
splitLine: {
lineStyle: {
type: "dashed",
color: "#E9E9E9",
},
},
axisLine: {
show: false,
},
axisTick: {
show: false,
2024-01-22 09:18:38 +08:00
},
},
series: [
{
name: "完成率",
type: "line",
2024-01-22 09:18:38 +08:00
data: company,
smooth: true,
symbolSize: 8,
zlevel: 3,
lineStyle: {
normal: {
color: color[0],
shadowBlur: 3,
shadowColor: hexToRgba(color[0], 0.5),
shadowOffsetY: 8,
},
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: hexToRgba(color[0], 0.3),
},
{
offset: 1,
color: hexToRgba(color[0], 0.1),
},
],
false
),
shadowColor: hexToRgba(color[0], 0.1),
shadowBlur: 10,
},
},
2024-01-22 09:18:38 +08:00
},
{
name: "及时完成率",
type: "line",
2024-01-22 09:18:38 +08:00
data: department,
smooth: true,
symbolSize: 8,
zlevel: 3,
lineStyle: {
normal: {
color: color[1],
shadowBlur: 3,
shadowColor: hexToRgba(color[1], 0.5),
shadowOffsetY: 8,
},
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: hexToRgba(color[1], 0.3),
},
{
offset: 1,
color: hexToRgba(color[1], 0.1),
},
],
false
),
shadowColor: hexToRgba(color[1], 0.1),
shadowBlur: 10,
},
},
2024-01-22 09:18:38 +08:00
},
],
});
2024-01-22 09:18:38 +08:00
}
};
getMould = (inputText) => {
this.setState({ loading: true });
var orgId = this.props.login ? this.props.login.OrgId : "";
let json = initFilter(
orgId,
inputText,
"",
"",
"",
this.state.startTime,
this.state.endTime
);
this.props.dispatch({
type: "app/getDataByPost",
payload: json,
url: "BI/BIStatiscialAnalysisController/GetPersonAnalyze",
onComplete: (ret) => {
if (ret) {
this.setState({
retData: ret.groupData,
totalCount: ret.TotalCount,
finishCount: ret.doneCount,
overtimeCount: ret.timeOverCount,
unfinishCount: ret.unfinishCount,
dovertimeCount: ret.timeOverWaitCount,
loading: false,
});
this.ksRun(ret.groupDataLine);
} else {
this.setState({
retData: [],
totalCount: 0,
finishCount: 0,
overtimeCount: 0,
unfinishCount: 0,
dovertimeCount: 0,
loading: false,
});
}
},
});
};
closeModal = () => {
// 退出弹窗
2024-01-22 09:18:38 +08:00
this.clearData();
};
2024-01-22 09:18:38 +08:00
clearData = () => {
let newtmpData = { ...this.state.tmpData };
newtmpData["data"].id = "";
2024-01-22 09:18:38 +08:00
newtmpData["data"].homeReload = false;
newtmpData.formCode = "";
2024-01-22 09:18:38 +08:00
this.setState({
visible: false,
tmpData: newtmpData,
});
};
handleCancel = () => {
// 退出弹窗
2024-01-22 09:18:38 +08:00
this.clearData();
};
2024-01-22 09:18:38 +08:00
handleSearch = (evt) => {
const { value } = evt.target;
this.setState({ inputText: value ? value : this.props.login.user.NAME });
};
2024-01-22 09:18:38 +08:00
render() {
const {
startTime,
endTime,
finishCount,
overtimeCount,
totalCount,
unfinishCount,
inputText,
weekColor,
monthColor,
threeMonthColor,
sixMonthColor,
yearColor,
dovertimeCount,
} = this.state;
let allFinishRate =
totalCount === 0 || totalCount == undefined
? 0
: (((finishCount + overtimeCount) / totalCount) * 100).toFixed(1);
let finishRate =
totalCount === 0 || totalCount == undefined
? 0
: ((finishCount / totalCount) * 100).toFixed(1);
return (
<div>
{/* className='route-home' ,boxShadow:'inset 0 0 10px #ccc' */}
<div
style={{
backgroundColor: "white",
width: "1200px",
top: "0",
bottom: "0",
left: "0",
right: "0",
margin: "auto",
borderStyle: "solid",
borderColor: "#ccc",
borderWidth: "1px",
}}
>
<Modal
2024-01-22 09:18:38 +08:00
visible={this.state.visible}
title={this.state.noticeTitle}
maskClosable={false}
onCancel={this.handleCancel}
footer={null}
className="antd-modal-fullscreen"
2024-01-22 09:18:38 +08:00
closeModal={this.closeModal}
// forceRender={true}
2024-01-22 09:18:38 +08:00
>
<FormPage {...this.state.tmpData} />
</Modal>
<h1
style={{
textAlign: "center",
verticalAlign: "Bottom",
marginTop: "20px",
marginBottom: "40px",
fontWeight: "bold",
}}
>
任务完成情况统计分析(个人)
</h1>
<Row
style={{
fontSize: "15px",
marginTop: "10px",
// marginLeft: "30px",
margin: "0px 100px",
height: "35px",
}}
>
<span style={{ marginLeft: "10px", width: "100px" }}>
<b>姓名</b>
{inputText}
</span>
<span style={{ marginLeft: "30px", width: "100px" }}>
<b>统计区间</b>
{startTime} - {endTime}
</span>
<span style={{ float: "right", marginRight: "30px" }}>
<Input
onChange={this.handleSearch}
style={{ width: "150px", marginRight: "10px" }}
defaultValue={this.props.login.user.NAME}
></Input>
<Button
onClick={() => this.getMould(inputText)}
style={{ width: "80px" }}
type="primary"
>
查询
</Button>
</span>
</Row>
{/* <hr style={{ width: "98%" }}></hr> */}
<br></br>
<div
style={{
display: "flex",
alignItems: "center",
justifyContent: "center",
marginTop: "10px",
// marginBottom: "20px",
}}
>
<div className={styles.menuPie}>
<li>
总任务数
<br />
<div className={styles.dataStyle}>
{totalCount ? totalCount : 0}
</div>
</li>
<Divider
type="vertical"
style={{ width: "1px", height: "70px", margin: "9px 0px" }}
/>
<li>
待办数
<br />
<div className={styles.dataStyle1}>
{unfinishCount ? unfinishCount : 0}
</div>
</li>
<Divider
type="vertical"
style={{ width: "1px", height: "70px", margin: "9px 0px" }}
/>
<li>
超时待办数
<br />
<div className={styles.dataStyle3}>
{dovertimeCount ? dovertimeCount : 0}
</div>
</li>
<Divider
type="vertical"
style={{ width: "1px", height: "70px", margin: "9px 0px" }}
/>
<li>
已办事项
<br />
<div className={styles.dataStyle2}>
{finishCount + overtimeCount
? finishCount + overtimeCount
: 0}
</div>
{/* <a href="#" style={{ color: "red" }}> */}
{/* </a> */}
</li>
<Divider
type="vertical"
style={{ width: "1px", height: "70px", margin: "9px 0px" }}
/>
<li>
完成率
<br />
<div className={styles.dataStyle3}>
{allFinishRate ? allFinishRate : 0}%
</div>
{/* <a href="#" style={{ color: "red" }}> */}
{/* </a> */}
</li>
<Divider
type="vertical"
style={{ width: "1px", height: "70px", margin: "9px 0px" }}
/>
<li>
及时完成率
<br />
<div className={styles.dataStyle3}>
{finishRate ? finishRate : 0}%
</div>
</li>
</div>
</div>
{/* <span style={{width:"800px",marginLeft:"30px",marginBottom:"20px"}}>
2024-01-22 09:18:38 +08:00
<Button style={{width:"120px",height:"80px",borderRadius: '8px',border:'1px RGB(24, 149, 255) solid',marginRight:"10px"}}>总任务数<br></br><span style={{fontWeight:"bold",fontSize:"30px",color:'black'}}>{totalCount?totalCount:0}</span></Button>
<Button style={{width:"120px",height:"80px",borderRadius: '8px',border:'1px RGB(24, 149, 255) solid',marginRight:"10px"}}>待办数<br></br><span style={{fontWeight:"bold",fontSize:"30px",color:'red'}}>{unfinishCount?unfinishCount:0}</span></Button>
<Button style={{width:"120px",height:"80px",borderRadius: '8px',border:'1px RGB(24, 149, 255) solid',marginRight:"10px"}}>超时待办数<br></br><span style={{fontWeight:"bold",fontSize:"30px",color:'orange'}}>{dovertimeCount?dovertimeCount:0}</span></Button>
<Button style={{width:"120px",height:"80px",borderRadius: '8px',border:'1px RGB(24, 149, 255) solid',marginRight:"10px"}}>已办事项<br></br><span style={{fontWeight:"bold",fontSize:"30px",color:'green'}}>{(finishCount+overtimeCount)?(finishCount+overtimeCount):0}</span></Button>
<Button style={{width:"130px",height:"80px",borderRadius: '8px',border:'1px RGB(24, 149, 255) solid',marginRight:"10px"}}>完成率<br></br><span style={{fontWeight:"bold",fontSize:"30px",color:'orange'}}>{allFinishRate?allFinishRate:0}%</span></Button>
<Button style={{width:"140px",height:"80px",borderRadius: '8px',border:'1px RGB(24, 149, 255) solid',marginRight:"10px"}}>及时完成率<br></br><span style={{fontWeight:"bold",fontSize:"30px",color:'orange'}}>{finishRate?finishRate:0}%</span></Button>
</span> */}
{/* <hr style={{border:'1px dashed #ccc',marginBottom:"20px",marginTop:"20px"}}></hr> */}
<Row
style={{
marginTop: "20px",
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
<Col
span={24}
style={{
display: "flex",
alignItems: "center",
justifyContent: "center",
width: "1100px",
}}
>
{/* <h2 style={{textAlign:'center',fontWeight:'bold'}}>任务及时完成率近12个月</h2> */}
<div
id="ksRun"
style={{
width: "100%",
height: "400px",
backgroundColor: "white",
borderStyle: "solid",
borderColor: "#ccc",
borderWidth: "1px",
}}
></div>
{/* <br></br> */}
{/* <span style={{ width: "100%" }}>
* 统计时间{moment(new Date()).format("YYYY-MM-DD HH:mm:ss")}
<br></br>
<br></br>
</span> */}
</Col>
</Row>
<Row
style={{
marginTop: "20px",
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
<Col
span={24}
style={{
display: "flex",
alignItems: "center",
justifyContent: "center",
width: "1100px",
}}
>
{/* <h2 style={{textAlign:'left',fontWeight:'bold',marginLeft:"30px"}}><Icon type="appstore"/> 部门统计分析</h2> */}
<Table
style={{
width: "100%",
// marginLeft: "30px",
textAlign: "center",
marginBottom: "30px",
}}
// scroll={{ y: 400 }}
2024-01-22 09:18:38 +08:00
dataSource={this.state.retData}
columns={this.state.columns}
pagination={false}
loading={false}
size="small"
bordered
/>
</Col>
</Row>
</div>
2024-01-22 09:18:38 +08:00
</div>
);
2024-01-22 09:18:38 +08:00
}
}
export default connect(({ login, app, loading }) => ({ login, app, loading }))(
BI011FormRunAnalysis
);