fix: 文件列表添加预览功能
This commit is contained in:
parent
5e9d8ec143
commit
5cb2a8fc5e
@ -987,6 +987,7 @@
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link size="small" @click="onDowmload(row)">下载</el-button>
|
||||
<el-button type="primary" link size="small" @click="onPreview(row)">预览</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -1002,6 +1003,10 @@ import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { useDownload } from "@/hooks/useDownload";
|
||||
import AreaSelected from "@/components/ChinaAreaData/index.vue";
|
||||
import divDialogComponent from "@/components/divDialogComponent/index.vue";
|
||||
import { Base64 } from "js-base64";
|
||||
const uplUrl = import.meta.env.VITE_ULD_API_URL;
|
||||
const baseUrl = window.location.protocol + "//" + window.location.host;
|
||||
// const baseUrl = import.meta.env.VITE_API_URL;
|
||||
const emits = defineEmits(["update:ennMEssageVisible"]);
|
||||
const props = defineProps(["relativeId", "ennMEssageVisible"]);
|
||||
const current = ref([]);
|
||||
@ -1197,6 +1202,14 @@ const onDowmload = row => {
|
||||
useDownload(exportApp, `${row.name}`, { fileUrl: row.response.fileUrl })
|
||||
);
|
||||
};
|
||||
const onPreview = (row: any) => {
|
||||
const fileExtension = row.fileUrl.slice(row.fileUrl.lastIndexOf(".") + 1);
|
||||
const url = Base64.encode(baseUrl + "/xmgl/file/preview?fileUrl=" + row.fileUrl + "&fullfilename=123." + fileExtension);
|
||||
// 标记打包
|
||||
// const url1 = "http://182.90.224.147:8012/onlinePreview?url=";
|
||||
// const url1 = "http://192.168.34.155:8012/onlinePreview?url=";
|
||||
window.open(uplUrl + url);
|
||||
};
|
||||
// 附件信息的查看点击
|
||||
const onAppendix = row => {
|
||||
console.log(row);
|
||||
|
||||
@ -115,6 +115,7 @@ import { jxj_User } from "@/api/types";
|
||||
import { useHandleData } from "@/hooks/useHandleData";
|
||||
import divDialogComponent from "@/components/divDialogComponent/index.vue";
|
||||
import { Base64 } from "js-base64";
|
||||
const uplUrl = import.meta.env.VITE_ULD_API_URL;
|
||||
const emits = defineEmits(["update:fileListVisible"]);
|
||||
const props = defineProps(["relativeId", "engineeringSn", "fileListVisible"]);
|
||||
const selectedAnnex = ref(); // 选中的查看附件
|
||||
@ -149,7 +150,6 @@ const addDialogVisible = ref(false);
|
||||
const dialogVisible = ref(false);
|
||||
const annexFiles = ref([]);
|
||||
const visible1 = ref(false);
|
||||
const uplUrl = import.meta.env.VITE_ULD_API_URL;
|
||||
// 保存附件文件上传列表
|
||||
const saveAnnexFile = async () => {
|
||||
let requestData = {
|
||||
|
||||
@ -290,6 +290,7 @@
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link size="small" @click="onDowmload(row)">下载</el-button>
|
||||
<el-button type="primary" link size="small" @click="onPreview(row)">预览</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -305,6 +306,10 @@ import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { useDownload } from "@/hooks/useDownload";
|
||||
import AreaSelected from "@/components/ChinaAreaData/index.vue";
|
||||
import divDialogComponent from "@/components/divDialogComponent/index.vue";
|
||||
import { Base64 } from "js-base64";
|
||||
const uplUrl = import.meta.env.VITE_ULD_API_URL;
|
||||
const baseUrl = window.location.protocol + "//" + window.location.host;
|
||||
// const baseUrl = import.meta.env.VITE_API_URL;
|
||||
const emits = defineEmits(["update:ennMEssageVisible"]);
|
||||
const props = defineProps(["relativeId", "ennMEssageVisible"]);
|
||||
const current = ref([]);
|
||||
@ -320,6 +325,14 @@ const onDowmload = row => {
|
||||
useDownload(exportApp, `${row.fileName}`, { fileUrl: row.fileUrl })
|
||||
);
|
||||
};
|
||||
const onPreview = (row: any) => {
|
||||
const fileExtension = row.fileUrl.slice(row.fileUrl.lastIndexOf(".") + 1);
|
||||
const url = Base64.encode(baseUrl + "/xmgl/file/preview?fileUrl=" + row.fileUrl + "&fullfilename=123." + fileExtension);
|
||||
// 标记打包
|
||||
// const url1 = "http://182.90.224.147:8012/onlinePreview?url=";
|
||||
// const url1 = "http://192.168.34.155:8012/onlinePreview?url=";
|
||||
window.open(uplUrl + url);
|
||||
};
|
||||
// 附件信息的查看点击
|
||||
const onAppendix = row => {
|
||||
dialogVisible.value = true;
|
||||
@ -521,7 +534,7 @@ onMounted(async () => {
|
||||
border-left: 2px solid #0f81ff;
|
||||
font-size: 24px;
|
||||
color: #333333;
|
||||
width: 90%;
|
||||
width: 97%;
|
||||
margin: 20px auto;
|
||||
> img {
|
||||
width: 16px;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user