Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

Commit 3b513ce

Browse files
committed
新增 文件管理分页功能
1 parent 7befaee commit 3b513ce

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

src/app/views/FileManager.vue

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@
7070
</el-col>
7171
</el-row>
7272

73+
<div class="row-mt page-pagination">
74+
<el-pagination
75+
small
76+
background
77+
layout="prev, pager, next"
78+
v-model:currentPage="pageParam.page"
79+
:page-size="pageParam.pageSize"
80+
:total="pageParam.total"
81+
@current-change="currentChange"
82+
/>
83+
</div>
84+
7385
<div class="row-mt" v-show="percentComplete > 0">
7486
<el-progress
7587
:text-inside="true"
@@ -179,6 +191,11 @@ export default {
179191
addr: "",
180192
password: ""
181193
},
194+
pageParam: {
195+
page: 1,
196+
pageSize: 40,
197+
total: 1
198+
},
182199
183200
paramPath: this.$route.query.path,
184201
@@ -222,6 +239,12 @@ export default {
222239
const p = path.normalize(path.join(this.currentDir, "../"));
223240
await this.list(p);
224241
},
242+
243+
// 目录下一页或上一页事件
244+
currentChange() {
245+
this.toDir(".");
246+
},
247+
225248
// 目录 List 功能
226249
async list(cwd = ".") {
227250
this.$route.query.path = cwd;
@@ -231,11 +254,16 @@ export default {
231254
params: {
232255
remote_uuid: this.serviceUuid,
233256
uuid: this.instanceUuid,
234-
target: cwd
257+
target: cwd,
258+
page: parseInt(this.pageParam.page) - 1,
259+
page_size: this.pageParam.pageSize
235260
}
236261
});
262+
const { items, total, page } = data;
237263
this.currentDir = path.normalize(cwd);
238-
this.tableFilter(data);
264+
this.tableFilter(items);
265+
this.pageParam.total = total;
266+
this.pageParam.page = page + 1;
239267
},
240268
241269
// 表格数据处理
@@ -623,4 +651,8 @@ export default {
623651
bottom: 20px;
624652
padding-left: 8px;
625653
}
654+
.page-pagination {
655+
display: flex;
656+
justify-content: right;
657+
}
626658
</style>

0 commit comments

Comments
 (0)