|
@@ -10,7 +10,7 @@ import TextNote from '@/components/DDComponents/TextNote';
|
|
|
import { PlusOutlined } from '@ant-design/icons';
|
|
|
|
|
|
interface IProps {
|
|
|
- tableID?: string;
|
|
|
+ table?: any;
|
|
|
columns?: Array<any>;
|
|
|
onChange: (e?: any, id?: string, label?: string) => void;
|
|
|
}
|
|
@@ -26,7 +26,7 @@ type TableDataType = {
|
|
|
};
|
|
|
|
|
|
function DIYTable(props: IProps) {
|
|
|
- const { tableID, columns, onChange } = props;
|
|
|
+ const { table, columns, onChange } = props;
|
|
|
|
|
|
const [tableData, setTableData] = useState<TableDataType[]>([{ index: 1 }]);
|
|
|
// 列配置
|
|
@@ -51,7 +51,13 @@ function DIYTable(props: IProps) {
|
|
|
return (
|
|
|
<DDSelectField
|
|
|
id={
|
|
|
- rowIndex + ',' + index + ';' + column.props.id + '>' + tableID
|
|
|
+ rowIndex +
|
|
|
+ ',' +
|
|
|
+ index +
|
|
|
+ ';' +
|
|
|
+ column.props.id +
|
|
|
+ '>' +
|
|
|
+ table.props.id
|
|
|
}
|
|
|
label={column.props.label + ';' + rowIndex + ',' + index}
|
|
|
style={{ padding: '0', margin: '0' }}
|
|
@@ -67,7 +73,13 @@ function DIYTable(props: IProps) {
|
|
|
return (
|
|
|
<DDDateField
|
|
|
id={
|
|
|
- rowIndex + ',' + index + ';' + column.props.id + '>' + tableID
|
|
|
+ rowIndex +
|
|
|
+ ',' +
|
|
|
+ index +
|
|
|
+ ';' +
|
|
|
+ column.props.id +
|
|
|
+ '>' +
|
|
|
+ table.props.id
|
|
|
}
|
|
|
label={column.props.label + ';' + rowIndex + ',' + index}
|
|
|
key={index + rowIndex + ''}
|
|
@@ -85,7 +97,13 @@ function DIYTable(props: IProps) {
|
|
|
return (
|
|
|
<NumberField
|
|
|
id={
|
|
|
- rowIndex + ',' + index + ';' + column.props.id + '>' + tableID
|
|
|
+ rowIndex +
|
|
|
+ ',' +
|
|
|
+ index +
|
|
|
+ ';' +
|
|
|
+ column.props.id +
|
|
|
+ '>' +
|
|
|
+ table.props.id
|
|
|
}
|
|
|
label={column.props.label + ';' + rowIndex + ',' + index}
|
|
|
size="small"
|
|
@@ -113,7 +131,7 @@ function DIYTable(props: IProps) {
|
|
|
';' +
|
|
|
column.props.id +
|
|
|
'>' +
|
|
|
- tableID,
|
|
|
+ table.props.id,
|
|
|
column.props.label + ';' + rowIndex + ',' + index,
|
|
|
)
|
|
|
}
|
|
@@ -127,7 +145,13 @@ function DIYTable(props: IProps) {
|
|
|
return (
|
|
|
<TextNote
|
|
|
id={
|
|
|
- rowIndex + ',' + index + ';' + column.props.id + '>' + tableID
|
|
|
+ rowIndex +
|
|
|
+ ',' +
|
|
|
+ index +
|
|
|
+ ';' +
|
|
|
+ column.props.id +
|
|
|
+ '>' +
|
|
|
+ table.props.id
|
|
|
}
|
|
|
style={{ padding: '0', margin: '0' }}
|
|
|
value={column.props.placeholder}
|
|
@@ -146,6 +170,7 @@ function DIYTable(props: IProps) {
|
|
|
|
|
|
return (
|
|
|
<>
|
|
|
+ {table.props.label}
|
|
|
<Table
|
|
|
columns={tableColumnDef}
|
|
|
dataSource={tableData}
|