feat: 修改流量限制按钮

pull/95/head
zhengkunwang223 2022-12-28 14:25:17 +08:00 committed by zhengkunwang223
parent 0f739b4afa
commit 29c8a2180f
3 changed files with 10 additions and 6 deletions

View File

@ -920,6 +920,7 @@ export default {
indexFolder: 'root',
logFoler: '',
sslFolder: '',
enableOrNot: '',
},
nginx: {
serverNamesHashBucketSizeHelper: 'hash',

View File

@ -9,10 +9,8 @@
:loading="loading"
label-width="100px"
>
<el-form-item>
<el-checkbox v-model="enable" @change="changeEnable">
{{ $t('website.limtHelper') }}
</el-checkbox>
<el-form-item prop="enable" :label="$t('website.enableOrNot')">
<el-switch v-model="enable" @change="changeEnable"></el-switch>
</el-form-item>
<el-form-item :label="$t('website.limit')">
<el-select v-model="ruleKey" @change="changeRule(ruleKey)">
@ -38,7 +36,8 @@
</el-form-item>
</el-form>
<el-button type="primary" @click="submit(limitForm)" :loading="loading">
{{ $t('commons.button.save') }}
<span v-if="enable">{{ $t('commons.button.save') }}</span>
<span v-else>{{ $t('commons.button.saveAndEnable') }}</span>
</el-button>
</el-col>
</el-row>
@ -146,6 +145,9 @@ const submit = async (formEl: FormInstance | undefined) => {
},
];
req.params = params;
if (req.operate === 'add') {
enable.value = true;
}
UpdateNginxConfig(req)
.then(() => {
ElMessage.success(i18n.global.t('commons.msg.updateSuccess'));
@ -163,6 +165,7 @@ const changeEnable = () => {
} else {
req.operate = 'add';
}
submit(limitForm.value);
};
const changeRule = (key: string) => {

View File

@ -1,6 +1,6 @@
<template>
<el-row :gutter="20">
<el-col :span="8" :offset="1">
<el-col :span="14" :offset="1">
<br />
<el-descriptions :column="1" border v-loading="loading">
<el-descriptions-item :label="$t('website.siteAlias')">{{ website.alias }}</el-descriptions-item>