@@ -3,13 +3,14 @@ import { Form, Input, message as Message, Modal, Select, Spin } from 'antd';
33import { isEmpty , isFunction , isNull } from 'lodash' ;
44
55import { API } from '@/api' ;
6+ import { urlReg } from '@/utils/reg' ;
67const FormItem = Form . Item ;
78const { TextArea } = Input ;
89const { Option } = Select ;
910
1011const EnvForm = ( props : any ) => {
1112 const { value, tagList = [ ] , forwardRef } = props ;
12- const { envName, hostIp, url, remark, tags = [ ] } = value ;
13+ const { envName, hostIp, uicUsername , uicPasswd , url, remark, tags = [ ] } = value ;
1314 const tagIds = tags . map ( ( item : any ) => Number ( item . id ) ) ;
1415 return (
1516 < Form
@@ -19,6 +20,8 @@ const EnvForm = (props: any) => {
1920 initialValues = { {
2021 envName,
2122 hostIp,
23+ uicUsername,
24+ uicPasswd,
2225 url,
2326 tagIds,
2427 remark,
@@ -30,24 +33,37 @@ const EnvForm = (props: any) => {
3033 rules = { [ { required : true , message : '请输入环境名称' } ] }
3134 hasFeedback
3235 >
33- < Input placeholder = "请输入环境名称" />
36+ < Input placeholder = "请输入环境名称" maxLength = { 255 } />
3437 </ FormItem >
3538 < FormItem
3639 label = "主机IP"
3740 name = "hostIp"
3841 rules = { [ { required : true , message : '请输入主机IP' } ] }
3942 hasFeedback
4043 >
41- < Input placeholder = "请输入主机IP" />
44+ < Input placeholder = "请输入主机IP" maxLength = { 255 } />
45+ </ FormItem >
46+ < FormItem label = "UIC用户名" name = "uicUsername" hasFeedback >
47+ < Input placeholder = "请输入UIC用户名" maxLength = { 255 } />
48+ </ FormItem >
49+ < FormItem label = "UIC密码" name = "uicPasswd" hasFeedback >
50+ < Input type = "password" placeholder = "请输入UIC密码" maxLength = { 255 } />
4251 </ FormItem >
4352 < Fragment >
4453 < FormItem
4554 label = "访问地址"
4655 name = "url"
47- rules = { [ { required : true , message : '请输入访问地址' } ] }
56+ rules = { [
57+ { required : true , message : '请输入访问地址' } ,
58+ {
59+ required : true ,
60+ pattern : urlReg ,
61+ message : '请输入正确格式的访问地址,以 http(s):// 开头' ,
62+ } ,
63+ ] }
4864 hasFeedback
4965 >
50- < TextArea placeholder = "请输入访问地址" rows = { 2 } maxLength = { 2000 } />
66+ < Input placeholder = "请输入访问地址" maxLength = { 2000 } />
5167 </ FormItem >
5268 </ Fragment >
5369 < FormItem
@@ -59,6 +75,14 @@ const EnvForm = (props: any) => {
5975 required : true ,
6076 message : '请选择标签' ,
6177 } ,
78+ {
79+ validator : ( rule , value = [ ] , callback ) => {
80+ if ( value ?. length > 3 ) {
81+ callback ( '最多选择三个标签' ) ;
82+ }
83+ callback ( ) ;
84+ } ,
85+ } ,
6286 ] }
6387 hasFeedback
6488 >
0 commit comments