瀏覽代碼

添加版本差异化

zhengnaiwen_citu 3 月之前
父節點
當前提交
443501c656

+ 5 - 0
src/api/salary.js

@@ -101,6 +101,11 @@ export function getSolutionDetails (data) {
   return http.post('/performance/solution/detail', data)
 }
 
+// 绩效方案 保存
+export function saveSolutionSimple (data) {
+  return http.post('/performance/solution/simple/save', data)
+}
+
 // 绩效方案 保存
 export function saveSolution (data) {
   return http.post('/performance/solution/save', data)

+ 12 - 6
src/views/salary/solution/components/ListTemplate.vue

@@ -76,11 +76,16 @@ export default {
       pageInfo: {
         current: 1,
         size: 10
-      }
+      },
+      query: {}
     }
   },
   methods: {
-    async onInit () {
+    async onInit (entity) {
+      this.query = entity ? { ...entity } : {}
+      this.getList()
+    },
+    async getList () {
       this.loading = true
       try {
         const { data } = await getSolutionPage({
@@ -92,7 +97,8 @@ export default {
             ...this.searchQuery,
             history: this.history ? 1 : 0,
             uuid: this.uuid,
-            env: this.env
+            env: this.env,
+            ...this.query
           }
         })
         this.items = data.records.map(e => e.entity)
@@ -105,15 +111,15 @@ export default {
     },
     onSearch () {
       this.pageInfo.current = 1
-      this.onInit()
+      this.getList()
     },
     onPageChange (page) {
       this.pageInfo.current = page
-      this.onInit()
+      this.getList()
     },
     onSortChange (v) {
       this.orders = v
-      this.onInit()
+      this.getList()
     }
   }
 }

+ 5 - 1
src/views/salary/solution/salaryCoefficient/index.vue

@@ -4,20 +4,24 @@
     <ListTemplate ref="listTemplateRefs" :card-title="$attrs.label">
       <template #actions="{ row }">
         <m-button text type="primary" size="small" @click="onOpen('salarySolutionParamRefs', row)">系数管理</m-button>
+        <m-button text type="primary" size="small" @click="onOpen('salaryCoefficientHistoryRefs', row)">版本记录</m-button>
       </template>
     </ListTemplate>
     <SalarySolutionParam ref="salarySolutionParamRefs" @refresh="onInit"></SalarySolutionParam>
+    <SalaryCoefficientHistory ref="salaryCoefficientHistoryRefs"></SalaryCoefficientHistory>
   </div>
 </template>
 
 <script>
 import ListTemplate from '../components/ListTemplate.vue'
 import SalarySolutionParam from './salarySolutionParam.vue'
+import SalaryCoefficientHistory from './salaryCoefficientHistory.vue'
 export default {
   name: 'SalaryCoefficient',
   components: {
     ListTemplate,
-    SalarySolutionParam
+    SalarySolutionParam,
+    SalaryCoefficientHistory
   },
   methods: {
     onInit () {

+ 49 - 0
src/views/salary/solution/salaryCoefficient/salaryCoefficientHistory.vue

@@ -0,0 +1,49 @@
+<template>
+  <m-dialog ref="dialog" :title="title + '  版本记录'">
+    <ListTemplate ref="listTemplateRefs" history :versionType="1" :show-search="false" shadow="never" :uuid="uuid" clearHeader>
+      <template #actions="{ row }">
+        <m-button text type="primary" @click="onOpen(row)">查看系数变化</m-button>
+      </template>
+    </ListTemplate>
+    <SalaryCoefficientHistoryPanel ref="salaryCoefficientHistoryPanelRefs"></SalaryCoefficientHistoryPanel>
+  </m-dialog>
+</template>
+
+<script>
+import ListTemplate from '../components/ListTemplate.vue'
+import SalaryCoefficientHistoryPanel from './salaryCoefficientHistoryPanel.vue'
+export default {
+  name: 'salaryCoefficientHistory',
+  components: {
+    ListTemplate,
+    SalaryCoefficientHistoryPanel
+  },
+  data () {
+    return {
+      uuid: null,
+      title: null
+    }
+  },
+  methods: {
+    open (item) {
+      this.$refs.dialog.open()
+      const { uuid, title } = item
+      this.uuid = uuid
+      this.title = title
+      this.$refs.dialog.open()
+      this.$nextTick(() => {
+        this.$refs.listTemplateRefs.onInit({
+          versionType: 1
+        })
+      })
+    },
+    onOpen (item) {
+      this.$refs.salaryCoefficientHistoryPanelRefs.open(item)
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 104 - 0
src/views/salary/solution/salaryCoefficient/salaryCoefficientHistoryPanel.vue

@@ -0,0 +1,104 @@
+<template>
+  <m-dialog ref="dialog" title="版本记录" append-to-body>
+    <div v-loading="loading">
+      <m-card
+        v-for="item in rules"
+        :key="item.category"
+        shadow="never"
+      >
+        <template #header>
+          {{ item.category }}
+        </template>
+        <el-form label-width="100px">
+          <el-form-item label="系数">
+            <el-descriptions
+              :labelStyle="{ width: '180px'}"
+              :column="1"
+              border
+            >
+              <el-descriptions-item
+                v-for="(calculateConfiguration, index) in item.calculateConfigurations"
+                :key="index"
+                :label="calculateConfiguration.name"
+              >
+                <template v-if="calculateConfiguration.valueCategory === 0">
+                  <el-tag size="small">{{ calculateConfiguration.value }}</el-tag>
+                </template>
+                <template v-else>
+                  <m-table
+                    clearHeader
+                    shadow="never"
+                    :headers="[
+                      { label: '名称', prop: 'name' },
+                      { label: '值', prop: 'value' }
+                    ]"
+                    :items="calculateConfiguration.value"
+                  >
+                  </m-table>
+                </template>
+              </el-descriptions-item>
+            </el-descriptions>
+          </el-form-item>
+        </el-form>
+      </m-card>
+    </div>
+  </m-dialog>
+</template>
+
+<script>
+import {
+  getSolutionDetails
+} from '@/api/salary'
+export default {
+  name: 'salaryCoefficientHistoryPanel',
+  data () {
+    return {
+      loading: false,
+      itemData: {}
+    }
+  },
+  methods: {
+    open (item) {
+      this.$refs.dialog.open()
+      this.onHistory(item)
+    },
+    async onHistory ({ performanceSolutionId }) {
+      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
+      }
+    }
+  },
+  computed: {
+    rules () {
+      return this.itemData.performanceSolutionDetailRespCategoryVos || []
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

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

@@ -115,7 +115,8 @@ export default {
       const query = {
         entity: {
           performanceSolutionId: this.itemData.performanceSolutionId,
-          env: this.env
+          env: this.env,
+          versionType: 1 // 系数变化
         },
         performanceSolutionDetailRespCategoryVos: this.items
       }

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

@@ -6,7 +6,7 @@
 
 <script>
 import {
-  saveSolution,
+  saveSolutionSimple,
   getSolutionDetails
 } from '@/api/salary'
 import {
@@ -158,12 +158,11 @@ export default {
               performanceSolutionId: this.itemData.entity?.performanceSolutionId,
               env: this.env,
               ...this.formQuery
-            },
-            performanceSolutionDetailRespCategoryVos: this.itemData.performanceSolutionDetailRespCategoryVos
+            }
           }
           this.loading = true
           try {
-            await saveSolution(query)
+            await saveSolutionSimple(query)
             this.$refs.dialog.close()
             this.$emit('refresh')
             this.$message.success('保存成功')

+ 3 - 1
src/views/salary/solution/salarySolution/salarySolutionHistory.vue

@@ -28,7 +28,9 @@ export default {
       this.title = title
       this.$refs.dialog.open()
       this.$nextTick(() => {
-        this.$refs.listTemplateRefs.onInit()
+        this.$refs.listTemplateRefs.onInit({
+          versionType: 0
+        })
       })
     }
   }

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

@@ -127,7 +127,8 @@ export default {
           await saveSolution({
             entity: {
               performanceSolutionId: this.itemData.performanceSolutionId,
-              env: this.env
+              env: this.env,
+              versionType: 0 // 规则变更
             },
             performanceSolutionDetailRespCategoryVos: data
           })
@@ -138,7 +139,6 @@ export default {
           this.$message.error(error)
         }
       }).catch(error => {
-        console.log(error)
         this.editableTabsValue = error.name
         this.$message.error('请填充完整')
       })

+ 2 - 2
src/views/sandbox/index.vue

@@ -14,7 +14,7 @@
       @sort-change="onSortChange"
     >
       <template #actions="{ row }">
-        <m-button text type="primary" size="small" @click="onOpen('sandboxDetailsRefs', row)">查看方案</m-button>
+        <m-button text type="primary" size="small" @click="onOpen('sandboxDetailsRefs', row)">查看规则</m-button>
         <m-button text type="primary" size="small" @click="onOpen('sandboxParamRefs', row)">系数导向</m-button>
         <m-button text type="success" size="small" @click="onCalculate(row)">开始测算</m-button>
         <m-button text type="primary" size="small" @click="onCalculateHistory(row)">测算历史</m-button>
@@ -141,7 +141,7 @@ export default {
       try {
         await sendSalaryRelease({ performanceSolutionId: row.performanceSolutionId })
         this.$message.success('发布成功')
-        this.$refs.Solution.onInit()
+        this.onInit()
       } catch (error) {
         this.$message.error(error)
       } finally {