@yorha2b-lab/autodev 2.1.16 → 2.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { MySearchForm } from './MySearchForm'
|
|
|
5
5
|
import { useTableQuery } from '../hooks/useTableQuery'
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
export const MyModalTable = ({ api, onOk, title, width, footer, visible, columns, operate, setModal, formItems, setModalForm, rowSelection, formatResponse, functionButtons, extraParams = {} }) => {
|
|
8
|
+
export const MyModalTable = ({ api, onOk, title, width, footer, visible, columns, operate, setModal, formItems, setModalForm, rowSelection, formatResponse, functionButtons, extraParams = {}, modalPagination = true }) => {
|
|
9
9
|
|
|
10
10
|
const [pending, setPending] = useState(false)
|
|
11
11
|
|
|
@@ -15,17 +15,18 @@ export const MyModalTable = ({ api, onOk, title, width, footer, visible, columns
|
|
|
15
15
|
|
|
16
16
|
const handleTableChange = (pagination, filters, sorter) => setSearch({ ...search, pageNo: pagination.current, pageSize: pagination.pageSize, orderBy: sorter.column ? sorter.field : undefined })
|
|
17
17
|
|
|
18
|
-
const handleOk = () => {
|
|
18
|
+
const handleOk = async () => {
|
|
19
19
|
if (onOk) {
|
|
20
20
|
try {
|
|
21
21
|
setPending(true)
|
|
22
|
-
onOk()
|
|
22
|
+
await onOk()
|
|
23
23
|
setPending(false)
|
|
24
24
|
} catch (error) {
|
|
25
25
|
console.log('操作失败:', error)
|
|
26
|
+
} finally {
|
|
27
|
+
setPending(false)
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
|
-
setModal({ visible: false })
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
return (
|
|
@@ -33,11 +34,13 @@ export const MyModalTable = ({ api, onOk, title, width, footer, visible, columns
|
|
|
33
34
|
{formItems?.length > 0 && <MySearchForm search={search} formItems={formItems} setSearch={handleSearch} syncUrlParams={false} />}
|
|
34
35
|
{functionButtons?.length > 0 && <Space>{functionButtons.map(item => <Button key={item.name} type={item.type} onClick={item.onClick}>{item.name}</Button>)}</Space>}
|
|
35
36
|
<MyTable
|
|
36
|
-
|
|
37
|
+
total={total}
|
|
38
|
+
search={search}
|
|
37
39
|
loading={loading}
|
|
38
40
|
scroll={{ y: 400 }}
|
|
39
41
|
dataSource={dataSource}
|
|
40
42
|
rowSelection={rowSelection}
|
|
43
|
+
pagination={modalPagination}
|
|
41
44
|
onChange={handleTableChange}
|
|
42
45
|
setDataSource={setDataSource}
|
|
43
46
|
columns={operate ? columns.concat(operate({ refresh, setModalForm })) : columns}
|