IDCDatasync-vue/src/views/fileManage/recycling.vue
2025-03-04 15:59:36 +08:00

187 lines
5.4 KiB
Vue

<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<a-form-item label="文件名称">
<a-input placeholder="请输入搜索关键词" v-model="queryParam.fileName"></a-input>
</a-form-item>
</a-col>
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24" >
<a-button type="primary" style="left: 10px" @click="loadData" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px;left: 10px">重置</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<!-- table区域-begin -->
<div style="height:900px;overflow-y:auto;">
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys,onChange: onSelectChange}"
@change="handleTableChange">
<!-- :locale="myLocale"-->
<!-- 字符串超长截取省略号显示-->
<span slot="action" slot-scope="text, record">
<a-popconfirm title="确定恢复吗?" @confirm="() => processFile(record.id)">
<a>恢复文件</a>
</a-popconfirm>
<a-divider type="vertical" v-has="'cont:btn'" />
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除文件</a>
</a-popconfirm>
</span>
</a-table>
</div>
<!-- table区域-end -->
<!-- 表单区域 -->
<uploadModal ref="modalForm" @ok="loadData"></uploadModal>
</a-card>
</template>
<script>
import uploadModal from './modules/uploadModal'
import { getlist,
deleteFile,
recoverFile } from '@/api/recycleBin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from "@/components/jeecg/JEllipsis";
import {putAction} from '@/api/manage'
export default {
name: "recycling",
mixins:[JeecgListMixin],
components: {
uploadModal,
JEllipsis,
VNodes: {
functional: true,
render: (h, ctx) => ctx.props.vnodes,
},
},
data () {
return {
description: '文件接引',
dataSources: [],
queryParam: {
pageNum :1,
pageSize:20,
fileName:'',
},
columns: [
{
title: "序号",
width: 70,
customRender: (text, record, index) => `${index + 1}`,
},
{
title: '文件名称',
align: "center",
dataIndex: 'fileName',
width: 120
},
{
title: '文件后缀',
align: "center",
width: 100,
dataIndex: 'fileSuffix',
},
{
title: '文件大小',
align: "center",
width: 120,
dataIndex: 'fileSize'
},
{
title: '删除时间',
align: "center",
width: 100,
dataIndex: 'createTime'
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
align: "center",
width: 170
}
]
}
},
computed: {
},
created () {
this.loadData();
},
methods: {
//筛选需要重写handleTableChange
handleTableChange(pagination, filters, sorter) {
//分页、排序、筛选变化时触发
//TODO 筛选
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field;
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
}
this.ipagination = pagination;
this.loadData();
},
loadData() {
getlist(this.queryParam).then((res) => {
if (res.success) {
this.dataSource = res.result.records;
if(res.result.total)
{
this.ipagination.total = res.result.total;
}
} else {
this.$message.warning(res.message);
}
});
},
handleDelete: function (id) {
var that = this;
deleteFile({id:id}).then((res) => {
if (res.success) {
this.$message.success(res.message);
that.loadData();
} else {
this.$message.warning(res.message);
}
});
},
processFile: function (id) {
var that = this;
putAction("/recycleBin/recoverFile?id="+id,{}).then((res) => {
if (res.success) {
this.$message.success(res.message);
that.loadData();
} else {
this.$message.warning(res.message);
}
});
},
handleAdd() {
this.$refs.modalForm.add();
this.$refs.modalForm.title = "文件上传";
this.$refs.modalForm.dataLinkType=this.queryParam.dataLinkType;
},
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>