|
|
|
|
@ -33,10 +33,9 @@
|
|
|
|
|
<!-- 文件列表 -->
|
|
|
|
|
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
|
|
|
|
|
<li v-for="(file, index) in fileList" :key="file.uid" class="el-upload-list__item ele-upload-list__item-content">
|
|
|
|
|
<el-link :href="`${file.url}`" :underline="false" target="_blank">
|
|
|
|
|
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
|
|
|
|
</el-link>
|
|
|
|
|
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
|
|
|
|
<div class="ele-upload-list__item-content-action">
|
|
|
|
|
<el-button type="primary" link @click="handleDownload(file)">下载</el-button>
|
|
|
|
|
<el-button type="danger" v-if="!disabled" link @click="handleDelete(index)">删除</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
@ -93,7 +92,8 @@ watch(
|
|
|
|
|
if (Array.isArray(val)) {
|
|
|
|
|
list = val;
|
|
|
|
|
} else {
|
|
|
|
|
const res = await listByIds(val);
|
|
|
|
|
const ossIdParam = typeof val === 'string' || typeof val === 'number' ? val : String(val);
|
|
|
|
|
const res = await listByIds(ossIdParam);
|
|
|
|
|
list = res.data.map((oss) => {
|
|
|
|
|
return {
|
|
|
|
|
name: oss.originalName,
|
|
|
|
|
@ -174,6 +174,15 @@ const handleUploadSuccess = (res: any, file: UploadFile) => {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 下载文件
|
|
|
|
|
const handleDownload = (file: any) => {
|
|
|
|
|
if (file.ossId) {
|
|
|
|
|
proxy?.$download.oss(file.ossId);
|
|
|
|
|
} else {
|
|
|
|
|
proxy?.$modal.msgWarning('文件ID不存在,无法下载');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 删除文件
|
|
|
|
|
const handleDelete = (index: number) => {
|
|
|
|
|
const ossId = fileList.value[index].ossId;
|
|
|
|
|
|