|
@@ -11,6 +11,22 @@
|
|
:auto-upload="autoUpload"
|
|
:auto-upload="autoUpload"
|
|
:on-change="handleFileChange"
|
|
:on-change="handleFileChange"
|
|
>
|
|
>
|
|
|
|
+ <!-- 使用file插槽自定义文件列表 -->
|
|
|
|
+ <template #file="{ file }">
|
|
|
|
+ <div class="file-item">
|
|
|
|
+ <HcIcon name="file" class="file-icon" />
|
|
|
|
+ <span class="file-name">{{ file.name }}</span>
|
|
|
|
+ <el-button
|
|
|
|
+ type="danger"
|
|
|
|
+ size="small"
|
|
|
|
+ circle
|
|
|
|
+ @click.stop="handleRemove(file)"
|
|
|
|
+ >
|
|
|
|
+ <HcIcon name="delete" />
|
|
|
|
+ </el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+
|
|
<template #trigger>
|
|
<template #trigger>
|
|
<div v-loading="uploadDisabled" :element-loading-text="loadingText" class="hc-upload-loading h-full" @click.stop="beforesubmitUpload">
|
|
<div v-loading="uploadDisabled" :element-loading-text="loadingText" class="hc-upload-loading h-full" @click.stop="beforesubmitUpload">
|
|
<HcIcon name="backup" ui="text-5xl mt-4" />
|
|
<HcIcon name="backup" ui="text-5xl mt-4" />
|
|
@@ -280,7 +296,7 @@ const submitUpload = async ()=>{
|
|
window.$message.warning('请先选择附件类型')
|
|
window.$message.warning('请先选择附件类型')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- console.log( fileListData.value, ' fileListData.valu1111111e')
|
|
|
|
|
|
+
|
|
|
|
|
|
// 确保所有文件都有sort参数
|
|
// 确保所有文件都有sort参数
|
|
fileListData.value = fileListData.value.map((file, index) => ({
|
|
fileListData.value = fileListData.value.map((file, index) => ({
|
|
@@ -288,15 +304,20 @@ const submitUpload = async ()=>{
|
|
sort: index + q,
|
|
sort: index + q,
|
|
}))
|
|
}))
|
|
console.log(fileListData.value, ' fileListData.valu222222e')
|
|
console.log(fileListData.value, ' fileListData.valu222222e')
|
|
- // 准备文件数据(包含sort)
|
|
|
|
- const filesWithSort = fileListData.value.map((file, index) => ({
|
|
|
|
- file: file.raw || file, // 上传的文件对象
|
|
|
|
- sort: index + q, // 计算sort值
|
|
|
|
- }))
|
|
|
|
- const { error, code, msg } = await wbsApi.addBussFileNode({
|
|
|
|
- ...uploadData.value, // 原有的上传参数
|
|
|
|
- files: filesWithSort, // 文件数组(含sort)
|
|
|
|
- })
|
|
|
|
|
|
+
|
|
|
|
+ // 创建 FormData 对象
|
|
|
|
+ const formData = new FormData()
|
|
|
|
+ fileListData.value.forEach((file, index) => {
|
|
|
|
+ formData.append('files', file.raw || file, file.name)
|
|
|
|
+ formData.append('sort', index + q)
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ // 添加其他必要的上传参数
|
|
|
|
+ formData.append('classify', uploadData.value.classify)
|
|
|
|
+ formData.append('nodeId', uploadData.value.nodeId)
|
|
|
|
+ formData.append('type', uploadData.value.type)
|
|
|
|
+ formData.append('contractId', uploadData.value.contractId)
|
|
|
|
+ const { error, code, msg } = await wbsApi.addBussFileNode(formData)
|
|
uploadDisabled.value = false
|
|
uploadDisabled.value = false
|
|
if (!error && code === 200) {
|
|
if (!error && code === 200) {
|
|
window?.$message?.success('删除成功')
|
|
window?.$message?.success('删除成功')
|