zhengnaiwen_citu 4 mesiacov pred
rodič
commit
3e3b5bd20d

+ 6 - 1
src/api/salary.js

@@ -231,7 +231,12 @@ export function getSalaryProductStatistics (data) {
   return http.post('/customer/performance/claim/product/statistics', data)
 }
 
-// 发布测算结构
+// 发布测算
 export function sendSalaryRelease (data) {
   return http.post('/performance/solution/send/release', data)
 }
+
+// 测算结果列表
+export function getSandboxResultList (data) {
+  return http.post('/sanbox/data/analysis/datas', data)
+}

+ 9 - 3
src/views/sandbox/index.vue

@@ -1,7 +1,8 @@
 <template>
   <div class="pa-3 white">
-    <m-search class="mb-3" :items="searchItems" v-model="searchValues"></m-search>
+    <m-search class="mb-3" :items="searchItems" v-model="searchValues" @search="onSearch"></m-search>
     <m-table
+      v-loading="loading"
       card-title="测算规则"
       :items="items"
       :headers="headers"
@@ -30,6 +31,7 @@
     <SandboxEdit ref="sandboxEditRefs" @refresh="onInit"></SandboxEdit>
     <SalarySolutionRules ref="salarySolutionRulesRefs" @refresh="onInit"></SalarySolutionRules>
     <SandboxParam ref="sandboxParamRefs" @refresh="onInit"></SandboxParam>
+    <SandboxCalculate ref="sandboxCalculateRefs"></SandboxCalculate>
   </div>
 </template>
 
@@ -43,6 +45,7 @@ import SandboxEdit from './sandboxEdit.vue'
 import SalarySolutionRules from './salarySolutionRules.vue'
 import SandboxDetails from './sandboxDetails.vue'
 import SandboxParam from './sandboxParam.vue'
+import SandboxCalculate from './sandboxCalculate.vue'
 export default {
   name: 'salary-solution-list',
   props: {
@@ -55,7 +58,8 @@ export default {
     SandboxEdit,
     SalarySolutionRules,
     SandboxDetails,
-    SandboxParam
+    SandboxParam,
+    SandboxCalculate
   },
   data () {
     return {
@@ -140,7 +144,9 @@ export default {
         this.loading = false
       }
     },
-    onCalculate () {},
+    onCalculate (item) {
+      this.$refs.sandboxCalculateRefs.open(item)
+    },
     onCalculateHistory () {},
     onOpen (ref, item) {
       this.$refs[ref]?.open && this.$refs[ref].open(item)

+ 1 - 3
src/views/sandbox/salarySolutionRules.vue

@@ -49,8 +49,6 @@ export default {
   components: {
     SalarySolutionRulesEdit
   },
-
-  inject: ['env'],
   data () {
     return {
       editableTabsValue: '1',
@@ -127,7 +125,7 @@ export default {
           await saveSolution({
             entity: {
               performanceSolutionId: this.itemData.performanceSolutionId,
-              env: this.env
+              env: 1
             },
             performanceSolutionDetailRespCategoryVos: data
           })

+ 80 - 0
src/views/sandbox/sandboxCalculate.vue

@@ -0,0 +1,80 @@
+<template>
+  <m-dialog title="测算"  ref="dialog" v-loading="loading">
+    <div v-if="!isCalculate && !isSuccess" class="d-flex align-center justify-center">
+      正在测算中,请稍后...
+    </div>
+    <el-result v-if="isCalculate" icon="success" title="测算完成"></el-result>
+    <template v-if="isSuccess">
+      <el-radio-group v-model="choose">
+        <el-radio
+          v-for="item in radioItems"
+          :key="item.id"
+          :label="item.name"
+        >
+          {{ item.name }}
+        </el-radio>
+      </el-radio-group>
+      <m-table
+        class="mt-3"
+        shadow="never"
+        clearHeader
+        :items="tableItems"
+        :headers="tableHeaders"
+      ></m-table>
+    </template>
+  </m-dialog>
+</template>
+
+<script>
+import {
+  getSandboxResultList
+} from '@/api/salary'
+export default {
+  name: 'sandboxCalculate',
+  data () {
+    return {
+      choose: null,
+      loading: false,
+      isCalculate: false,
+      isSuccess: false,
+      radioItems: [],
+      tableItems: [],
+      tableHeaders: [
+        { label: '姓名', prop: 'name' },
+        { label: '部门', prop: 'department' },
+        { label: '岗位', prop: 'position' }
+      ]
+    }
+  },
+  methods: {
+    async open (item) {
+      this.isCalculate = false
+      this.isSuccess = false
+      this.$refs.dialog.open()
+      this.loading = true
+      try {
+        const { data } = await getSandboxResultList({
+          modelName: item.modelName
+        })
+        this.radioItems = data || []
+        if (this.radioItems.length) {
+          this.choose = this.radioItems[0].name
+        }
+        this.isCalculate = true
+        setTimeout(() => {
+          this.isCalculate = false
+          this.isSuccess = true
+        }, 1000)
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.loading = false
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 1 - 3
src/views/sandbox/sandboxEdit.vue

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