项目周报 - 项目管理系统
import React, { useEffect, useState } from 'react'; import ContentCard from '@/components/ContentCard'; import PageContainer from '@/components/PageContainer'; import ProCardComponent from '@/components/ProCard'; import ProCard from '@ant-design/pro-card'; import ProTable, { ProColumns } from '@ant-design/pro-table'; import { Button, Typography } from 'antd'; import { PlusOutlined } from '@ant-design/icons'; import { history, useModel } from 'umi'; import TaskModal from './TaskModal'; import { getBudgetByProjectId, getWeeklyData } from '@/services/project/kanban'; import moment from 'moment'; const { Link } = Typography; import './index.less'; import { projectList, WeeklyList } from '../../Kanban/WeeklyReports/type';
const WeeklyReport: React.FC = () => {
const [depBugModal, setDepBugModal] = useState({ visible: false, projectTask: {} });
const { current, changeCurrent } = useModel('operation');
const [budgetKey, setBudgetKey] = useState('');
const [WeeklyData, setWeeklyData] = useState([]);
const [loading, setLoading] = useState
setWeeklyData(tableData);
} catch (error) {
return { success: false };
}
}; const getBudgetByProjectIds = async (id: string) => { try { const { data } = await getBudgetByProjectId({ projectId: id }); const bugValue = data.bpProjectId; setBudgetKey(bugValue); } catch (error) { return { success: false }; } };
useEffect(() => { if (current) { getBudgetByProjectIds(current); } }, [current]); useEffect(() => { if (budgetKey && current) { getWeeklyDatas(); } }, [budgetKey, current]);
const columns: ProColumns[] = [
{
title: '序号',
width: 20,
dataIndex: 'serial',
align: 'center',
render: (value, row) => {
return {
children: value,
props: { rowSpan: row.span },
};
},
},
{
title: '周报',
dataIndex: 'weeklyName',
align: 'left',
hideInSearch: true,
width: 60,
render: (text, record) => {
return (
<Link
onClick={() => {
history.push(
/project/operation/projectDocuments/reportDetails?weeklyName=${record.weeklyName}&weeklyTime=${record.weeklyTime}&creator=${record.creator},
);
}}
>
{record.weeklyName}
);
},
onCell: (row) => {
return { rowSpan: row.span };
},
},
{
title: 'SPM',
dataIndex: 'spm',
align: 'center',
hideInSearch: true,
width: 30,
},
{
title: '创建时间',
dataIndex: 'createTime',
align: 'center',
hideInSearch: true,
width: 45,
render: (value, row) => {
return {
children: value,
props: { rowSpan: row.span },
};
},
},
{
title: '创建人',
dataIndex: 'creator',
align: 'center',
hideInSearch: true,
width: 40,
render: (value, row) => {
return {
children: value,
props: { rowSpan: row.span },
};
},
},
{
title: '任务总数',
dataIndex: 'task',
align: 'center',
hideInSearch: true,
width: 40,
render: (, record) => {
return (
<span
onClick={() => setDepBugModal({ visible: true, projectTask: record.task })}
style={{ cursor: 'pointer', color: '#1890FF' }}
>
{record.task?.length || '0'}
);
},
onCell: (row) => {
return { rowSpan: row.span };
},
},
{
title: '本周完成任务',
dataIndex: 'finishedTask',
align: 'center',
hideInSearch: true,
width: 45,
render: (, record) => {
return (
<span
onClick={() => setDepBugModal({ visible: true, projectTask: record.finishedTask })}
style={{ cursor: 'pointer', color: '#1890FF' }}
>
{record.finishedTask?.length || '0'}
);
},
onCell: (row) => {
return { rowSpan: row.span };
},
},
{
title: '待完成任务',
dataIndex: 'unFinishedTask',
align: 'center',
hideInSearch: true,
width: 40,
render: (, record) => {
return (
<span
onClick={() => setDepBugModal({ visible: true, projectTask: record.unFinishedTask })}
style={{ cursor: 'pointer', color: '#1890FF' }}
>
{record.unFinishedTask?.length || '0'}
);
},
onCell: (row) => {
return { rowSpan: row.span };
},
},
{
title: '周报合并项目(共预算项目)',
dataIndex: 'projectName',
align: 'center',
hideInSearch: true,
width: 100,
render: (, record: any) => {
return (
<div style={{ textAlign: 'left' }}>
<Link
onClick={() => {
changeCurrent(record.projectId);
history.push(/project/operation/home?projectId=${record.projectId});
}}
>
{record.projectName}
return (