223 lines
6.8 KiB
Vue
223 lines
6.8 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="8" >
|
||
<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-col :md="15" :sm="24" style="text-align: right;">
|
||
<a-button type="primary" @click="allDelete" icon="delete" style="background-color: brown;">清空回收站</a-button>
|
||
</a-col>
|
||
</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" />
|
||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||
<a>删除文件</a>
|
||
</a-popconfirm>
|
||
</span>
|
||
</a-table>
|
||
</div>
|
||
<!-- table区域-end -->
|
||
|
||
<!-- 表单区域 -->
|
||
<deleteFileModal ref="modalForm"></deleteFileModal>
|
||
|
||
</a-card>
|
||
</template>
|
||
|
||
<script>
|
||
import deleteFileModal from './modules/deleteFileModal'
|
||
import {getlist, deleteFile, recoverFile, deleteAllFile} from '@/api/recycleBin'
|
||
import store from '@/store/'
|
||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||
import JEllipsis from "@/components/jeecg/JEllipsis";
|
||
import {putAction} from '@/api/manage'
|
||
export default {
|
||
name: "recycling",
|
||
mixins:[JeecgListMixin],
|
||
components: {
|
||
deleteFileModal,
|
||
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.initWebSocket();
|
||
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);
|
||
}
|
||
});
|
||
},
|
||
allDelete(){
|
||
deleteAllFile({}).then((res) => {
|
||
if (res.success) {
|
||
this.$message.success(res.result);
|
||
} else {
|
||
this.$message.warning(res.message);
|
||
}
|
||
});
|
||
this.$refs.modalForm.open();
|
||
},
|
||
initWebSocket: function () {
|
||
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于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 + ")");
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
<style scoped>
|
||
@import '~@assets/less/common.less';
|
||
/deep/ .ant-checkbox-checked{
|
||
background: #40a9ff !important;
|
||
}
|
||
</style> |