Rap 原分销系统代码Web
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

e75bc4f7d983b3834ac4af3d5d4d0e529bf4ad1b.svn-base 3.8KB

5 månader sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div class="app-container">
  3. <div class="head-container">
  4. <div v-if="crud.props.searchToggle">
  5. <el-input v-model="query.filter" clearable size="small" placeholder="全表模糊搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
  6. <rrOperation />
  7. </div>
  8. <crudOperation>
  9. <el-button
  10. slot="left"
  11. class="filter-item"
  12. type="danger"
  13. icon="el-icon-delete"
  14. size="mini"
  15. :loading="delLoading"
  16. :disabled="crud.selections.length === 0"
  17. @click="doDelete(crud.selections)"
  18. >
  19. 强退
  20. </el-button>
  21. </crudOperation>
  22. </div>
  23. <!--表格渲染-->
  24. <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
  25. <el-table-column type="selection" width="55" />
  26. <el-table-column prop="userName" label="用户名" />
  27. <el-table-column prop="nickName" label="用户昵称" />
  28. <el-table-column prop="dept" label="部门" />
  29. <el-table-column prop="ip" label="登录IP" />
  30. <el-table-column :show-overflow-tooltip="true" prop="address" label="登录地点" />
  31. <el-table-column prop="browser" label="浏览器" />
  32. <el-table-column prop="loginTime" label="登录时间" />
  33. <el-table-column label="操作" width="70px" fixed="right">
  34. <template slot-scope="scope">
  35. <el-popover
  36. :ref="scope.$index"
  37. v-permission="['admin']"
  38. placement="top"
  39. width="180"
  40. >
  41. <p>确定强制退出该用户吗?</p>
  42. <div style="text-align: right; margin: 0">
  43. <el-button size="mini" type="text" @click="$refs[scope.$index].doClose()">取消</el-button>
  44. <el-button :loading="delLoading" type="primary" size="mini" @click="delMethod(scope.row.key, scope.$index)">确定</el-button>
  45. </div>
  46. <el-button slot="reference" size="mini" type="text">强退</el-button>
  47. </el-popover>
  48. </template>
  49. </el-table-column>
  50. </el-table>
  51. <!--分页组件-->
  52. <pagination />
  53. </div>
  54. </template>
  55. <script>
  56. import { del } from '@/api/monitor/online'
  57. import CRUD, { presenter, header, crud } from '@crud/crud'
  58. import rrOperation from '@crud/RR.operation'
  59. import crudOperation from '@crud/CRUD.operation'
  60. import pagination from '@crud/Pagination'
  61. export default {
  62. name: 'OnlineUser',
  63. components: { pagination, crudOperation, rrOperation },
  64. cruds() {
  65. return CRUD({ url: 'api/online', title: '在线用户' })
  66. },
  67. mixins: [presenter(), header(), crud()],
  68. data() {
  69. return {
  70. delLoading: false,
  71. permission: {}
  72. }
  73. },
  74. created() {
  75. this.crud.msg.del = '强退成功!'
  76. this.crud.optShow = {
  77. add: false,
  78. edit: false,
  79. del: false,
  80. download: true
  81. }
  82. },
  83. methods: {
  84. doDelete(datas) {
  85. this.$confirm(`确认强退选中的${datas.length}个用户?`, '提示', {
  86. confirmButtonText: '确定',
  87. cancelButtonText: '取消',
  88. type: 'warning'
  89. }).then(() => {
  90. this.delMethod(datas)
  91. }).catch(() => {})
  92. },
  93. // 踢出用户
  94. delMethod(key, index) {
  95. const ids = []
  96. if (key instanceof Array) {
  97. key.forEach(val => {
  98. ids.push(val.key)
  99. })
  100. } else ids.push(key)
  101. this.delLoading = true
  102. del(ids).then(() => {
  103. this.delLoading = false
  104. if (this.$refs[index]) {
  105. this.$refs[index].doClose()
  106. }
  107. this.crud.dleChangePage(1)
  108. this.crud.delSuccessNotify()
  109. this.crud.toQuery()
  110. }).catch(() => {
  111. this.delLoading = false
  112. if (this.$refs[index]) {
  113. this.$refs[index].doClose()
  114. }
  115. })
  116. }
  117. }
  118. }
  119. </script>