style: system views code style

This commit is contained in:
xingyu4j
2025-04-22 11:25:11 +08:00
parent 4e1d6812ff
commit da3fd5b718
84 changed files with 1200 additions and 624 deletions

View File

@@ -2,11 +2,12 @@ import type { VbenFormSchema } from '#/adapter/form';
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemSmsChannelApi } from '#/api/system/sms/channel';
import { useAccess } from '@vben/access';
import { z } from '#/adapter/form';
import { CommonStatusEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { getRangePickerDefaultProps } from '#/utils/date';
import { useAccess } from '@vben/access';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
const { hasAccessByCodes } = useAccess();
@@ -211,7 +212,7 @@ export function useGridColumns<T = SystemSmsChannelApi.SystemSmsChannel>(
{
code: 'delete',
show: hasAccessByCodes(['system:sms-channel:delete']),
}
},
],
},
},

View File

@@ -1,19 +1,27 @@
<script lang="ts" setup>
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
import type {
OnActionClickParams,
VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { SystemSmsChannelApi } from '#/api/system/sms/channel';
import { Page, useVbenModal } from '@vben/common-ui';
import { Button, message } from 'ant-design-vue';
import { Download, Plus } from '@vben/icons';
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 { getSmsChannelPage, deleteSmsChannel, exportSmsChannel } from '#/api/system/sms/channel';
import {
deleteSmsChannel,
exportSmsChannel,
getSmsChannelPage,
} from '#/api/system/sms/channel';
import { DocAlert } from '#/components/doc-alert';
import { $t } from '#/locales';
import { downloadByData } from '#/utils/download';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
@@ -66,14 +74,14 @@ function onActionClick({
row,
}: OnActionClickParams<SystemSmsChannelApi.SystemSmsChannel>) {
switch (code) {
case 'edit': {
onEdit(row);
break;
}
case 'delete': {
onDelete(row);
break;
}
case 'edit': {
onEdit(row);
break;
}
}
}
@@ -114,11 +122,20 @@ const [Grid, gridApi] = useVbenVxeGrid({
<FormModal @success="onRefresh" />
<Grid table-title="短信渠道列表">
<template #toolbar-tools>
<Button type="primary" @click="onCreate" v-access:code="['system:sms-channel:create']">
<Button
type="primary"
@click="onCreate"
v-access:code="['system:sms-channel:create']"
>
<Plus class="size-5" />
{{ $t('ui.actionTitle.create', ['短信渠道']) }}
</Button>
<Button type="primary" class="ml-2" @click="onExport" v-access:code="['system:sms-channel:export']">
<Button
type="primary"
class="ml-2"
@click="onExport"
v-access:code="['system:sms-channel:export']"
>
<Download class="size-5" />
{{ $t('ui.actionTitle.export') }}
</Button>

View File

@@ -1,13 +1,19 @@
<script lang="ts" setup>
import type { SystemSmsChannelApi } from '#/api/system/sms/channel';
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { $t } from '#/locales';
import { computed, ref } from 'vue';
import { useVbenForm } from '#/adapter/form';
import { getSmsChannel, createSmsChannel, updateSmsChannel } from '#/api/system/sms/channel';
import {
createSmsChannel,
getSmsChannel,
updateSmsChannel,
} from '#/api/system/sms/channel';
import { $t } from '#/locales';
import { useFormSchema } from '../data';
@@ -24,8 +30,8 @@ const [Form, formApi] = useVbenForm({
schema: useFormSchema(),
showDefaultActions: false,
commonConfig: {
labelWidth: 120
}
labelWidth: 120,
},
});
const [Modal, modalApi] = useVbenModal({
@@ -36,9 +42,12 @@ const [Modal, modalApi] = useVbenModal({
}
modalApi.lock();
// 提交表单
const data = (await formApi.getValues()) as SystemSmsChannelApi.SystemSmsChannel;
const data =
(await formApi.getValues()) as SystemSmsChannelApi.SystemSmsChannel;
try {
await (formData.value?.id ? updateSmsChannel(data) : createSmsChannel(data));
await (formData.value?.id
? updateSmsChannel(data)
: createSmsChannel(data));
// 关闭并提示
await modalApi.close();
emit('success');

View File

@@ -2,11 +2,12 @@ import type { VbenFormSchema } from '#/adapter/form';
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemSmsLogApi } from '#/api/system/sms/log';
import { getSimpleSmsChannelList } from '#/api/system/sms/channel';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { getRangePickerDefaultProps } from '#/utils/date';
import { useAccess } from '@vben/access';
import { getSimpleSmsChannelList } from '#/api/system/sms/channel';
import { getRangePickerDefaultProps } from '#/utils/date';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
const { hasAccessByCodes } = useAccess();
/** 列表的搜索表单 */

View File

@@ -1,14 +1,18 @@
<script lang="ts" setup>
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
import type {
OnActionClickParams,
VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { SystemSmsLogApi } from '#/api/system/sms/log';
import { Page, useVbenModal } from '@vben/common-ui';
import { Download } from '@vben/icons';
import { Button } from 'ant-design-vue';
import { DocAlert } from '#/components/doc-alert';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { exportSmsLog, getSmsLogPage } from '#/api/system/sms/log';
import { DocAlert } from '#/components/doc-alert';
import { $t } from '#/locales';
import { downloadByData } from '#/utils/download';
@@ -86,7 +90,12 @@ const [Grid, gridApi] = useVbenVxeGrid({
<DetailModal @success="onRefresh" />
<Grid table-title="短信日志列表">
<template #toolbar-tools>
<Button type="primary" class="ml-2" @click="onExport" v-access:code="['system:sms-log:export']">
<Button
type="primary"
class="ml-2"
@click="onExport"
v-access:code="['system:sms-log:export']"
>
<Download class="size-5" />
{{ $t('ui.actionTitle.export') }}
</Button>

View File

@@ -1,12 +1,14 @@
<script lang="ts" setup>
import type { SystemSmsLogApi } from '#/api/system/sms/log';
import { useVbenModal } from '@vben/common-ui';
import { Descriptions } from 'ant-design-vue';
import { DictTag } from '#/components/dict-tag';
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { formatDateTime } from '@vben/utils';
import { Descriptions } from 'ant-design-vue';
import { DictTag } from '#/components/dict-tag';
import { DICT_TYPE } from '#/utils/dict';
const formData = ref<SystemSmsLogApi.SystemSmsLog>();
@@ -32,8 +34,19 @@ const [Modal, modalApi] = useVbenModal({
</script>
<template>
<Modal title="短信日志详情" class="w-1/2" :show-cancel-button="false" :show-confirm-button="false">
<Descriptions bordered :column="2" size="middle" class="mx-4" :label-style="{ width: '140px' }">
<Modal
title="短信日志详情"
class="w-1/2"
:show-cancel-button="false"
:show-confirm-button="false"
>
<Descriptions
bordered
:column="2"
size="middle"
class="mx-4"
:label-style="{ width: '140px' }"
>
<Descriptions.Item label="创建时间">
{{ formatDateTime(formData?.createTime || '') }}
</Descriptions.Item>
@@ -47,13 +60,19 @@ const [Modal, modalApi] = useVbenModal({
{{ formData?.templateId }}
</Descriptions.Item>
<Descriptions.Item label="模板类型">
<DictTag :type="DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE" :value="formData?.templateType" />
<DictTag
:type="DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE"
:value="formData?.templateType"
/>
</Descriptions.Item>
<Descriptions.Item label="短信内容">
{{ formData?.templateContent }}
</Descriptions.Item>
<Descriptions.Item label="发送状态">
<DictTag :type="DICT_TYPE.SYSTEM_SMS_SEND_STATUS" :value="formData?.sendStatus" />
<DictTag
:type="DICT_TYPE.SYSTEM_SMS_SEND_STATUS"
:value="formData?.sendStatus"
/>
</Descriptions.Item>
<Descriptions.Item label="发送时间">
{{ formatDateTime(formData?.sendTime || '') }}
@@ -65,7 +84,10 @@ const [Modal, modalApi] = useVbenModal({
{{ formData?.apiSendMsg }}
</Descriptions.Item>
<Descriptions.Item label="接收状态">
<DictTag :type="DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS" :value="formData?.receiveStatus" />
<DictTag
:type="DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS"
:value="formData?.receiveStatus"
/>
</Descriptions.Item>
<Descriptions.Item label="接收时间">
{{ formatDateTime(formData?.receiveTime || '') }}

View File

@@ -2,12 +2,13 @@ import type { VbenFormSchema } from '#/adapter/form';
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemSmsTemplateApi } from '#/api/system/sms/template';
import { useAccess } from '@vben/access';
import { z } from '#/adapter/form';
import { getSimpleSmsChannelList } from '#/api/system/sms/channel';
import { CommonStatusEnum } from '#/utils/constants';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { getRangePickerDefaultProps } from '#/utils/date';
import { useAccess } from '@vben/access';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
const { hasAccessByCodes } = useAccess();

View File

@@ -1,20 +1,28 @@
<script lang="ts" setup>
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
import type {
OnActionClickParams,
VxeTableGridOptions,
} from '#/adapter/vxe-table';
import type { SystemSmsTemplateApi } from '#/api/system/sms/template';
import { Page, useVbenModal } from '@vben/common-ui';
import { Download, Plus } from '@vben/icons';
import { Button, message } from 'ant-design-vue';
import Form from './modules/form.vue';
import SendForm from './modules/send-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 { deleteSmsTemplate, exportSmsTemplate, getSmsTemplatePage } from '#/api/system/sms/template';
import {
deleteSmsTemplate,
exportSmsTemplate,
getSmsTemplatePage,
} from '#/api/system/sms/template';
import { DocAlert } from '#/components/doc-alert';
import { $t } from '#/locales';
import { downloadByData } from '#/utils/download';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
import SendForm from './modules/send-form.vue';
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
@@ -77,14 +85,14 @@ function onActionClick({
row,
}: OnActionClickParams<SystemSmsTemplateApi.SystemSmsTemplate>) {
switch (code) {
case 'edit': {
onEdit(row);
break;
}
case 'delete': {
onDelete(row);
break;
}
case 'edit': {
onEdit(row);
break;
}
case 'sms-send': {
onSend(row);
break;
@@ -130,11 +138,20 @@ const [Grid, gridApi] = useVbenVxeGrid({
<SendModal />
<Grid table-title="短信模板列表">
<template #toolbar-tools>
<Button type="primary" @click="onCreate" v-access:code="['system:sms-template:create']">
<Button
type="primary"
@click="onCreate"
v-access:code="['system:sms-template:create']"
>
<Plus class="size-5" />
{{ $t('ui.actionTitle.create', ['短信模板']) }}
</Button>
<Button type="primary" class="ml-2" @click="onExport" v-access:code="['system:sms-template:export']">
<Button
type="primary"
class="ml-2"
@click="onExport"
v-access:code="['system:sms-template:export']"
>
<Download class="size-5" />
{{ $t('ui.actionTitle.export') }}
</Button>

View File

@@ -1,13 +1,19 @@
<script lang="ts" setup>
import type { SystemSmsTemplateApi } from '#/api/system/sms/template';
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { $t } from '#/locales';
import { computed, ref } from 'vue';
import { useVbenForm } from '#/adapter/form';
import { createSmsTemplate, getSmsTemplate, updateSmsTemplate } from '#/api/system/sms/template';
import {
createSmsTemplate,
getSmsTemplate,
updateSmsTemplate,
} from '#/api/system/sms/template';
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({

View File

@@ -1,10 +1,12 @@
<script lang="ts" setup>
import type { SystemSmsTemplateApi } from '#/api/system/sms/template';
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { ref } from 'vue';
import { useVbenForm } from '#/adapter/form';
import { sendSms } from '#/api/system/sms/template';