From 390edc5e3e6d28cb95328934b48a6121f0f88a09 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期二, 20 九月 2022 10:51:08 +0800 Subject: [PATCH] update 优化 oss管理 支持时间排序 --- ruoyi-ui/src/views/system/oss/index.vue | 38 ++++++++++++++++++-------------------- 1 files changed, 18 insertions(+), 20 deletions(-) diff --git a/ruoyi-ui/src/views/system/oss/index.vue b/ruoyi-ui/src/views/system/oss/index.vue index b4c5a46..d304451 100644 --- a/ruoyi-ui/src/views/system/oss/index.vue +++ b/ruoyi-ui/src/views/system/oss/index.vue @@ -118,7 +118,7 @@ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> - <el-table v-loading="loading" :data="ossList" @selection-change="handleSelectionChange"> + <el-table v-loading="loading" :data="ossList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange"> <el-table-column type="selection" width="55" align="center" /> <el-table-column label="瀵硅薄瀛樺偍涓婚敭" align="center" prop="ossId" v-if="false"/> <el-table-column label="鏂囦欢鍚�" align="center" prop="fileName" /> @@ -135,13 +135,13 @@ v-if="!checkFileSuffix(scope.row.fileSuffix) || !previewListResource"/> </template> </el-table-column> - <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180"> + <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180"> <template slot-scope="scope"> <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> </template> </el-table-column> <el-table-column label="涓婁紶浜�" align="center" prop="createBy" /> - <el-table-column label="鏈嶅姟鍟�" align="center" prop="service" /> + <el-table-column label="鏈嶅姟鍟�" align="center" prop="service" sortable="custom" :sort-orders="['descending', 'ascending']" /> <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope"> <el-button @@ -187,8 +187,7 @@ </template> <script> -import { listOss, delOss, changePreviewListResource } from "@/api/system/oss"; -import { downLoadOss } from "@/utils/download"; +import { listOss, delOss } from "@/api/system/oss"; export default { name: "Oss", @@ -222,6 +221,8 @@ previewListResource: true, // 鍒涘缓鏃堕棿鏃堕棿鑼冨洿 daterangeCreateTime: [], + // 榛樿鎺掑簭 + defaultSort: {prop: 'createTime', order: 'ascending'}, // 鏌ヨ鍙傛暟 queryParams: { pageNum: 1, @@ -300,6 +301,12 @@ this.single = selection.length!==1 this.multiple = !selection.length }, + /** 鎺掑簭瑙﹀彂浜嬩欢 */ + handleSortChange(column, prop, order) { + this.queryParams.orderByColumn = column.prop; + this.queryParams.isAsc = column.order; + this.getList(); + }, /** 浠诲姟鏃ュ織鍒楄〃鏌ヨ */ handleOssConfig() { this.$router.push({ path: '/system/oss-config/index'}) @@ -325,22 +332,18 @@ }, /** 涓嬭浇鎸夐挳鎿嶄綔 */ handleDownload(row) { - downLoadOss(row.ossId) + this.$download.oss(row.ossId) }, /** 鍒犻櫎鎸夐挳鎿嶄綔 */ handleDelete(row) { const ossIds = row.ossId || this.ids; - this.$confirm('鏄惁纭鍒犻櫎OSS瀵硅薄瀛樺偍缂栧彿涓�"' + ossIds + '"鐨勬暟鎹」?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }).then(() => { + this.$modal.confirm('鏄惁纭鍒犻櫎OSS瀵硅薄瀛樺偍缂栧彿涓�"' + ossIds + '"鐨勬暟鎹」?').then(() => { this.loading = true; return delOss(ossIds); }).then(() => { this.loading = false; this.getList(); - this.msgSuccess("鍒犻櫎鎴愬姛"); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); }).finally(() => { this.loading = false; }); @@ -348,16 +351,11 @@ // 棰勮鍒楄〃鍥剧墖鐘舵�佷慨鏀� handlePreviewListResource(previewListResource) { let text = previewListResource ? "鍚敤" : "鍋滅敤"; - this.$confirm( - '纭瑕�"' + text + '""棰勮鍒楄〃鍥剧墖"閰嶇疆鍚�?', "璀﹀憡", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning", - }).then(() => { - return changePreviewListResource(previewListResource); + this.$modal.confirm('纭瑕�"' + text + '""棰勮鍒楄〃鍥剧墖"閰嶇疆鍚�?').then(() => { + return this.updateConfigByKey("sys.oss.previewListResource", previewListResource); }).then(() => { this.getList() - this.msgSuccess(text + "鎴愬姛"); + this.$modal.msgSuccess(text + "鎴愬姛"); }).catch(() => { this.previewListResource = previewListResource !== true; }) -- Gitblit v1.9.3