mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 00:09:16 +08:00
fix: 服务器地址支持设置为空 (#2016)
This commit is contained in:
parent
7fac0fcbe8
commit
d572c28d1c
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/public/favicon.png" />
|
||||
|
@ -4,10 +4,17 @@
|
||||
<template #header>
|
||||
<DrawerHeader :header="$t('setting.systemIP')" :back="handleClose" />
|
||||
</template>
|
||||
<el-form ref="formRef" label-position="top" :model="form" @submit.prevent v-loading="loading">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
label-position="top"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
@submit.prevent
|
||||
v-loading="loading"
|
||||
>
|
||||
<el-row type="flex" justify="center">
|
||||
<el-col :span="22">
|
||||
<el-form-item :label="$t('setting.systemIP')" prop="systemIP" :rules="Rules.ipV4V6OrDomain">
|
||||
<el-form-item :label="$t('setting.systemIP')" prop="systemIP">
|
||||
<el-input clearable v-model="form.systemIP" />
|
||||
<span class="input-help">{{ $t('commons.rule.hostHelper') }}</span>
|
||||
</el-form-item>
|
||||
@ -31,8 +38,8 @@ import i18n from '@/lang';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { updateSetting } from '@/api/modules/setting';
|
||||
import { FormInstance } from 'element-plus';
|
||||
import { Rules } from '@/global/form-rules';
|
||||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||
import { checkDomain, checkIpV4V6 } from '@/utils/util';
|
||||
|
||||
const emit = defineEmits<{ (e: 'search'): void }>();
|
||||
|
||||
@ -47,6 +54,18 @@ const form = reactive({
|
||||
});
|
||||
|
||||
const formRef = ref<FormInstance>();
|
||||
const rules = reactive({
|
||||
systemIP: [{ validator: checkSystemIP, trigger: 'blur' }],
|
||||
});
|
||||
|
||||
function checkSystemIP(rule: any, value: any, callback: any) {
|
||||
if (form.systemIP !== '') {
|
||||
if (checkIpV4V6(form.systemIP) && checkDomain(form.systemIP)) {
|
||||
return callback(new Error(i18n.global.t('commons.rule.host')));
|
||||
}
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
const acceptParams = (params: DialogProps): void => {
|
||||
form.systemIP = params.systemIP;
|
||||
|
Loading…
x
Reference in New Issue
Block a user