1
|
-import React, { memo, useEffect } from 'react';
|
1
|
+import React, { memo } from 'react';
|
2
|
import { Space } from 'antd';
|
2
|
import { Space } from 'antd';
|
3
|
import { QxSearchForm, QxTable, QxToolbar } from '@/src/components/view-render';
|
3
|
import { QxSearchForm, QxTable, QxToolbar } from '@/src/components/view-render';
|
|
|
4
|
+import { useRequest } from 'ahooks';
|
4
|
import { getData } from './services';
|
5
|
import { getData } from './services';
|
5
|
import data from './data.json';
|
6
|
import data from './data.json';
|
6
|
|
7
|
|
7
|
const AppView: React.FC<AppViewProps> = (props) => {
|
8
|
const AppView: React.FC<AppViewProps> = (props) => {
|
8
|
const { search, list, bar } = data;
|
9
|
const { search, list, bar } = data;
|
|
|
10
|
+ const { data: tableData = {} as any, run, loading } = useRequest(getData);
|
|
|
11
|
+
|
9
|
const changeFullscreen = () => {};
|
12
|
const changeFullscreen = () => {};
|
10
|
-
|
|
|
11
|
- useEffect(() => {
|
|
|
12
|
- getData().then((res: any) => {
|
|
|
13
|
- console.log('res', res);
|
|
|
14
|
- });
|
|
|
15
|
- }, []);
|
|
|
16
|
|
13
|
|
17
|
return (
|
14
|
return (
|
18
|
<Space direction="vertical" size={20}>
|
15
|
<Space direction="vertical" size={20}>
|
19
|
- <QxSearchForm {...search} />
|
16
|
+ <QxSearchForm {...search} onSearch={() => run()} />
|
20
|
<QxToolbar
|
17
|
<QxToolbar
|
21
|
isFullscreen
|
18
|
isFullscreen
|
22
|
changeFullscreen={changeFullscreen}
|
19
|
changeFullscreen={changeFullscreen}
|
23
|
buttons={bar.buttons}
|
20
|
buttons={bar.buttons}
|
24
|
/>
|
21
|
/>
|
25
|
- <QxTable columns={list.columns} />
|
22
|
+ <QxTable
|
|
|
23
|
+ loading={loading}
|
|
|
24
|
+ columns={list.columns}
|
|
|
25
|
+ dataSource={tableData.list}
|
|
|
26
|
+ />
|
26
|
</Space>
|
27
|
</Space>
|
27
|
);
|
28
|
);
|
28
|
};
|
29
|
};
|