index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <div class="execution">
  3. <basic-container>
  4. <avue-crud
  5. ref="crud"
  6. :page="page"
  7. :data="tableData"
  8. :table-loading="tableLoading"
  9. :option="tableOption"
  10. @on-load="getList"
  11. @refresh-change="refreshChange"
  12. @size-change="sizeChange"
  13. @current-change="currentChange"
  14. @search-change="handleFilter"
  15. @search-reset="handleSearchReset">
  16. <template slot-scope="scope" slot="jobLogStatus">
  17. <div v-if="scope.row.jobLogStatus === '0'">
  18. <el-tag type="success">{{ getDicNameJobExecuteStatus(scope.row.jobLogStatus) }}</el-tag>
  19. </div>
  20. <div v-else>
  21. <el-tag type="danger">{{ getDicNameJobExecuteStatus(scope.row.jobLogStatus) }}</el-tag>
  22. </div>
  23. </template>
  24. </avue-crud>
  25. </basic-container>
  26. </div>
  27. </template>
  28. <script>
  29. import {
  30. fetchList
  31. } from '@/api/daemon/sys-job-log'
  32. import {
  33. tableOption
  34. } from '@/const/crud/daemon/sys-job-log'
  35. import {
  36. remote
  37. } from '@/api/admin/dict'
  38. import {
  39. mapGetters
  40. } from 'vuex'
  41. export default {
  42. name: 'JobLog',
  43. data() {
  44. return {
  45. queryParams: {}, // 全局检索条件
  46. tableData: [],
  47. page: {
  48. total: 0, // 总页数
  49. currentPage: 1, // 当前页数
  50. pageSize: 10 // 每页显示多少条,
  51. },
  52. tableLoading: false,
  53. tableOption: tableOption,
  54. JobExecuteStatusDicCache: []
  55. }
  56. },
  57. created() {
  58. },
  59. mounted: function() {
  60. this.getDicNameCache('job_execute_status')// 获取定时任务运行时状态
  61. },
  62. computed: {
  63. ...mapGetters(['permissions'])
  64. },
  65. methods: {
  66. getList(page) {
  67. this.tableLoading = true
  68. fetchList(Object.assign({
  69. descs: 'create_time',
  70. current: page.currentPage,
  71. size: page.pageSize
  72. }, this.queryParams)).then(response => {
  73. this.tableData = response.data.data.records
  74. this.page.pageSize = response.data.data.pageSize
  75. this.page.total = response.data.data.total
  76. this.tableLoading = false
  77. })
  78. },
  79. /**
  80. * 清除全局检索条件
  81. */
  82. handleSearchReset() {
  83. this.queryParams = {}
  84. },
  85. /**
  86. * 检索查询
  87. */
  88. handleFilter(params) {
  89. this.queryParams = params
  90. this.getList(this.page)
  91. },
  92. refreshChange() {
  93. this.getList(this.page)
  94. },
  95. sizeChange(pageSize){
  96. this.page.pageSize = pageSize
  97. },
  98. currentChange(current){
  99. this.page.currentPage = current
  100. },
  101. getDicNameCache(type) {
  102. remote(type).then(response => {
  103. const code = response.data.code
  104. if (code === 0) {
  105. const _data = response.data.data
  106. this.JobExecuteStatusDicCache = _data
  107. }
  108. })
  109. },
  110. getDicNameJobExecuteStatus(value) {
  111. let re = ''
  112. this.JobExecuteStatusDicCache.forEach(obj => {
  113. if (obj.value === value) {
  114. re = obj.label
  115. }
  116. })
  117. return re
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="scss" scoped>
  123. </style>