83
This commit is contained in:
parent
1b34272383
commit
8ef96d5004
|
@ -25,7 +25,7 @@
|
||||||
:pagination="pagination" :scroll="{ y: 'calc(100vh - 420px)' }" rowKey="id"
|
:pagination="pagination" :scroll="{ y: 'calc(100vh - 420px)' }" rowKey="id"
|
||||||
@change="handleTableChange">
|
@change="handleTableChange">
|
||||||
<span slot="action" slot-scope="text, record">
|
<span slot="action" slot-scope="text, record">
|
||||||
<a @click="download(record,$event)">下载</a> <a @click="viewFile(record,$event)">预览</a>
|
<a @click="download(record,$event)">下载</a> <a v-if="isPreviewable(record.fileName)" @click="viewFile(record,$event)">预览</a>
|
||||||
</span>
|
</span>
|
||||||
</a-table>
|
</a-table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -120,6 +120,7 @@ export default {
|
||||||
showTotal: total => `总共 ${total} 个项目`, // 显示总数
|
showTotal: total => `总共 ${total} 个项目`, // 显示总数
|
||||||
onShowSizeChange: (current, pageSize) => (this.pageSize = pageSize)
|
onShowSizeChange: (current, pageSize) => (this.pageSize = pageSize)
|
||||||
},
|
},
|
||||||
|
viewFileType:["png","bmp","jpg","jpeg","mp4","avi","mp3","pdf"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -131,6 +132,12 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
isPreviewable(fileName){
|
||||||
|
const parts = fileName.split('.');
|
||||||
|
if (parts.length < 2) return false; // 无后缀
|
||||||
|
const extension = parts.pop().toLowerCase();
|
||||||
|
return this.viewFileType.includes(extension);
|
||||||
|
},
|
||||||
handleTableChange(pagination, filters, sorter) {
|
handleTableChange(pagination, filters, sorter) {
|
||||||
this.pagination = pagination
|
this.pagination = pagination
|
||||||
this.searchFile.pageNum = pagination.current
|
this.searchFile.pageNum = pagination.current
|
||||||
|
|
|
@ -132,7 +132,7 @@
|
||||||
@change="handleTableChange"
|
@change="handleTableChange"
|
||||||
>
|
>
|
||||||
<span slot="action" slot-scope="text, record">
|
<span slot="action" slot-scope="text, record">
|
||||||
<a @click="download(record, $event)">下载</a> <a @click="viewFile(record, $event)">预览</a>
|
<a @click="download(record, $event)">下载</a> <a v-if="isPreviewable(record.fileName)" @click="viewFile(record, $event)">预览</a>
|
||||||
<a @click="DeleteFile(record, $event)">删除</a>
|
<a @click="DeleteFile(record, $event)">删除</a>
|
||||||
</span>
|
</span>
|
||||||
</a-table>
|
</a-table>
|
||||||
|
@ -233,6 +233,7 @@ export default {
|
||||||
audio: 0,
|
audio: 0,
|
||||||
total: 0,
|
total: 0,
|
||||||
},
|
},
|
||||||
|
viewFileType:["png","bmp","jpg","jpeg","mp4","avi","mp3","pdf"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {},
|
created() {},
|
||||||
|
@ -243,6 +244,12 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
methods: {
|
methods: {
|
||||||
|
isPreviewable(fileName){
|
||||||
|
const parts = fileName.split('.');
|
||||||
|
if (parts.length < 2) return false; // 无后缀
|
||||||
|
const extension = parts.pop().toLowerCase();
|
||||||
|
return this.viewFileType.includes(extension);
|
||||||
|
},
|
||||||
calculateScrollY() {
|
calculateScrollY() {
|
||||||
// 获取父容器高度(需减去表格内其他元素的高度,如分页栏)
|
// 获取父容器高度(需减去表格内其他元素的高度,如分页栏)
|
||||||
const container = this.$refs.tableContainer;
|
const container = this.$refs.tableContainer;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user