feat:告警界面中英文

This commit is contained in:
zhongzm
2025-08-13 16:10:47 +08:00
parent 9237488b17
commit 3c98c26f0a
5 changed files with 49 additions and 21 deletions

View File

@@ -8,6 +8,7 @@ import { Button, Card, message, Space } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { getAlertPage, updateAlert } from '#/api/alert/alert';
import { getUserPage } from '#/api/system/user';
import { $t } from '#/locales';
// 表单数据
const formData = ref({
@@ -22,10 +23,10 @@ const userOptions = ref([]);
// 提醒天数选项
const daysOptions = [
{ label: '15', value: 15 },
{ label: '7', value: 7 },
{ label: '2', value: 2 },
{ label: '1', value: 1 },
{ label: '15'+$t('alert.day'), value: 15 },
{ label: '7'+$t('alert.day'), value: 7 },
{ label: '2'+$t('alert.day'), value: 2 },
{ label: '1'+$t('alert.day'), value: 1 },
];
// 表单配置
@@ -40,11 +41,11 @@ const formSchema = computed(() => [
},
{
fieldName: 'users',
label: '提醒人',
label: $t('alert.Reminder'),
rules: 'required',
component: 'Select',
componentProps: {
placeholder: '请选择提醒人',
placeholder: $t('alert.selectremind'),
mode: 'multiple',
allowClear: true,
showSearch: true,
@@ -56,11 +57,11 @@ const formSchema = computed(() => [
},
{
fieldName: 'days',
label: '提醒天数',
label: $t('alert.reminderdays'),
rules: 'required',
component: 'Select',
componentProps: {
placeholder: '请选择提醒天数',
placeholder: $t('alert.selectday'),
mode: 'multiple',
allowClear: true,
options: daysOptions,
@@ -68,11 +69,11 @@ const formSchema = computed(() => [
},
{
fieldName: 'content',
label: '提醒内容',
label: $t('alert.content'),
rules: 'required',
component: 'Textarea',
componentProps: {
placeholder: '请输入提醒内容',
placeholder: $t('alert.selectcontent'),
rows: 4,
showCount: true,
maxlength: 500,
@@ -80,11 +81,11 @@ const formSchema = computed(() => [
},
{
fieldName: 'status',
label: '启用状态',
label: $t('alert.status'),
component: 'Switch',
componentProps: {
checkedChildren: '启用',
unCheckedChildren: '禁用',
checkedChildren: $t('alert.enable'),
unCheckedChildren: $t('alert.disable'),
checkedValue: 1,
unCheckedValue: 2,
style: { width: 'auto' },
@@ -125,7 +126,6 @@ async function handleSubmit() {
// 根据实际需要调用创建或更新接口
if (values.id) {
await updateAlert(submitData);
message.success('更新成功');
}
} catch {}
}
@@ -178,12 +178,12 @@ onMounted(async () => {
<template>
<Page auto-content-height>
<Card title="告警配置">
<Card :title="$t('alert.alerttitle')">
<Form />
<div class="mt-4 flex justify-end">
<Space>
<Button type="primary" @click="handleSubmit">保存</Button>
<Button @click="handleReset">重置</Button>
<Button type="primary" @click="handleSubmit">{{$t('alert.save')}}</Button>
<Button @click="handleReset">{{ $t('alert.reset') }}</Button>
</Space>
</div>
</Card>