style: system views code style
This commit is contained in:
@@ -2,9 +2,10 @@ import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { SystemMailAccountApi } from '#/api/system/mail/account';
|
||||
|
||||
import { useAccess } from '@vben/access';
|
||||
|
||||
import { z } from '#/adapter/form';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
||||
import { useAccess } from '@vben/access';
|
||||
|
||||
const { hasAccessByCodes } = useAccess();
|
||||
|
||||
@@ -94,7 +95,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入备注',
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -109,7 +110,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
componentProps: {
|
||||
placeholder: '请输入邮箱',
|
||||
clearable: true,
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'username',
|
||||
@@ -118,8 +119,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
componentProps: {
|
||||
placeholder: '请输入用户名',
|
||||
clearable: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -198,7 +199,7 @@ export function useGridColumns<T = SystemMailAccountApi.SystemMailAccount>(
|
||||
{
|
||||
code: 'delete',
|
||||
show: hasAccessByCodes(['system:mail-account:delete']),
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
<script lang="ts" setup>
|
||||
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type {
|
||||
OnActionClickParams,
|
||||
VxeTableGridOptions,
|
||||
} from '#/adapter/vxe-table';
|
||||
import type { SystemMailAccountApi } from '#/api/system/mail/account';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { Plus } from '@vben/icons';
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
import Form from './modules/form.vue';
|
||||
import { DocAlert } from '#/components/doc-alert';
|
||||
|
||||
import { $t } from '#/locales';
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { deleteMailAccount, getMailAccountPage } from '#/api/system/mail/account';
|
||||
import {
|
||||
deleteMailAccount,
|
||||
getMailAccountPage,
|
||||
} from '#/api/system/mail/account';
|
||||
import { DocAlert } from '#/components/doc-alert';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
@@ -106,7 +113,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
<FormModal @success="onRefresh" />
|
||||
<Grid table-title="邮箱账号列表">
|
||||
<template #toolbar-tools>
|
||||
<Button type="primary" @click="onCreate" v-access:code="['system:mail-account:create']">
|
||||
<Button
|
||||
type="primary"
|
||||
@click="onCreate"
|
||||
v-access:code="['system:mail-account:create']"
|
||||
>
|
||||
<Plus class="size-5" />
|
||||
{{ $t('ui.actionTitle.create', ['邮箱账号']) }}
|
||||
</Button>
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
<script lang="ts" setup>
|
||||
import type { SystemMailAccountApi } from '#/api/system/mail/account';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { $t } from '#/locales';
|
||||
import { computed, ref } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { createMailAccount, getMailAccount, updateMailAccount,} from '#/api/system/mail/account';
|
||||
import {
|
||||
createMailAccount,
|
||||
getMailAccount,
|
||||
updateMailAccount,
|
||||
} from '#/api/system/mail/account';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
@@ -24,8 +30,8 @@ const [Form, formApi] = useVbenForm({
|
||||
schema: useFormSchema(),
|
||||
showDefaultActions: false,
|
||||
commonConfig: {
|
||||
labelWidth: 140
|
||||
}
|
||||
labelWidth: 140,
|
||||
},
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
@@ -36,9 +42,12 @@ const [Modal, modalApi] = useVbenModal({
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as SystemMailAccountApi.SystemMailAccount;
|
||||
const data =
|
||||
(await formApi.getValues()) as SystemMailAccountApi.SystemMailAccount;
|
||||
try {
|
||||
await (formData.value?.id ? updateMailAccount(data) : createMailAccount(data));
|
||||
await (formData.value?.id
|
||||
? updateMailAccount(data)
|
||||
: createMailAccount(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
|
||||
Reference in New Issue
Block a user