新增预警页面

This commit is contained in:
2025-12-14 14:21:32 +08:00
parent 228dd136d8
commit 0b40608761
42 changed files with 4871 additions and 2 deletions

View File

@@ -0,0 +1,63 @@
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
*/
import { defHttp } from '@jeesite/core/utils/http/axios';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
import { UploadFileParams } from '@jeesite/types/axios';
import { AxiosProgressEvent } from 'axios';
const { ctxPath, adminPath } = useGlobSetting();
export interface BizMailAccount extends BasicModel<BizMailAccount> {
createTime: string; // 记录时间
accountName: string;
host: string; // SMTP服务
smtpPort: number; // SMTP端口
imapHost: string; // IMAP服务
imapPort: number; // IMAP端口
username: string; // 用户名称
password: string; // 用户密码
fromAddress: string; // 发件人地址
sslEnable?: string; // 是否启用SSL
ustatus: string; //状态
remark?: string; // 备注
updateTime: string; // 更新时间
ftenantId?: string; // 租户id
fflowId?: string; // 流程id
fflowTaskId?: string; // 流程任务主键
fflowState?: number; // 流程任务状态
}
export const bizMailAccountList = (params?: BizMailAccount | any) =>
defHttp.get<BizMailAccount>({ url: adminPath + '/biz/mailAccount/list', params });
export const bizMailAccountListData = (params?: BizMailAccount | any) =>
defHttp.post<Page<BizMailAccount>>({ url: adminPath + '/biz/mailAccount/listData', params });
export const bizMailAccountForm = (params?: BizMailAccount | any) =>
defHttp.get<BizMailAccount>({ url: adminPath + '/biz/mailAccount/form', params });
export const bizMailAccountSave = (params?: any, data?: BizMailAccount | any) =>
defHttp.postJson<BizMailAccount>({ url: adminPath + '/biz/mailAccount/save', params, data });
export const bizMailAccountImportData = (
params: UploadFileParams,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
) =>
defHttp.uploadFile<UploadApiResult>(
{
url: ctxPath + adminPath + '/biz/mailAccount/importData',
onUploadProgress,
},
params,
);
export const bizMailAccountDelete = (params?: BizMailAccount | any) =>
defHttp.get<BizMailAccount>({ url: adminPath + '/biz/mailAccount/delete', params });
export const bizMailReceived = (params?: BizMailAccount | any) =>
defHttp.get<BizMailAccount>({ url: adminPath + '/biz/mailAccount/received', params });

View File

@@ -0,0 +1,55 @@
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
*/
import { defHttp } from '@jeesite/core/utils/http/axios';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
import { UploadFileParams } from '@jeesite/types/axios';
import { AxiosProgressEvent } from 'axios';
const { ctxPath, adminPath } = useGlobSetting();
export interface BizMailAttachments extends BasicModel<BizMailAttachments> {
createTime?: string; // 记录时间
mailId: number; // 收件标识
messageId: string; // 消息标识
fileName: string; // 附件名称
fileSize: number; // 文件大小
fileType?: string; // 文件类型
fileExt?: string; // 文件扩展名
storagePath: string; // 存储路径
fileMd5?: string; // 文件MD5
downloadCount?: number; // 下载次数
isCompressed?: string; // 是否压缩
isEncrypted?: string; // 是否加密
}
export const bizMailAttachmentsList = (params?: BizMailAttachments | any) =>
defHttp.get<BizMailAttachments>({ url: adminPath + '/biz/mailAttachments/list', params });
export const bizMailAttachmentsListData = (params?: BizMailAttachments | any) =>
defHttp.post<Page<BizMailAttachments>>({ url: adminPath + '/biz/mailAttachments/listData', params });
export const bizMailAttachmentsForm = (params?: BizMailAttachments | any) =>
defHttp.get<BizMailAttachments>({ url: adminPath + '/biz/mailAttachments/form', params });
export const bizMailAttachmentsSave = (params?: any, data?: BizMailAttachments | any) =>
defHttp.postJson<BizMailAttachments>({ url: adminPath + '/biz/mailAttachments/save', params, data });
export const bizMailAttachmentsImportData = (
params: UploadFileParams,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
) =>
defHttp.uploadFile<UploadApiResult>(
{
url: ctxPath + adminPath + '/biz/mailAttachments/importData',
onUploadProgress,
},
params,
);
export const bizMailAttachmentsDelete = (params?: BizMailAttachments | any) =>
defHttp.get<BizMailAttachments>({ url: adminPath + '/biz/mailAttachments/delete', params });

View File

@@ -0,0 +1,58 @@
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
*/
import { defHttp } from '@jeesite/core/utils/http/axios';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
import { UploadFileParams } from '@jeesite/types/axios';
import { AxiosProgressEvent } from 'axios';
const { ctxPath, adminPath } = useGlobSetting();
export interface BizMailReceived extends BasicModel<BizMailReceived> {
createTime: string; // 记录时间
messageId: string; // 邮件服务器消息ID
accountId: string; // 邮件账户标识
fromAddress: string; // 发件人地址
fromName?: string; // 发件人名称
toAddresses: string; // 收件人地址
ccAddresses?: string; // 抄送地址
bccAddresses?: string; // 密送地址
subject: string; // 邮件主题
mailContent?: string; // 邮件内容
receivedTime: string; // 接收时间
sendTime?: string; // 发送时间
hasAttachment?: string; // 是否有附件
mailbox: string; // mailbox
ustatus: string; // 状态
}
export const bizMailReceivedList = (params?: BizMailReceived | any) =>
defHttp.get<BizMailReceived>({ url: adminPath + '/biz/mailReceived/list', params });
export const bizMailReceivedListData = (params?: BizMailReceived | any) =>
defHttp.post<Page<BizMailReceived>>({ url: adminPath + '/biz/mailReceived/listData', params });
export const bizMailReceivedForm = (params?: BizMailReceived | any) =>
defHttp.get<BizMailReceived>({ url: adminPath + '/biz/mailReceived/form', params });
export const bizMailReceivedSave = (params?: any, data?: BizMailReceived | any) =>
defHttp.postJson<BizMailReceived>({ url: adminPath + '/biz/mailReceived/save', params, data });
export const bizMailReceivedImportData = (
params: UploadFileParams,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
) =>
defHttp.uploadFile<UploadApiResult>(
{
url: ctxPath + adminPath + '/biz/mailReceived/importData',
onUploadProgress,
},
params,
);
export const bizMailReceivedDelete = (params?: BizMailReceived | any) =>
defHttp.get<BizMailReceived>({ url: adminPath + '/biz/mailReceived/delete', params });

View File

@@ -0,0 +1,60 @@
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
*/
import { defHttp } from '@jeesite/core/utils/http/axios';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
import { UploadFileParams } from '@jeesite/types/axios';
import { AxiosProgressEvent } from 'axios';
const { ctxPath, adminPath } = useGlobSetting();
export interface BizMailSent extends BasicModel<BizMailSent> {
createTime?: string; // 记录时间
messageId: string; // 件服务器消息标识
accountId: string; // 邮件账户标识
fromAddress: string; // 发件人地址
toAddresses: string; // 收件人地址
ccAddresses?: string; // 抄送人地址
subject: string; // 邮件主题
content: string; // 邮件内容
sendTime?: string; // 发送时间
sendStatus: string; // 发送状态
errorMsg?: string; // 错误信息
hasAttachment?: string; // 是否有附件
updateTime?: string; // 更新时间
ftenantId?: string; // 租户id
fflowId?: string; // 流程id
fflowTaskId?: string; // 流程任务主键
fflowState?: number; // 流程任务状态
}
export const bizMailSentList = (params?: BizMailSent | any) =>
defHttp.get<BizMailSent>({ url: adminPath + '/biz/mailSent/list', params });
export const bizMailSentListData = (params?: BizMailSent | any) =>
defHttp.post<Page<BizMailSent>>({ url: adminPath + '/biz/mailSent/listData', params });
export const bizMailSentForm = (params?: BizMailSent | any) =>
defHttp.get<BizMailSent>({ url: adminPath + '/biz/mailSent/form', params });
export const bizMailSentSave = (params?: any, data?: BizMailSent | any) =>
defHttp.postJson<BizMailSent>({ url: adminPath + '/biz/mailSent/save', params, data });
export const bizMailSentImportData = (
params: UploadFileParams,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
) =>
defHttp.uploadFile<UploadApiResult>(
{
url: ctxPath + adminPath + '/biz/mailSent/importData',
onUploadProgress,
},
params,
);
export const bizMailSentDelete = (params?: BizMailSent | any) =>
defHttp.get<BizMailSent>({ url: adminPath + '/biz/mailSent/delete', params });

View File

@@ -91,7 +91,7 @@
{
label: t('数据库密码'),
field: 'dbPassword',
component: 'Input',
component: 'InputPassword',
componentProps: {
maxlength: 256,
},

View File

@@ -0,0 +1,186 @@
<!--
* 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"
:okAuth="'biz:mailAccount:edit'"
@register="registerModal"
@ok="handleSubmit"
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';
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: record.value.isNewRecord ? t('新增邮件信息') : t('编辑邮件信息'),
}));
const inputFormSchemas: FormSchema<BizMailAccount>[] = [
{
label: t('配置名称'),
field: 'accountName',
component: 'Input',
componentProps: {
maxlength: 255,
},
required: true,
colProps: { md: 24, lg: 24 },
},
{
label: t('SMTP服务'),
field: 'host',
component: 'Input',
componentProps: {
maxlength: 255,
},
required: true,
},
{
label: t('SMTP端口'),
field: 'smtpPort',
component: 'InputNumber',
componentProps: {
maxlength: 9,
},
required: true,
},
{
label: t('IMAP服务'),
field: 'imapHost',
component: 'Input',
componentProps: {
maxlength: 255,
},
required: true,
},
{
label: t('IMAP端口'),
field: 'imapPort',
component: 'InputNumber',
componentProps: {
maxlength: 9,
},
required: true,
},
{
label: t('用户名称'),
field: 'username',
component: 'Input',
componentProps: {
maxlength: 255,
},
required: true,
},
{
label: t('用户密码'),
field: 'password',
component: 'InputPassword',
componentProps: {
maxlength: 255,
},
required: true,
},
{
label: t('发件地址'),
field: 'fromAddress',
component: 'Input',
componentProps: {
maxlength: 255,
},
required: true,
},
{
label: t('启用SSL'),
field: 'sslEnable',
component: 'Select',
componentProps: {
dictType: 'is_open',
allowClear: true,
},
required: true,
},
{
label: t('备注'),
field: 'remark',
component: 'Input',
componentProps: {
maxlength: 500,
},
},
{
label: t('状态'),
field: 'ustatus',
component: 'Select',
componentProps: {
dictType: 'ustatus',
allowClear: true,
},
required: 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 });
});
async function handleSubmit() {
try {
const data = await validate();
setModalProps({ confirmLoading: true });
const params: any = {
isNewRecord: record.value.isNewRecord,
id: record.value.id || data.id,
};
// console.log('submit', params, data, record);
const res = await bizMailAccountSave(params, data);
showMessage(res.message);
setTimeout(closeModal);
emit('success', data);
} catch (error: any) {
if (error && error.errorFields) {
showMessage(error.message || t('common.validateError'));
}
console.log('error', error);
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,103 @@
<!--
* 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"
:title="t('导入邮件信息')"
:okText="t('导入')"
@register="registerModal"
@ok="handleSubmit"
:minHeight="120"
:width="400"
>
<Upload accept=".xls,.xlsx" :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
<a-button> <Icon icon="ant-design:upload-outlined" /> {{ t('选择文件') }} </a-button>
<span class="ml-4">{{ uploadInfo }}</span>
</Upload>
<div class="ml-4 mt-4">
{{ t('提示仅允许导入“xls”或“xlsx”格式文件') }}
</div>
<div class="mt-4">
<a-button @click="handleDownloadTemplate()" type="text">
<Icon icon="i-fa:file-excel-o" />
{{ t('下载模板') }}
</a-button>
</div>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { Upload } from 'ant-design-vue';
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { downloadByUrl } from '@jeesite/core/utils/file/download';
import { Icon } from '@jeesite/core/components/Icon';
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
import { bizMailAccountImportData } from '@jeesite/biz/api/biz/mailAccount';
import { FileType } from 'ant-design-vue/es/upload/interface';
import { AxiosProgressEvent } from 'axios';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.mailAccount');
const { showMessage, showMessageModal } = useMessage();
const fileList = ref<FileType[]>([]);
const uploadInfo = ref('');
const beforeUpload = (file: FileType) => {
fileList.value = [file];
return false;
};
const handleRemove = () => {
fileList.value = [];
};
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
fileList.value = [];
uploadInfo.value = '';
});
async function handleDownloadTemplate() {
const { ctxAdminPath } = useGlobSetting();
downloadByUrl({ url: ctxAdminPath + '/biz/mailAccount/importTemplate' });
}
function onUploadProgress(progressEvent: AxiosProgressEvent) {
const complete = ((progressEvent.loaded / (progressEvent.total || 1)) * 100) | 0;
if (complete != 100) {
uploadInfo.value = t('正在导入,请稍候') + ' ' + complete + '%...';
} else {
uploadInfo.value = '';
}
}
async function handleSubmit() {
try {
if (fileList.value.length == 0) {
showMessage(t('请选择要导入的数据文件'));
return;
}
setModalProps({ confirmLoading: true });
const params = {
file: fileList.value[0],
};
const { data } = await bizMailAccountImportData(params, onUploadProgress);
showMessageModal({ content: data.message });
setTimeout(closeModal);
emit('success');
} catch (error: any) {
if (error && error.errorFields) {
showMessage(error.message || t('common.validateError'));
}
console.log('error', error);
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,311 @@
<!--
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
-->
<template>
<div>
<BasicTable @register="registerTable">
<template #tableTitle>
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
<span> {{ getTitle.value }} </span>
</template>
<template #toolbar>
<a-button type="default" :loading="loading" @click="handleExport()">
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
</a-button>
<a-button type="primary" @click="handleForm({})" v-auth="'biz:mailAccount:edit'">
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
</a-button>
</template>
<template #slotBizKey="{ record }">
<a @click="handleForm({ id: record.id })" :title="record.accountName">
{{ record.accountName }}
</a>
</template>
</BasicTable>
<InputForm @register="registerModal" @success="handleSuccess" />
<FormImport @register="registerImportModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup name="ViewsBizMailAccountList">
import { onMounted, ref, unref } from 'vue';
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { downloadByUrl } from '@jeesite/core/utils/file/download';
import { router } from '@jeesite/core/router';
import { Icon } from '@jeesite/core/components/Icon';
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
import { BizMailAccount, bizMailAccountList } from '@jeesite/biz/api/biz/mailAccount';
import { bizMailAccountDelete, bizMailAccountListData, bizMailReceived } from '@jeesite/biz/api/biz/mailAccount';
import { useModal } from '@jeesite/core/components/Modal';
import { FormProps } from '@jeesite/core/components/Form';
import InputForm from './form.vue';
import FormImport from './formImport.vue';
const { t } = useI18n('biz.mailAccount');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizMailAccount>({} as BizMailAccount);
const getTitle = {
icon: meta.icon || 'i-ant-design:book-outlined',
value: t('配置管理'),
};
const loading = ref(false);
const searchForm: FormProps<BizMailAccount> = {
baseColProps: { md: 8, lg: 6 },
labelWidth: 90,
schemas: [
{
label: t('记录时间起'),
field: 'createTime_gte',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('记录时间止'),
field: 'createTime_lte',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('SMTP服务'),
field: 'host',
component: 'Input',
},
{
label: t('用户名称'),
field: 'username',
component: 'Input',
},
{
label: t('发件地址'),
field: 'fromAddress',
component: 'Input',
},
{
label: t('启用SSL'),
field: 'sslEnable',
component: 'Select',
componentProps: {
dictType: 'is_open',
allowClear: true,
},
},
{
label: t('状态'),
field: 'ustatus',
component: 'Select',
componentProps: {
dictType: 'ustatus',
allowClear: true,
onChange: handleSuccess,
},
},
],
};
const tableColumns: BasicColumn<BizMailAccount>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
fixed: 'left',
},
{
title: t('配置名称'),
dataIndex: 'accountName',
key: 'a.account_name',
sorter: true,
width: 130,
align: 'left',
slot: 'slotBizKey',
},
{
title: t('SMTP服务'),
dataIndex: 'host',
key: 'a.host',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('SMTP端口'),
dataIndex: 'smtpPort',
key: 'a.smtp_port',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('IMAP服务'),
dataIndex: 'imapHost',
key: 'a.imap_host',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('IMAP端口'),
dataIndex: 'imapPort',
key: 'a.imap_port',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('用户名称'),
dataIndex: 'username',
key: 'a.username',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('发件地址'),
dataIndex: 'fromAddress',
key: 'a.from_address',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('启用SSL'),
dataIndex: 'sslEnable',
key: 'a.ssl_enable',
sorter: true,
width: 130,
align: 'center',
dictType: 'is_open',
},
{
title: t('状态'),
dataIndex: 'ustatus',
key: 'a.ustatus',
sorter: true,
width: 130,
align: 'center',
dictType: 'ustatus',
},
{
title: t('备注'),
dataIndex: 'remark',
key: 'a.remark',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 180,
align: 'center',
},
];
const actionColumn: BasicColumn<BizMailAccount> = {
width: 160,
align: 'center',
actions: (record: BizMailAccount) => [
{
icon: 'i-clarity:note-edit-line',
title: t('编辑'),
onClick: handleForm.bind(this, { id: record.id }),
auth: 'biz:mailAccount:edit',
},
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
title: t('删除'),
popConfirm: {
title: t('是否确认删除邮件配置?'),
confirm: handleDelete.bind(this, record),
},
auth: 'biz:mailAccount:edit',
},
{
icon: 'ant-design:undo-outlined',
color: 'success',
title: t('接收'),
popConfirm: {
title: t('是否确认接收邮件?'),
confirm: handleReceived.bind(this, record),
},
ifShow: record.ustatus == '1'
},
],
};
const [registerTable, { reload, getForm }] = useTable<BizMailAccount>({
api: bizMailAccountListData,
beforeFetch: (params) => {
return params;
},
columns: tableColumns,
actionColumn: actionColumn,
formConfig: searchForm,
showTableSetting: true,
useSearchForm: true,
canResize: true,
});
onMounted(async () => {
const res = await bizMailAccountList();
record.value = (res.bizMailAccount || {}) as BizMailAccount;
await getForm().setFieldsValue(record.value);
});
const [registerModal, { openModal }] = useModal();
function handleForm(record: Recordable) {
openModal(true, record);
}
async function handleExport() {
loading.value = true;
const { ctxAdminPath } = useGlobSetting();
await downloadByUrl({
url: ctxAdminPath + '/biz/mailAccount/exportData',
params: getForm().getFieldsValue(),
});
loading.value = false;
}
const [registerImportModal, { openModal: importModal }] = useModal();
function handleImport() {
importModal(true, {});
}
async function handleDelete(record: Recordable) {
const params = { id: record.id };
const res = await bizMailAccountDelete(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleReceived(record: Recordable) {
const params = { ...record };
const res = await bizMailReceived(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleSuccess(record: Recordable) {
await reload({ record });
}
</script>

View File

@@ -0,0 +1,180 @@
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
import { bizMailAccountListData } from '@jeesite/biz/api/biz/mailAccount';
const { t } = useI18n('biz.mailAccount');
const modalProps = {
title: t('邮件信息选择'),
};
const searchForm: FormProps<BizMailAccount> = {
baseColProps: { md: 8, lg: 6 },
labelWidth: 90,
schemas: [
{
label: t('记录时间起'),
field: 'createTime_gte',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('记录时间止'),
field: 'createTime_lte',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('服务地址'),
field: 'host',
component: 'Input',
},
{
label: t('用户名称'),
field: 'username',
component: 'Input',
},
{
label: t('发件人地址'),
field: 'fromAddress',
component: 'Input',
},
{
label: t('是否启用SSL'),
field: 'sslEnable',
component: 'Select',
componentProps: {
dictType: 'is_open',
allowClear: true,
},
},
{
label: t('状态'),
field: 'status',
component: 'Select',
componentProps: {
dictType: 'ustatus',
allowClear: true,
},
},
],
};
const tableColumns: BasicColumn<BizMailAccount>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 230,
align: 'left',
slot: 'firstColumn',
},
{
title: t('服务地址'),
dataIndex: 'host',
key: 'a.host',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('SMTP端口'),
dataIndex: 'smtpPort',
key: 'a.smtp_port',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('IMAP端口'),
dataIndex: 'imapPort',
key: 'a.imap_port',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('用户名称'),
dataIndex: 'username',
key: 'a.username',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('用户密码'),
dataIndex: 'password',
key: 'a.password',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('发件人地址'),
dataIndex: 'fromAddress',
key: 'a.from_address',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('是否启用SSL'),
dataIndex: 'sslEnable',
key: 'a.ssl_enable',
sorter: true,
width: 130,
align: 'center',
dictType: 'is_open',
},
{
title: t('状态'),
dataIndex: 'status',
key: 'a.status',
sorter: true,
width: 130,
align: 'center',
dictType: 'ustatus',
},
{
title: t('备注'),
dataIndex: 'remark',
key: 'a.remark',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 130,
align: 'center',
},
];
const tableProps: BasicTableProps = {
api: bizMailAccountListData,
beforeFetch: (params) => {
params['isAll'] = true;
return params;
},
columns: tableColumns,
formConfig: searchForm,
rowKey: 'id',
};
export default {
modalProps,
tableProps,
itemCode: 'id',
itemName: 'id',
isShowCode: false,
};

View File

@@ -0,0 +1,103 @@
<!--
* 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"
:title="t('导入邮件附件表')"
:okText="t('导入')"
@register="registerModal"
@ok="handleSubmit"
:minHeight="120"
:width="400"
>
<Upload accept=".xls,.xlsx" :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
<a-button> <Icon icon="ant-design:upload-outlined" /> {{ t('选择文件') }} </a-button>
<span class="ml-4">{{ uploadInfo }}</span>
</Upload>
<div class="ml-4 mt-4">
{{ t('提示仅允许导入“xls”或“xlsx”格式文件') }}
</div>
<div class="mt-4">
<a-button @click="handleDownloadTemplate()" type="text">
<Icon icon="i-fa:file-excel-o" />
{{ t('下载模板') }}
</a-button>
</div>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { Upload } from 'ant-design-vue';
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { downloadByUrl } from '@jeesite/core/utils/file/download';
import { Icon } from '@jeesite/core/components/Icon';
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
import { bizMailAttachmentsImportData } from '@jeesite/biz/api/biz/mailAttachments';
import { FileType } from 'ant-design-vue/es/upload/interface';
import { AxiosProgressEvent } from 'axios';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.mailAttachments');
const { showMessage, showMessageModal } = useMessage();
const fileList = ref<FileType[]>([]);
const uploadInfo = ref('');
const beforeUpload = (file: FileType) => {
fileList.value = [file];
return false;
};
const handleRemove = () => {
fileList.value = [];
};
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
fileList.value = [];
uploadInfo.value = '';
});
async function handleDownloadTemplate() {
const { ctxAdminPath } = useGlobSetting();
downloadByUrl({ url: ctxAdminPath + '/biz/mailAttachments/importTemplate' });
}
function onUploadProgress(progressEvent: AxiosProgressEvent) {
const complete = ((progressEvent.loaded / (progressEvent.total || 1)) * 100) | 0;
if (complete != 100) {
uploadInfo.value = t('正在导入,请稍候') + ' ' + complete + '%...';
} else {
uploadInfo.value = '';
}
}
async function handleSubmit() {
try {
if (fileList.value.length == 0) {
showMessage(t('请选择要导入的数据文件'));
return;
}
setModalProps({ confirmLoading: true });
const params = {
file: fileList.value[0],
};
const { data } = await bizMailAttachmentsImportData(params, onUploadProgress);
showMessageModal({ content: data.message });
setTimeout(closeModal);
emit('success');
} catch (error: any) {
if (error && error.errorFields) {
showMessage(error.message || t('common.validateError'));
}
console.log('error', error);
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,258 @@
<!--
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
-->
<template>
<div>
<BasicTable @register="registerTable">
<template #tableTitle>
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
<span> {{ getTitle.value }} </span>
</template>
<template #toolbar>
<a-button type="default" :loading="loading" @click="handleExport()">
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
</a-button>
</template>
</BasicTable>
<FormImport @register="registerImportModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup name="ViewsBizMailAttachmentsList">
import { onMounted, ref, unref } from 'vue';
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { downloadByUrl } from '@jeesite/core/utils/file/download';
import { router } from '@jeesite/core/router';
import { Icon } from '@jeesite/core/components/Icon';
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
import { BizMailAttachments, bizMailAttachmentsList } from '@jeesite/biz/api/biz/mailAttachments';
import { bizMailAttachmentsDelete, bizMailAttachmentsListData } from '@jeesite/biz/api/biz/mailAttachments';
import { useDrawer } from '@jeesite/core/components/Drawer';
import { useModal } from '@jeesite/core/components/Modal';
import { FormProps } from '@jeesite/core/components/Form';
import FormImport from './formImport.vue';
const { t } = useI18n('biz.mailAttachments');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizMailAttachments>({} as BizMailAttachments);
const getTitle = {
icon: meta.icon || 'i-ant-design:book-outlined',
value: t('附件管理'),
};
const loading = ref(false);
const searchForm: FormProps<BizMailAttachments> = {
baseColProps: { md: 8, lg: 6 },
labelWidth: 90,
schemas: [
{
label: t('记录时间起'),
field: 'createTime_gte',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('记录时间止'),
field: 'createTime_lte',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('收件标识'),
field: 'mailId',
component: 'Input',
},
{
label: t('附件名称'),
field: 'fileName',
component: 'Input',
},
{
label: t('文件扩展名'),
field: 'fileExt',
component: 'Input',
},
{
label: t('是否压缩'),
field: 'isCompressed',
component: 'Input',
},
{
label: t('是否加密'),
field: 'isEncrypted',
component: 'Input',
},
],
};
const tableColumns: BasicColumn<BizMailAttachments>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
slot: 'firstColumn',
},
{
title: t('收件标识'),
dataIndex: 'mailId',
key: 'a.mail_id',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('附件名称'),
dataIndex: 'fileName',
key: 'a.file_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('文件大小'),
dataIndex: 'fileSize',
key: 'a.file_size',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('文件类型'),
dataIndex: 'fileType',
key: 'a.file_type',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('文件扩展名'),
dataIndex: 'fileExt',
key: 'a.file_ext',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('存储路径'),
dataIndex: 'storagePath',
key: 'a.storage_path',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('文件MD5'),
dataIndex: 'fileMd5',
key: 'a.file_md5',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('下载次数'),
dataIndex: 'downloadCount',
key: 'a.download_count',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('是否压缩'),
dataIndex: 'isCompressed',
key: 'a.is_compressed',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('是否加密'),
dataIndex: 'isEncrypted',
key: 'a.is_encrypted',
sorter: true,
width: 130,
align: 'left',
},
];
const actionColumn: BasicColumn<BizMailAttachments> = {
width: 160,
actions: (record: BizMailAttachments) => [
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
title: t('删除'),
popConfirm: {
title: t('是否确认删除邮件附件?'),
confirm: handleDelete.bind(this, record),
},
auth: 'biz:mailAttachments:edit',
},
],
};
const [registerTable, { reload, getForm }] = useTable<BizMailAttachments>({
api: bizMailAttachmentsListData,
beforeFetch: (params) => {
return params;
},
columns: tableColumns,
actionColumn: actionColumn,
formConfig: searchForm,
showTableSetting: true,
useSearchForm: true,
canResize: true,
});
onMounted(async () => {
const res = await bizMailAttachmentsList();
record.value = (res.bizMailAttachments || {}) as BizMailAttachments;
await getForm().setFieldsValue(record.value);
});
const [registerDrawer, { openDrawer }] = useDrawer();
function handleForm(record: Recordable) {
openDrawer(true, record);
}
async function handleExport() {
loading.value = true;
const { ctxAdminPath } = useGlobSetting();
await downloadByUrl({
url: ctxAdminPath + '/biz/mailAttachments/exportData',
params: getForm().getFieldsValue(),
});
loading.value = false;
}
const [registerImportModal, { openModal: importModal }] = useModal();
function handleImport() {
importModal(true, {});
}
async function handleDelete(record: Recordable) {
const params = { tid: record.tid };
const res = await bizMailAttachmentsDelete(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleSuccess(record: Recordable) {
await reload({ record });
}
</script>

View File

@@ -0,0 +1,39 @@
<template>
<div class="web-page-container">
<Tabs v-model:activeKey="activeKey">
<TabPane key="1" tab="发件箱">
<MailSent />
</TabPane>
<TabPane key="2" tab="收件箱">
<MailReceived />
</TabPane>
<TabPane key="3" tab="附件箱">
<MailAttachments />
</TabPane>
<TabPane key="4" tab="邮箱配置">
<MailAccount />
</TabPane>
</Tabs>
</div>
</template>
<script lang="ts" setup name="AboutPage">
import { h, ref } from 'vue';
import { Tag, Tabs ,TabPane } from 'ant-design-vue';
import MailSent from './sent/list.vue';
import MailReceived from './received/list.vue';
import MailAttachments from './attachments/list.vue';
import MailAccount from './account/list.vue';
const activeKey = ref('1');
</script>
<style scoped lang="less">
// 整体容器样式
.web-page-container {
width: 100%;
background-color: #e8f4f8;
display: flex;
flex-direction: column; // 垂直布局
overflow: hidden; // 防止内容溢出
}
</style>

View File

@@ -0,0 +1,103 @@
<!--
* 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"
:title="t('导入收件')"
:okText="t('导入')"
@register="registerModal"
@ok="handleSubmit"
:minHeight="120"
:width="400"
>
<Upload accept=".xls,.xlsx" :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
<a-button> <Icon icon="ant-design:upload-outlined" /> {{ t('选择文件') }} </a-button>
<span class="ml-4">{{ uploadInfo }}</span>
</Upload>
<div class="ml-4 mt-4">
{{ t('提示仅允许导入“xls”或“xlsx”格式文件') }}
</div>
<div class="mt-4">
<a-button @click="handleDownloadTemplate()" type="text">
<Icon icon="i-fa:file-excel-o" />
{{ t('下载模板') }}
</a-button>
</div>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { Upload } from 'ant-design-vue';
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { downloadByUrl } from '@jeesite/core/utils/file/download';
import { Icon } from '@jeesite/core/components/Icon';
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
import { bizMailReceivedImportData } from '@jeesite/biz/api/biz/mailReceived';
import { FileType } from 'ant-design-vue/es/upload/interface';
import { AxiosProgressEvent } from 'axios';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.mailReceived');
const { showMessage, showMessageModal } = useMessage();
const fileList = ref<FileType[]>([]);
const uploadInfo = ref('');
const beforeUpload = (file: FileType) => {
fileList.value = [file];
return false;
};
const handleRemove = () => {
fileList.value = [];
};
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
fileList.value = [];
uploadInfo.value = '';
});
async function handleDownloadTemplate() {
const { ctxAdminPath } = useGlobSetting();
downloadByUrl({ url: ctxAdminPath + '/biz/mailReceived/importTemplate' });
}
function onUploadProgress(progressEvent: AxiosProgressEvent) {
const complete = ((progressEvent.loaded / (progressEvent.total || 1)) * 100) | 0;
if (complete != 100) {
uploadInfo.value = t('正在导入,请稍候') + ' ' + complete + '%...';
} else {
uploadInfo.value = '';
}
}
async function handleSubmit() {
try {
if (fileList.value.length == 0) {
showMessage(t('请选择要导入的数据文件'));
return;
}
setModalProps({ confirmLoading: true });
const params = {
file: fileList.value[0],
};
const { data } = await bizMailReceivedImportData(params, onUploadProgress);
showMessageModal({ content: data.message });
setTimeout(closeModal);
emit('success');
} catch (error: any) {
if (error && error.errorFields) {
showMessage(error.message || t('common.validateError'));
}
console.log('error', error);
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,227 @@
<!--
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
-->
<template>
<div>
<BasicTable @register="registerTable">
<template #tableTitle>
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
<span> {{ getTitle.value }} </span>
</template>
<template #toolbar>
<a-button type="default" :loading="loading" @click="handleExport()">
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
</a-button>
</template>
</BasicTable>
<FormImport @register="registerImportModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup name="ViewsBizMailReceivedList">
import { onMounted, ref, unref } from 'vue';
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { downloadByUrl } from '@jeesite/core/utils/file/download';
import { router } from '@jeesite/core/router';
import { Icon } from '@jeesite/core/components/Icon';
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
import { BizMailReceived, bizMailReceivedList } from '@jeesite/biz/api/biz/mailReceived';
import { bizMailReceivedDelete, bizMailReceivedListData } from '@jeesite/biz/api/biz/mailReceived';
import { useDrawer } from '@jeesite/core/components/Drawer';
import { useModal } from '@jeesite/core/components/Modal';
import { FormProps } from '@jeesite/core/components/Form';
import FormImport from './formImport.vue';
const { t } = useI18n('biz.mailReceived');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizMailReceived>({} as BizMailReceived);
const getTitle = {
icon: meta.icon || 'i-ant-design:book-outlined',
value: t('收件管理'),
};
const loading = ref(false);
const searchForm: FormProps<BizMailReceived> = {
baseColProps: { md: 8, lg: 6 },
labelWidth: 90,
schemas: [
{
label: t('记录时间起'),
field: 'createTime_gte',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('记录时间止'),
field: 'createTime_lte',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('账号名称'),
field: 'accountId',
component: 'Input',
},
{
label: t('发件人名称'),
field: 'fromName',
component: 'Input',
},
{
label: t('邮件主题'),
field: 'subject',
component: 'Input',
},
{
label: t('是否有附件'),
field: 'hasAttachment',
component: 'Input',
},
{
label: t('状态'),
field: 'ustatus',
component: 'Input',
},
],
};
const tableColumns: BasicColumn<BizMailReceived>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
fixed: 'left',
},
{
title: t('账户标识'),
dataIndex: 'accountId',
key: 'a.account_id',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('发件人地址'),
dataIndex: 'fromAddress',
key: 'a.from_address',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('发件人名称'),
dataIndex: 'fromName',
key: 'a.from_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('邮件主题'),
dataIndex: 'subject',
key: 'a.subject',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('接收时间'),
dataIndex: 'receivedTime',
key: 'a.received_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('是否有附件'),
dataIndex: 'hasAttachment',
key: 'a.has_attachment',
sorter: true,
width: 130,
align: 'left',
},
];
const actionColumn: BasicColumn<BizMailReceived> = {
width: 160,
align: 'center',
actions: (record: BizMailReceived) => [
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
title: t('删除'),
popConfirm: {
title: t('是否确认删除邮件?'),
confirm: handleDelete.bind(this, record),
},
auth: 'biz:mailReceived:edit',
},
],
};
const [registerTable, { reload, getForm }] = useTable<BizMailReceived>({
api: bizMailReceivedListData,
beforeFetch: (params) => {
return params;
},
columns: tableColumns,
actionColumn: actionColumn,
formConfig: searchForm,
showTableSetting: true,
useSearchForm: true,
canResize: true,
});
onMounted(async () => {
const res = await bizMailReceivedList();
record.value = (res.bizMailReceived || {}) as BizMailReceived;
await getForm().setFieldsValue(record.value);
});
const [registerDrawer, { openDrawer }] = useDrawer();
function handleForm(record: Recordable) {
openDrawer(true, record);
}
async function handleExport() {
loading.value = true;
const { ctxAdminPath } = useGlobSetting();
await downloadByUrl({
url: ctxAdminPath + '/biz/mailReceived/exportData',
params: getForm().getFieldsValue(),
});
loading.value = false;
}
const [registerImportModal, { openModal: importModal }] = useModal();
function handleImport() {
importModal(true, {});
}
async function handleDelete(record: Recordable) {
const params = { id: record.id };
const res = await bizMailReceivedDelete(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleSuccess(record: Recordable) {
await reload({ record });
}
</script>

View File

@@ -0,0 +1,137 @@
<!--
* 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"
:okAuth="'biz:mailSent:edit'"
@register="registerModal"
@ok="handleSubmit"
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="ViewsBizMailSentForm">
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 { BizMailSent, bizMailSentSave, bizMailSentForm } from '@jeesite/biz/api/biz/mailSent';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.mailSent');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizMailSent>({} as BizMailSent);
const getTitle = computed(() => ({
icon: meta.icon || 'i-ant-design:book-outlined',
value: record.value.isNewRecord ? t('新增发件') : t('编辑发件'),
}));
const inputFormSchemas: FormSchema<BizMailSent>[] = [
{
label: t('邮件主题'),
field: 'subject',
component: 'Input',
componentProps: {
maxlength: 500,
},
required: true,
},
{
label: t('账户名称'),
field: 'accountId',
component: 'Input',
componentProps: {
maxlength: 52,
},
required: true,
},
{
label: t('发件人地址'),
field: 'fromAddress',
component: 'Input',
componentProps: {
maxlength: 255,
},
required: true,
},
{
label: t('收件人地址'),
field: 'toAddresses',
component: 'Input',
required: true,
},
{
label: t('邮件内容'),
field: 'content',
component: 'InputTextArea',
required: true,
colProps: { md: 24, lg: 24 },
},
{
label: t('附件上传'),
field: 'dataMap',
component: 'Upload',
componentProps: {
loadTime: computed(() => record.value.__t),
bizKey: computed(() => record.value.id),
bizType: 'bizMailSent_file',
uploadType: 'all',
},
colProps: { md: 24, lg: 24 },
},
];
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<BizMailSent>({
labelWidth: 120,
schemas: inputFormSchemas,
baseColProps: { md: 24, lg: 12 },
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ loading: true });
await resetFields();
const res = await bizMailSentForm(data);
record.value = (res.bizMailSent || {}) as BizMailSent;
record.value.__t = new Date().getTime();
await setFieldsValue(record.value);
setModalProps({ loading: false });
});
async function handleSubmit() {
try {
const data = await validate();
setModalProps({ confirmLoading: true });
const params: any = {
isNewRecord: record.value.isNewRecord,
id: record.value.id || data.id,
};
// console.log('submit', params, data, record);
const res = await bizMailSentSave(params, data);
showMessage(res.message);
setTimeout(closeModal);
emit('success', data);
} catch (error: any) {
if (error && error.errorFields) {
showMessage(error.message || t('common.validateError'));
}
console.log('error', error);
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,103 @@
<!--
* 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"
:title="t('导入发件')"
:okText="t('导入')"
@register="registerModal"
@ok="handleSubmit"
:minHeight="120"
:width="400"
>
<Upload accept=".xls,.xlsx" :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
<a-button> <Icon icon="ant-design:upload-outlined" /> {{ t('选择文件') }} </a-button>
<span class="ml-4">{{ uploadInfo }}</span>
</Upload>
<div class="ml-4 mt-4">
{{ t('提示仅允许导入“xls”或“xlsx”格式文件') }}
</div>
<div class="mt-4">
<a-button @click="handleDownloadTemplate()" type="text">
<Icon icon="i-fa:file-excel-o" />
{{ t('下载模板') }}
</a-button>
</div>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { Upload } from 'ant-design-vue';
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { downloadByUrl } from '@jeesite/core/utils/file/download';
import { Icon } from '@jeesite/core/components/Icon';
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
import { bizMailSentImportData } from '@jeesite/biz/api/biz/mailSent';
import { FileType } from 'ant-design-vue/es/upload/interface';
import { AxiosProgressEvent } from 'axios';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.mailSent');
const { showMessage, showMessageModal } = useMessage();
const fileList = ref<FileType[]>([]);
const uploadInfo = ref('');
const beforeUpload = (file: FileType) => {
fileList.value = [file];
return false;
};
const handleRemove = () => {
fileList.value = [];
};
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
fileList.value = [];
uploadInfo.value = '';
});
async function handleDownloadTemplate() {
const { ctxAdminPath } = useGlobSetting();
downloadByUrl({ url: ctxAdminPath + '/biz/mailSent/importTemplate' });
}
function onUploadProgress(progressEvent: AxiosProgressEvent) {
const complete = ((progressEvent.loaded / (progressEvent.total || 1)) * 100) | 0;
if (complete != 100) {
uploadInfo.value = t('正在导入,请稍候') + ' ' + complete + '%...';
} else {
uploadInfo.value = '';
}
}
async function handleSubmit() {
try {
if (fileList.value.length == 0) {
showMessage(t('请选择要导入的数据文件'));
return;
}
setModalProps({ confirmLoading: true });
const params = {
file: fileList.value[0],
};
const { data } = await bizMailSentImportData(params, onUploadProgress);
showMessageModal({ content: data.message });
setTimeout(closeModal);
emit('success');
} catch (error: any) {
if (error && error.errorFields) {
showMessage(error.message || t('common.validateError'));
}
console.log('error', error);
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,252 @@
<!--
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
-->
<template>
<div>
<BasicTable @register="registerTable">
<template #tableTitle>
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
<span> {{ getTitle.value }} </span>
</template>
<template #toolbar>
<a-button type="default" :loading="loading" @click="handleExport()">
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
</a-button>
<a-button type="primary" @click="handleForm({})" v-auth="'biz:mailSent:edit'">
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
</a-button>
</template>
<template #firstColumn="{ record }">
<a @click="handleForm({ id: record.id })" :title="record.createTime">
{{ record.createTime }}
</a>
</template>
</BasicTable>
<InputForm @register="registerModal" @success="handleSuccess" />
<FormImport @register="registerImportModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup name="ViewsBizMailSentList">
import { onMounted, ref, unref } from 'vue';
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { downloadByUrl } from '@jeesite/core/utils/file/download';
import { router } from '@jeesite/core/router';
import { Icon } from '@jeesite/core/components/Icon';
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
import { BizMailSent, bizMailSentList } from '@jeesite/biz/api/biz/mailSent';
import { bizMailSentDelete, bizMailSentListData } from '@jeesite/biz/api/biz/mailSent';
import { useModal } from '@jeesite/core/components/Modal';
import { FormProps } from '@jeesite/core/components/Form';
import InputForm from './form.vue';
import FormImport from './formImport.vue';
const { t } = useI18n('biz.mailSent');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizMailSent>({} as BizMailSent);
const getTitle = {
icon: meta.icon || 'i-ant-design:book-outlined',
value: t('发件管理'),
};
const loading = ref(false);
const searchForm: FormProps<BizMailSent> = {
baseColProps: { md: 8, lg: 6 },
labelWidth: 90,
schemas: [
{
label: t('记录时间起'),
field: 'createTime_gte',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('记录时间止'),
field: 'createTime_lte',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('账号名称'),
field: 'accountId',
component: 'Input',
},
{
label: t('发件地址'),
field: 'fromAddress',
component: 'Input',
},
{
label: t('邮件主题'),
field: 'subject',
component: 'Input',
},
{
label: t('发送状态'),
field: 'sendStatus',
component: 'Select',
componentProps: {
dictType: '',
allowClear: true,
},
},
{
label: t('有无附件'),
field: 'hasAttachment',
component: 'Select',
componentProps: {
dictType: '',
allowClear: true,
},
},
],
};
const tableColumns: BasicColumn<BizMailSent>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
slot: 'firstColumn',
},
{
title: t('发件人地址'),
dataIndex: 'fromAddress',
key: 'a.from_address',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('收件人地址'),
dataIndex: 'toAddresses',
key: 'a.to_addresses',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('邮件主题'),
dataIndex: 'subject',
key: 'a.subject',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('发送时间'),
dataIndex: 'sendTime',
key: 'a.send_time',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('发送状态'),
dataIndex: 'sendStatus',
key: 'a.send_status',
sorter: true,
width: 130,
align: 'left',
dictType: '',
},
{
title: t('是否有附件'),
dataIndex: 'hasAttachment',
key: 'a.has_attachment',
sorter: true,
width: 130,
align: 'left',
dictType: '',
},
];
const actionColumn: BasicColumn<BizMailSent> = {
width: 160,
align: 'center',
actions: (record: BizMailSent) => [
{
icon: 'i-clarity:note-edit-line',
title: t('编辑'),
onClick: handleForm.bind(this, { id: record.id }),
auth: 'biz:mailSent:edit',
},
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
title: t('删除'),
popConfirm: {
title: t('是否确认删除发件信息?'),
confirm: handleDelete.bind(this, record),
},
auth: 'biz:mailSent:edit',
},
],
};
const [registerTable, { reload, getForm }] = useTable<BizMailSent>({
api: bizMailSentListData,
beforeFetch: (params) => {
return params;
},
columns: tableColumns,
actionColumn: actionColumn,
formConfig: searchForm,
showTableSetting: true,
useSearchForm: true,
canResize: true,
});
onMounted(async () => {
const res = await bizMailSentList();
record.value = (res.bizMailSent || {}) as BizMailSent;
await getForm().setFieldsValue(record.value);
});
const [registerModal, { openModal }] = useModal();
function handleForm(record: Recordable) {
openModal(true, record);
}
async function handleExport() {
loading.value = true;
const { ctxAdminPath } = useGlobSetting();
await downloadByUrl({
url: ctxAdminPath + '/biz/mailSent/exportData',
params: getForm().getFieldsValue(),
});
loading.value = false;
}
const [registerImportModal, { openModal: importModal }] = useModal();
function handleImport() {
importModal(true, {});
}
async function handleDelete(record: Recordable) {
const params = { id: record.id };
const res = await bizMailSentDelete(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleSuccess(record: Recordable) {
await reload({ record });
}
</script>

View File

@@ -0,0 +1,196 @@
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
import { bizMailSentListData } from '@jeesite/biz/api/biz/mailSent';
const { t } = useI18n('biz.mailSent');
const modalProps = {
title: t('发件选择'),
};
const searchForm: FormProps<BizMailSent> = {
baseColProps: { md: 8, lg: 6 },
labelWidth: 90,
schemas: [
{
label: t('记录时间起'),
field: 'createTime_gte',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('记录时间止'),
field: 'createTime_lte',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('邮件账户标识'),
field: 'accountId',
component: 'Input',
},
{
label: t('发件人地址'),
field: 'fromAddress',
component: 'Input',
},
{
label: t('邮件主题'),
field: 'subject',
component: 'Input',
},
{
label: t('发送状态'),
field: 'sendStatus',
component: 'Select',
componentProps: {
dictType: '',
allowClear: true,
},
},
{
label: t('是否有附件'),
field: 'hasAttachment',
component: 'Select',
componentProps: {
dictType: '',
allowClear: true,
},
},
],
};
const tableColumns: BasicColumn<BizMailSent>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 230,
align: 'left',
slot: 'firstColumn',
},
{
title: t('件服务器消息标识'),
dataIndex: 'messageId',
key: 'a.message_id',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('邮件账户标识'),
dataIndex: 'accountId',
key: 'a.account_id',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('发件人地址'),
dataIndex: 'fromAddress',
key: 'a.from_address',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('收件人地址'),
dataIndex: 'toAddresses',
key: 'a.to_addresses',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('抄送人地址'),
dataIndex: 'ccAddresses',
key: 'a.cc_addresses',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('邮件主题'),
dataIndex: 'subject',
key: 'a.subject',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('邮件内容'),
dataIndex: 'content',
key: 'a.content',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('发送时间'),
dataIndex: 'sendTime',
key: 'a.send_time',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('发送状态'),
dataIndex: 'sendStatus',
key: 'a.send_status',
sorter: true,
width: 130,
align: 'left',
dictType: '',
},
{
title: t('错误信息'),
dataIndex: 'errorMsg',
key: 'a.error_msg',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('是否有附件'),
dataIndex: 'hasAttachment',
key: 'a.has_attachment',
sorter: true,
width: 130,
align: 'left',
dictType: '',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 130,
align: 'center',
},
];
const tableProps: BasicTableProps = {
api: bizMailSentListData,
beforeFetch: (params) => {
params['isAll'] = true;
return params;
},
columns: tableColumns,
formConfig: searchForm,
rowKey: 'id',
};
export default {
modalProps,
tableProps,
itemCode: 'id',
itemName: 'id',
isShowCode: false,
};

View File

@@ -184,7 +184,7 @@
helpMessage: '控制器中定义的权限标识,如:@RequiresPermissions("权限标识")',
component: 'Input',
componentProps: {
maxlength: 100,
maxlength: 1000,
},
},