WXL
3 天以前 1a1df739a5f866de1014762167ac9ecb8e06595f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!-- src/views/case/assessment/components/AttachmentPreview.vue -->
<template>
  <el-dialog
    title="附件预览"
    :visible="visible"
    width="70%"
    @close="$emit('close')"
  >
    <el-table :data="attachmentList">
      <el-table-column label="文件名" prop="fileName" />
      <el-table-column label="类型" prop="fileType" width="100" />
      <el-table-column label="大小" width="100">
        <template slot-scope="scope">
          {{ (scope.row.fileSize / 1024 / 1024).toFixed(2) }} MB
        </template>
      </el-table-column>
      <el-table-column label="操作" width="150">
        <template slot-scope="scope">
          <el-button type="text" @click="handlePreview(scope.row)">预览</el-button>
          <el-button type="text" @click="handleDownload(scope.row)">下载</el-button>
        </template>
      </el-table-column>
    </el-table>
  </el-dialog>
</template>
 
<script>
export default {
  name: "AttachmentPreview",
  props: {
    visible: Boolean,
    attachmentList: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    handlePreview(file) {
      this.$message.info(`预览文件: ${file.fileName}`);
    },
    handleDownload(file) {
      this.$message.success(`开始下载: ${file.fileName}`);
    }
  }
}
</script>