feat: 为审批和任务页面新增文件预览功能

添加文件预览组件到印章、报销、差旅审批详情页和任务详情页
移除旧版附件展示代码,统一使用新的文件预览组件
更新版本号至5.2.2
This commit is contained in:
砂糖
2026-02-25 10:53:06 +08:00
parent 53eb80dfed
commit f91ab6d45f
6 changed files with 271 additions and 4 deletions

View File

@@ -81,12 +81,13 @@
<!-- 附件展示 -->
<view v-if="taskDetail.accessory" class="section-title">附件</view>
<view v-if="taskDetail.accessory" class="attachment-list">
<oa-file-list v-if="taskDetail.accessory" :files="taskDetail.accessory"></oa-file-list>
<!-- <view v-if="taskDetail.accessory" class="attachment-list">
<view
v-for="(file, index) in attachmentFiles"
:key="`${file.ossId}_${index}`"
class="attachment-item"
@click="downloadFile(file)"
@click="previewFile(file)"
>
<view class="file-icon">
<u-icon :name="getFileIcon(file.originalName)" size="24" color="#007aff"></u-icon>
@@ -102,7 +103,7 @@
</view>
<view v-if="taskDetail.accessory && attachmentFiles.length === 0" class="no-attachment">
暂无附件
</view>
</view> -->
<!-- 新增报工按钮仅报工任务显示 -->
<u-button v-if="isReportTask" type="primary" class="add-btn" @click="openAddPopup">新增报工</u-button>
@@ -309,6 +310,18 @@ export default {
}
})
},
previewFile(file) {
console.log(file)
uni.downloadFile({
url: file.url,
success(res) {
uni.openDocument({
filePath: res.tempFilePath,
})
}
})
},
// 获取文件图标
getFileIcon(fileName) {