|
|
@@ -24,14 +24,8 @@
|
|
|
</section>
|
|
|
<section class="attachment">
|
|
|
<span class="info-content">附件({{ defenseNoticeDetail?.noticeAttachment.length }})</span>
|
|
|
- <a @click="handleDownloadAll">下载全部</a>
|
|
|
<div class="attachment-list">
|
|
|
- <div
|
|
|
- class="attachment-item"
|
|
|
- v-for="item in defenseNoticeDetail?.noticeAttachment"
|
|
|
- :key="item.id"
|
|
|
- @click="handlePreview(item)"
|
|
|
- >
|
|
|
+ <div class="attachment-item" v-for="item in defenseNoticeDetail?.noticeAttachment" :key="item.id">
|
|
|
<span class="attachment-item--name">{{ item.fileName }}</span>
|
|
|
<div class="attachment-item--footer">
|
|
|
<div class="info">
|
|
|
@@ -51,30 +45,17 @@
|
|
|
import { FILE_TYPE_ICON } from '@/views/disaster/constant';
|
|
|
import { getDefenseNoticeDetail } from '@/api/disaster-warning';
|
|
|
import type { DefenseNoticeDetailResponse, DefenseNoticeAttachment } from '@/types/disaster-warning';
|
|
|
- import VueOfficeDocx from '@vue-office/docx'
|
|
|
- import '@vue-office/docx/lib/index.css'
|
|
|
-
|
|
|
+ import VueOfficeDocx from '@vue-office/docx';
|
|
|
+ import '@vue-office/docx/lib/index.css';
|
|
|
|
|
|
const props = defineProps<{
|
|
|
id: number;
|
|
|
}>();
|
|
|
|
|
|
const defenseNoticeDetail = ref<DefenseNoticeDetailResponse>();
|
|
|
- const handleDownloadAll = () => {
|
|
|
- defenseNoticeDetail.value?.noticeAttachment.forEach((item) => {
|
|
|
- if (item.downloadUrl) {
|
|
|
- window.open(item.downloadUrl, '_blank');
|
|
|
- }
|
|
|
- });
|
|
|
- };
|
|
|
const handleDownload = (fileUrl: string) => {
|
|
|
window.open(fileUrl, '_blank');
|
|
|
};
|
|
|
- const handlePreview = (item: DefenseNoticeAttachment) => {
|
|
|
- if (item.fileType === 'pdf') {
|
|
|
- window.open(item.downloadUrl, '_blank');
|
|
|
- }
|
|
|
- };
|
|
|
|
|
|
onMounted(() => {
|
|
|
getDefenseNoticeDetail(props.id).then((res) => {
|