Skip to content

Commit 88cd81e

Browse files
committed
feat(Ballcat): 添加用户文档页面
1 parent 5cb78ef commit 88cd81e

File tree

4 files changed

+148
-0
lines changed

4 files changed

+148
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import Page from '@/components/Page';
2+
import { document } from '@/services/ballcat/sample';
3+
import type { DocumentQo, DocumentVo, Document } from '@/services/ballcat/sample';
4+
import type { ProColumns } from '@ant-design/pro-table';
5+
import { ProFormText } from '@ant-design/pro-form';
6+
import Lov from '@/components/Lov';
7+
import { Form } from 'antd';
8+
9+
const dataColumns: ProColumns<DocumentVo>[] = [
10+
{
11+
title: 'ID',
12+
dataIndex: 'id',
13+
},
14+
{
15+
title: '文档名称',
16+
dataIndex: 'name',
17+
hideInSearch: true,
18+
},
19+
{
20+
title: '所属用户ID',
21+
dataIndex: 'userId',
22+
hideInSearch: true,
23+
},
24+
{
25+
title: '所属用户',
26+
dataIndex: 'username',
27+
hideInSearch: true,
28+
},
29+
{
30+
title: '所属组织ID',
31+
dataIndex: 'organizationId',
32+
hideInSearch: true,
33+
},
34+
{
35+
title: '所属组织',
36+
dataIndex: 'organizationName',
37+
hideInSearch: true,
38+
},
39+
{
40+
title: '创建时间',
41+
dataIndex: 'createTime',
42+
width: '150px',
43+
sorter: true,
44+
hideInSearch: true,
45+
},
46+
];
47+
48+
export default () => {
49+
return (
50+
<Page.Modal<DocumentVo, DocumentQo, Document>
51+
{...document}
52+
rowKey="id"
53+
title="文档表,用于演示数据权限,可切换不同用户并授予不同角色体验效果(需退出重新登录)"
54+
columns={dataColumns}
55+
toolBarActions={[{ type: 'create', permission: 'sample:document:add' }]}
56+
operateBar={[{ type: 'del', permission: 'sample:document:del' }]}
57+
>
58+
<ProFormText hidden name="id" />
59+
60+
<ProFormText
61+
label="文档名称"
62+
name="name"
63+
rules={[{ required: true, message: '请输入文档名称!' }]}
64+
/>
65+
66+
<Form.Item
67+
label="所属用户"
68+
name="userId"
69+
rules={[{ required: true, message: '请选择所属用户!' }]}
70+
>
71+
<Lov keyword="ballcat_user_multiple" overwriteConfig={{ multiple: false }} />
72+
</Form.Item>
73+
</Page.Modal>
74+
);
75+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import type { PageResult, QueryParam, R } from '@/typings';
2+
import { request } from 'umi';
3+
import type { Document, DocumentQo, DocumentVo } from './typings';
4+
5+
export async function query(body: QueryParam<DocumentQo>) {
6+
return request<R<PageResult<DocumentVo>>>('sample/document/page', {
7+
method: 'GET',
8+
params: body,
9+
});
10+
}
11+
12+
export async function create(body: Document) {
13+
return request<R<any>>('sample/document', {
14+
method: 'POST',
15+
data: body,
16+
});
17+
}
18+
19+
export async function edit(body: Document) {
20+
return request<R<any>>('sample/document', {
21+
method: 'PUT',
22+
data: body,
23+
});
24+
}
25+
26+
export async function del(body: DocumentVo) {
27+
return request<R<any>>(`sample/document/${body.id}`, {
28+
method: 'DELETE',
29+
});
30+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
export type DocumentQo = {
2+
// ID
3+
id: number;
4+
};
5+
6+
export type DocumentVo = {
7+
// ID
8+
id: number;
9+
// 文档名称
10+
name: string;
11+
// 所属用户ID
12+
userId: number;
13+
// 用户名
14+
username: string;
15+
// 所属组织ID
16+
organizationId: number;
17+
// 组织名
18+
organizationName: string;
19+
// 创建时间
20+
createTime: string;
21+
// 更新时间
22+
updateTime: string;
23+
};
24+
25+
export type Document = {
26+
// ID
27+
id: number;
28+
// 文档名称
29+
name: string;
30+
// 所属用户ID
31+
userId: number;
32+
// 所属组织ID
33+
organizationId: number;
34+
// 创建时间
35+
createTime: string;
36+
// 更新时间
37+
updateTime: string;
38+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import * as document from './document';
2+
3+
export * from './document/typings';
4+
5+
export { document };

0 commit comments

Comments
 (0)