修改过滤条件
This commit is contained in:
parent
42cfdefb74
commit
0e39672b16
|
|
@ -8,35 +8,51 @@ export {}
|
||||||
declare module '@vue/runtime-core' {
|
declare module '@vue/runtime-core' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
Countup: typeof import('./src/components/countup.vue')['default']
|
Countup: typeof import('./src/components/countup.vue')['default']
|
||||||
|
ElAlert: typeof import('element-plus/es')['ElAlert']
|
||||||
ElAvatar: typeof import('element-plus/es')['ElAvatar']
|
ElAvatar: typeof import('element-plus/es')['ElAvatar']
|
||||||
ElButton: typeof import('element-plus/es')['ElButton']
|
ElButton: typeof import('element-plus/es')['ElButton']
|
||||||
|
ElCalendar: typeof import('element-plus/es')['ElCalendar']
|
||||||
ElCard: typeof import('element-plus/es')['ElCard']
|
ElCard: typeof import('element-plus/es')['ElCard']
|
||||||
|
ElCarousel: typeof import('element-plus/es')['ElCarousel']
|
||||||
|
ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem']
|
||||||
|
ElCascader: typeof import('element-plus/es')['ElCascader']
|
||||||
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
|
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
|
||||||
|
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
|
||||||
ElCol: typeof import('element-plus/es')['ElCol']
|
ElCol: typeof import('element-plus/es')['ElCol']
|
||||||
|
ElCollapse: typeof import('element-plus/es')['ElCollapse']
|
||||||
|
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
|
||||||
|
ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
|
||||||
|
ElCountdown: typeof import('element-plus/es')['ElCountdown']
|
||||||
|
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
|
||||||
ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
|
ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
|
||||||
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
|
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
|
||||||
ElDialog: typeof import('element-plus/es')['ElDialog']
|
ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||||
ElDivider: typeof import('element-plus/es')['ElDivider']
|
ElDivider: typeof import('element-plus/es')['ElDivider']
|
||||||
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
||||||
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
|
||||||
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
|
|
||||||
ElEmpty: typeof import('element-plus/es')['ElEmpty']
|
ElEmpty: typeof import('element-plus/es')['ElEmpty']
|
||||||
ElForm: typeof import('element-plus/es')['ElForm']
|
ElForm: typeof import('element-plus/es')['ElForm']
|
||||||
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
||||||
ElIcon: typeof import('element-plus/es')['ElIcon']
|
ElIcon: typeof import('element-plus/es')['ElIcon']
|
||||||
|
ElImage: typeof import('element-plus/es')['ElImage']
|
||||||
ElInput: typeof import('element-plus/es')['ElInput']
|
ElInput: typeof import('element-plus/es')['ElInput']
|
||||||
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
|
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
|
||||||
ElLink: typeof import('element-plus/es')['ElLink']
|
ElLink: typeof import('element-plus/es')['ElLink']
|
||||||
ElMenu: typeof import('element-plus/es')['ElMenu']
|
|
||||||
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
|
|
||||||
ElOption: typeof import('element-plus/es')['ElOption']
|
ElOption: typeof import('element-plus/es')['ElOption']
|
||||||
ElPagination: typeof import('element-plus/es')['ElPagination']
|
ElPagination: typeof import('element-plus/es')['ElPagination']
|
||||||
ElProgress: typeof import('element-plus/es')['ElProgress']
|
ElProgress: typeof import('element-plus/es')['ElProgress']
|
||||||
ElRadio: typeof import('element-plus/es')['ElRadio']
|
ElRadio: typeof import('element-plus/es')['ElRadio']
|
||||||
|
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
|
||||||
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
|
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
|
||||||
|
ElRate: typeof import('element-plus/es')['ElRate']
|
||||||
|
ElResult: typeof import('element-plus/es')['ElResult']
|
||||||
ElRow: typeof import('element-plus/es')['ElRow']
|
ElRow: typeof import('element-plus/es')['ElRow']
|
||||||
|
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
|
||||||
ElSelect: typeof import('element-plus/es')['ElSelect']
|
ElSelect: typeof import('element-plus/es')['ElSelect']
|
||||||
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
|
ElSlider: typeof import('element-plus/es')['ElSlider']
|
||||||
|
ElSpace: typeof import('element-plus/es')['ElSpace']
|
||||||
|
ElStatistic: typeof import('element-plus/es')['ElStatistic']
|
||||||
|
ElStep: typeof import('element-plus/es')['ElStep']
|
||||||
|
ElSteps: typeof import('element-plus/es')['ElSteps']
|
||||||
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
||||||
ElTable: typeof import('element-plus/es')['ElTable']
|
ElTable: typeof import('element-plus/es')['ElTable']
|
||||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
||||||
|
|
@ -45,7 +61,14 @@ declare module '@vue/runtime-core' {
|
||||||
ElTag: typeof import('element-plus/es')['ElTag']
|
ElTag: typeof import('element-plus/es')['ElTag']
|
||||||
ElTimeline: typeof import('element-plus/es')['ElTimeline']
|
ElTimeline: typeof import('element-plus/es')['ElTimeline']
|
||||||
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
|
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
|
||||||
|
ElTimePicker: typeof import('element-plus/es')['ElTimePicker']
|
||||||
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
||||||
|
ElTour: typeof import('element-plus/es')['ElTour']
|
||||||
|
ElTourStep: typeof import('element-plus/es')['ElTourStep']
|
||||||
|
ElTransfer: typeof import('element-plus/es')['ElTransfer']
|
||||||
|
ElTree: typeof import('element-plus/es')['ElTree']
|
||||||
|
ElUpload: typeof import('element-plus/es')['ElUpload']
|
||||||
|
ElWatermark: typeof import('element-plus/es')['ElWatermark']
|
||||||
Header: typeof import('./src/components/header.vue')['default']
|
Header: typeof import('./src/components/header.vue')['default']
|
||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
RouterView: typeof import('vue-router')['RouterView']
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
|
|
|
||||||
|
|
@ -476,8 +476,6 @@ import {
|
||||||
DeleteMyVPNPolicyHandler,
|
DeleteMyVPNPolicyHandler,
|
||||||
MatchVPNPolicyHandler
|
MatchVPNPolicyHandler
|
||||||
} from '@/api/vpn';
|
} from '@/api/vpn';
|
||||||
import { match } from 'assert';
|
|
||||||
import { el } from 'element-plus/es/locale';
|
|
||||||
|
|
||||||
// 全局协议选项数组
|
// 全局协议选项数组
|
||||||
const protocolOptions = ref([
|
const protocolOptions = ref([
|
||||||
|
|
@ -1001,126 +999,13 @@ const onDstTypeChange = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取源类型验证规则
|
// 获取源类型验证规则
|
||||||
const getSrcRules = () => {
|
const getSrcRules = (): any[] => {
|
||||||
const rules = [{ required: true, message: '此项不能为空', trigger: 'blur' }];
|
return [{ required: true, message: '此项不能为空', trigger: 'blur' }];
|
||||||
|
|
||||||
switch (policyForm.src_type) {
|
|
||||||
case 0: // IP地址
|
|
||||||
case 1: // 网段
|
|
||||||
rules.push({
|
|
||||||
validator: (rule: any, value: string, callback: Function) => {
|
|
||||||
if (!value) {
|
|
||||||
callback(new Error('IP地址不能为空'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (policyForm.src_type === 1) {
|
|
||||||
// 网段格式验证
|
|
||||||
const cidrRegex = /^([0-9]{1,3}\.){3}[0-9]{1,3}\/[0-9]{1,2}$/;
|
|
||||||
if (!cidrRegex.test(value)) {
|
|
||||||
callback(new Error('请输入正确的CIDR格式,如:192.168.1.0/24'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// IP地址格式验证
|
|
||||||
const ipRegex = /^([0-9]{1,3}\.){3}[0-9]{1,3}$/;
|
|
||||||
if (!ipRegex.test(value)) {
|
|
||||||
callback(new Error('请输入正确的IP地址格式'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
callback();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 2: // 用户ID
|
|
||||||
rules.push({
|
|
||||||
validator: (rule: any, value: number, callback: Function) => {
|
|
||||||
if (!value || value <= 0) {
|
|
||||||
callback(new Error('用户ID必须大于0'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
callback();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 3: // 组ID
|
|
||||||
rules.push({
|
|
||||||
validator: (rule: any, value: number, callback: Function) => {
|
|
||||||
if (!value || value <= 0) {
|
|
||||||
callback(new Error('组ID必须大于0'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
callback();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rules;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取目标类型验证规则
|
// 获取目标类型验证规则
|
||||||
const getDstRules = () => {
|
const getDstRules = (): any[] => {
|
||||||
const rules = [{ required: true, message: '此项不能为空', trigger: 'blur' }];
|
return [{ required: true, message: '此项不能为空', trigger: 'blur' }];
|
||||||
|
|
||||||
switch (policyForm.dst_type) {
|
|
||||||
case 0: // IP地址
|
|
||||||
case 1: // 网段
|
|
||||||
rules.push({
|
|
||||||
validator: (rule: any, value: string, callback: Function) => {
|
|
||||||
if (!value) {
|
|
||||||
callback(new Error('IP地址不能为空'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (policyForm.dst_type === 1) {
|
|
||||||
// 网段格式验证
|
|
||||||
const cidrRegex = /^([0-9]{1,3}\.){3}[0-9]{1,3}\/[0-9]{1,2}$/;
|
|
||||||
if (!cidrRegex.test(value)) {
|
|
||||||
callback(new Error('请输入正确的CIDR格式,如:192.168.1.0/24'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// IP地址格式验证
|
|
||||||
const ipRegex = /^([0-9]{1,3}\.){3}[0-9]{1,3}$/;
|
|
||||||
if (!ipRegex.test(value)) {
|
|
||||||
callback(new Error('请输入正确的IP地址格式'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
callback();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 2: // 用户ID
|
|
||||||
rules.push({
|
|
||||||
validator: (rule: any, value: number, callback: Function) => {
|
|
||||||
if (!value || value <= 0) {
|
|
||||||
callback(new Error('用户ID必须大于0'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
callback();
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 3: // 组ID
|
|
||||||
rules.push({
|
|
||||||
validator: (rule: any, value: number, callback: Function) => {
|
|
||||||
if (!value || value <= 0) {
|
|
||||||
callback(new Error('组ID必须大于0'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
trigger: 'blur'
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rules;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取源类型占位符
|
// 获取源类型占位符
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue