|
@@ -1,8 +1,5 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div class="body-wrapper">
|
3
|
|
- <div class="button-block">
|
4
|
|
- <el-button type="primary" @click="handleUpload">上传</el-button>
|
5
|
|
- </div>
|
6
|
3
|
<el-table :data="tableData">
|
7
|
4
|
<el-table-column v-for="(item, index) in columns" :key="index" :label="item.label" :prop="item.key">
|
8
|
5
|
</el-table-column>
|
|
@@ -10,7 +7,6 @@
|
10
|
7
|
label="操作"
|
11
|
8
|
width="100">
|
12
|
9
|
<template slot-scope="scope">
|
13
|
|
- <el-button @click="handleDelete(scope.row)" type="text" size="small">删除</el-button>
|
14
|
10
|
<el-button @click="handleDown(scope.row)" type="text" size="small">下载</el-button>
|
15
|
11
|
</template>
|
16
|
12
|
</el-table-column>
|
|
@@ -20,30 +16,11 @@
|
20
|
16
|
:current-page.sync="pageNum" :page-size.sync="pageSize">
|
21
|
17
|
</el-pagination>
|
22
|
18
|
</div>
|
23
|
|
- <el-dialog
|
24
|
|
- title="上传"
|
25
|
|
- :visible.sync="dialogVisible"
|
26
|
|
- width="30%">
|
27
|
|
- <el-upload
|
28
|
|
- class="upload-demo"
|
29
|
|
- action="https://jsonplaceholder.typicode.com/posts/"
|
30
|
|
- :on-preview="handlePreview"
|
31
|
|
- :on-remove="handleRemove"
|
32
|
|
- multiple
|
33
|
|
- :limit="3"
|
34
|
|
- :on-exceed="handleExceed"
|
35
|
|
- :file-list="fileList">
|
36
|
|
- <el-button size="small" type="primary">点击上传</el-button>
|
37
|
|
- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
|
38
|
|
- </el-upload>
|
39
|
|
- <span slot="footer" class="dialog-footer">
|
40
|
|
- <el-button @click="dialogVisible = false">取 消</el-button>
|
41
|
|
- <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
|
42
|
|
- </span>
|
43
|
|
- </el-dialog>
|
44
|
19
|
</div>
|
45
|
20
|
</template>
|
46
|
21
|
<script>
|
|
22
|
+import api from "@/api/homepage/file.js";
|
|
23
|
+import config from '@/config/index';
|
47
|
24
|
|
48
|
25
|
export default {
|
49
|
26
|
components: {},
|
|
@@ -52,11 +29,11 @@ export default {
|
52
|
29
|
columns: [
|
53
|
30
|
{
|
54
|
31
|
label: '名称',
|
55
|
|
- key: 'nameCh'
|
|
32
|
+ key: 'fileName'
|
56
|
33
|
},
|
57
|
34
|
{
|
58
|
35
|
label: '时间',
|
59
|
|
- key: 'nameEn'
|
|
36
|
+ key: 'createdTime'
|
60
|
37
|
}
|
61
|
38
|
],
|
62
|
39
|
tableData: [],
|
|
@@ -68,34 +45,26 @@ export default {
|
68
|
45
|
}
|
69
|
46
|
},
|
70
|
47
|
mounted() {
|
|
48
|
+ this.getTableData()
|
71
|
49
|
},
|
72
|
50
|
watch: {
|
73
|
51
|
|
74
|
52
|
},
|
75
|
53
|
methods: {
|
76
|
54
|
handlePageChange() {
|
77
|
|
- console.log('enter handle page change')
|
78
|
|
- },
|
79
|
|
- handleDelete(row) {
|
80
|
|
- console.log('enter handle delete')
|
|
55
|
+ this.getTableData()
|
81
|
56
|
},
|
82
|
57
|
handleDown(row) {
|
83
|
|
- console.log('enter handle down')
|
84
|
|
- },
|
85
|
|
- handleUpload() {
|
86
|
|
- this.dialogVisible = true
|
87
|
|
- },
|
88
|
|
- handleRemove(file, fileList) {
|
89
|
|
- console.log(file, fileList);
|
90
|
|
- },
|
91
|
|
- handlePreview(file) {
|
92
|
|
- console.log(file);
|
93
|
|
- },
|
94
|
|
- handleExceed(files, fileList) {
|
95
|
|
- this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
|
58
|
+ window.location.href = `${this.getUrl()}/xyjc/index-files/download/${row.id}`
|
96
|
59
|
},
|
97
|
|
- beforeRemove(file, fileList) {
|
98
|
|
- return this.$confirm(`确定移除 ${ file.name }?`);
|
|
60
|
+ getTableData() {
|
|
61
|
+ const { pageNum, pageSize } = this
|
|
62
|
+ api.fileList({pageNum, pageSize}).then(res => {
|
|
63
|
+ if (res.success) {
|
|
64
|
+ this.tableData = res.data.records
|
|
65
|
+ this.total = res.data.total
|
|
66
|
+ }
|
|
67
|
+ })
|
99
|
68
|
}
|
100
|
69
|
}
|
101
|
70
|
}
|