里程碑检查列表 - 项目管理系统
import ContentCard from '@/components/ContentCard'; import { PageContainer } from '@ant-design/pro-layout'; import { Button, Radio, Typography } from 'antd'; import ProTable from '@ant-design/pro-table'; import ProCard from '@/components/ProCard'; import React, { useRef, useState } from 'react'; import { history } from 'umi'; const { Link } = Typography; import './index.less'; import { getProjectMilepostPage, getDropdownPage, getPlanItemNameList, } from '@/services/project/kanban'; import { queryDict } from '@/services/common';
import moment from 'moment'; import { TYPE_PROJECT } from '@/constant/new'; import { ProFormInstance } from '@ant-design/pro-form';
const titleSR = [
{ name: 'SR5', value: 'SR5' },
{ name: 'SR4A', value: 'SR4A' },
{ name: 'SR4-2', value: 'SR4-2' },
{ name: 'SR6', value: 'SR6' },
{ name: 'SR4-1', value: 'SR4-1' },
{ name: 'SR4', value: 'SR4' },
{ name: 'SR3', value: 'SR3' },
{ name: 'SR2', value: 'SR2' },
{ name: 'SR1', value: 'SR1' },
];
const MilestoneCheckList: React.FC = () => {
const [radioValue, setRadioValue] = useState
const radioChange = (e: any) => { setRadioValue(e.target.value); setMilestList({ featureFlag: e.target.value }); };
return (
);
};
export default MilestoneCheckList; 原文地址: http://www.cveoy.top/t/topic/p82H 著作权归作者所有。请勿转载和采集! // 将milestList对象赋值给params对象
params = { ...params, ...milestList };
try {
let mileName = '';
if (radioValue === false) {
mileName = 'LeadingMode';
} else if (radioValue === true) {
mileName = 'feature评审点';
}
const result = await getPlanItemNameList({ name: mileName });
delete params.pageSize;
const {
data: { total, records },
} = await getProjectMilepostPage({
...params,
current: params.current || 1,
size: params.pageSize || 20,
featureFlag: radioValue,
keyword,
nodeName: params.nodeNames,
nodeNames: undefined,
});
const checklistData = records; // data.record.planNodeList(动态渲染后面SR)
const lastColumns = result?.data?.map((title: any) => {
return {
title,
width: 100,
dataIndex: title,
hideInSearch: true,
render: (text: any, record: any) => {
if (!record.planNodeList) {
return (
<div>
<div className='cellBorder'>'-'</div>
<div className='cellNoBorder'>'-'</div>
</div>
);
}
const ind = record?.planNodeList?.findIndex(
(ite: any) => ite.itemName === title,
);
return (
<div>
<div className='cellBorder'>
{record?.planNodeList[ind]?.itemPlanTime
? moment(record?.planNodeList[ind]?.itemPlanTime).format(
'YYYY-MM-DD',
)
: '-'}
</div>
<div className='cellNoBorder'>
{record?.planNodeList[ind]?.itemRealTime
? moment(record?.planNodeList[ind]?.itemRealTime).format(
'YYYY-MM-DD',
)
: '-'}
</div>
</div>
);
},
};
});
const columns = [
{
title: '序号',
width: 50,
dataIndex: 'index',
align: 'center',
valueType: 'index',
},
{
title: '项目一级类型',
dataIndex: 'projectOneLvlTypeEnum',
align: 'center',
hideInTable: true,
valueType: 'select',
request: async () => {
const { data } = await queryDict({
types: ['ProjectOneLvlTypeEnum'],
});
return data[0].enumTypeVOS;
},
fieldProps: {
allowClear: false,
},
formItemProps:{
initialValue:'PRODUCT_DEV'
},
},
{
title: '项目类型',
dataIndex: 'projectTypeList',
align: 'center',
width: 120,
valueType: 'select',
hideInTable: true,
request: async () => {
const { data } = await queryDict({
types: ['ProjectType'],
});
return data[0].enumTypeVOS;
},
fieldProps: {
allowClear: false,
mode: 'multiple',
},
},
{
title: '项目类型',
dataIndex: 'projectType',
align: 'center',
hideInSearch: true,
width: 120,
render: (_: any, row: any) => {
return <span>{TYPE_PROJECT[row.projectType]}</span>;
},
},
{
title: '项目ID',
dataIndex: 'projectId',
align: 'center',
hideInSearch: true,
width: 50,
// onCell: (_, index: any) => {
// if (index % 2 === 0) {
// return { rowSpan: 2 };
// }
// return { rowSpan: 0 };
// },
},
{
title: '项目名称',
dataIndex: 'projectName',
align: 'center',
hideInSearch: true,
width: 300,
render: (_, record: any) => (
<div style={{ textAlign: 'left' }}>
<Link
onClick={() =>
history.push(`/project/operation/home?projectId=${record.projectId}`)
}
>
{record.projectName}
</Link>
</div>
),
// onCell: (_, index: any) => {
// if (index % 2 === 0) {
// return { rowSpan: 2 };
// }
// return { rowSpan: 0 };
// },
},
{
title: '产品大类',
dataIndex: 'productType',
align: 'center',
hideInTable: true,
valueType: 'select',
request: async () => {
const { data } = await queryDict({
types: ['ProductType'],
});
return data[0].enumTypeVOS;
},
},
{
title: 'SPM',
dataIndex: 'spmUserName',
align: 'center',
width: 80,
request: async () => {
const { data } = await getDropdownPage({
kanbanDropdownType: 'SPM_ROLE',
});
return data.records;
},
fieldProps: {
showSearch: true,
fieldNames: {
label: 'name',
value: 'code',
},
},
},
{
title: '项目节点',
dataIndex: 'nodeNames',
width: 80,
hideInTable: true,
valueType: 'select',
fieldProps: {
options: titleSR,
},
},
{
title: '时间',
dataIndex: 'planTimeName',
align: 'center',
hideInSearch: true,
width: 100,
render: () => {
return (
<div>
<div className='cellBorder'>'计划时间'</div>
<div className='cellNoBorder'>'实际时间'</div>
</div>
);
},
},
...lastColumns,
];
checklistData.map((item: any) => {
item.key = item.projectId;
// const tempPlan = Object.assign({}, item);
// // const tempReal = Object.assign({}, item);
// tempPlan.key = tempPlan.projectId + '1';
// // tempReal.key = tempPlan.projectId + '2';
// d.push(tempPlan);
// // d.push(tempReal);
});
setColumnsEnding(columns);
return {
success: true,
data: checklistData,
total,
};
} catch (error) {
return { success: false };
}
}}
/>
</div>
</ContentCard>
</ProCard>
</PageContainer>