Browse Source

【更新】前端在线用户列表改为分页

俞宝山 4 years ago
parent
commit
35686af149
1 changed files with 16 additions and 23 deletions
  1. 16 23
      _web/src/views/system/onlineUser/index.vue

+ 16 - 23
_web/src/views/system/onlineUser/index.vue

@ -1,13 +1,13 @@
<template>
  <a-card :bordered="false">
    <a-table
    <s-table
      ref="table"
      size="default"
      :pagination="false"
      :loading="loading"
      :columns="columns"
      :dataSource="loadData"
      :data="loadData"
      :rowKey="(record) => record.sessionId"
      :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
    >
@ -16,23 +16,22 @@
          <a>强制下线</a>
        </a-popconfirm>
      </span>
    </a-table>
    </s-table>
  </a-card>
</template>
<script>
  import { STable } from '@/components'
  import { sysOnlineUserForceExist, sysOnlineUserList } from '@/api/modular/system/onlineUserManage'
  export default {
    components: {
      STable
    },
    data () {
      return {
        // 高级搜索 展开/关闭
        advanced: false,
        // 查询参数
        queryParam: {},
        // 表头
@ -67,7 +66,17 @@
          }
        ],
        loading: true,
        loadData: [],
        loadData: parameter => {
          return sysOnlineUserList(Object.assign(parameter, this.queryParam)).then((res) => {
            if (this.hasPerm('sysOnlineUser:list')) {
              return res.data
            } else {
              return new Promise((resolve, reject) => {
                return resolve()
              })
            }
          })
        },
        selectedRowKeys: [],
        selectedRows: []
    }
@ -75,7 +84,6 @@
    // 进页面加载
    created () {
      this.loadDataList()
      if (this.hasPerm('sysOnlineUser:forceExist')) {
        this.columns.push({
          title: '操作',
@ -88,20 +96,6 @@
    methods: {
      // 加载数据方法
      loadDataList () {
        if (!this.hasPerm('sysOnlineUser:list')) {
          this.loading = false
          this.loadData = null
          this.$message.error('无权限查询数据,请联系管理员')
          return
        }
        sysOnlineUserList().then((res) => {
          this.loading = false
          this.loadData = res.data
        })
      },
      forceExist (record) {
        sysOnlineUserForceExist(record).then((res) => {
          if (res.success) {
@ -132,5 +126,4 @@
  button {
    margin-right: 8px;
  }
</style>