|
@@ -97,20 +97,31 @@
|
|
|
class="upload-demo"
|
|
class="upload-demo"
|
|
|
action="#"
|
|
action="#"
|
|
|
:on-change="handleFileChange"
|
|
:on-change="handleFileChange"
|
|
|
|
|
+ :on-remove="handleFileRemove"
|
|
|
:file-list="fileList"
|
|
:file-list="fileList"
|
|
|
:auto-upload="false"
|
|
:auto-upload="false"
|
|
|
:limit="1"
|
|
:limit="1"
|
|
|
accept=".xlsx,.xls"
|
|
accept=".xlsx,.xls"
|
|
|
>
|
|
>
|
|
|
|
|
+ <!-- 触发上传按钮 -->
|
|
|
<template #trigger>
|
|
<template #trigger>
|
|
|
<el-button type="primary">点击上传盲注表</el-button>
|
|
<el-button type="primary">点击上传盲注表</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
+ <!-- 自定义文件列表 -->
|
|
|
|
|
+ <template #file="{ file }">
|
|
|
|
|
+ <div style="display: flex; align-items: center">
|
|
|
|
|
+ <span class="el-upload__tip">{{ file.name }}</span>
|
|
|
|
|
+ <el-button type="text" icon="el-icon-delete" @click.stop="() => handleFileRemove(file)" style="margin-left: auto"> 删除 </el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 提示信息 -->
|
|
|
<template #tip>
|
|
<template #tip>
|
|
|
<div class="el-upload__tip">
|
|
<div class="el-upload__tip">
|
|
|
- <el-link type="primary" @click="downloadTemplate"> <el-icon name="download" /> 模板下载 </el-link>
|
|
|
|
|
|
|
+ <el-link type="primary" @click="downloadTemplate"> <i class="el-icon-download"></i> 模板下载 </el-link>
|
|
|
|
|
|
|
|
|
|
- <el-button link @click="openPreview"> <el-icon name="document" /> 预 览 </el-button>
|
|
|
|
|
|
|
+ <el-button link @click="openPreview"> <i class="el-icon-document"></i> 预 览 </el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</el-upload>
|
|
</el-upload>
|
|
@@ -403,6 +414,16 @@ const handleFileChange = (file) => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+// 删除文件处理函数
|
|
|
|
|
+const handleFileRemove = (file) => {
|
|
|
|
|
+ const index = fileList.value.findIndex((f) => f.uid === file.uid);
|
|
|
|
|
+ if (index > -1) {
|
|
|
|
|
+ const newFileList = [...fileList.value];
|
|
|
|
|
+ newFileList.splice(index, 1);
|
|
|
|
|
+ fileList.value = newFileList;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// 预览数据
|
|
// 预览数据
|
|
|
const previewData = ref<any[]>([]);
|
|
const previewData = ref<any[]>([]);
|
|
|
const previewHeaders = ref<string[]>([]); // 新增表头数组
|
|
const previewHeaders = ref<string[]>([]); // 新增表头数组
|