Skip to content

Commit 8709b27

Browse files
committed
add node
1 parent ebf3953 commit 8709b27

File tree

1 file changed

+61
-3
lines changed

1 file changed

+61
-3
lines changed

antd-pro/src/pages/table/index.tsx

+61-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { list, save, del } from '@/services/api/table';
22
import { PlusOutlined } from '@ant-design/icons';
33
import type { ActionType, ProColumns } from '@ant-design/pro-components';
4-
import { ModalForm, PageContainer, ProFormText, ProFormTextArea, } from '@ant-design/pro-components';
4+
import { ModalForm, PageContainer, ProFormSelect, ProFormText, ProTable } from '@ant-design/pro-components';
55
import { Button, Form, message, Popconfirm } from 'antd';
66
import { MyTable } from 'coding-components';
77
import React, { useRef, useState } from 'react';
@@ -48,17 +48,43 @@ const TablePage: React.FC = () => {
4848
{
4949
title: "编号",
5050
dataIndex: 'id',
51+
sorter: true,
5152
search: false,
5253
},
5354
{
5455
title: "服务名称",
5556
dataIndex: 'name',
57+
sorter: true,
5658
},
5759
{
5860
title: "地址",
5961
dataIndex: 'url',
6062
search: false,
6163
},
64+
{
65+
title: "状态",
66+
dataIndex: 'state',
67+
filters: [
68+
{
69+
text: '禁用',
70+
value: 0,
71+
},
72+
{
73+
text: '启用',
74+
value: 1,
75+
},
76+
],
77+
valueEnum: {
78+
0: {
79+
text: '禁用',
80+
status: 'Error'
81+
},
82+
1: {
83+
text: '启用',
84+
status: 'Success'
85+
},
86+
},
87+
},
6288
{
6389
title: "操作",
6490
dataIndex: 'option',
@@ -112,7 +138,12 @@ const TablePage: React.FC = () => {
112138
</Button>,
113139
]}
114140
request={async (params, sort, filter) => {
115-
const res = await list(params);
141+
console.log(params, sort, filter);
142+
const res = await list({
143+
...params,
144+
sort: Buffer.from(JSON.stringify(sort)).toString('base64'),
145+
filter: Buffer.from(JSON.stringify(filter)).toString('base64'),
146+
});
116147
return {
117148
data: res.data.list,
118149
success: res.success,
@@ -126,6 +157,9 @@ const TablePage: React.FC = () => {
126157
<ModalForm
127158
title="新建规则"
128159
form={form}
160+
initialValues={{
161+
state: 1,
162+
}}
129163
modalProps={{
130164
destroyOnClose: true,
131165
onCancel: () => {
@@ -149,6 +183,7 @@ const TablePage: React.FC = () => {
149183
name="id"
150184
/>
151185
<ProFormText
186+
label="服务名称"
152187
placeholder="请输入服务名称"
153188
rules={[
154189
{
@@ -158,7 +193,8 @@ const TablePage: React.FC = () => {
158193
]}
159194
name="name"
160195
/>
161-
<ProFormTextArea
196+
<ProFormText
197+
label="服务地址"
162198
rules={[
163199
{
164200
required: true,
@@ -167,6 +203,28 @@ const TablePage: React.FC = () => {
167203
]}
168204
placeholder="请输入服务地址"
169205
name="url" />
206+
207+
<ProFormSelect
208+
label="服务状态"
209+
placeholder="请输入服务状态"
210+
rules={[
211+
{
212+
required: true,
213+
message: "请输入服务状态",
214+
},
215+
]}
216+
options={[
217+
{
218+
label: '启用',
219+
value: 1,
220+
},
221+
{
222+
label: '禁用',
223+
value: 0,
224+
},
225+
]}
226+
name="state"
227+
/>
170228
</ModalForm>
171229

172230
</PageContainer>

0 commit comments

Comments
 (0)