55c7ed3865128df78d5de17723396e97c722e0e8.svn-base 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :md="6" :sm="12">
  8. <a-form-item label="账号">
  9. <a-input placeholder="请输入账号查询" v-model="queryParam.username"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="8">
  13. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  14. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  15. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  16. </span>
  17. </a-col>
  18. </a-row>
  19. </a-form>
  20. </div>
  21. <!-- 查询区域-END -->
  22. <!-- table区域-begin -->
  23. <div>
  24. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  25. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  26. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  27. </div>
  28. <a-table
  29. ref="table"
  30. size="middle"
  31. :scroll="{x:true}"
  32. bordered
  33. rowKey="token"
  34. :columns="columns"
  35. :dataSource="dataSource"
  36. :pagination="ipagination"
  37. :loading="loading"
  38. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  39. class="j-table-force-nowrap"
  40. @change="handleTableChange">
  41. <template slot="avatarslot" slot-scope="text, record, index">
  42. <div class="anty-img-wrap">
  43. <a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/>
  44. </div>
  45. </template>
  46. <span slot="action" slot-scope="text, record">
  47. <a-popconfirm title="强制退出用户?" @confirm="() => handleForce(record)">
  48. <a-button type="danger">强退</a-button>
  49. </a-popconfirm>
  50. </span>
  51. </a-table>
  52. </div>
  53. </a-card>
  54. </template>
  55. <script>
  56. import '@/assets/less/TableExpand.less'
  57. import { mixinDevice } from '@/utils/mixin'
  58. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  59. import { forceLogout } from '@/api/login'
  60. import {filterDictTextByCache} from '@/components/dict/JDictSelectUtil'
  61. import {getFileAccessHttpUrl} from '@/api/manage';
  62. export default {
  63. name: "SysUserOnlineList",
  64. mixins:[JeecgListMixin, mixinDevice],
  65. components: {},
  66. data () {
  67. return {
  68. description: '在线用户管理页面',
  69. queryParam: {
  70. username: ''
  71. },
  72. // 表头
  73. columns: [
  74. {
  75. title:'用户账号',
  76. align:"center",
  77. dataIndex: 'username'
  78. },{
  79. title:'用户姓名',
  80. align:"center",
  81. dataIndex: 'realname'
  82. },{
  83. title: '头像',
  84. align: "center",
  85. width: 120,
  86. dataIndex: 'avatar',
  87. scopedSlots: {customRender: "avatarslot"}
  88. },{
  89. title:'生日',
  90. align:"center",
  91. dataIndex: 'birthday'
  92. },{
  93. title: '性别',
  94. align: "center",
  95. dataIndex: 'sex',
  96. customRender: (text) => {
  97. //字典值翻译通用方法
  98. return filterDictTextByCache('sex', text);
  99. }
  100. },{
  101. title:'手机号',
  102. align:"center",
  103. dataIndex: 'phone'
  104. },{
  105. title: '操作',
  106. dataIndex: 'action',
  107. scopedSlots: {customRender: 'action'},
  108. align: "center",
  109. width: 170
  110. }
  111. ],
  112. url: {
  113. list: "/sys/online/list"
  114. },
  115. dictOptions:{},
  116. }
  117. },
  118. created() {
  119. },
  120. computed: {
  121. importExcelUrl: function(){
  122. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  123. },
  124. },
  125. methods: {
  126. getAvatarView: function (avatar) {
  127. return getFileAccessHttpUrl(avatar)
  128. },
  129. handleForce(record) {
  130. let that = this;
  131. let forceParam = {
  132. token: record.token
  133. }
  134. return forceLogout(forceParam).then((res) => {
  135. if (res.success) {
  136. that.loadData();
  137. this.$message.success('强制退出用户”'+record.realname+'“成功!');
  138. } else {
  139. that.$message.warning(res.message);
  140. }
  141. })
  142. }
  143. }
  144. }
  145. </script>
  146. <style scoped>
  147. @import '~@assets/less/common.less';
  148. </style>