zhengnaiwen_citu 3 months ago
parent
commit
d87586496a

+ 97 - 0
src/views/salary/sandbox/index.vue

@@ -0,0 +1,97 @@
+<template>
+  <div class="pa-3 white">
+    <el-tabs v-model="activeName" @tab-click="handleClick">
+      <el-tab-pane label="核算规则" name="Solution">
+        <Solution label="核算规则" ref="Solution" @history="onHistory"></Solution>
+      </el-tab-pane>
+      <el-tab-pane label="系数导向" name="Coefficient">
+        <Coefficient label="系数导向" ref="Coefficient"></Coefficient>
+      </el-tab-pane>
+      <el-tab-pane label="历史记录" name="History">
+        <History label="历史记录" ref="History" @history="onHistory"></History>
+      </el-tab-pane>
+    </el-tabs>
+    <el-drawer
+      :title="itemData.title"
+      :visible.sync="show"
+      direction="rtl"
+    >
+      <div class="pa-3" v-loading="loading">
+        <SolutionDetails :item-data="itemData"></SolutionDetails>
+      </div>
+    </el-drawer>
+  </div>
+</template>
+
+<script>
+import Solution from '../solution/salarySolution'
+import Coefficient from '../solution/salaryCoefficient'
+import History from '../solution/salarySolutionHistory'
+import SolutionDetails from '../solution/components/solutionDetails.vue'
+import {
+  getSolutionDetails
+} from '@/api/salary'
+export default {
+  name: 'Salary-Sandbox',
+  provide () {
+    return {
+      env: 1
+    }
+  },
+  components: {
+    Solution,
+    Coefficient,
+    History,
+    SolutionDetails
+  },
+  data () {
+    return {
+      itemData: {},
+      loading: false,
+      show: false,
+      activeName: 'Solution'
+    }
+  },
+  mounted () {
+    this.$refs[this.activeName].onInit()
+  },
+  methods: {
+    handleClick (tab, event) {
+      this.$refs[this.activeName].onInit()
+    },
+    async onHistory ({ performanceSolutionId }) {
+      this.show = true
+      this.loading = true
+      try {
+        const { data } = await getSolutionDetails({ performanceSolutionId })
+        const { performanceSolutionDetailRespCategoryVos, ...obj } = data
+        const resolveData = {
+          ...obj,
+          performanceSolutionDetailRespCategoryVos: performanceSolutionDetailRespCategoryVos.map(e => {
+            e.calculateConfigurations = e.calculateConfigurations.map(item => {
+              if (item.valueCategory !== 0) {
+                item.value = JSON.parse(item.value)
+                return item
+              }
+              return item
+            })
+            return e
+          })
+        }
+        this.itemData = {
+          ...resolveData.entity,
+          ...resolveData
+        }
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.loading = false
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 3 - 1
src/views/salary/solution/components/ListTemplate.vue

@@ -44,6 +44,7 @@ export default {
     },
     uuid: String
   },
+  inject: ['env'],
   data () {
     return {
       searchQuery: {
@@ -90,7 +91,8 @@ export default {
           entity: {
             ...this.searchQuery,
             history: this.history ? 1 : 0,
-            uuid: this.uuid
+            uuid: this.uuid,
+            env: this.env
           }
         })
         this.items = data.records.map(e => e.entity)

+ 5 - 0
src/views/salary/solution/index.vue

@@ -25,6 +25,11 @@ export default {
     SolutionDetails,
     TabTemplate
   },
+  provide () {
+    return {
+      env: 0
+    }
+  },
   data () {
     return {
       itemData: {},

+ 4 - 2
src/views/salary/solution/salaryCoefficient/salarySolutionParam.vue

@@ -68,6 +68,7 @@ import {
 } from '@/api/salary'
 export default {
   name: 'salarySolutionParam',
+  inject: ['env'],
   data () {
     return {
       activeNames: null,
@@ -103,7 +104,7 @@ export default {
           })
           return e
         })
-        this.activeNames = this.items[0].category
+        this.activeNames = this.items[0]?.category
       } catch (error) {
         this.$message.error(error)
       } finally {
@@ -113,7 +114,8 @@ export default {
     async onSure () {
       const query = {
         entity: {
-          performanceSolutionId: this.itemData.performanceSolutionId
+          performanceSolutionId: this.itemData.performanceSolutionId,
+          env: this.env
         },
         performanceSolutionDetailRespCategoryVos: this.items
       }

+ 3 - 0
src/views/salary/solution/salarySolution/salarySolutionEdit.vue

@@ -98,6 +98,8 @@ export default {
       ]
     }
   },
+
+  inject: ['env'],
   methods: {
     async open (item) {
       this.$refs.dialog.open()
@@ -154,6 +156,7 @@ export default {
           const query = {
             entity: {
               performanceSolutionId: this.itemData.entity?.performanceSolutionId,
+              env: this.env,
               ...this.formQuery
             },
             performanceSolutionDetailRespCategoryVos: this.itemData.performanceSolutionDetailRespCategoryVos

+ 4 - 2
src/views/salary/solution/salarySolution/salarySolutionRules.vue

@@ -49,6 +49,8 @@ export default {
   components: {
     SalarySolutionRulesEdit
   },
+
+  inject: ['env'],
   data () {
     return {
       editableTabsValue: '1',
@@ -119,13 +121,13 @@ export default {
       }
     },
     async onSure () {
-      console.log(this.$refs)
       // 验证
       Promise.all(this.$refs.salarySolutionRulesEditRefs.map(e => e.valid())).then(async data => {
         try {
           await saveSolution({
             entity: {
-              performanceSolutionId: this.itemData.performanceSolutionId
+              performanceSolutionId: this.itemData.performanceSolutionId,
+              env: this.env
             },
             performanceSolutionDetailRespCategoryVos: data
           })