浏览代码

调整对象系数

zhengnaiwen_citu 2 月之前
父节点
当前提交
00aa03468b

+ 5 - 0
src/api/salary.js

@@ -241,6 +241,11 @@ export function sendSalaryRelease (data) {
   return http.post('/performance/solution/send/release', data)
 }
 
+// 保存测算参数
+export function saveSalaryParamForSandbox (data) {
+  return http.post('/performance/solution/test/save', data)
+}
+
 // 测算结果列表
 export function getSandboxResultList (data) {
   return http.post('/sanbox/data/analysis/datas', data)

+ 4 - 0
src/views/salary/solution/components/ListTemplate.vue

@@ -16,6 +16,9 @@
       @page-change="onPageChange"
       @sort-change="onSortChange"
     >
+      <template #save_status="{ row }">
+        <el-tag :type="row.save_status === 1 ? 'success' : 'danger'">{{ row.save_status === 1 ? '已保存规则' : '未保存规则'}}</el-tag>
+      </template>
       <template #card-tools>
         <slot name="tool"></slot>
       </template>
@@ -64,6 +67,7 @@ export default {
       headers: [
         { label: '名称', prop: 'title' },
         { label: '描述', prop: 'tag' },
+        { label: '状态', prop: 'save_status' },
         { label: '创建日期', prop: 'createDate' },
         { label: '操作', prop: 'actions' }
       ],

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

@@ -119,7 +119,16 @@ export default {
           env: this.env,
           versionType: 1 // 系数变化
         },
-        performanceSolutionDetailRespCategoryVos: this.items
+        performanceSolutionDetailRespCategoryVos: this.items.map(e => {
+          e.calculateConfigurations = e.calculateConfigurations.map(item => {
+            if (item.valueCategory !== 0) {
+              item.value = JSON.stringify(item.value)
+              return item
+            }
+            return item
+          })
+          return e
+        })
       }
       try {
         await saveSolution(query)

+ 4 - 2
src/views/sandbox/sandboxAdd.vue

@@ -74,7 +74,8 @@ export default {
     return {
       loading: false,
       active: 0,
-      descriptionValues: JSON.parse(JSON.stringify(_data))
+      descriptionValues: JSON.parse(JSON.stringify(_data)),
+      performanceSolutionId: null // 保存参数id 发布使用
     }
   },
   computed: {
@@ -128,6 +129,7 @@ export default {
         if (!success) {
           return
         }
+        this.performanceSolutionId = success.performanceSolutionId
       }
       this.active++
       this.ref.init && this.ref.init(this.descriptionValues[this.active - 1].id)
@@ -135,7 +137,7 @@ export default {
     async onIssue () {
       this.loading = true
       try {
-        await sendSalaryRelease({ performanceSolutionId: this.descriptionValues[1].id })
+        await sendSalaryRelease({ performanceSolutionId: this.performanceSolutionId })
         this.$message.success('发布成功')
         this.$refs.dialog.close()
       } catch (error) {

+ 13 - 4
src/views/sandbox/sandboxParam.vue

@@ -58,7 +58,7 @@
 <script>
 import {
   getSolutionDetails,
-  saveSolution
+  saveSalaryParamForSandbox
 } from '@/api/salary'
 export default {
   name: 'salarySolutionParam',
@@ -108,11 +108,20 @@ export default {
           env: 0,
           versionType: 1 // 系数变化
         },
-        performanceSolutionDetailRespCategoryVos: this.items
+        performanceSolutionDetailRespCategoryVos: this.items.map(e => {
+          e.calculateConfigurations = e.calculateConfigurations.map(item => {
+            if (item.valueCategory !== 0) {
+              item.value = JSON.stringify(item.value)
+              return item
+            }
+            return item
+          })
+          return e
+        })
       }
       try {
-        await saveSolution(query)
-        return true
+        const { data } = await saveSalaryParamForSandbox(query)
+        return data
       } catch (error) {
         this.$message.error(error)
       }