|
@@ -114,7 +114,7 @@
|
|
|
v-if="scope.row.isUpload === 1 || scope.row.isUpload === '1'"
|
|
v-if="scope.row.isUpload === 1 || scope.row.isUpload === '1'"
|
|
|
type="text"
|
|
type="text"
|
|
|
size="small"
|
|
size="small"
|
|
|
- @click="$emit('handleFileView', scope.row)"
|
|
|
|
|
|
|
+ @click="handleFileView(scope.row)"
|
|
|
>
|
|
>
|
|
|
查看
|
|
查看
|
|
|
</el-button>
|
|
</el-button>
|
|
@@ -226,6 +226,36 @@
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ // 预览:与 UploadComponent.vue 的 handlePreview 一致
|
|
|
|
|
+ handleFileView(row) {
|
|
|
|
|
+ console.log(row, '这一行数据')
|
|
|
|
|
+ try {
|
|
|
|
|
+ const filePath =
|
|
|
|
|
+ row?.filePath ||
|
|
|
|
|
+ row?.filepath ||
|
|
|
|
|
+ row?.fileUrl ||
|
|
|
|
|
+ row?.url ||
|
|
|
|
|
+ row?.path ||
|
|
|
|
|
+ ''
|
|
|
|
|
+ if (!filePath) {
|
|
|
|
|
+ this.$message &&
|
|
|
|
|
+ this.$message.warning &&
|
|
|
|
|
+ this.$message.warning('未找到可预览的文件路径')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ const encodedUrl = encodeURIComponent(
|
|
|
|
|
+ Base64.encode((window.context && window.context.form) + filePath)
|
|
|
|
|
+ )
|
|
|
|
|
+ window.open(`${host}:8012/onlinePreview?url=${encodedUrl}`)
|
|
|
|
|
+ // 兼容保留:通知父组件
|
|
|
|
|
+ this.$emit('handleFileView', row)
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.error('文件预览失败: ', e)
|
|
|
|
|
+ this.$message &&
|
|
|
|
|
+ this.$message.error &&
|
|
|
|
|
+ this.$message.error('文件预览失败')
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
// 根据资料类型返回上传accept白名单
|
|
// 根据资料类型返回上传accept白名单
|
|
|
getUploadAccept(row) {
|
|
getUploadAccept(row) {
|
|
|
const fmt = row && row.formatRequired
|
|
const fmt = row && row.formatRequired
|