index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div class="pa-3 white">
  3. <m-search class="mb-3" :items="searchItems" v-model="searchValues" @search="onSearch"></m-search>
  4. <m-table
  5. v-loading="loading"
  6. :items="items"
  7. :headers="headers"
  8. :page-size="pageInfo.size"
  9. :page-current="pageInfo.current"
  10. :total="total"
  11. @page-change="onPageChange"
  12. >
  13. <template #score="{ row }">
  14. <el-tag type="orange">{{ row.score }}</el-tag>
  15. </template>
  16. <template #actions="{ row }">
  17. <m-button text type="primary" @click="onDetails(row)">查看明细</m-button>
  18. </template>
  19. </m-table>
  20. <AccumulatePointsApplyDetails ref="accumulatePointsApplyDetailsRefs"></AccumulatePointsApplyDetails>
  21. </div>
  22. </template>
  23. <script>
  24. import { mapGetters } from 'vuex'
  25. import AccumulatePointsApplyDetails from '../components/accumulatePointsApplyDetails.vue'
  26. import {
  27. getAccumulatePointList
  28. } from '@/api/accumulatePoint'
  29. export default {
  30. name: 'accumulatePointsIntegralList',
  31. components: {
  32. AccumulatePointsApplyDetails
  33. },
  34. data () {
  35. return {
  36. headers: [
  37. { label: '员工姓名', prop: 'employeeName' },
  38. { label: '机构', prop: 'organizationName' },
  39. { label: '申报积分', prop: 'score', align: 'center' },
  40. { label: '创建时间', prop: 'createDate' },
  41. { label: '操作', prop: 'actions' }
  42. ],
  43. items: [],
  44. total: 0,
  45. pageInfo: {
  46. current: 1,
  47. size: 10
  48. },
  49. loading: false,
  50. searchValues: {
  51. employeeName: null,
  52. organizationName: null
  53. }
  54. }
  55. },
  56. created () {
  57. this.onInit()
  58. },
  59. computed: {
  60. ...mapGetters(['organizationTree']),
  61. searchItems () {
  62. return [
  63. { label: '员工姓名', prop: 'employeeName', type: 'input', options: { placeholder: '请输入员工姓名' } },
  64. {
  65. label: '机构',
  66. prop: 'organizationNo',
  67. type: 'cascader',
  68. options: {
  69. placeholder: '请选择机构',
  70. options: this.organizationTree,
  71. showAllLevels: false,
  72. props: {
  73. emitPath: false,
  74. checkStrictly: true,
  75. value: 'organizationNo',
  76. label: 'organizationName',
  77. children: 'child'
  78. }
  79. }
  80. }
  81. ]
  82. }
  83. },
  84. methods: {
  85. async onInit () {
  86. this.loading = true
  87. try {
  88. const { data } = await getAccumulatePointList({
  89. page: {
  90. ...this.pageInfo
  91. },
  92. entity: {
  93. ...this.searchValues
  94. }
  95. })
  96. this.items = data.records
  97. this.total = data.total
  98. } catch (error) {
  99. this.$message.error(error)
  100. } finally {
  101. this.loading = false
  102. }
  103. },
  104. onDetails (item) {
  105. this.$refs.accumulatePointsApplyDetailsRefs.open(item, {
  106. employeeCode: item.employeeCode
  107. })
  108. },
  109. onSearch () {
  110. this.pageInfo.current = 1
  111. this.onInit()
  112. },
  113. onPageChange (index) {
  114. this.pageInfo.current = index
  115. this.onInit()
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. </style>