<template>
|
<!-- 系列文档 -->
|
<div class="tableBox">
|
<el-table border :max-height="state.tableHeight" stripe :data="state.m_fileList" style="width: 100%"
|
:empty-text="t('ebookPage.noData.TR')">
|
<el-table-column align="center" header-align="center" width="100" :label="t('ebookPage.operation.TR')">
|
<template #default="scope">
|
<!-- <el-button link size="small" type="primary" icon="Download" @click="downloadFile(scope.$index, scope.row)">{{
|
t("ebookPage.download.TR") }}</el-button> -->
|
<div @click="downloadFile(scope.$index, scope.row)" class="download-style"><el-icon>
|
<Download />
|
</el-icon> {{ t("ebookPage.download.TR") }}</div>
|
</template>
|
</el-table-column>
|
<el-table-column align="center" header-align="center" width="180" property="AttachType"
|
:label="t('ebookPage.type.TR')"></el-table-column>
|
<el-table-column align="center" header-align="center" width="180" property="Name"
|
:label="t('ebookPage.name.TR')"></el-table-column>
|
<el-table-column align="center" header-align="center" width="140" property="UploadTime"
|
:label="t('ebookPage.updateTime.TR')"></el-table-column>
|
<el-table-column align="center" header-align="center" width="60" property="Version"
|
:label="t('ebookPage.version.TR')"></el-table-column>
|
<el-table-column align="center" width="120" header-align="center" property="Language"
|
:label="t('ebookPage.lang.TR')"></el-table-column>
|
<el-table-column width="100" align="center" header-align="center" property="FileSize"
|
:label="t('ebookPage.size.TR')"></el-table-column>
|
<el-table-column header-align="center" property="Description" :label="t('ebookPage.desc.TR')"></el-table-column>
|
</el-table>
|
</div>
|
</template>
|
|
<script setup name="attachFile">
|
import axiosHelper from "@/utils/axiosHelper.js";
|
import { onMounted, nextTick, reactive } from "vue";
|
import { ElTable, ElTableColumn, ElButton } from "element-plus";
|
import { useI18n } from "vue-i18n";
|
const { t } = useI18n()
|
const globalConfig = window.globalConfig
|
let state = reactive({
|
tableHeight: 0,
|
m_seriesID: "",
|
m_fileList: [],
|
})
|
onMounted(() => {
|
initwindowSize()
|
})
|
|
const downloadFile = (file_index, file_item) => {
|
//
|
let root = "";
|
if (file_item.DsLocType == 1) {
|
//oss域名
|
let corpFlag = globalConfig.CorpInfo.CorpFlag; // 公司标识
|
root = "https://spump.oss-cn-shanghai.aliyuncs.com/" + corpFlag + "/";
|
} else if (file_item.DsLocType == 0) {
|
//本地服务 服务器
|
root = globalConfig.WebApiUrl.FileUrl + 'Data/';
|
} else {
|
root = globalConfig.WebApiUrl.FileUrl + 'Data/';
|
}
|
//
|
let src = "";
|
if (file_item.SourceType == 3) {
|
let seriesDocumentUrl = "ProductDocument/";
|
src = `${root}${seriesDocumentUrl}${file_item.DsFileName}`;
|
} else if (file_item.SourceType == 9) {
|
src = `${root}` + `${file_item.DsFileName}`;
|
} else {
|
//系列文件名
|
let seriesFileUrl = "Series" + state.m_seriesID + "/";
|
src = `${root}${seriesFileUrl}${file_item.DsFileName}`;
|
}
|
|
window.open(src, "_blank");
|
//添加 附件下载日志
|
initFileDownLog(file_item);
|
}
|
const initialFileList = (seriesID, fileList) => {
|
state.m_seriesID = seriesID;
|
if (fileList == null) fileList = [];
|
state.m_fileList = fileList;
|
}
|
//添加 附件下载日志
|
const initFileDownLog = (file_item) => {
|
//if(file_item.ID == 0)
|
// return ;
|
let requestData = {
|
SoftType: globalConfig.SoftType,
|
Lang: file_item.Language,
|
FileID: file_item.ID,
|
SeriesID: state.m_seriesID,
|
FileName: file_item.Name,
|
};
|
|
var action_name = "AddSeriesAttachLog";
|
if (file_item.SourceType == 2) action_name = "AddBimFileLog";
|
|
axiosHelper
|
.post({
|
version: 3,
|
controller: "FileDownLog",
|
action: action_name,
|
data: requestData,
|
apiUrlType: "main",
|
isAddUrlSoftType: "false",
|
})
|
.then((res) => {
|
// console.log(res);
|
})
|
.catch((err) => {
|
// console.log(err);
|
});
|
}
|
const initwindowSize = () => {
|
nextTick(function () {
|
let headerHeight = 0;
|
let footerHeight = 0;
|
if (document.querySelector("#app header")) {
|
headerHeight = document.querySelector("#app header").clientHeight;
|
}
|
if (document.querySelector("#app footer")) {
|
footerHeight = document.querySelector("#app footer").clientHeight;
|
}
|
state.tableHeight =
|
document.body.clientHeight - headerHeight - footerHeight - 160; //
|
});
|
window.addEventListener(
|
"resize",
|
() => {
|
return (() => {
|
let headerHeight = 0;
|
let footerHeight = 0;
|
if (document.querySelector("#app header")) {
|
headerHeight = document.querySelector("#app header").clientHeight;
|
}
|
if (document.querySelector("#app footer")) {
|
footerHeight = document.querySelector("#app footer").clientHeight;
|
}
|
state.tableHeight =
|
document.body.clientHeight - headerHeight - footerHeight - 160;
|
})();
|
},
|
false
|
);
|
}
|
|
defineExpose({ initialFileList })
|
</script>
|
<style>
|
.download-style {
|
color: blue;
|
text-decoration: underline;
|
cursor: pointer;
|
}
|
</style>
|