Skip to content

Commit 56816a8

Browse files
authored
Merge pull request #138 from codingapi/dev
update ui version
2 parents 928448c + cca9cf3 commit 56816a8

File tree

7 files changed

+118
-65
lines changed

7 files changed

+118
-65
lines changed

admin-ui/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"dependencies": {
66
"@ant-design/icons": "^5.4.0",
77
"@ant-design/pro-components": "^2.8.7",
8-
"@codingapi/flow-pc": "^0.0.45",
9-
"@codingapi/form-pc": "^0.0.45",
10-
"@codingapi/ui-framework": "^0.0.45",
8+
"@codingapi/flow-pc": "^0.0.58",
9+
"@codingapi/form-pc": "^0.0.58",
10+
"@codingapi/ui-framework": "^0.0.58",
1111
"@dnd-kit/core": "^6.2.0",
1212
"@dnd-kit/sortable": "^9.0.0",
1313
"@handsontable/react-wrapper": "^15.0.0",

admin-ui/src/pages/flow/leave/LeaveForm.tsx

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, {useEffect} from "react";
2-
import {FlowFormViewProps, ValidateUtils} from "@codingapi/ui-framework";
3-
import {Form, FormInput, FormTextArea} from "@codingapi/form-pc";
2+
import {FlowFormViewProps} from "@codingapi/ui-framework";
3+
import {Form, FormItem} from "@codingapi/form-pc";
44

55
const LeaveForm: React.FC<FlowFormViewProps> = (props) => {
66

@@ -19,29 +19,43 @@ const LeaveForm: React.FC<FlowFormViewProps> = (props) => {
1919
layout={"vertical"}
2020
>
2121

22-
<FormInput
22+
<FormItem
2323
name={"id"}
2424
hidden={true}
25+
type={"input"}
2526
/>
2627

27-
<FormInput
28+
<FormItem
29+
type={"input"}
2830
name={"username"}
2931
hidden={true}
3032
/>
3133

32-
<FormInput
34+
<FormItem
35+
type={"input"}
3336
name={"days"}
3437
label={"请假天数"}
3538
inputType={"number"}
3639
required={true}
37-
validateFunction={ValidateUtils.validateNotEmpty}
40+
rules={[
41+
{
42+
required: true,
43+
message: "请假天数不能为空",
44+
},
45+
]}
3846
/>
3947

40-
<FormTextArea
48+
<FormItem
49+
type={"textarea"}
4150
name={"desc"}
4251
label={"请假原因"}
4352
required={true}
44-
validateFunction={ValidateUtils.validateNotEmpty}
53+
rules={[
54+
{
55+
required: true,
56+
message: "请假原因不能为空",
57+
},
58+
]}
4559
/>
4660

4761
</Form>

admin-ui/src/pages/flow/user/index.tsx

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import {changeManager, entrust, list, remove, removeEntrust, save} from "@/api/u
44
import {Button, message, Modal, Popconfirm, Space} from "antd";
55
import {DeleteOutlined, SettingOutlined} from "@ant-design/icons";
66
import UserSelect from "@/pages/flow/user/select";
7-
import {Form,FormInput,FormSwitch} from "@codingapi/form-pc";
8-
import {ValidateUtils} from "@codingapi/ui-framework";
7+
import {Form, FormItem} from "@codingapi/form-pc";
98

109
const UserPage = () => {
1110

@@ -186,8 +185,8 @@ const UserPage = () => {
186185
onCancel={()=>{
187186
setVisible(false);
188187
}}
189-
onOk={async ()=>{
190-
await form.submit();
188+
onOk={ ()=>{
189+
form.submit();
191190
}}
192191
>
193192
<Form
@@ -197,33 +196,53 @@ const UserPage = () => {
197196
handleSave(values);
198197
}}
199198
>
200-
<FormInput
199+
<FormItem
200+
type={"input"}
201201
name={"id"}
202202
hidden={true}
203203
/>
204204

205-
<FormInput
205+
<FormItem
206+
type={"input"}
206207
name={"name"}
207208
label={"姓名"}
208209
required={true}
209-
validateFunction={ValidateUtils.validateNotEmpty}
210+
rules={[
211+
{
212+
required: true,
213+
message: "姓名不能为空",
214+
}
215+
]}
210216
/>
211217

212-
<FormInput
218+
<FormItem
219+
type={"input"}
213220
name={"username"}
214221
label={"登录账号"}
215222
required={true}
216-
validateFunction={ValidateUtils.validateNotEmpty}
223+
rules={[
224+
{
225+
required: true,
226+
message: "登录账号不能为空",
227+
}
228+
]}
217229
/>
218230

219-
<FormInput
231+
<FormItem
232+
type={"password"}
220233
name={"password"}
221234
label={"登录密码"}
222235
required={true}
223-
validateFunction={ValidateUtils.validateNotEmpty}
236+
rules={[
237+
{
238+
required: true,
239+
message: "登录密码不能为空",
240+
}
241+
]}
224242
/>
225243

226-
<FormSwitch
244+
<FormItem
245+
type={"switch"}
227246
name={"flowManager"}
228247
label={"是否流程管理员"}
229248
/>

admin-ui/src/pages/flow/work/index.tsx

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import React from "react";
2-
import {Flow,FlowActionType} from "@codingapi/flow-pc";
2+
import {Flow, FlowActionType} from "@codingapi/flow-pc";
33
import {ActionType, PageContainer, ProTable} from "@ant-design/pro-components";
44
import {changeState, copy, list, remove, save, schema} from "@/api/flow";
55
import {Button, Drawer, message, Modal, Popconfirm, Space} from "antd";
6-
import {Form,FormInput,FormTextArea,FormSwitch} from "@codingapi/form-pc";
7-
import {ValidateUtils} from "@codingapi/ui-framework";
6+
import {Form, FormItem} from "@codingapi/form-pc";
87

98
const FlowPage = () => {
109

@@ -199,8 +198,8 @@ const FlowPage = () => {
199198
onCancel={()=>{
200199
setEditorVisible(false)
201200
}}
202-
onOk={async ()=>{
203-
await form.submit();
201+
onOk={ ()=>{
202+
form.submit();
204203
}}
205204
>
206205

@@ -209,40 +208,61 @@ const FlowPage = () => {
209208
layout={"vertical"}
210209
onFinish={handlerSave}
211210
>
212-
<FormInput
211+
<FormItem
212+
type={"input"}
213213
name={"id"}
214214
hidden={true}
215215
/>
216216

217-
<FormInput
217+
<FormItem
218+
type={"input"}
218219
name={"title"}
219220
label={"标题"}
220221
required={true}
221-
validateFunction={ValidateUtils.validateNotEmpty}
222+
rules={[
223+
{
224+
required: true,
225+
message: '请输入标题'
226+
}
227+
]}
222228
/>
223229

224-
<FormInput
230+
<FormItem
231+
type={"input"}
225232
name={"code"}
226233
label={"编码"}
227234
required={true}
228-
validateFunction={ValidateUtils.validateNotEmpty}
235+
rules={[
236+
{
237+
required: true,
238+
message: '请输入编码'
239+
}
240+
]}
229241
/>
230242

231-
<FormTextArea
243+
<FormItem
232244
name={"description"}
233245
label={"描述"}
246+
type={"textarea"}
234247
/>
235248

236-
<FormInput
249+
<FormItem
250+
type={"input"}
237251
name={"postponedMax"}
238252
tooltip={"允许流程最大的延期次数"}
239253
label={"最大延期次数"}
240254
inputType={'number'}
241255
required={true}
242-
validateFunction={ValidateUtils.validateNotEmpty}
256+
rules={[
257+
{
258+
required: true,
259+
message: '请输入最大延期次数'
260+
}
261+
]}
243262
/>
244263

245-
<FormSwitch
264+
<FormItem
265+
type={"switch"}
246266
name={"skipIfSameApprover"}
247267
tooltip={"是否跳过相同审批人,默认为否"}
248268
label={"是否跳过相同审批人"}

mobile-ui/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@codingapi/flow-mobile": "^0.0.45",
7-
"@codingapi/form-mobile": "^0.0.45",
8-
"@codingapi/ui-framework": "^0.0.45",
6+
"@codingapi/flow-mobile": "^0.0.58",
7+
"@codingapi/form-mobile": "^0.0.58",
8+
"@codingapi/ui-framework": "^0.0.58",
99
"@logicflow/core": "^2.0.10",
1010
"@logicflow/extension": "^2.0.14",
1111
"@reduxjs/toolkit": "^2.2.7",

mobile-ui/src/pages/leave/fields.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ export const fields = [
2121
label: "请假天数",
2222
name: "days",
2323
required: true,
24-
validateFunction: async (content) => {
25-
if (content.value <= 0) {
26-
return ["请假天数不能小于0"];
24+
rules: [
25+
{
26+
required: true,
27+
message: "请假天数不能为空"
2728
}
28-
return []
29-
}
29+
],
3030
}
3131
},
3232
{
@@ -35,12 +35,12 @@ export const fields = [
3535
label: "请假理由",
3636
name: "desc",
3737
required: true,
38-
validateFunction: async (content) => {
39-
if (content.value && content.value.length > 0) {
40-
return []
38+
rules:[
39+
{
40+
required: true,
41+
message: "请假理由不能为空"
4142
}
42-
return ["请假理由不能为空"];
43-
}
43+
]
4444
}
4545
}
4646
] as FormField[]

mobile-ui/src/pages/login/index.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
22
import {Button, Toast} from "antd-mobile";
3-
import {FormInput,FormPassword,Form} from "@codingapi/form-mobile";
3+
import {Form, FormItem} from "@codingapi/form-mobile";
44
import {useNavigate} from "react-router";
55
import {initUser, login} from "@/api/account";
66
import {config} from "@/config/theme";
@@ -53,32 +53,32 @@ const LoginPage = () => {
5353
)}
5454
>
5555

56-
<FormInput
56+
<FormItem
57+
type={"input"}
5758
name={'username'}
5859
label={'用户名'}
5960
placeholder={'请输入用户名'}
6061
required={true}
61-
validateFunction={async (content)=>{
62-
if(content.value){
63-
return []
64-
}else {
65-
return ["用户名不能为空"]
62+
rules={[
63+
{
64+
required: true,
65+
message: "用户名不能为空"
6666
}
67-
}}
67+
]}
6868
/>
6969

70-
<FormPassword
70+
<FormItem
71+
type={"password"}
7172
name={'password'}
7273
label={'密码'}
7374
placeholder={'请输入密码'}
7475
required={true}
75-
validateFunction={async (content)=>{
76-
if(content.value){
77-
return []
78-
}else {
79-
return ["密码不能为空"]
76+
rules={[
77+
{
78+
required: true,
79+
message: "密码不能为空"
8080
}
81-
}}
81+
]}
8282
/>
8383
</Form>
8484
</div>

0 commit comments

Comments
 (0)