table.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <div>
  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 #card-tools>
  14. <m-button type="orange" icon="el-icon-plus" @click="onAdd">新增</m-button>
  15. </template> -->
  16. <template #actions="{ row }">
  17. <m-button type="primary" text @click="onEdit(row)">分润认领</m-button>
  18. <!-- <m-button type="danger" text @click="onDelete(row)">删除</m-button> -->
  19. </template>
  20. </m-table>
  21. </div>
  22. </template>
  23. <script>
  24. import { getCustomerProfitSharingClaim } from '@/api/salary'
  25. export default {
  26. name: 'salaryClaimCommonTable',
  27. props: {
  28. type: {
  29. type: String,
  30. default: '0'
  31. }
  32. },
  33. data () {
  34. return {
  35. searchItems: [
  36. {
  37. label: '客户编号',
  38. prop: 'customerId',
  39. type: 'input',
  40. options: {
  41. placeholder: '请输入客户编号'
  42. }
  43. },
  44. {
  45. label: '科目名称',
  46. prop: 'subjectName',
  47. type: 'input',
  48. options: {
  49. placeholder: '请输入科目名称'
  50. }
  51. }
  52. ],
  53. searchValues: {
  54. subjectName: null,
  55. customerId: null
  56. },
  57. headers: [
  58. { label: '客户编号', prop: 'customerId' },
  59. { label: '一级科目编码/名称', prop: 'oneLevelSubject' },
  60. { label: '二级科目编码/名称', prop: 'twoLevelSubject' },
  61. { label: '金额', prop: 'amount' },
  62. { label: '统一认证号1', prop: 'unifiedCertificationNumber1' },
  63. { label: '统一认证号2', prop: 'unifiedCertificationNumber2' },
  64. { label: '数据日期', prop: 'dataDate' },
  65. { label: '管户层级标识', prop: 'customerLevelIdentifier' },
  66. { label: '客户类别标识', prop: 'customerCategoryIdentifier' },
  67. { label: '员工分润比例', prop: 'employeeProfitSharingRatio' },
  68. { label: '操作', prop: 'actions', fixed: 'right' }
  69. ],
  70. items: [],
  71. total: 0,
  72. pageInfo: {
  73. current: 1,
  74. size: 10
  75. },
  76. loading: false
  77. }
  78. },
  79. methods: {
  80. async onInit () {
  81. this.loading = true
  82. try {
  83. const { data } = await getCustomerProfitSharingClaim({
  84. ...this.pageInfo,
  85. level: this.type,
  86. ...this.searchValues
  87. })
  88. this.items = data.records
  89. this.total = data.total
  90. } catch (error) {
  91. this.$message.error(error)
  92. } finally {
  93. this.loading = false
  94. }
  95. },
  96. onAdd () {
  97. this.$refs.templateRefs.open()
  98. },
  99. onEdit (item) {
  100. this.$refs.templateRefs.open(item)
  101. },
  102. onDelete (row) {
  103. this.$confirm('确定删除吗?', '提示')
  104. .then(async () => {
  105. try {
  106. // await ApiName({ id: row.id })
  107. this.$message.success('删除成功')
  108. this.onInit()
  109. } catch (error) {
  110. this.$message.error(error)
  111. }
  112. })
  113. .catch(_ => {})
  114. },
  115. onSearch () {
  116. this.pageInfo.current = 1
  117. this.onInit()
  118. },
  119. onPageChange (index) {
  120. this.pageInfo.current = index
  121. this.onInit()
  122. }
  123. }
  124. }
  125. </script>
  126. <style lang="scss" scoped>
  127. /* 自定义样式 */
  128. </style>