// import { ProFormInstance } from '@ant-design/pro-form';
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',
bug: 'bug分析内容1'
}, {
key: 1,
totals: '0',
s: '0',
a: '0',
b: '0',
c: '0',
bug: 'bug分析内容2'
}];
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',
render: (text, record, index) => {
if (index === 1) {
return {
children: text,
props: {
rowSpan: 2
}
};
}
return text;
}
}, {
title: '总数',
dataIndex: 'totals',
align: 'center',
render: (_, record, index) => {
if (index === 1) {
return null;
}
return ;
}
}, {
title: 'S',
dataIndex: 's',
align: 'center',
render: (, record, index) => {
if (index === 1) {
return null;
}
return ;
}
}, {
title: 'A',
dataIndex: 'a',
align: 'center',
render: (, record, index) => {
if (index === 1) {
return null;
}
return ;
}
}, {
title: 'B',
dataIndex: 'b',
align: 'center',
render: (, record, index) => {
if (index === 1) {
return null;
}
return ;
}
}, {
title: 'C',
dataIndex: 'c',
align: 'center',
render: (, record, index) => {
if (index === 1) {
return null;
}
return ;
}
}, {
title: 'BUG分析',
dataIndex: 'bug',
align: 'center',
render: (, record, index) => {
if (index === 1) {
return null;
}
return ;
}
}];
useEffect(() => {
setEditableRowKeys(datas?.map((item: any) => item.id));
setData([...datas]);
}, []);
return (<ContentCard title={'BUG分析'} className="bug-list"><EditableProTable
rowKey="key"
recordCreatorProps={false}
actionRef={actionRef}
columns={columns}
value={data}
bordered
editable={{ type: 'multiple', editableKeys, onChange: setEditableRowKeys, onValuesChange: (, values) => { setData(values); }, actionRender: (row, config, defaultDoms) => { return []; } }}/>
);
});
export default BugAnalysis;