IDCDatasync-vue/src/views/fileManage/recycling.vue

220 lines
6.8 KiB
Vue
Raw Normal View History

2025-02-24 14:41:28 +08:00
<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">
2025-02-26 10:34:29 +08:00
<a-form-item label="文件名称">
<a-input placeholder="请输入搜索关键词" v-model="queryParam.fileName"></a-input>
2025-02-24 14:41:28 +08:00
</a-form-item>
</a-col>
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
2025-04-21 00:24:13 +08:00
<a-col :md="6" :sm="8" >
2025-02-24 14:41:28 +08:00
<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>
2025-04-21 00:24:13 +08:00
<a-col :md="15" :sm="24" style="text-align: right;">
2025-04-21 19:29:51 +08:00
<a-button type="primary" @click="allDelete" icon="delete" style="background-color: brown;">清空回收站</a-button>
2025-04-21 00:24:13 +08:00
</a-col>
2025-02-24 14:41:28 +08:00
</a-row>
</a-form>
2025-04-21 00:24:13 +08:00
2025-02-24 14:41:28 +08:00
</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">
2025-02-26 10:34:29 +08:00
<a-popconfirm title="确定恢复吗?" @confirm="() => processFile(record.id)">
<a>恢复文件</a>
</a-popconfirm>
2025-03-08 19:02:56 +08:00
<a-divider type="vertical" />
2025-02-24 14:41:28 +08:00
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
2025-02-26 10:34:29 +08:00
<a>删除文件</a>
2025-02-24 14:41:28 +08:00
</a-popconfirm>
</span>
</a-table>
</div>
<!-- table区域-end -->
<!-- 表单区域 -->
2025-04-21 00:24:13 +08:00
<deleteFileModal ref="modalForm"></deleteFileModal>
2025-02-24 14:41:28 +08:00
</a-card>
</template>
<script>
2025-04-21 00:24:13 +08:00
import deleteFileModal from './modules/deleteFileModal'
2025-04-21 19:29:51 +08:00
import {getlist, deleteFile, recoverFile, deleteAllFile} from '@/api/recycleBin'
import store from '@/store/'
2025-02-24 14:41:28 +08:00
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from "@/components/jeecg/JEllipsis";
2025-03-04 15:59:36 +08:00
import {putAction} from '@/api/manage'
2025-02-24 14:41:28 +08:00
export default {
name: "recycling",
mixins:[JeecgListMixin],
components: {
2025-04-21 00:24:13 +08:00
deleteFileModal,
2025-02-24 14:41:28 +08:00
JEllipsis,
VNodes: {
functional: true,
render: (h, ctx) => ctx.props.vnodes,
},
},
data () {
return {
description: '文件接引',
dataSources: [],
queryParam: {
pageNum :1,
pageSize:20,
2025-02-26 10:34:29 +08:00
fileName:'',
2025-02-24 14:41:28 +08:00
},
columns: [
2025-02-26 10:34:29 +08:00
{
title: "序号",
width: 70,
customRender: (text, record, index) => `${index + 1}`,
},
{
2025-02-24 14:41:28 +08:00
title: '文件名称',
2025-02-26 10:34:29 +08:00
align: "center",
2025-02-24 14:41:28 +08:00
dataIndex: 'fileName',
2025-02-26 10:34:29 +08:00
width: 120
},
{
title: '文件后缀',
align: "center",
width: 100,
dataIndex: 'fileSuffix',
},
{
title: '文件大小',
align: "center",
width: 120,
dataIndex: 'fileSize'
},
{
title: '删除时间',
align: "center",
width: 100,
2025-02-24 14:41:28 +08:00
dataIndex: 'createTime'
2025-02-26 10:34:29 +08:00
},
{
2025-02-24 14:41:28 +08:00
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
2025-02-26 10:34:29 +08:00
align: "center",
width: 170
}
2025-02-24 14:41:28 +08:00
]
}
},
computed: {
},
created () {
2025-04-21 19:29:51 +08:00
this.initWebSocket();
2025-02-24 14:41:28 +08:00
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() {
2025-02-26 10:34:29 +08:00
getlist(this.queryParam).then((res) => {
2025-02-24 14:41:28 +08:00
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;
2025-02-26 10:34:29 +08:00
deleteFile({id:id}).then((res) => {
2025-02-24 14:41:28 +08:00
if (res.success) {
this.$message.success(res.message);
that.loadData();
} else {
this.$message.warning(res.message);
}
});
},
2025-03-04 15:55:03 +08:00
processFile: function (id) {
2025-02-24 14:41:28 +08:00
var that = this;
2025-03-04 15:59:36 +08:00
putAction("/recycleBin/recoverFile?id="+id,{}).then((res) => {
2025-02-24 14:41:28 +08:00
if (res.success) {
this.$message.success(res.message);
that.loadData();
} else {
this.$message.warning(res.message);
}
});
},
2025-04-21 19:29:51 +08:00
allDelete(){
deleteAllFile({}).then((res) => {
if (res.success) {
this.$message.success(res.result);
} else {
this.$message.warning(res.message);
}
});
2025-04-21 00:24:13 +08:00
this.$refs.modalForm.open();
2025-04-21 19:29:51 +08:00
},
initWebSocket: function () {
// WebSocket与普通的请求所用协议有所不同ws等同于httpwss等同于https
var userId = store.getters.userInfo.id;
var url = window._CONFIG['domianURL'].replace("https://", "ws://").replace("http://", "ws://") + "/websocket/" + userId + "/file_del";
this.websock = new WebSocket(url);
this.websock.onopen = this.websocketonopen;
this.websock.onerror = this.websocketonerror;
this.websock.onmessage = this.websocketonmessage;
this.websock.onclose = this.websocketclose;
},
websocketonopen: function () {
console.log("消息服务连接成功");
},
websocketonerror: function (e) {
console.log("消息服务连接失败" + JSON.stringify(e));
},
websocketonmessage: function (e) {
console.log(e.data)
this.$refs.modalForm.percent = e.data;
this.loadData();
},
websocketclose: function (e) {
console.log("connection closed (" + e + ")");
},
2025-02-24 14:41:28 +08:00
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>