From aab91150254007fe922a500851560d3286bdafef Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期二, 10 十月 2023 14:26:32 +0800 Subject: [PATCH] 令牌管理失效,删除功能优化 --- src/api/api.js | 6 ++++++ src/views/maintenance/tokentool.vue | 54 +++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/src/api/api.js b/src/api/api.js index 2285a01..2c88876 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -420,6 +420,12 @@ export function updateToken(params) { return request.post('/token/updateToken', params); } +//浠ょ墝绠$悊 =>澶辨晥 +export function token_updateExpireById(params) { + return request.get('/token/updateExpireById', { params: params }); +} + + //榛戠櫧鍚嶅崟鍒楄〃鑾峰彇 export function blacklistSelectByPageAndCount(params) { return request.get('/blacklist/selectByPageAndCount', { params: params }); diff --git a/src/views/maintenance/tokentool.vue b/src/views/maintenance/tokentool.vue index 104b54c..25ac588 100644 --- a/src/views/maintenance/tokentool.vue +++ b/src/views/maintenance/tokentool.vue @@ -92,6 +92,7 @@ style="width: 100%" border height="calc(100% - 45px)" + @selection-change="handleSelectionChange" > <el-table-column type="selection" @@ -105,7 +106,17 @@ <el-table-column prop="token" :label="$t('operatManage.tokentoolObj.token')" - /> + > + <template slot-scope="scope"> + <span + style="color: #F56C6C;" + v-if="!scope.row.status" + >{{scope.row.token }}</span> + + <span v-if="scope.row.status">{{scope.row.token }}</span> + </template> + </el-table-column> + <el-table-column prop="duration" width="120" @@ -154,19 +165,21 @@ > <template slot-scope="scope"> <el-button + v-if="scope.row.status" type="danger" size="small" plain + @click="setExpireById(scope.$index, scope.row)" >{{ $t("operatManage.tokentoolObj.invalid") }}</el-button> - <el-button + <!-- <el-button type="info" size="small" plain >{{ $t("operatManage.tokentoolObj.renewal") - }}</el-button> + }}</el-button> --> <el-button v-if="menuStatus.update" @click="handleEdit(scope.$index, scope.row)" @@ -370,6 +383,7 @@ insertToken, updateToken, deleteTokens, + token_updateExpireById } from "../../api/api.js"; export default { //import寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� @@ -425,6 +439,23 @@ window.removeEventListener("resize", this.onResize); }, methods: { + async setExpireById(index, row) { + const data = await token_updateExpireById({ id: row.id }) + if (data.code == 200) { + this.$message({ + message: "鎴愬姛锛�", + type: "success", + }); + } else { + this.$message({ + message: "澶辫触锛�", + type: "warning", + }); + } + setTimeout((res) => { + this.getRoleTabelData(); + }, 500) + }, onResize() { this.timer && clearTimeout(this.timer); this.timer = setTimeout(() => { @@ -453,6 +484,12 @@ }, async delTokenData() { var std = []; + debugger + if (this.multipleSelection.length <= 0) { + return this.$message({ + message: "鍒犻櫎澶辫触锛屾湭閫夋嫨瑕佸垹闄ょ殑鏁版嵁", + }); + } for (var i in this.multipleSelection) { std.push(this.multipleSelection[i].id); } @@ -537,6 +574,7 @@ this.upform.edit = JSON.stringify(row.type); }, handleSelectionChange(val) { + debugger this.multipleSelection = val; }, insertFromDataClose() { @@ -655,8 +693,14 @@ if (data.code != 200) { this.$message.error("鍒楄〃璋冪敤澶辫触"); } - - this.tableData = data.result; + var val = data.result.filter((res) => { + res.status = false; + if (res.expire > new Date().getTime()) { + res.status = true + } + return res; + }) + this.tableData = val; this.count = data.count; }, handleSizeChange(val) { -- Gitblit v1.9.3