【前端】智能库房综合管理系统前端项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
4.4 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div>
  3. <div class="head-container">
  4. <!-- <crudOperation /> -->
  5. <!-- <el-button v-permission="permission.download" :loading="crud.downloadLoading" :disabled="!selections.length" size="mini" icon="el-icon-download" @click="handleDownload">导出</el-button> -->
  6. <el-button :loading="crud.downloadLoading" size="mini" icon="el-icon-download" @click="handleDownload">导出</el-button>
  7. <el-input
  8. v-model="query.blurry"
  9. size="small"
  10. clearable
  11. placeholder="请输入关键词"
  12. style="width: 300px;margin-right:10px;padding-left:10px"
  13. class="input-prepend filter-item"
  14. @keyup.enter.native="crud.toQuery"
  15. >
  16. <!-- <el-select slot="prepend" v-model="optionVal" style="width: 100px" @keyup.enter.native="crud.toQuery"> -->
  17. <el-select slot="prepend" v-model="optionVal" style="width: 100px">
  18. <el-option
  19. v-for="item in options"
  20. :key="item.value"
  21. :label="item.label"
  22. :value="item.value"
  23. />
  24. </el-select>
  25. </el-input>
  26. <date-range-picker v-model="query.createTime" class="date-item" />
  27. <rrOperation />
  28. </div>
  29. <el-table
  30. ref="table"
  31. :data="crud.data"
  32. style="width: 100%;"
  33. height="calc(100vh - 356px)"
  34. @row-click="clickRowHandler"
  35. @selection-change="selectionChangeHandler"
  36. >
  37. <el-table-column type="selection" width="55" align="center" />
  38. <el-table-column type="index" label="序号" width="100" align="center" />
  39. <el-table-column prop="account" label="登录账号" min-width="150" align="center" />
  40. <el-table-column prop="username" label="用户名" align="center" min-width="150" />
  41. <el-table-column prop="role" label="用户角色" align="center" min-width="150">
  42. <template slot-scope="scope">
  43. <div>{{ scope.row.role | parseRole }}</div>
  44. </template>
  45. </el-table-column>
  46. <el-table-column prop="det" label="所属部门" align="center" min-width="180" />
  47. <el-table-column prop="requestIp" label="IP地址" align="center" min-width="180" />
  48. <el-table-column prop="create_time" label="操作时间" align="center" min-width="180">
  49. <template slot-scope="scope">
  50. <div>{{ scope.row.create_time | parseTime }}</div>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. <pagination />
  55. </div>
  56. </template>
  57. <script>
  58. import rrOperation from '@crud/RR.operation'
  59. import CRUD, { presenter, crud, header } from '@crud/crud'
  60. import DateRangePicker from '@/components/DateRangePicker'
  61. import pagination from '@crud/Pagination'
  62. import { mapGetters } from 'vuex'
  63. import { parseTime, saveAs, getBlob } from '@/utils/index'
  64. import qs from 'qs'
  65. export default {
  66. name: 'LoginLog',
  67. components: { rrOperation, DateRangePicker, pagination },
  68. filters: {
  69. parseRole(val) {
  70. const arr = val.split(',')
  71. const arr1 = arr.filter(item => item.includes('name'))
  72. const role = arr1[0].split('=')[1]
  73. return role
  74. }
  75. },
  76. mixins: [presenter(), crud(), header()],
  77. cruds() {
  78. return CRUD({
  79. url: 'api/loginlogs/list',
  80. // sort: ['update_time,desc'],
  81. // crudMethod: caseCrudMethod,
  82. optShow: {
  83. add: false,
  84. edit: false,
  85. del: false,
  86. download: true
  87. }
  88. })
  89. },
  90. data() {
  91. return {
  92. selections: [],
  93. keyWord: '',
  94. optionVal: 1,
  95. options: [
  96. { value: 1, label: '用户名' },
  97. { value: 2, label: '所属部门' },
  98. { value: 3, label: '登录账号' }
  99. ],
  100. queryTime: null
  101. }
  102. },
  103. computed: {
  104. ...mapGetters([
  105. 'baseApi'
  106. ])
  107. },
  108. methods: {
  109. // 导出
  110. handleDownload() {
  111. this.crud.downloadLoading = true
  112. const fileName = parseTime(new Date()) + '-登录日志'
  113. getBlob(this.baseApi + '/api/loginlogs/download' + '?' + qs.stringify(this.crud.query, { indices: false }), function(blob) {
  114. saveAs(blob, fileName)
  115. })
  116. this.crud.downloadLoading = false
  117. },
  118. test() {
  119. console.log(this.crud, 'crud')
  120. },
  121. clickRowHandler(row) {
  122. this.$refs.table.toggleRowSelection(row) // 单击选中
  123. },
  124. selectionChangeHandler(val) {
  125. this.selections = val
  126. }
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. @import "~@/assets/styles/archives-manage.scss";
  132. </style>