فهرست منبع

测算系数保存

zhengnaiwen_citu 2 ماه پیش
والد
کامیت
fd5838babd
2فایلهای تغییر یافته به همراه53 افزوده شده و 22 حذف شده
  1. 33 19
      src/views/sandbox/sandboxAdd.vue
  2. 20 3
      src/views/sandbox/sandboxParam.vue

+ 33 - 19
src/views/sandbox/sandboxAdd.vue

@@ -1,25 +1,27 @@
 <template>
   <m-dialog title="新增测算" ref="dialog" v-bind="$attrs" width="1200px" v-on="$listeners">
     <template #button-after>
-      <m-button :disabled="active === 0" @click="onPrev">上一步</m-button>
-      <m-button v-if="active === items.length - 1" type="success" @click="onIssue">发布</m-button>
-      <m-button v-else type="orange" @click="onNext">下一步</m-button>
+      <m-button :disabled="active === 0 || loading" @click="onPrev">上一步</m-button>
+      <m-button v-if="active === items.length - 1" type="success" @click="onIssue" :disabled="loading">发布</m-button>
+      <m-button v-else type="orange" @click="onNext" :disabled="loading">下一步</m-button>
     </template>
-    <div style="min-height: 100px;">
-      <el-steps :active="active" finish-status="success">
-        <el-step
-          v-for="item in items"
-          :key="item.title"
-          :title="item.title"
-          :description="item.description ? item.subtitle + item.description : ''"
-        ></el-step>
-      </el-steps>
+    <div v-loading="loading">
+      <div style="min-height: 100px;">
+        <el-steps :active="active" finish-status="success">
+          <el-step
+            v-for="item in items"
+            :key="item.title"
+            :title="item.title"
+            :description="item.description ? item.subtitle + item.description : ''"
+          ></el-step>
+        </el-steps>
+      </div>
+      <SandboxRules v-show="active === 0" ref="sandboxRulesRefs" @row-click="assignDescription"></SandboxRules>
+      <SandboxList v-show="active === 1" ref="sandboxListRefs" @row-click="assignDescription"></SandboxList>
+      <SandboxParam v-show="active === 2" ref="sandboxParamRefs"></SandboxParam>
+      <SandboxDate v-show="active === 3" ref="sandboxDateRefs" @change="assignDescription"></SandboxDate>
+      <SandboxResultDetails v-show="active === 4" ref="sandboxResultDetailsRefs"></SandboxResultDetails>
     </div>
-    <SandboxRules v-show="active === 0" ref="sandboxRulesRefs" @row-click="assignDescription"></SandboxRules>
-    <SandboxList v-show="active === 1" ref="sandboxListRefs" @row-click="assignDescription"></SandboxList>
-    <SandboxParam v-show="active === 2" ref="sandboxParamRefs"></SandboxParam>
-    <SandboxDate v-show="active === 3" ref="sandboxDateRefs" @change="assignDescription"></SandboxDate>
-    <SandboxResultDetails v-show="active === 4" ref="sandboxResultDetailsRefs"></SandboxResultDetails>
   </m-dialog>
 </template>
 
@@ -70,6 +72,7 @@ export default {
   },
   data () {
     return {
+      loading: false,
       active: 0,
       descriptionValues: JSON.parse(JSON.stringify(_data))
     }
@@ -106,7 +109,7 @@ export default {
       }
       this.active--
     },
-    onNext () {
+    async onNext () {
       if (this.active === this.items.length - 1) {
         return
       }
@@ -116,14 +119,25 @@ export default {
       if (this.active === 2) {
         this.descriptionValues[this.active].name = '完成系数设置'
       }
+
+      if (this.active === 3) {
+        // 开始计算 调用保存接口
+        this.loading = true
+        const success = await this.$refs.sandboxParamRefs.onSave()
+        this.loading = false
+        if (!success) {
+          return
+        }
+      }
       this.active++
       this.ref.init && this.ref.init(this.descriptionValues[this.active - 1].id)
     },
     async onIssue () {
       this.loading = true
       try {
-        await sendSalaryRelease({ performanceSolutionId: this.descriptionValues[4].id })
+        await sendSalaryRelease({ performanceSolutionId: this.descriptionValues[1].id })
         this.$message.success('发布成功')
+        this.$refs.dialog.close()
       } catch (error) {
         this.$message.error(error)
       } finally {

+ 20 - 3
src/views/sandbox/sandboxParam.vue

@@ -57,8 +57,8 @@
 
 <script>
 import {
-  getSolutionDetails
-  // saveSolution
+  getSolutionDetails,
+  saveSolution
 } from '@/api/salary'
 export default {
   name: 'salarySolutionParam',
@@ -93,13 +93,30 @@ export default {
           return e
         })
         this.activeNames = this.items[0]?.category
-        this.itemData = data
+        this.itemData = data.entity
       } catch (error) {
         this.$message.error(error)
       } finally {
         this.loading = false
       }
     },
+    async onSave () {
+      const { env, versionType, ...obj } = this.itemData
+      const query = {
+        entity: {
+          ...obj,
+          env: 0,
+          versionType: 1 // 系数变化
+        },
+        performanceSolutionDetailRespCategoryVos: this.items
+      }
+      try {
+        await saveSolution(query)
+        return true
+      } catch (error) {
+        this.$message.error(error)
+      }
+    },
     validate () {
       if (!this.items.length) {
         this.$message.error('尚未配置系数')