index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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="execution">
  19. <basic-container>
  20. <avue-crud
  21. ref="crud"
  22. :page="page"
  23. :data="tableData"
  24. :table-loading="tableLoading"
  25. :option="tableOption"
  26. :permission="permissionList"
  27. @on-load="getList"
  28. @refresh-change="refreshChange"
  29. @size-change="sizeChange"
  30. @current-change="currentChange"
  31. @row-del="handleDel"/>
  32. </basic-container>
  33. </div>
  34. </template>
  35. <script>
  36. import { delObj, fetchList } from '@/api/daemon/execution-log'
  37. import { tableOption } from '@/const/crud/daemon/execution-log'
  38. import { mapGetters } from 'vuex'
  39. export default {
  40. name: 'ExecutionLog',
  41. data() {
  42. return {
  43. tableData: [],
  44. page: {
  45. total: 0, // 总页数
  46. currentPage: 1, // 当前页数
  47. pageSize: 20 // 每页显示多少条
  48. },
  49. tableLoading: false,
  50. tableOption: tableOption
  51. }
  52. },
  53. created() {
  54. this.page.pageSize = 20
  55. },
  56. mounted: function() {
  57. },
  58. computed: {
  59. ...mapGetters(['permissions']),
  60. permissionList() {
  61. return {
  62. delBtn: this.vaildData(this.permissions.daemon_execution_log_del, false)
  63. }
  64. }
  65. },
  66. methods: {
  67. getList(page, params = {}) {
  68. this.tableLoading = true
  69. fetchList(Object.assign({
  70. current: page.currentPage,
  71. size: page.pageSize,
  72. descs: 'start_time'
  73. }, params)).then(response => {
  74. this.tableData = response.data.data.records
  75. this.page.total = response.data.data.total
  76. this.tableLoading = false
  77. })
  78. },
  79. handleDel: function(row, index) {
  80. this.$confirm('是否确认删除ID为' + row.id, '提示', {
  81. confirmButtonText: '确定',
  82. cancelButtonText: '取消',
  83. type: 'warning'
  84. }).then(function() {
  85. return delObj(row.id)
  86. }).then(() => {
  87. this.$message.success('删除成功')
  88. this.getList(this.page)
  89. })
  90. },
  91. sizeChange(pageSize){
  92. this.page.pageSize = pageSize
  93. },
  94. currentChange(current){
  95. this.page.currentPage = current
  96. },
  97. refreshChange() {
  98. this.getList(this.page)
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. </style>