mh_jy_safe_web/src/components/CustomPages/BI/BI012NotificationTaskAnalysis.js
2025-08-25 10:08:30 +08:00

182 lines
4.9 KiB
JavaScript

import React, { useState, useEffect, useRef, Component } from 'react'
import { connect } from 'dva'
import { initFilter, addRuleAndGroups, guid, extendInclude, extendRule, extendOrder, extend, initQueryFilter } from "../../../utils/common"
import { Table, Row, Col, Button, Select, DatePicker, message } from 'antd';
class NotificationTaskAnalysis extends React.Component {
constructor(props) {
super(props);
this.state = {
pagination: {},
showLoading: false,
retData: [],
};
};
componentDidMount() {
let currentType = "1";
if (this.props.formParam != undefined || this.props.formParam != null) {
currentType = this.props.formParam.type;
}
if (currentType == 2) {
this.state.columns1 = [
{
title: '序号',
render: (text, record, index) => `${index + 1}`
},
{
title: '班组',
dataIndex: 'NAME1',
},
{
title: '昨天',
dataIndex: 'NAME2',
},
{
title: '今天',
dataIndex: 'NAME3',
},
{
title: '明天',
dataIndex: 'NAME4',
}, {
title: '后天',
dataIndex: 'NAME5',
},
]
this.loadData1();
} else {
this.state.columns1 = [
{
title: '序号',
render: (text, record, index) => `${index + 1}`
},
{
title: '模块',
dataIndex: 'NAME1',
},
{
title: '表单名称',
dataIndex: 'NAME2',
},
{
title: '待办数',
dataIndex: 'NAME3',
sorter: (a, b) => a.NAME3 - b.NAME3,
},
{
title: '完成数',
dataIndex: 'NAME4',
sorter: (a, b) => a.NAME4 - b.NAME4,
}, {
title: '完成率',
dataIndex: 'NAME5',
sorter: (a, b) => a.NAME5 - b.NAME5,
render: (text, record) => (
<span>
{record.NAME5}{"%"}
</span>
),
},
{
title: '及时完成率',
dataIndex: 'NAME6',
sorter: (a, b) => a.NAME6 - b.NAME6,
render: (text, record) => (
<span>
{record.NAME6}{"%"}
</span>
),
},
{
title: '总数',
dataIndex: 'NAME7',
sorter: (a, b) => a.NAME7 - b.NAME7,
},
]
this.loadData();
}
};
loadData = () => {
const json = initFilter(this.props.login.OrgId);
this.state.showLoading = true;
json.Parameter1 = new Date().getFullYear() + "-01-01";
this.props.dispatch({
type: 'app/getDataByPost',
url: 'BI/BIController/getNotificationTask',
payload: json,
onlyData: false,
onComplete: (ret) => {
if (ret) {
this.state.showLoading = false;
ret.Data.sort((a, b) => {
if (a.NAME3 > b.NAME3) {
return -1;
} else if (a.NAME3 < b.NAME3) {
return 1;
} else {
return 0;
}
});
this.state.retData = ret.Data
}
}
})
}
loadData1 = () => {
const json = initFilter(this.props.login.OrgId);
this.state.showLoading = true;
this.props.dispatch({
type: 'app/getDataByPost',
url: 'BI/BIController/getScheduling',
payload: json,
onlyData: false,
onComplete: (ret) => {
if (ret) {
this.state.showLoading = false;
this.state.retData = ret.Data
}
}
})
}
onChange = (type, value) => {
this.setState({
[type]: value
})
}
paginationConfig = {
pageSizeOptions: ['10', '20', '50', '100'],
pageSize: 50,
showSizeChanger: true,
size: 'small',
}
render() {
return (
<div style={{ backgroundColor: 'white', width: '1200px', top: '0', bottom: '0', left: '0', right: '0', margin: 'auto', borderStyle: 'solid', borderColor: '#ccc', borderWidth: '1px', }}>
<h1 style={{ textAlign: "center", marginTop: '30px', fontWeight: 'bold' }}>待办统计</h1>
<hr style={{ border: '1px dashed #ccc', marginBottom: "20px", marginTop: "20px" }}></hr>
<Row gutter={10} style={{ marginTop: "14px" }}>
<Col span={1}></Col>
<Col span={22} style={{ height: '100%' }}>
<div className="dashboard-div-style" style={{ boxShadow: '0px 0px 10px rgba(0,0,0,.15)' }}>
<Table
dataSource={this.state.retData}
columns={this.state.columns1}
pagination={this.paginationConfig}
bordered
loading={this.state.showLoading}
size="small"
rowKey="1"
/>
</div>
</Col>
<Col span={1}></Col>
</Row>
<br />
</div>
)
}
}
export default connect(({ login, app }) => ({ login, app }))(NotificationTaskAnalysis)