管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2023-10-10 aab91150254007fe922a500851560d3286bdafef
令牌管理失效,删除功能优化
已修改2个文件
60 ■■■■■ 文件已修改
src/api/api.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/maintenance/tokentool.vue 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 });
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) {