Commit f3f9be8e authored by XieZhiXiong's avatar XieZhiXiong

chore: 替换 table

parent bf7bb16f
......@@ -2,20 +2,18 @@
* @Author: XieZhiXiong
* @Date: 2021-05-27 17:12:55
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-01 14:52:18
* @LastEditTime: 2021-07-16 15:25:38
* @Description: 适用会员角色 Form Item
*/
import React, { useState, useRef } from 'react';
import React, { useState, useEffect } from 'react';
import { Button, Descriptions, Drawer, message } from 'antd';
import {
PlusOutlined,
} from '@ant-design/icons';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions } from '@formily/antd';
import { PublicApi } from '@/services/api';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import NiceForm from '@/components/NiceForm';
import PolymericTable, { FetchParamsType } from '@/components/PolymericTable';
import querySchema from './schema';
import styles from './index.less';
......@@ -42,15 +40,12 @@ export type ValueType = {
businessTypeName: string,
};
const formActions = createFormActions();
const fetchListData = async (params: any) => {
const payload = { ...params };
const res = await PublicApi.getMemberProcessRuleRolePage(payload);
if (res.code === 1000) {
return res.data;
}
return [];
};
const MemberRoleFormItem = (props) => {
......@@ -61,8 +56,6 @@ const MemberRoleFormItem = (props) => {
} = props;
const [visibleDrawer, setVisibleDrawer] = useState(false);
const ref = useRef<any>({});
const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'roleId', type: 'radio' });
const columns: ColumnType<ValueType>[] = [
......@@ -88,6 +81,13 @@ const MemberRoleFormItem = (props) => {
},
];
useEffect(() => {
if (value) {
RowCtl.setSelectedRowKeys([value.roleId]);
RowCtl.setSelectRow([value]);
}
}, [value]);
const handleVisibleDrawer = (flag: boolean) => {
setVisibleDrawer(!!flag);
};
......@@ -126,6 +126,9 @@ const MemberRoleFormItem = (props) => {
width={1000}
onClose={() => handleVisibleDrawer(false)}
visible={visibleDrawer}
bodyStyle={{
paddingBottom: 0,
}}
footer={
<div
style={{
......@@ -141,24 +144,16 @@ const MemberRoleFormItem = (props) => {
</div>
}
>
<StandardTable
tableProps={{
rowKey: 'roleId',
}}
<PolymericTable
rowKey="roleId"
columns={columns}
currentRef={ref}
rowSelection={rowSelection}
fetchTableData={(params: any) => fetchListData(params)}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
effects={($, actions) => {
}}
schema={querySchema}
/>
}
searchFormProps={{
schema: querySchema,
}}
fetchDataSource={fetchListData}
defaultPageSize={15}
full
/>
</Drawer>
</div>
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-05-27 18:01:56
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-28 11:07:18
* @LastEditTime: 2021-07-16 14:52:53
* @Description:
*/
import { ISchema } from '@formily/antd';
......@@ -10,20 +10,17 @@ import { ISchema } from '@formily/antd';
const querySchema: ISchema = {
type: 'object',
properties: {
MAGE_LAYOUT: {
type: 'object',
'x-component': 'Mega-Layout',
properties: {
name: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
tip: '输入 中文名称 进行搜索',
advanced: false,
align: 'flex-left',
},
},
name: {
type: 'string',
'x-mega-props': {
wrapperCol: 12,
},
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
tip: '输入 中文名称 进行搜索',
advanced: false,
align: 'flex-left',
},
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment