资料关闭上传文件bug修改

This commit is contained in:
2026-09-17 14:10:17 +08:00
parent 4b31fbc3f1
commit 347c6839cd
+21 -9
View File
@@ -11,7 +11,7 @@ import { getChangeDetailApi } from '@/service/api/change';
import { myTasksCloseMaterialApi } from '@/service/api/myTasks';
import PDF from 'pdf-vue3'
import { VueOfficeDocx, VueOfficeExcel } from 'vue3-office-preview'
import { VueOfficeDocx, VueOfficeExcel, VueOfficePptx } from 'vue3-office-preview'
import 'vue3-office-preview/lib/style.css'
const themeStore = useThemeStore();
@@ -87,7 +87,7 @@ const onUploadFile = async (type:string = '',files:any,index:number = -1) => {
if(!error){
// 是否是本地上传
data.isLocalUpload = true;
console.log(data)
// console.log(data)
window.$message?.success('上传成功');
if(type==='3'){
trainFiles.value=[data];
@@ -157,14 +157,18 @@ const handleFileType = (type:string) => {
const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']
const wordExtensions = ['docx']
const excelExtensions = ['xlsx']
const pptExtensions = ['pptx']
if(imageExtensions.includes(type)){
return 'image'
}
if(wordExtensions.includes(type)){
return 'word'
}
if(excelExtensions.includes(type)){
return 'excel'
}
if(imageExtensions.includes(type)){
return 'image'
if(pptExtensions.includes(type)){
return 'ppt'
}
if(type==='pdf'){
return 'pdf'
@@ -341,7 +345,8 @@ onMounted(async () => {
</NButton>
<NUpload
class="w-auto"
accept="image/*,.pdf,.docx,.xlsx"
:key="trainFiles.length?'train_'+trainFiles[0]?.id:'train'"
accept="image/*,.pdf,.docx,.xlsx,.pptx"
:default-upload="false"
:show-file-list="false"
@change="(files) => onUploadFile('3', files)"
@@ -389,7 +394,8 @@ onMounted(async () => {
</NButton>
<NUpload
class="w-auto"
accept="image/*,.pdf,.docx,.xlsx"
:key="pssrFiles.length?'pssr_'+pssrFiles[0]?.id:'pssr'"
accept="image/*,.pdf,.docx,.xlsx,.pptx"
:default-upload="false"
:show-file-list="false"
@change="(files) => onUploadFile('4', files)"
@@ -460,7 +466,8 @@ onMounted(async () => {
</NButton>
<NUpload
class="w-auto"
accept="image/*,.pdf,.docx,.xlsx"
:key="acceptFiles.length?'accept_'+acceptFiles[0]?.id:'accept'"
accept="image/*,.pdf,.docx,.xlsx,.pptx"
:default-upload="false"
:show-file-list="false"
@change="(files) => onUploadFile('5', files)"
@@ -546,7 +553,8 @@ onMounted(async () => {
<NButton size="small" class="text-xs" @click="openFileList(Number(index))">从变更附件选择</NButton>
<NUpload
class="w-auto"
accept="image/*,.pdf,.docx,.xlsx"
:key="item.id"
accept="image/*,.pdf,.docx,.xlsx,.pptx"
:default-upload="false"
:show-file-list="false"
@change="(files) => onUploadFile(item.name, files, Number(index))"
@@ -613,7 +621,7 @@ onMounted(async () => {
v-model:show="previewModal"
preset="card"
:auto-focus="false"
:style="{ width: '1100px', height: 'auto' }"
:style="{ width: '80%', height: 'auto' }"
:segmented="{ content: true, footer: true }"
>
<template #header>
@@ -643,6 +651,10 @@ onMounted(async () => {
<template v-if="handleFileType(previewFile?.file_type) === 'excel'">
<VueOfficeExcel :src="previewFile?.file_url" class="w-full" />
</template>
<!-- Ppt 预览 -->
<template v-if="handleFileType(previewFile?.file_type) === 'ppt'">
<VueOfficePptx :src="previewFile?.file_url" class="w-full" />
</template>
<!-- PDF 预览 -->
<template v-if="handleFileType(previewFile?.file_type) === 'pdf'">
<div class="h-[68vh]">