Pārlūkot izejas kodu

other: 暂存,切换分支

ZhaoJun 2 gadi atpakaļ
vecāks
revīzija
6f166cb9bc

+ 32 - 7
src/components/DDComponents/DIYTable/index.tsx

@@ -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}

+ 1 - 5
src/components/DDComponents/index.js

@@ -114,11 +114,7 @@ export default function DDComponents(props) {
       break;
     case 'DIYTable':
       component = (
-        <DIYTable
-          tableID={item.props.id}
-          columns={item.columns}
-          onChange={onChange}
-        />
+        <DIYTable table={item} columns={item.columns} onChange={onChange} />
       );
       break;
     case 'RelateField': //关联审批单