|
|
@ -179,22 +179,47 @@ function Fence(props) { |
|
|
|
{ |
|
|
|
title: "设备名称", |
|
|
|
dataIndex: "device_name", |
|
|
|
width: 90, |
|
|
|
render: (text) => { |
|
|
|
if (text && text.length > 30) { |
|
|
|
return <div title={text}>{text.slice(0, 30) + '...'}</div> |
|
|
|
} else { |
|
|
|
return text |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "所属商户", |
|
|
|
dataIndex: "operqator", |
|
|
|
width: 90 |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "所属路段", |
|
|
|
dataIndex: "road_name", |
|
|
|
width: 90, |
|
|
|
render: (text) => { |
|
|
|
if (text && text.length > 10) { |
|
|
|
return <div title={text}>{text.slice(0, 10) + '...'}</div> |
|
|
|
} else { |
|
|
|
return text |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "地址", |
|
|
|
dataIndex: "address", |
|
|
|
render: (text) => { |
|
|
|
if (text && text.length > 10) { |
|
|
|
return <div title={text}>{text.slice(0, 10) + '...'}</div> |
|
|
|
} else { |
|
|
|
return text |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "网络模式", |
|
|
|
dataIndex: "network_mode", |
|
|
|
width: 90 |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "IP地址/设备编码", |
|
|
@ -464,6 +489,28 @@ function Fence(props) { |
|
|
|
} |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
const validateNonChineseCharacters = (rule, value, callback) => { |
|
|
|
// 使用正则表达式验证是否不包含中文字符 |
|
|
|
const nonChineseCharactersRegex = /^[^\u4e00-\u9fa5]+$/; |
|
|
|
|
|
|
|
if (!value || nonChineseCharactersRegex.test(value)) { |
|
|
|
callback(); |
|
|
|
} else { |
|
|
|
callback('密码请勿包含中文内容'); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const validateIPAddress = (rule, value, callback) => { |
|
|
|
const ipAddressRegex = /^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)$/; |
|
|
|
|
|
|
|
if (!value || ipAddressRegex.test(value)) { |
|
|
|
callback(); |
|
|
|
} else { |
|
|
|
callback('请输入正确的ip地址'); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
getSelectList(); |
|
|
|
if (formData?.operator) { |
|
|
@ -739,6 +786,7 @@ function Fence(props) { |
|
|
|
name={"video_port"} |
|
|
|
rules={[ |
|
|
|
{ required: true, message: "视频端口号不能为空" }, |
|
|
|
{ type: 'number', message: '视频端口号格式错误' } |
|
|
|
]} |
|
|
|
> |
|
|
|
<Input /> |
|
|
@ -750,7 +798,10 @@ function Fence(props) { |
|
|
|
<Form.Item |
|
|
|
label={"IP地址"} |
|
|
|
name={"ip_address"} |
|
|
|
rules={[{ required: true, message: "ip地址不能为空" }]} |
|
|
|
rules={[ |
|
|
|
{ required: true, message: "ip地址不能为空" }, |
|
|
|
{ validator: validateIPAddress } |
|
|
|
]} |
|
|
|
> |
|
|
|
<Input /> |
|
|
|
</Form.Item> |
|
|
@ -759,7 +810,10 @@ function Fence(props) { |
|
|
|
<Form.Item |
|
|
|
label={"端口号"} |
|
|
|
name={"port"} |
|
|
|
rules={[{ required: true, message: "端口号不能为空" }]} |
|
|
|
rules={[ |
|
|
|
{ required: true, message: "端口号不能为空" }, |
|
|
|
{ type: 'number', message: '端口号格式错误' } |
|
|
|
]} |
|
|
|
> |
|
|
|
<Input /> |
|
|
|
</Form.Item> |
|
|
@ -779,7 +833,10 @@ function Fence(props) { |
|
|
|
<Form.Item |
|
|
|
label={"密码"} |
|
|
|
name={"password"} |
|
|
|
rules={[{ required: true, message: "密码不能为空" }]} |
|
|
|
rules={[ |
|
|
|
{ validator: validateNonChineseCharacters }, |
|
|
|
{ required: true, message: "密码不能为空" } |
|
|
|
]} |
|
|
|
> |
|
|
|
<Input /> |
|
|
|
</Form.Item> |
|
|
|