|
|
@@ -1,51 +1,51 @@
|
|
|
-import { Row } from 'antd'
|
|
|
-import React from 'react'
|
|
|
-import EditableFormItem from './editableFormItem'
|
|
|
-
|
|
|
-const EditableForm = ({ dataSource, columns, type, tartgetUrl }) => {
|
|
|
- // console.log(store)
|
|
|
- const newColumns = columns.map(item => {
|
|
|
- const newItem = { ...item }
|
|
|
-
|
|
|
- // 控制col span
|
|
|
- if (!item.span) {
|
|
|
- newItem.span = 24
|
|
|
- }
|
|
|
-
|
|
|
- // 默认编辑
|
|
|
- if (!item.editable) {
|
|
|
- newItem.editable = true
|
|
|
- }
|
|
|
-
|
|
|
- // 默认组件
|
|
|
- if (!item.editCellType) {
|
|
|
- newItem.editCellType = 'input'
|
|
|
- }
|
|
|
-
|
|
|
- return newItem
|
|
|
- })
|
|
|
- return (
|
|
|
- <Row>
|
|
|
- {newColumns.map(column => {
|
|
|
- return (
|
|
|
- <EditableFormItem
|
|
|
- type={type}
|
|
|
- key={column.dataIndex}
|
|
|
- label={column.label}
|
|
|
- dataSource={dataSource}
|
|
|
- dataIndex={column.dataIndex}
|
|
|
- // record={dataSource[column.dataIndex]}
|
|
|
- span={column.span}
|
|
|
- // dataId={dataSource.id}
|
|
|
- editable={column.editable}
|
|
|
- editCellType={column.editCellType}
|
|
|
- customCell={column.customCell}
|
|
|
- requestUrl={tartgetUrl}
|
|
|
- />
|
|
|
- )
|
|
|
- })}
|
|
|
- </Row>
|
|
|
- )
|
|
|
-}
|
|
|
-
|
|
|
-export default EditableForm
|
|
|
+import React from 'react'
|
|
|
+import { Row } from 'antd'
|
|
|
+import EditableFormItem from './editableFormItem'
|
|
|
+
|
|
|
+const EditableForm = ({ dataSource, columns, type, tartgetUrl }) => {
|
|
|
+ // console.log(store)
|
|
|
+ const newColumns = columns.map(item => {
|
|
|
+ const newItem = { ...item }
|
|
|
+
|
|
|
+ // 控制col span
|
|
|
+ if (!item.span) {
|
|
|
+ newItem.span = 24
|
|
|
+ }
|
|
|
+
|
|
|
+ // 默认编辑
|
|
|
+ if (!item.editable) {
|
|
|
+ newItem.editable = true
|
|
|
+ }
|
|
|
+
|
|
|
+ // 默认组件
|
|
|
+ if (!item.editCellType) {
|
|
|
+ newItem.editCellType = 'input'
|
|
|
+ }
|
|
|
+
|
|
|
+ return newItem
|
|
|
+ })
|
|
|
+ return (
|
|
|
+ <Row>
|
|
|
+ {newColumns.map(column => {
|
|
|
+ return (
|
|
|
+ <EditableFormItem
|
|
|
+ type={type}
|
|
|
+ key={column.dataIndex}
|
|
|
+ label={column.label}
|
|
|
+ dataSource={dataSource}
|
|
|
+ dataIndex={column.dataIndex}
|
|
|
+ // record={dataSource[column.dataIndex]}
|
|
|
+ span={column.span}
|
|
|
+ // dataId={dataSource.id}
|
|
|
+ editable={column.editable}
|
|
|
+ editCellType={column.editCellType}
|
|
|
+ customCell={column.customCell}
|
|
|
+ requestUrl={tartgetUrl}
|
|
|
+ />
|
|
|
+ )
|
|
|
+ })}
|
|
|
+ </Row>
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
+export default EditableForm
|