index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <!--
  2. - Copyright (c) 2018-2025, lengleng All rights reserved.
  3. -
  4. - Redistribution and use in source and binary forms, with or without
  5. - modification, are permitted provided that the following conditions are met:
  6. -
  7. - Redistributions of source code must retain the above copyright notice,
  8. - this list of conditions and the following disclaimer.
  9. - Redistributions in binary form must reproduce the above copyright
  10. - notice, this list of conditions and the following disclaimer in the
  11. - documentation and/or other materials provided with the distribution.
  12. - Neither the name of the pig4cloud.com developer nor the names of its
  13. - contributors may be used to endorse or promote products derived from
  14. - this software without specific prior written permission.
  15. - Author: lengleng (wangiegie@gmail.com)
  16. -->
  17. <template>
  18. <div class="log">
  19. <basic-container>
  20. <avue-crud ref="crud"
  21. :page="page"
  22. :data="tableData"
  23. :table-loading="tableLoading"
  24. :option="tableOption"
  25. :permission="permissionList"
  26. @on-load="getList"
  27. @search-change="searchChange"
  28. @refresh-change="refreshChange"
  29. @row-del="handleDel">
  30. </avue-crud>
  31. </basic-container>
  32. </div>
  33. </template>
  34. <script>
  35. import {delObj, fetchList} from '@/api/admin/log'
  36. import {tableOption} from '@/const/crud/admin/log'
  37. import {mapGetters} from 'vuex'
  38. export default {
  39. name: 'log',
  40. data() {
  41. return {
  42. tableData: [],
  43. page: {
  44. total: 0, // 总页数
  45. currentPage: 1, // 当前页数
  46. pageSize: 20 // 每页显示多少条
  47. },
  48. tableLoading: false,
  49. tableOption: tableOption
  50. }
  51. },
  52. created() {
  53. },
  54. mounted: function () {
  55. },
  56. computed: {
  57. ...mapGetters(['permissions']),
  58. permissionList() {
  59. return {
  60. delBtn: this.vaildData(this.permissions.sys_log_del, false),
  61. };
  62. }
  63. },
  64. methods: {
  65. getList(page, params) {
  66. this.tableLoading = true
  67. fetchList(Object.assign({
  68. descs: 'create_time',
  69. current: page.currentPage,
  70. size: page.pageSize
  71. }, params)).then(response => {
  72. this.tableData = response.data.data.records
  73. this.page.total = response.data.data.total
  74. this.tableLoading = false
  75. })
  76. },
  77. handleDel: function (row, index) {
  78. var _this = this
  79. this.$confirm('是否确认删除ID为"' + row.id + '"的日志?', '警告', {
  80. confirmButtonText: '确定',
  81. cancelButtonText: '取消',
  82. type: 'warning'
  83. }).then(function () {
  84. return delObj(row.id)
  85. }).then(data => {
  86. this.getList(this.page)
  87. _this.$message({
  88. showClose: true,
  89. message: '删除成功',
  90. type: 'success'
  91. })
  92. }).catch(function (err) {
  93. })
  94. },
  95. /**
  96. * 搜索回调
  97. */
  98. searchChange(form) {
  99. this.getList(this.page, form)
  100. },
  101. /**
  102. * 刷新回调
  103. */
  104. refreshChange() {
  105. this.getList(this.page)
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. </style>