2024-09-13 11:11:21 +08:00
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<el-drawer v-model="drawer" size="1000px">
|
|
|
|
|
<el-collapse v-model="activeName" accordion>
|
2024-09-18 15:52:50 +08:00
|
|
|
<!-- <el-collapse-item title="典型电能质量干扰源" name="1"></el-collapse-item> -->
|
|
|
|
|
<el-collapse-item title="国家电网有限公司企业标准" name="2">
|
|
|
|
|
<!-- <el-empty description="暂无数据" class="custom-empty iframe" /> -->
|
|
|
|
|
<div :style="`overflow: auto;`" class="iframe">
|
|
|
|
|
<vue-office-docx v-if="url.includes('.doc') || url.includes('.docx')" :src="url" />
|
|
|
|
|
<vue-office-excel v-if="url.includes('.xls') || url.includes('.xlsx')" :src="url" />
|
|
|
|
|
<vue-office-pdf v-if="url.includes('.pdf')" :src="url" />
|
|
|
|
|
<img
|
|
|
|
|
v-if="
|
|
|
|
|
url.includes('.png') ||
|
|
|
|
|
url.includes('.jpg') ||
|
|
|
|
|
url.includes('.gif') ||
|
|
|
|
|
url.includes('.bmp')
|
|
|
|
|
"
|
|
|
|
|
:src="url"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-09-13 11:11:21 +08:00
|
|
|
</el-collapse-item>
|
|
|
|
|
</el-collapse>
|
|
|
|
|
</el-drawer>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
2024-09-18 15:52:50 +08:00
|
|
|
//引入相关样式
|
|
|
|
|
import '@vue-office/excel/lib/index.css'
|
|
|
|
|
//引入VueOfficeDocx组件
|
|
|
|
|
import VueOfficeDocx from '@vue-office/docx'
|
|
|
|
|
import VueOfficeExcel from '@vue-office/excel'
|
|
|
|
|
//引入VueOfficePdf组件
|
|
|
|
|
import VueOfficePdf from '@vue-office/pdf'
|
2024-09-13 11:11:21 +08:00
|
|
|
import { ref, reactive } from 'vue'
|
|
|
|
|
const drawer = ref(false)
|
|
|
|
|
const activeName = ref('2')
|
2024-09-18 15:52:50 +08:00
|
|
|
const num = ref(0)
|
|
|
|
|
import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
|
|
|
|
|
const url = ref('')
|
|
|
|
|
const open = (row: any) => {
|
|
|
|
|
// console.log('🚀 ~ open ~ row:', row)
|
|
|
|
|
// url.value = row
|
2024-09-13 11:11:21 +08:00
|
|
|
drawer.value = true
|
2024-09-18 15:52:50 +08:00
|
|
|
|
|
|
|
|
getFileNameAndFilePath({ filePath: row }).then(res => {
|
|
|
|
|
url.value = res.data.url
|
|
|
|
|
})
|
2024-09-13 11:11:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
defineExpose({ open })
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
/* 设置iframe的样式 */
|
2024-09-18 15:52:50 +08:00
|
|
|
.iframe {
|
2024-09-13 11:11:21 +08:00
|
|
|
width: 100%; /* 宽度设置为父容器的100% */
|
2024-09-18 15:52:50 +08:00
|
|
|
height: calc(100vh - 110px); /* 高度根据需要设置 */
|
2024-09-13 11:11:21 +08:00
|
|
|
border: none; /* 移除边框 */
|
|
|
|
|
transform: scale(1); /* 放大200% */
|
2024-09-18 15:52:50 +08:00
|
|
|
}
|
|
|
|
|
/* 自定义 el-empty 的样式 */
|
|
|
|
|
:deep(.custom-empty) {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
height: 100%; /* 调整高度 */
|
|
|
|
|
padding: 20px; /* 调整内边距 */
|
|
|
|
|
.el-empty__image {
|
|
|
|
|
display: none; /* 隐藏默认图片 */
|
|
|
|
|
}
|
|
|
|
|
.el-empty__description {
|
|
|
|
|
font-size: 14px; /* 调整字体大小 */
|
|
|
|
|
color: var(--vxe-font-color);
|
|
|
|
|
}
|
2024-09-13 11:11:21 +08:00
|
|
|
}
|
|
|
|
|
</style>
|