index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. @sort-change="onSortChange"
  13. >
  14. <!-- <template #card-tools>
  15. <m-button type="orange" icon="el-icon-plus" @click="onAdd">新增</m-button>
  16. </template> -->
  17. <!-- <template #actions="{ row }">
  18. <m-button type="primary" text @click="onEdit(row)">编辑</m-button>
  19. <m-button type="danger" text @click="onDelete(row)">删除</m-button>
  20. </template> -->
  21. </m-table>
  22. </div>
  23. </template>
  24. <script>
  25. import {
  26. getSalaryFixedList
  27. } from '@/api/salary'
  28. import { mapGetters } from 'vuex'
  29. export default {
  30. name: 'salaryFixedCalculation',
  31. data () {
  32. return {
  33. searchValues: {
  34. employeeName: null
  35. },
  36. headers: [
  37. { label: '姓名', prop: 'employeeName' },
  38. { label: '所在部门名称', prop: 'deptName' },
  39. { label: '岗位名称', prop: 'postName' },
  40. { label: '人员类别', prop: 'personnelCategory' },
  41. { label: '职务层级', prop: 'jobLevel' },
  42. { label: '薪酬档次', prop: 'salaryCategory', align: 'center' },
  43. { label: '薪酬等级', prop: 'salaryLevel', align: 'center' },
  44. { label: '固定薪资', prop: 'salaryAmount', align: 'center' }
  45. // { label: '操作', prop: 'actions', fixed: 'right', width: 150 }
  46. ],
  47. items: [],
  48. total: 0,
  49. pageInfo: {
  50. current: 1,
  51. size: 10
  52. },
  53. orders: [],
  54. loading: false
  55. }
  56. },
  57. computed: {
  58. ...mapGetters(['organizationTree']),
  59. searchItems () {
  60. return [
  61. {
  62. label: '姓名',
  63. prop: 'employeeName',
  64. type: 'input',
  65. options: {
  66. placeholder: '姓名'
  67. }
  68. },
  69. {
  70. label: '部门',
  71. prop: 'organizationNo',
  72. type: 'cascader',
  73. options: {
  74. filterable: true,
  75. clearable: true,
  76. placeholder: '请选择部门',
  77. options: this.organizationTree,
  78. showAllLevels: false,
  79. props: {
  80. emitPath: false,
  81. value: 'organizationNo',
  82. label: 'organizationName',
  83. children: 'child'
  84. }
  85. }
  86. }
  87. ]
  88. }
  89. },
  90. created () {
  91. this.onInit()
  92. },
  93. methods: {
  94. async onInit () {
  95. this.loading = true
  96. try {
  97. const { organizationNo, ...param } = this.searchValues
  98. const { data } = await getSalaryFixedList({
  99. page: {
  100. ...this.pageInfo,
  101. orders: this.orders
  102. },
  103. entity: {
  104. ...param
  105. },
  106. organizationNo
  107. })
  108. this.items = data.records
  109. this.total = data.total
  110. } catch (error) {
  111. this.$message.error(error)
  112. } finally {
  113. this.loading = false
  114. }
  115. },
  116. onAdd () {
  117. this.$refs.fixedSalaryCalculationRefs.open()
  118. },
  119. onEdit (item) {
  120. this.$refs.fixedSalaryCalculationRefs.open(item)
  121. },
  122. onDelete (row) {
  123. this.$confirm('确定删除吗?', '提示')
  124. .then(async () => {
  125. try {
  126. // await ApiName({ id: row.id })
  127. this.$message.success('删除成功')
  128. this.onInit()
  129. } catch (error) {
  130. this.$message.error(error)
  131. }
  132. })
  133. .catch(_ => {})
  134. },
  135. onSearch () {
  136. this.pageInfo.current = 1
  137. this.onInit()
  138. },
  139. onPageChange (index) {
  140. this.pageInfo.current = index
  141. this.onInit()
  142. },
  143. onSortChange (orders) {
  144. this.orders = orders
  145. this.onInit()
  146. }
  147. }
  148. }
  149. </script>
  150. <style lang="scss" scoped>
  151. /* 自定义样式 */
  152. </style>