1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
| import {
| ProFormDateTimePicker,
| ProFormRadio,
| ProFormSelect,
| ProFormText,
| ProFormTextArea,
| StepsForm,
| } from '@ant-design/pro-components';
| import { FormattedMessage, useIntl } from '@umijs/max';
| import { Modal } from 'antd';
| import React from 'react';
|
| const UpdateForm = (props) => {
| const intl = useIntl();
| return (
| <StepsForm
| stepsProps={{
| size: 'small',
| }}
| stepsFormRender={(dom, submitter) => {
| return (
| <Modal
| width={640}
| bodyStyle={{ padding: '32px 40px 48px' }}
| destroyOnClose
| title={intl.formatMessage({
| id: 'pages.searchTable.updateForm.ruleConfig',
| defaultMessage: '规则配置',
| })}
| open={props.updateModalOpen}
| footer={submitter}
| onCancel={() => {
| props.onCancel();
| }}
| >
| {dom}
| </Modal>
| );
| }}
| onFinish={props.onSubmit}
| >
| <StepsForm.StepForm
| initialValues={{
| name: props.values.name,
| desc: props.values.desc,
| }}
| title={intl.formatMessage({
| id: 'pages.searchTable.updateForm.basicConfig',
| defaultMessage: '基本信息',
| })}
| >
| <ProFormText
| name="name"
| label={intl.formatMessage({
| id: 'pages.searchTable.updateForm.ruleName.nameLabel',
| defaultMessage: '规则名称',
| })}
| width="md"
| rules={[
| {
| required: true,
| message: (
| <FormattedMessage
| id="pages.searchTable.updateForm.ruleName.nameRules"
| defaultMessage="请输入规则名称!"
| />
| ),
| },
| ]}
| />
| <ProFormTextArea
| name="desc"
| width="md"
| label={intl.formatMessage({
| id: 'pages.searchTable.updateForm.ruleDesc.descLabel',
| defaultMessage: '规则描述',
| })}
| placeholder={intl.formatMessage({
| id: 'pages.searchTable.updateForm.ruleDesc.descPlaceholder',
| defaultMessage: '请输入至少五个字符',
| })}
| rules={[
| {
| required: true,
| message: (
| <FormattedMessage
| id="pages.searchTable.updateForm.ruleDesc.descRules"
| defaultMessage="请输入至少五个字符的规则描述!"
| />
| ),
| min: 5,
| },
| ]}
| />
| </StepsForm.StepForm>
| <StepsForm.StepForm
| initialValues={{
| target: '0',
| template: '0',
| }}
| title={intl.formatMessage({
| id: 'pages.searchTable.updateForm.ruleProps.title',
| defaultMessage: '配置规则属性',
| })}
| >
| <ProFormSelect
| name="target"
| width="md"
| label={intl.formatMessage({
| id: 'pages.searchTable.updateForm.object',
| defaultMessage: '监控对象',
| })}
| valueEnum={{
| 0: '表一',
| 1: '表二',
| }}
| />
| <ProFormSelect
| name="template"
| width="md"
| label={intl.formatMessage({
| id: 'pages.searchTable.updateForm.ruleProps.templateLabel',
| defaultMessage: '规则模板',
| })}
| valueEnum={{
| 0: '规则模板一',
| 1: '规则模板二',
| }}
| />
| <ProFormRadio.Group
| name="type"
| label={intl.formatMessage({
| id: 'pages.searchTable.updateForm.ruleProps.typeLabel',
| defaultMessage: '规则类型',
| })}
| options={[
| {
| value: '0',
| label: '强',
| },
| {
| value: '1',
| label: '弱',
| },
| ]}
| />
| </StepsForm.StepForm>
| <StepsForm.StepForm
| initialValues={{
| type: '1',
| frequency: 'month',
| }}
| title={intl.formatMessage({
| id: 'pages.searchTable.updateForm.schedulingPeriod.title',
| defaultMessage: '设定调度周期',
| })}
| >
| <ProFormDateTimePicker
| name="time"
| width="md"
| label={intl.formatMessage({
| id: 'pages.searchTable.updateForm.schedulingPeriod.timeLabel',
| defaultMessage: '开始时间',
| })}
| rules={[
| {
| required: true,
| message: (
| <FormattedMessage
| id="pages.searchTable.updateForm.schedulingPeriod.timeRules"
| defaultMessage="请选择开始时间!"
| />
| ),
| },
| ]}
| />
| <ProFormSelect
| name="frequency"
| label={intl.formatMessage({
| id: 'pages.searchTable.updateForm.object',
| defaultMessage: '监控对象',
| })}
| width="md"
| valueEnum={{
| month: '月',
| week: '周',
| }}
| />
| </StepsForm.StepForm>
| </StepsForm>
| );
| };
|
| export default UpdateForm;
|
|