"use strict";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";import { projectNode } from '../BugetManagement/PlanChange/contant';// 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(false); const [columnsCheck, setColumnsEnding] = useState<any[]>([]); const [milestList, setMilestList] = useState({}); const formRef = useRef(); const radioChange = (e: any) => { setRadioValue(e.target.value); setMilestList({ featureFlag: e.target.value }); }; return ( <ProTable formRef={formRef} rowKey={'key'} className="nodeList" scroll={{ x: 'max-content', y: 'calc(100vh - 366px)' }} columns={columnsCheck} options={false} bordered search={{ // collapsed: false, labelWidth: 120, }} pagination={{ showSizeChanger: false }} headerTitle={
<Radio.Group defaultValue={radioValue} buttonStyle="solid" onChange={radioChange} > <Radio.Button value={false}>非Feature项目</Radio.Button> <Radio.Button value={true}>Feature项目</Radio.Button> </Radio.Group> <Button style={{ marginLeft: '10px' }} onClick={() => { const { current, pageSize, total } = formRef.current.getFieldsValue(); const downloadUrl = /project-manager-api/projectKanban/downloadProjectMilepostData?projectOneLvlTypeEnum=${ formRef?.current?.getFieldsValue()?.projectOneLvlTypeEnum }&productType=${ formRef?.current?.getFieldsValue()?.productType }&spmUserName=${ formRef?.current?.getFieldsValue()?.spmUserName }&featureFlag=${radioValue}&nodeNames=${[ formRef?.current?.getFieldsValue()?.nodeNames, ]}&projectTypeList=${[ formRef?.current?.getFieldsValue()?.projectTypeList ]}¤t=${current}&size=${pageSize}&total=${total}; window.location.href = downloadUrl; }} > 下载
} params={milestList} request={async (params: any) => { const { keyword } = params; 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 (
); } const ind = record?.planNodeList?.findIndex( (ite: any) => ite.itemName === title, ); return (
{record?.planNodeList[ind]?.itemPlanTime ? moment(record?.planNodeList[ind]?.itemPlanTime).format( 'YYYY-MM-DD', ) : '-'}
{record?.planNodeList[ind]?.itemRealTime ? moment(record?.planNodeList[ind]?.itemRealTime).format( 'YYYY-MM-DD', ) : '-'}
); }, }; }); 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 {TYPE_PROJECT[row.projectType]}; }, }, { 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} ), // 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; }, formItemProps: { initialValue: 'SMART_SCREEN', }, }, { 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: projectNode, mode: 'multiple', maxTagCount: 1, }, // formItemProps: { // initialValue: projectNode.map((item) => item.value), // }, }, { title: '时间', dataIndex: 'planTimeName', align: 'center', hideInSearch: true, width: 100, render: () => { return ( ); }, }, ...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 }; } }} />
);};export default MilestoneCheckLis