import React, { ForwardedRef, forwardRef, useEffect, useRef, useState } from 'react'; import ContentCard from '@/components/ContentCard'; import { ActionType, EditableProTable, ProColumns } from '@ant-design/pro-table'; import ProForm, { ProFormTextArea } from '@ant-design/pro-form'; import './index.less';

export type BugFormRef = { getApplicationFormValue?: () => any; validateApplicationForm: () => Promise | undefined; };

interface Props { ref?: ForwardedRef; }

const datas = [ { key: 0, title: '新增BUG总数', totals: '1', s: '0', a: '1', b: '0', c: '0', mergeCells: ['title', 'totals', 's', 'a', 'b', 'c'], // 合并单元格 }, { key: 1, title: 'PEN BUG总数', totals: '0', s: '0', a: '0', b: '0', c: '0', mergeCells: ['title', 'totals', 's', 'a', 'b', 'c'], // 合并单元格 }, ];

const BugAnalysis: React.FC = forwardRef(() => { const actionRef = useRef(); const [data, setData] = useState([]); const [editableKeys, setEditableRowKeys] = useState<React.Key[]>([]);

const columns: ProColumns[] = [ { title: 'BUG等级', dataIndex: 'title', align: 'center', mergeCells: true, // 合并单元格 }, { title: '总数', dataIndex: 'totals', align: 'center', readonly: true, mergeCells: true, // 合并单元格 }, { title: 'S', dataIndex: 's', align: 'center', readonly: true, mergeCells: true, // 合并单元格 }, { title: 'A', dataIndex: 'a', align: 'center', readonly: true, mergeCells: true, // 合并单元格 }, { title: 'B', dataIndex: 'b', align: 'center', readonly: true, mergeCells: true, // 合并单元格 }, { title: 'C', dataIndex: 'c', align: 'center', readonly: true, mergeCells: true, // 合并单元格 }, { title: 'BUG分析', dataIndex: 'bug', align: 'center', readonly: true, }, ];

useEffect(() => { setEditableRowKeys(datas?.map((item: any) => item.id)); setData([...datas]); }, []);

return ( <ContentCard title={'BUG分析'} className="bug-list"> <EditableProTable rowKey="id" recordCreatorProps={false} actionRef={actionRef} columns={columns} value={data} bordered mergeCells // 开启合并单元格 editable={{ type: 'multiple', editableKeys, onChange: setEditableRowKeys, onValuesChange: (_, values) => { setData(values); }, actionRender: (row, config, defaultDoms) => { return []; }, }} /> ); });

export default BugAnalysis;

BUG分析表格

原文地址: https://www.cveoy.top/t/topic/qm63 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录