新增待办信息
|
Before Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 8.0 KiB |
@@ -168,6 +168,16 @@
|
||||
},
|
||||
auth: 'biz:mailAttachments:edit',
|
||||
},
|
||||
{
|
||||
icon: 'i-ant-design:download-outlined',
|
||||
color: 'success',
|
||||
title: t('下载'),
|
||||
popConfirm: {
|
||||
title: t('是否确认下载邮件附件?'),
|
||||
confirm: handleDownload.bind(this, record),
|
||||
},
|
||||
auth: 'biz:mailAttachments:edit',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -205,6 +215,18 @@
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
async function handleDownload(record: Recordable){
|
||||
loading.value = true;
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
url: ctxAdminPath + '/biz/mailAttachments/downloadFile',
|
||||
params: {
|
||||
id: record.id
|
||||
},
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
const [registerImportModal, { openModal: importModal }] = useModal();
|
||||
|
||||
@@ -213,7 +235,7 @@
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
const params = { tid: record.tid };
|
||||
const params = { id: record.id };
|
||||
const res = await bizMailAttachmentsDelete(params);
|
||||
showMessage(res.message);
|
||||
await handleSuccess(record);
|
||||
|
||||
@@ -32,12 +32,7 @@
|
||||
<div class="attachments-grid">
|
||||
<div class="attachment-card" v-for="(item, index) in MailAttachments" :key="index">
|
||||
<div class="attachment-icon-wrapper">
|
||||
<img
|
||||
class="attachment-icon"
|
||||
:src="getAttachmentIconUrl(item)"
|
||||
:alt="item.fileName + '图标'"
|
||||
@error="handleIconLoadError"
|
||||
/>
|
||||
<Icon :icon="item.svgIcon" size="24" />
|
||||
</div>
|
||||
|
||||
<div class="attachment-info-wrapper">
|
||||
@@ -62,6 +57,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, PropType } from 'vue';
|
||||
import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
||||
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
|
||||
import { BizMailReceived } from '@jeesite/biz/api/biz/mailReceived';
|
||||
@@ -69,17 +65,6 @@
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { BizMailAttachments, bizMailAttachmentsListAll } from '@jeesite/biz/api/biz/mailAttachments';
|
||||
|
||||
import defaultIcon from '@jeesite/assets/images/file.png';
|
||||
import docxIcon from '@jeesite/assets/images/docx.png';
|
||||
import gzIcon from '@jeesite/assets/images/gz.png';
|
||||
import pdfIcon from '@jeesite/assets/images/pdf.png';
|
||||
import pptxIcon from '@jeesite/assets/images/pptx.png';
|
||||
import pyIcon from '@jeesite/assets/images/py.png';
|
||||
import sqlIcon from '@jeesite/assets/images/sql.png';
|
||||
import wpsIcon from '@jeesite/assets/images/wps.png';
|
||||
import xlsxIcon from '@jeesite/assets/images/xlsx.png';
|
||||
import zipIcon from '@jeesite/assets/images/zip.png';
|
||||
|
||||
// 定义自定义图标配置类型
|
||||
interface CustomIconConfig {
|
||||
default?: string;
|
||||
@@ -90,48 +75,11 @@
|
||||
export default defineComponent({
|
||||
components: { BasicModal },
|
||||
emits: ['modalClose'],
|
||||
props: {
|
||||
customIcons: {
|
||||
type: Object as PropType<CustomIconConfig>,
|
||||
default: () => ({
|
||||
default: 'default-file.png',
|
||||
types: {
|
||||
docx: 'docx.png',
|
||||
gz: 'gz.png',
|
||||
pdf: 'pdf.png',
|
||||
pptx: 'pptx.png',
|
||||
py: 'py.png',
|
||||
sql: 'sql.png',
|
||||
wps: 'wps.png',
|
||||
xlsx: 'xlsx.png',
|
||||
zip: 'zip.png',
|
||||
other: 'default-file.png'
|
||||
},
|
||||
exts: {}
|
||||
})
|
||||
},
|
||||
iconBasePath: {
|
||||
type: String,
|
||||
default: '@jeesite/assets/images/'
|
||||
}
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const ReceivedList = ref<BizMailReceived>();
|
||||
const MailAttachments = ref<BizMailAttachments[]>([]);
|
||||
const { createMessage } = useMessage();
|
||||
const iconMap = {
|
||||
'default-file.png': defaultIcon,
|
||||
'docx.png': docxIcon,
|
||||
'gz.png': gzIcon,
|
||||
'pdf.png': pdfIcon,
|
||||
'pptx.png': pptxIcon,
|
||||
'py.png': pyIcon,
|
||||
'sql.png': sqlIcon,
|
||||
'wps.png': wpsIcon,
|
||||
'xlsx.png': xlsxIcon,
|
||||
'zip.png': zipIcon
|
||||
};
|
||||
|
||||
|
||||
const [register, { closeModal }] = useModalInner(async (data: any) => {
|
||||
if (!data) return;
|
||||
if (data.messageId) {
|
||||
@@ -151,7 +99,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
async function downloadAttachment(attachment: BizMailAttachments) {
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
@@ -175,64 +122,6 @@
|
||||
return `${fileSize.toFixed(1)} ${units[unitIndex]}`;
|
||||
};
|
||||
|
||||
// 第一步:根据文件扩展名获取图标文件名
|
||||
const getAttachmentIconName = (file: BizMailAttachments) => {
|
||||
const { customIcons } = props;
|
||||
const ext = file.fileExt?.toLowerCase() || ''; // 统一转小写,避免大小写问题
|
||||
|
||||
let iconName = '';
|
||||
// 1. 优先按扩展名配置匹配
|
||||
if (customIcons.exts?.[ext]) {
|
||||
iconName = customIcons.exts[ext];
|
||||
}
|
||||
// 2. 按文件类型映射匹配
|
||||
else if (customIcons.types) {
|
||||
// 扩展名 → 图标类型的映射(覆盖所有常见类型)
|
||||
const typeMap: Record<string, string> = {
|
||||
'doc': 'docx.png',
|
||||
'docx': 'docx.png',
|
||||
'gz': 'gz.png',
|
||||
'pdf': 'pdf.png',
|
||||
'ppt': 'pptx.png',
|
||||
'pptx': 'pptx.png',
|
||||
'py': 'py.png',
|
||||
'sql': 'sql.png',
|
||||
'wps': 'wps.png',
|
||||
'xls': 'xlsx.png',
|
||||
'xlsx': 'xlsx.png',
|
||||
'zip': 'zip.png',
|
||||
'rar': 'zip.png',
|
||||
'7z': 'zip.png',
|
||||
'tar': 'zip.png',
|
||||
'jpg': 'default-file.png',
|
||||
'png': 'default-file.png',
|
||||
'txt': 'default-file.png',
|
||||
'json': 'default-file.png'
|
||||
};
|
||||
// 匹配不到则用other类型
|
||||
iconName = typeMap[ext] || customIcons.types['other'] || 'default-file.png';
|
||||
}
|
||||
// 3. 兜底用默认图标
|
||||
iconName = iconName || customIcons.default || 'default-file.png';
|
||||
|
||||
return iconName;
|
||||
};
|
||||
|
||||
// 第二步:根据图标文件名获取打包后的真实URL(核心)
|
||||
const getAttachmentIconUrl = (file: BizMailAttachments) => {
|
||||
const iconName = getAttachmentIconName(file);
|
||||
// 从映射表获取,兜底用默认图标
|
||||
return iconMap[iconName] || iconMap['default-file.png'];
|
||||
};
|
||||
|
||||
// 处理图标加载失败
|
||||
const handleIconLoadError = (e: Event) => {
|
||||
const target = e.target as HTMLImageElement;
|
||||
// 避免无限循环
|
||||
if (target.src === iconMap['default-file.png']) return;
|
||||
target.src = iconMap['default-file.png'];
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
emit('modalClose');
|
||||
closeModal();
|
||||
@@ -246,8 +135,6 @@
|
||||
MailAttachments,
|
||||
downloadAttachment,
|
||||
formatFileSize,
|
||||
getAttachmentIconUrl,
|
||||
handleIconLoadError
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@@ -389,7 +389,7 @@
|
||||
</a-button>
|
||||
</span>
|
||||
<div class="action-buttons">
|
||||
<a-button type="link" size="small" @click="downloadFiles(file)" >
|
||||
<a-button type="link" size="small" :loading="loading" @click="downloadFiles(file)" >
|
||||
<Icon icon="ant-design:cloud-download-outlined"/>
|
||||
</a-button>
|
||||
<a-button type="link" size="small" @click="deleteFiles(file)" danger>
|
||||
@@ -416,22 +416,22 @@ import { Icon } from '@jeesite/core/components/Icon';
|
||||
import { useModal } from '@jeesite/core/components/Modal';
|
||||
import { useGlobSetting } from '@jeesite/core/hooks/setting';
|
||||
import { downloadByUrl } from '@jeesite/core/utils/file/download';
|
||||
import { bizFoldersSave, bizFoldersAllData, bizFolderItemAll, bizFoldersDelete } from '@jeesite/biz/api/biz/folders';
|
||||
import { BizMyfiles, bizMyfilesEdit, bizMyfilesListAll, bizMyfilesDelete } from '@jeesite/biz/api/biz/myfiles';
|
||||
import { BasicTree } from '@jeesite/core/components/Tree';
|
||||
import { useUserStore } from '@jeesite/core/store/modules/user';
|
||||
import UploadModal from './upload.vue';
|
||||
import FolderModal from './folder.vue';
|
||||
import InputModal from './form.vue';
|
||||
|
||||
import { bizFoldersSave, bizFoldersAllData, bizFolderItemAll, bizFoldersDelete } from '@jeesite/biz/api/biz/folders';
|
||||
import { BizMyfiles, bizMyfilesEdit, bizMyfilesListAll, bizMyfilesDelete } from '@jeesite/biz/api/biz/myfiles';
|
||||
|
||||
import { useUserStore } from '@jeesite/core/store/modules/user';
|
||||
const userStore = useUserStore();
|
||||
const userinfo = computed(() => userStore.getUserInfo);
|
||||
import { BasicTree } from '@jeesite/core/components/Tree';
|
||||
|
||||
|
||||
const [registerModal, { openModal: openInputModal }] = useModal();
|
||||
const [registerUpload, { openModal: openUploadModal }] = useModal();
|
||||
const [registerFolder, { openModal: openfolderModal }] = useModal();
|
||||
|
||||
const loading = ref(false);
|
||||
|
||||
interface FolderNode {
|
||||
id: string;
|
||||
@@ -1045,6 +1045,7 @@ const handleFolderModalClose = () => {
|
||||
|
||||
async function downloadFiles(myFiles: BizMyfiles) {
|
||||
message.success("文件正在下载中,请稍后...");
|
||||
loading.value = true;
|
||||
const { ctxAdminPath } = useGlobSetting();
|
||||
await downloadByUrl({
|
||||
url: ctxAdminPath + '/biz/myfiles/downloadFile',
|
||||
@@ -1052,6 +1053,7 @@ async function downloadFiles(myFiles: BizMyfiles) {
|
||||
id : myFiles.id
|
||||
},
|
||||
});
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
async function deleteFiles(myFiles: BizMyfiles) {
|
||||
|
||||