index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div>
  3. <div v-if="!customerId" style="min-height: 400px;" class="d-flex justify-center align-center">
  4. <div>
  5. <el-input v-model="customerIdModel" placeholder="请输入客户编号"></el-input>
  6. </div>
  7. <m-button class="ml-3" type="orange" @click="onSearchCustomer">查询</m-button>
  8. </div>
  9. <template v-if="customerId">
  10. <m-search class="mb-3" :items="searchItems" v-model="searchValues" @search="onSearch"></m-search>
  11. <m-table
  12. v-loading="loading"
  13. :cardTitle="cardTitle"
  14. :items="items"
  15. :headers="headers"
  16. :page-size="pageInfo.size"
  17. :page-current="pageInfo.current"
  18. :total="total"
  19. @page-change="onPageChange"
  20. >
  21. <template #actions="{ row }">
  22. <m-button type="primary" text @click="onEdit(row)">分润认领</m-button>
  23. </template>
  24. </m-table>
  25. </template>
  26. <ClaimForm ref="claimFormRef" @submit="onSubmit" />
  27. </div>
  28. </template>
  29. <script>
  30. import { dateFormat } from '@/utils/date'
  31. import { getCustomerProfitSharingClaim, getCustomerProfitSharingClaimStaffAdd } from '@/api/salary'
  32. import ClaimForm from '../components/form.vue'
  33. export default {
  34. name: 'salaryClaimStaff',
  35. components: {
  36. ClaimForm
  37. },
  38. data () {
  39. return {
  40. customerIdModel: null,
  41. customerId: null,
  42. searchItems: [
  43. {
  44. label: '客户编号',
  45. prop: 'customerId',
  46. type: 'input',
  47. options: {
  48. clearable: false,
  49. placeholder: '请输入客户编号'
  50. }
  51. },
  52. {
  53. label: '月份',
  54. prop: 'month',
  55. type: 'datePicker',
  56. options: {
  57. clearable: false,
  58. type: 'month',
  59. format: 'yyyy-MM',
  60. valueFormat: 'yyyy-MM',
  61. placeholder: '选择查询月份'
  62. }
  63. },
  64. {
  65. label: '科目名称',
  66. prop: 'subjectName',
  67. type: 'input',
  68. options: {
  69. placeholder: '请输入科目名称'
  70. }
  71. }
  72. ],
  73. searchValues: {
  74. subjectName: null,
  75. customerId: null,
  76. month: dateFormat('YYYY-mm', new Date())
  77. },
  78. headers: [
  79. { label: '客户编号', prop: 'customerId', align: 'center' },
  80. { label: '一级科目编码/名称', prop: 'oneLevelSubject', width: 180 },
  81. { label: '二级科目编码/名称', prop: 'twoLevelSubject', width: 180 },
  82. { label: '金额', prop: 'amount' },
  83. { label: '机构名称', prop: 'organizationName' },
  84. { label: '统一认证号1', prop: 'unifiedCertificationNumber1', width: 150 },
  85. { label: '员工姓名1', prop: 'employeeName1', width: 120 },
  86. { label: '统一认证号2', prop: 'unifiedCertificationNumber2', width: 150 },
  87. { label: '员工姓名2', prop: 'employeeName2', width: 120 },
  88. { label: '管户层级标识', prop: 'customerLevelIdentifier' },
  89. { label: '客户类别标识', prop: 'customerCategoryIdentifier' },
  90. { label: '员工分润比例', prop: 'employeeProfitSharingRatio', align: 'center' },
  91. { label: '数据日期', prop: 'dataDate', width: 120 },
  92. { label: '操作', prop: 'actions', fixed: 'right', width: 180 }
  93. ],
  94. items: [],
  95. total: 0,
  96. pageInfo: {
  97. current: 1,
  98. size: 10
  99. },
  100. loading: false,
  101. cardTitle: null
  102. }
  103. },
  104. methods: {
  105. async onSearchCustomer () {
  106. this.customerId = this.customerIdModel
  107. this.searchValues.customerId = this.customerIdModel
  108. this.initPage()
  109. },
  110. async initPage () {
  111. this.loading = true
  112. try {
  113. const { data } = await getCustomerProfitSharingClaim({
  114. ...this.pageInfo,
  115. ...this.searchValues
  116. })
  117. this.items = data.records
  118. this.total = data.total
  119. } catch (error) {
  120. this.$message.error(error)
  121. } finally {
  122. this.loading = false
  123. }
  124. },
  125. async onInit (cardTitle) {
  126. this.cardTitle = cardTitle
  127. this.customerIdModel = null
  128. this.customerId = null
  129. this.searchValues.customerId = null
  130. },
  131. onAdd () {
  132. this.$refs.templateRefs.open()
  133. },
  134. onEdit (item) {
  135. this.$refs.claimFormRef.open(item, true)
  136. },
  137. onSearch () {
  138. if (!this.searchValues.customerId) return this.$message.warning('请输入要查询的客户编码')
  139. this.pageInfo.current = 1
  140. this.initPage()
  141. },
  142. onPageChange (index) {
  143. this.pageInfo.current = index
  144. this.initPage()
  145. },
  146. async onSubmit (query) {
  147. this.$refs.claimFormRef.setLoading(true)
  148. try {
  149. await getCustomerProfitSharingClaimStaffAdd(query)
  150. this.$refs.claimFormRef.close()
  151. this.$message.success('操作成功')
  152. this.initPage()
  153. } catch (error) {
  154. this.$message.error(error)
  155. } finally {
  156. this.$refs.claimFormRef.setLoading(false)
  157. }
  158. }
  159. }
  160. }
  161. </script>
  162. <style lang="scss" scoped>
  163. /* 自定义样式 */
  164. </style>