|
@@ -10,14 +10,18 @@ const ReportTable = ({ data, month }) => {
|
|
|
if (!data) return [];
|
|
|
// return data
|
|
|
return data.filter(
|
|
|
- item => item.unsubmittedReports.length > 0 || item.lateSubmissions.length > 0
|
|
|
+ (item) =>
|
|
|
+ item.unsubmittedReports.length > 0 || item.lateSubmissions.length > 0,
|
|
|
);
|
|
|
}, [data]);
|
|
|
|
|
|
const exportToExcel = () => {
|
|
|
const worksData1 = dataSource
|
|
|
- .filter(item => item.unsubmittedReports.length > 0 || item.lateSubmissions.length > 0)
|
|
|
- .map(item => ({
|
|
|
+ .filter(
|
|
|
+ (item) =>
|
|
|
+ item.unsubmittedReports.length > 0 || item.lateSubmissions.length > 0,
|
|
|
+ )
|
|
|
+ .map((item) => ({
|
|
|
工号: item.userId,
|
|
|
姓名: item.name,
|
|
|
迟交次数: item.lateSubmissions.length,
|
|
@@ -26,7 +30,7 @@ const ReportTable = ({ data, month }) => {
|
|
|
}));
|
|
|
const worksheet1 = XLSX.utils.json_to_sheet(worksData1);
|
|
|
|
|
|
- const worksData2 = dataSource.map(item => ({
|
|
|
+ const worksData2 = dataSource.map((item) => ({
|
|
|
工号: item.userId,
|
|
|
姓名: item.name,
|
|
|
迟交: item.lateSubmissions.join(','),
|
|
@@ -41,7 +45,10 @@ const ReportTable = ({ data, month }) => {
|
|
|
XLSX.utils.book_append_sheet(workbook, worksheet1, '总览');
|
|
|
XLSX.utils.book_append_sheet(workbook, worksheet2, '详情');
|
|
|
|
|
|
- const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
|
|
|
+ const excelBuffer = XLSX.write(workbook, {
|
|
|
+ bookType: 'xlsx',
|
|
|
+ type: 'array',
|
|
|
+ });
|
|
|
const data = new Blob([excelBuffer], {
|
|
|
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
|
});
|
|
@@ -70,7 +77,7 @@ const ReportTable = ({ data, month }) => {
|
|
|
title: '漏交',
|
|
|
dataIndex: 'unsubmittedReports',
|
|
|
key: 'unsubmittedReports',
|
|
|
- render: unsubmittedReports => (
|
|
|
+ render: (unsubmittedReports) => (
|
|
|
<Tooltip title={unsubmittedReports.join(',')}>
|
|
|
<a>{unsubmittedReports.length}</a>
|
|
|
</Tooltip>
|
|
@@ -80,7 +87,7 @@ const ReportTable = ({ data, month }) => {
|
|
|
title: '迟交',
|
|
|
dataIndex: 'lateSubmissions',
|
|
|
key: 'lateSubmissions',
|
|
|
- render: lateSubmissions => (
|
|
|
+ render: (lateSubmissions) => (
|
|
|
<Tooltip title={lateSubmissions.join(',')}>
|
|
|
<a>{lateSubmissions.length}</a>
|
|
|
</Tooltip>
|
|
@@ -90,7 +97,7 @@ const ReportTable = ({ data, month }) => {
|
|
|
title: '请假',
|
|
|
dataIndex: 'takingLeaveReports',
|
|
|
key: 'takingLeaveReports',
|
|
|
- render: takingLeaveReports => (
|
|
|
+ render: (takingLeaveReports) => (
|
|
|
<Tooltip title={takingLeaveReports.join(',')}>
|
|
|
<a>{takingLeaveReports.length}</a>
|
|
|
</Tooltip>
|
|
@@ -109,11 +116,11 @@ const ReportTable = ({ data, month }) => {
|
|
|
|
|
|
{
|
|
|
title: '操作',
|
|
|
- render: item => <a onClick={() => showModal(item)}>日志提交时间</a>,
|
|
|
+ render: (item) => <a onClick={() => showModal(item)}>日志提交时间</a>,
|
|
|
},
|
|
|
];
|
|
|
|
|
|
- const showModal = item => {
|
|
|
+ const showModal = (item) => {
|
|
|
setItem(item);
|
|
|
setVisible(true);
|
|
|
};
|