diff --git a/components.d.ts b/components.d.ts index aa1814f..64d4079 100644 --- a/components.d.ts +++ b/components.d.ts @@ -8,35 +8,51 @@ export {} declare module '@vue/runtime-core' { export interface GlobalComponents { Countup: typeof import('./src/components/countup.vue')['default'] + ElAlert: typeof import('element-plus/es')['ElAlert'] ElAvatar: typeof import('element-plus/es')['ElAvatar'] ElButton: typeof import('element-plus/es')['ElButton'] + ElCalendar: typeof import('element-plus/es')['ElCalendar'] 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'] + ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup'] 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'] ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem'] ElDialog: typeof import('element-plus/es')['ElDialog'] ElDivider: typeof import('element-plus/es')['ElDivider'] 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'] ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElIcon: typeof import('element-plus/es')['ElIcon'] + ElImage: typeof import('element-plus/es')['ElImage'] ElInput: typeof import('element-plus/es')['ElInput'] ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] 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'] ElPagination: typeof import('element-plus/es')['ElPagination'] ElProgress: typeof import('element-plus/es')['ElProgress'] ElRadio: typeof import('element-plus/es')['ElRadio'] + ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] 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'] + ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] 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'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] @@ -45,7 +61,14 @@ declare module '@vue/runtime-core' { ElTag: typeof import('element-plus/es')['ElTag'] ElTimeline: typeof import('element-plus/es')['ElTimeline'] ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem'] + ElTimePicker: typeof import('element-plus/es')['ElTimePicker'] 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'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] diff --git a/src/views/system/vpn-policy.vue b/src/views/system/vpn-policy.vue index e6ab313..f3e4635 100644 --- a/src/views/system/vpn-policy.vue +++ b/src/views/system/vpn-policy.vue @@ -476,8 +476,6 @@ import { DeleteMyVPNPolicyHandler, MatchVPNPolicyHandler } from '@/api/vpn'; -import { match } from 'assert'; -import { el } from 'element-plus/es/locale'; // 全局协议选项数组 const protocolOptions = ref([ @@ -1001,126 +999,13 @@ const onDstTypeChange = () => { }; // 获取源类型验证规则 -const getSrcRules = () => { - const rules = [{ 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 getSrcRules = (): any[] => { + return [{ required: true, message: '此项不能为空', trigger: 'blur' }]; }; // 获取目标类型验证规则 -const getDstRules = () => { - const rules = [{ 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; +const getDstRules = (): any[] => { + return [{ required: true, message: '此项不能为空', trigger: 'blur' }]; }; // 获取源类型占位符