index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <div class="white pa-3">
  3. <m-search :items="searchItems" v-model="searchValues" class="mb-3" @search="onSearch"></m-search>
  4. <m-table
  5. :items="items"
  6. :headers="headers"
  7. v-loading="loading"
  8. :total="total"
  9. :page-size="pageInfo.size"
  10. :page-current="pageInfo.current"
  11. @page-change="onPageChange"
  12. >
  13. <template #status="{ row }">
  14. <el-tag :type="statusList[row.status]?.type ?? 'info'">{{ statusList[row.status]?.label ?? '未知状态' }}</el-tag>
  15. </template>
  16. <template #actions="{ row }">
  17. <el-button type="text" @click="onShowDetails(row)">查看详情</el-button>
  18. </template>
  19. </m-table>
  20. <ApproveDetails ref="approveDetailsRefs"></ApproveDetails>
  21. </div>
  22. </template>
  23. <script>
  24. import {
  25. getBonusApprovePage
  26. } from '@/api/bonus'
  27. import ApproveDetails from './approveDetails.vue'
  28. import { STATUS_LIST } from '../utils'
  29. export default {
  30. name: 'bonusAllocationApprove',
  31. components: {
  32. ApproveDetails
  33. },
  34. data () {
  35. return {
  36. statusList: STATUS_LIST,
  37. loading: false,
  38. items: [],
  39. headers: [
  40. { label: '月份', prop: 'month' },
  41. { label: '分配机构', prop: 'opOrganizationName' },
  42. // { label: '分配员工', prop: 'opNickname', align: 'center' },
  43. { label: '员工类型', prop: 'employeeCategory', align: 'center' },
  44. { label: '状态', prop: 'status', align: 'center' },
  45. { label: '数据版本', prop: 'version', align: 'center' },
  46. { label: '审核信息', prop: 'authMsg' },
  47. { label: '操作', prop: 'actions' }
  48. ],
  49. total: 0,
  50. pageInfo: {
  51. current: 1,
  52. size: 10
  53. },
  54. searchValues: {}
  55. }
  56. },
  57. computed: {
  58. searchItems () {
  59. return [
  60. {
  61. label: '月份',
  62. prop: 'month',
  63. type: 'datePicker',
  64. options: {
  65. placeholder: '请选择月份',
  66. clearable: false,
  67. type: 'month',
  68. valueFormat: 'yyyy-MM',
  69. format: 'yyyy 年 MM 月'
  70. }
  71. },
  72. {
  73. label: '机构',
  74. prop: 'organizationName',
  75. type: 'input',
  76. options: {
  77. placeholder: '请输入机构'
  78. }
  79. },
  80. {
  81. label: '员工类型',
  82. prop: 'employeeCategory',
  83. type: 'input',
  84. options: {
  85. placeholder: '请输入员工类型'
  86. }
  87. }
  88. ]
  89. }
  90. },
  91. created () {
  92. this.onInit()
  93. },
  94. methods: {
  95. async onInit () {
  96. try {
  97. const { data } = await getBonusApprovePage({
  98. page: {
  99. ...this.pageInfo
  100. },
  101. entity: {}
  102. })
  103. this.items = data.records
  104. this.total = data.total
  105. } catch (error) {
  106. this.$message.error(error)
  107. }
  108. },
  109. onPageChange (page) {
  110. this.pageInfo.current = page
  111. this.onInit()
  112. },
  113. onSearch () {
  114. this.pageInfo.current = 1
  115. this.onInit()
  116. },
  117. onShowDetails () {
  118. this.$refs.approveDetailsRefs.open()
  119. }
  120. }
  121. }
  122. </script>
  123. <style lang="scss" scoped>
  124. </style>