103 lines
2.4 KiB
JavaScript
103 lines
2.4 KiB
JavaScript
/*
|
|
* @Author: Chengliang 1546584672@qq.com
|
|
* @Date: 2023-09-11 15:33:27
|
|
* @LastEditors: Chengliang 1546584672@qq.com
|
|
* @LastEditTime: 2023-09-15 11:39:05
|
|
* @FilePath: /org-chart-frant/src/pages/statisticsTable.jsx
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
*/
|
|
import React, { useEffect, useState, useRef } from 'react';
|
|
import * as d3 from 'd3';
|
|
import qs from 'qs';
|
|
import { Table } from 'antd';
|
|
|
|
const StatisticsTable = () => {
|
|
const [loading, setLoading] = useState(true);
|
|
const [dataSource, setDataSource] = useState([]);
|
|
const [columns, setColumns] = useState([]);
|
|
|
|
useEffect(() => {
|
|
const columns = [
|
|
{
|
|
title: '序号',
|
|
dataIndex: 'key',
|
|
key: 'key',
|
|
},
|
|
{
|
|
title: '名称',
|
|
dataIndex: 'dataIdName',
|
|
key: 'dataIdName',
|
|
},
|
|
{
|
|
title: '上级',
|
|
dataIndex: 'superIdName',
|
|
key: 'superIdName',
|
|
},
|
|
{
|
|
title: '类型',
|
|
dataIndex: 'type',
|
|
key: 'type',
|
|
render(value, row, index) {
|
|
if (value == 1) {
|
|
return '分部';
|
|
} else {
|
|
return '部门';
|
|
}
|
|
},
|
|
},
|
|
{
|
|
title: '在编数',
|
|
dataIndex: 'onJobNum',
|
|
key: 'onJobNum',
|
|
},
|
|
{
|
|
title: '编制数',
|
|
dataIndex: 'staffNum',
|
|
key: 'staffNum',
|
|
},
|
|
{
|
|
title: '创建人',
|
|
dataIndex: 'creator',
|
|
key: 'creator',
|
|
},
|
|
{
|
|
title: '创建时间',
|
|
dataIndex: 'createTime',
|
|
key: 'createTime',
|
|
},
|
|
{
|
|
title: '更新时间',
|
|
dataIndex: 'updateTime',
|
|
key: 'updateTime',
|
|
},
|
|
];
|
|
setColumns(columns);
|
|
d3.json(`/api/bs/hrmorganization/orgchart/selectStatistics`).then((res) => {
|
|
setDataSource(res.data.result);
|
|
setLoading(false);
|
|
});
|
|
}, [true]);
|
|
|
|
return (
|
|
<>
|
|
<div style={{ padding: '50px' }}>
|
|
<Table
|
|
dataSource={dataSource}
|
|
columns={columns}
|
|
loading={loading}
|
|
pagination={{
|
|
locale: {
|
|
items_per_page: '条/页',
|
|
jump_to: '跳至',
|
|
page: '页',
|
|
},
|
|
showTotal: (total) => `共 ${dataSource.length} 条`,
|
|
}}
|
|
/>
|
|
;
|
|
</div>
|
|
</>
|
|
);
|
|
};
|
|
export default StatisticsTable;
|