保存进度

This commit is contained in:
2025-11-30 14:59:27 +08:00
parent 835e812d4e
commit 8e97044faa
4 changed files with 70 additions and 12 deletions

View File

@@ -14,13 +14,13 @@ interface RegulatoryData {
release_year: string;
regulatory_name: string;
comment: string;
regulatory_files: null | RegulatoryFile[];
regulatory_files: RegulatoryFile[];
}
interface RegulatoryFile {
regulatory_file_name: string;
file_url: string;
local_file_path: null | string;
local_file_path: string;
file_type: string;
}

View File

@@ -115,7 +115,7 @@ Copyright © CPIC All rights reserved
</el-upload>
</el-dialog>
<el-dialog
v-model="ui.showPreviewDialog" :close-on-click-model="false"
v-model="ui.isPDF" :close-on-click-model="false"
:close-on-press-escape="false"
:show-close="true"
align-center
@@ -127,13 +127,31 @@ Copyright © CPIC All rights reserved
style="height:calc(100vh - 100px);"
@error="errorHandle"
/>
</el-dialog>
<el-dialog
v-model="ui.isDOCX" :close-on-click-model="false"
:close-on-press-escape="false"
:show-close="true"
align-center
title="文件预览"
width="1024px"
>
<VueOfficeDocx
v-if="ui.isDOCX" :src="ui.fileURL"
style="height:calc(100vh - 100px);"
@error="errorHandle"
/>
</el-dialog>
<el-dialog
v-model="ui.isXLSX" :close-on-click-model="false"
:close-on-press-escape="false"
:show-close="true"
align-center
title="文件预览"
width="1024px"
>
<VueOfficeExcel
v-if="ui.isXLSX" :src="ui.fileURL"
:src="ui.fileURL"
style="height:calc(100vh - 100px);"
@error="errorHandle"
/>
@@ -152,6 +170,11 @@ import VueOfficePdf from "@vue-office/pdf";
import VueOfficeDocx from "@vue-office/docx";
import VueOfficeExcel from "@vue-office/excel";
//引入相关样式
import "@vue-office/pdf/lib/index.css";
import "@vue-office/docx/lib/index.css";
import "@vue-office/excel/lib/index.css";
interface UI{
showUI: boolean;
showUploadDialog: boolean;
@@ -189,10 +212,10 @@ export default {
regulatory_files: [],
},
showFileList: false,
isPDF: true,
isPDF: false,
isDOCX: false,
isXLSX: false,
fileURL: "http://10.39.0.1:8080/regulatory/%E4%BF%A1%E6%81%AF%E6%8A%80%E6%9C%AF%E9%83%A8/test.pdf",
fileURL: "",
});
const headerCellStyle = reactive(
@@ -239,7 +262,29 @@ export default {
const onPreviewUploadedFile = ( rowId: number ): void =>
{
ui.showPreviewDialog = true;
// ui.showPreviewDialog = true;
ui.fileURL = ui.newRegulatory.regulatory_files[rowId]?.file_url + "/" + ui.newRegulatory.regulatory_files[rowId]?.regulatory_file_name;
console.log( "完整路径:", ui.fileURL );
ui.isDOCX = false;
ui.isPDF = false;
ui.isXLSX = false;
switch ( ui.newRegulatory.regulatory_files[rowId].file_type )
{
case "WPS文档":
ui.isDOCX = true;
break;
case "WPS表格":
ui.isXLSX = true;
break;
case "PDF文档":
ui.isPDF = true;
break;
default:
break;
}
};
/**
@@ -292,7 +337,7 @@ export default {
regulatory_file_name: response.fileList[0].fileName ?? "",
local_file_path: response.fileList[0]?.absoluteFilePath ?? "",
file_type: getFileType( response.fileList[0]?.fileName ),
file_url: API_URL.URL_PREFIX + response.fileList[0]?.relativeFilePath,
file_url: API_URL.URL_PREFIX + "/" + response.fileList[0]?.relativeFilePath,
};
ui.newRegulatory.regulatory_files?.push( uploadedFile );

View File

@@ -41,8 +41,8 @@ export default {
const ui = reactive({
showUI: true,
isPDF: false,
isDocx: true,
isXlsx: false,
isDocx: false,
isXlsx: true,
fileURLPDF: "http://10.39.0.1:8080/regulatory/%E4%BF%A1%E6%81%AF%E6%8A%80%E6%9C%AF%E9%83%A8/%E5%85%B3%E4%BA%8E%E5%8D%B0%E5%8F%91%E3%80%8A%E5%A4%AA%E5%B9%B3%E6%B4%8B%E4%BA%A7%E9%99%A9%E5%8E%A6%E9%97%A8%E5%88%86%E5%85%AC%E5%8F%B8IT%E8%B5%84%E4%BA%A7%E7%AE%A1%E7%90%86%E5%8A%9E%E6%B3%95%E3%80%8B%EF%BC%882019%E5%B9%B4%E4%BF%AE%E8%AE%A2%EF%BC%89%E7%9A%84%E9%80%9A%E7%9F%A5/%E5%8E%A6%E5%A4%AA%E4%BF%9D%E4%BA%A7%E5%8F%91%E3%80%902019%E3%80%9146%E5%8F%B7%E5%85%B3%E4%BA%8E%E5%8D%B0%E5%8F%91%E3%80%8A%E5%A4%AA%E5%B9%B3%E6%B4%8B%E4%BA%A7%E9%99%A9%E5%8E%A6%E9%97%A8%E5%88%86%E5%85%AC%E5%8F%B8IT%E8%B5%84%E4%BA%A7%E7%AE%A1%E7%90%86%E5%8A%9E%E6%B3%95%E3%80%8B%EF%BC%882019%E5%B9%B4%E4%BF%AE%E8%AE%A2%EF%BC%89%E7%9A%84%E9%80%9A%E7%9F%A5.pdf",
fileURLDocx: "http://10.39.0.1:8080/regulatory/%E4%BF%A1%E6%81%AF%E6%8A%80%E6%9C%AF%E9%83%A8/%E5%85%B3%E4%BA%8E%E5%8D%B0%E5%8F%91%E3%80%8A%E5%A4%AA%E5%B9%B3%E6%B4%8B%E4%BA%A7%E9%99%A9%E5%8E%A6%E9%97%A8%E5%88%86%E5%85%AC%E5%8F%B8%E8%BD%AF%E4%BB%B6%E5%BC%80%E5%8F%91%E9%9C%80%E6%B1%82%E7%AE%A1%E7%90%86%E5%8A%9E%E6%B3%95%EF%BC%882020%E5%B9%B4%E4%BF%AE%E8%AE%A2%EF%BC%89%E3%80%8B%E7%9A%84%E9%80%9A%E7%9F%A5/%E9%99%84%E4%BB%B62%EF%BC%9A%E4%B8%9A%E5%8A%A1%E9%9C%80%E6%B1%82%E8%AF%B4%E6%98%8E%E4%B9%A6.docx",
fileURLXlsx: "http://10.39.0.1:8080/regulatory/%E4%BF%A1%E6%81%AF%E6%8A%80%E6%9C%AF%E9%83%A8/%E5%85%B3%E4%BA%8E%E5%8D%B0%E5%8F%91%E3%80%8A%E5%A4%AA%E5%B9%B3%E6%B4%8B%E4%BA%A7%E9%99%A9%E5%8E%A6%E9%97%A8%E5%88%86%E5%85%AC%E5%8F%B8%E8%BD%AF%E4%BB%B6%E5%BC%80%E5%8F%91%E9%9C%80%E6%B1%82%E7%AE%A1%E7%90%86%E5%8A%9E%E6%B3%95%EF%BC%882020%E5%B9%B4%E4%BF%AE%E8%AE%A2%EF%BC%89%E3%80%8B%E7%9A%84%E9%80%9A%E7%9F%A5/%E9%99%84%E4%BB%B64%EF%BC%9A%E5%88%86%E5%85%AC%E5%8F%B8%E8%87%AA%E5%BB%BA%E7%B3%BB%E7%BB%9F%E9%83%A8%E7%BD%B2%E6%83%85%E5%86%B5%E7%99%BB%E8%AE%B0%E8%A1%A8.xlsx",