index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div class="pa-3 white">
  3. <el-tabs v-model="activeName" @tab-click="handleClick">
  4. <el-tab-pane label="核算规则" name="Solution">
  5. <Solution
  6. label="核算规则"
  7. ref="Solution"
  8. @history="onHistory"
  9. >
  10. <template #tool>
  11. <m-button type="orange" size="small" icon="el-icon-plus" @click="onOpen('salarySolutionEditRefs')" >新增</m-button>
  12. </template>
  13. <template #actions="{ row }">
  14. <m-button text type="primary" size="small" @click="onOpen('salarySolutionEditRefs', row)">编辑</m-button>
  15. <m-button text type="primary" size="small" @click="onOpen('salarySolutionRulesRefs', row)">规则配置</m-button>
  16. <m-button text type="success" size="small" @click="onCalculate(row)">计算</m-button>
  17. <m-button text type="success" size="small" @click="onSend(row)">发布</m-button>
  18. </template>
  19. </Solution>
  20. </el-tab-pane>
  21. <el-tab-pane label="系数导向" name="Coefficient">
  22. <Coefficient label="系数导向" ref="Coefficient"></Coefficient>
  23. </el-tab-pane>
  24. <el-tab-pane label="历史记录" name="History">
  25. <History label="历史记录" ref="History" @history="onHistory"></History>
  26. </el-tab-pane>
  27. </el-tabs>
  28. <el-drawer
  29. :title="itemData.title"
  30. :visible.sync="show"
  31. direction="rtl"
  32. >
  33. <div class="pa-3" v-loading="loading">
  34. <SolutionDetails :item-data="itemData"></SolutionDetails>
  35. </div>
  36. </el-drawer>
  37. <SalarySolutionEdit ref="salarySolutionEditRefs" @refresh="$refs.Solution.onInit()"></SalarySolutionEdit>
  38. <SalarySandboxRules ref="salarySandboxRulesRefs" @refresh="$refs.Solution.onInit()"></SalarySandboxRules>
  39. </div>
  40. </template>
  41. <script>
  42. import Solution from '../solution/salarySolution'
  43. import SalarySolutionEdit from './salarySandboxEdit.vue'
  44. import SalarySandboxRules from './salarySandboxRules.vue'
  45. import Coefficient from '../solution/salaryCoefficient'
  46. import History from '../solution/salarySolutionHistory'
  47. import SolutionDetails from '../solution/components/solutionDetails.vue'
  48. import {
  49. getSolutionDetails
  50. } from '@/api/salary'
  51. export default {
  52. name: 'Salary-Sandbox',
  53. provide () {
  54. return {
  55. env: 1
  56. }
  57. },
  58. components: {
  59. SalarySolutionEdit,
  60. SalarySandboxRules,
  61. Solution,
  62. Coefficient,
  63. History,
  64. SolutionDetails
  65. },
  66. data () {
  67. return {
  68. itemData: {},
  69. loading: false,
  70. show: false,
  71. activeName: 'Solution'
  72. }
  73. },
  74. mounted () {
  75. this.$refs[this.activeName].onInit()
  76. },
  77. methods: {
  78. onCalculate () {},
  79. onOpen (ref, item) {
  80. this.$refs[ref]?.open && this.$refs[ref].open(item)
  81. },
  82. handleClick (tab, event) {
  83. this.$refs[this.activeName].onInit()
  84. },
  85. async onHistory ({ performanceSolutionId }) {
  86. this.show = true
  87. this.loading = true
  88. try {
  89. const { data } = await getSolutionDetails({ performanceSolutionId })
  90. const { performanceSolutionDetailRespCategoryVos, ...obj } = data
  91. const resolveData = {
  92. ...obj,
  93. performanceSolutionDetailRespCategoryVos: performanceSolutionDetailRespCategoryVos.map(e => {
  94. e.calculateConfigurations = e.calculateConfigurations.map(item => {
  95. if (item.valueCategory !== 0) {
  96. item.value = JSON.parse(item.value)
  97. return item
  98. }
  99. return item
  100. })
  101. return e
  102. })
  103. }
  104. this.itemData = {
  105. ...resolveData.entity,
  106. ...resolveData
  107. }
  108. } catch (error) {
  109. this.$message.error(error)
  110. } finally {
  111. this.loading = false
  112. }
  113. }
  114. }
  115. }
  116. </script>
  117. <style lang="scss" scoped>
  118. </style>