fix: 参数配置值类型为字符串http判断
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
||||
addParamConfigInfo,
|
||||
} from '@/api/configManage/configParam';
|
||||
import useNeInfoStore from '@/store/modules/neinfo';
|
||||
import { regExpIPv4, regExpIPv6 } from '@/utils/regular-utils';
|
||||
import { regExpIPv4, regExpIPv6, validURL } from '@/utils/regular-utils';
|
||||
import { SizeType } from 'ant-design-vue/lib/config-provider';
|
||||
import { DataNode } from 'ant-design-vue/lib/tree';
|
||||
const neInfoStore = useNeInfoStore();
|
||||
@@ -933,7 +933,6 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
|
||||
if (row.optional === 'true' && !value) {
|
||||
return result;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case 'int':
|
||||
if (filter && filter.indexOf('~') !== -1) {
|
||||
@@ -1003,6 +1002,7 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
|
||||
}
|
||||
break;
|
||||
case 'string':
|
||||
// 字符串长度判断
|
||||
if (filter && filter.indexOf('~') !== -1) {
|
||||
try {
|
||||
const filterArr = filter.split('~');
|
||||
@@ -1021,12 +1021,28 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
// 字符串http判断
|
||||
if (value.startsWith('http')) {
|
||||
try {
|
||||
if (!validURL(value)) {
|
||||
return [
|
||||
false,
|
||||
t('views.configManage.configParamForm.requireString', {
|
||||
display,
|
||||
}),
|
||||
];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'regex':
|
||||
if (filter) {
|
||||
try {
|
||||
let regex = new RegExp(filter);
|
||||
console.log(regex, regex.test(value));
|
||||
if (!regex.test(value)) {
|
||||
return [
|
||||
false,
|
||||
|
||||
Reference in New Issue
Block a user