Files
my-worker/web-vue/packages/biz/views/biz/settingInfo/account/view.vue

166 lines
4.2 KiB
Vue
Raw Normal View History

2026-01-10 17:47:44 +08:00
<!--
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
-->
<template>
<BasicModal
v-bind="$attrs"
:showFooter="true"
:showOkBtn="false"
@register="registerModal"
2026-02-08 14:28:10 +08:00
defaultFullscreen="true"
2026-01-10 17:47:44 +08:00
width="70%"
>
<template #title>
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
<span> {{ getTitle.value }} </span>
</template>
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup name="ViewsBizMailAccountForm">
import { ref, unref, computed } from 'vue';
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
import { router } from '@jeesite/core/router';
import { Icon } from '@jeesite/core/components/Icon';
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
import { BizMailAccount, bizMailAccountSave, bizMailAccountForm } from '@jeesite/biz/api/biz/mailAccount';
import { formatToDateTime } from '@jeesite/core/utils/dateUtil';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.mailAccount');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizMailAccount>({} as BizMailAccount);
const getTitle = computed(() => ({
icon: meta.icon || 'i-ant-design:book-outlined',
value: t('查看邮件信息'),
}));
const inputFormSchemas: FormSchema<BizMailAccount>[] = [
{
label: t('配置名称'),
field: 'accountName',
component: 'Input',
componentProps: {
maxlength: 255,
},
dynamicDisabled: true,
colProps: { md: 24, lg: 24 },
},
{
label: t('SMTP服务'),
field: 'host',
component: 'Input',
componentProps: {
maxlength: 255,
},
dynamicDisabled: true,
},
{
label: t('SMTP端口'),
field: 'smtpPort',
component: 'InputNumber',
componentProps: {
maxlength: 9,
},
dynamicDisabled: true,
},
{
label: t('IMAP服务'),
field: 'imapHost',
component: 'Input',
componentProps: {
maxlength: 255,
},
dynamicDisabled: true,
},
{
label: t('IMAP端口'),
field: 'imapPort',
component: 'InputNumber',
componentProps: {
maxlength: 9,
},
dynamicDisabled: true,
},
{
label: t('用户名称'),
field: 'username',
component: 'Input',
componentProps: {
maxlength: 255,
},
dynamicDisabled: true,
},
{
label: t('用户密码'),
field: 'password',
component: 'Input',
componentProps: {
maxlength: 255,
},
dynamicDisabled: true,
},
{
label: t('发件地址'),
field: 'fromAddress',
component: 'Input',
componentProps: {
maxlength: 255,
},
dynamicDisabled: true,
},
{
label: t('启用SSL'),
field: 'sslEnable',
component: 'Select',
componentProps: {
dictType: 'is_enable',
allowClear: true,
},
dynamicDisabled: true,
},
{
label: t('备注'),
field: 'remark',
component: 'Input',
componentProps: {
maxlength: 500,
},
dynamicDisabled: true,
},
{
label: t('状态'),
field: 'ustatus',
component: 'Select',
componentProps: {
dictType: 'ustatus',
allowClear: true,
},
dynamicDisabled: true,
},
];
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<BizMailAccount>({
labelWidth: 120,
schemas: inputFormSchemas,
baseColProps: { md: 24, lg: 12 },
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ loading: true });
await resetFields();
const res = await bizMailAccountForm(data);
record.value = (res.bizMailAccount || {}) as BizMailAccount;
record.value.__t = new Date().getTime();
await setFieldsValue(record.value);
setModalProps({ loading: false });
});
</script>