From 6e8501e2ebc00deec415088a1cbd98db8a55a6b1 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 29 一月 2024 20:12:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 company/src/components/enterprise/OperaInsuranceApplyWindow.vue |  100 +++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 78 insertions(+), 22 deletions(-)

diff --git a/company/src/components/enterprise/OperaInsuranceApplyWindow.vue b/company/src/components/enterprise/OperaInsuranceApplyWindow.vue
index 424cb7b..d31b415 100644
--- a/company/src/components/enterprise/OperaInsuranceApplyWindow.vue
+++ b/company/src/components/enterprise/OperaInsuranceApplyWindow.vue
@@ -142,7 +142,7 @@
 import importEmployees from '@/components/enterprise/importEmployees'
 import confirmJobType from '@/components/enterprise/confirmJobType'
 import { all } from '@/api/business/solutions'
-import { create, getCountCyclePriceVO } from '@/api/business/insuranceApply'
+import { create, getCountCyclePriceVO, getDetail, findList, updateData } from '@/api/business/insuranceApply'
 export default {
   name: 'OperaInsuranceApplyWindow',
   extends: BaseOpera,
@@ -151,6 +151,7 @@
     return {
       form: {
           id: null,
+          ID: null,
           solutionId: '',
           applyStartTime: '',
           applyEndTime: ''
@@ -187,14 +188,35 @@
           this.form.solutionId = ''
           this.form.applyStartTime = ''
           this.form.applyEndTime = ''
-          this.$nextTick(() => {
-              this.$refs.form.resetFields()
-              this.form[this.configData['field.id']] = null
-          })
-          this.visible = true
+          if (target && target.id) {
+              this.form.id = target.id
+              this.getDetails()
+          } else {
+              this.$nextTick(() => {
+                  this.$refs.form.resetFields()
+                  this.form[this.configData['field.id']] = null
+              })
+          }
           this.getCompany()
+          this.visible = true
           this.updatePickerOptions()
       },
+        // 鑾峰彇鎶曚繚璇︽儏
+        getDetails() {
+            findList({ applyId: this.form.id })
+                .then(res => {
+                    res.forEach(item => {
+                        item.idCard = item.idcardNo
+                        item.fee = ''
+                    })
+                    this.tableData = res
+                })
+            getDetail(this.form.id)
+                .then(res => {
+                    this.form.solutionId = res.solutionId
+                    this.changeSolution1(res.solutionId)
+                })
+        },
         getSummaries(param) {
             const { columns, data } = param
             const sums = []
@@ -245,22 +267,42 @@
                         item.idcardNo = item.idCard
                     })
                     this.isWorking = true
-                    create({
-                        applyDetailList: arr,
-                        applyStartTime: this.form.applyStartTime,
-                        applyEndTime: this.form.applyEndTime,
-                        solutionId: this.form.solutionId
-                    }).then(() => {
-                        this.visible = false
-                        this.$tip.apiSuccess('鎿嶄綔鎴愬姛')
-                        this.$emit('success')
-                    })
-                    .catch(e => {
-                        this.$tip.apiFailed(e)
-                    })
-                    .finally(() => {
-                        this.isWorking = false
-                    })
+                    if (!this.form.id) {
+                        create({
+                            applyDetailList: arr,
+                            applyStartTime: this.form.applyStartTime,
+                            applyEndTime: this.form.applyEndTime,
+                            solutionId: this.form.solutionId
+                        }).then(() => {
+                            this.visible = false
+                            this.$tip.apiSuccess('鎿嶄綔鎴愬姛')
+                            this.$emit('success')
+                        })
+                            .catch(e => {
+                                this.$tip.apiFailed(e)
+                            })
+                            .finally(() => {
+                                this.isWorking = false
+                            })
+                    } else {
+                        updateData({
+                            id: this.form.id,
+                            applyDetailList: arr,
+                            applyStartTime: this.form.applyStartTime,
+                            applyEndTime: this.form.applyEndTime,
+                            solutionId: this.form.solutionId
+                        }).then(() => {
+                            this.visible = false
+                            this.$tip.apiSuccess('鎿嶄綔鎴愬姛')
+                            this.$emit('success')
+                        }).catch(e => {
+                            this.$tip.apiFailed(e)
+                        })
+                        .finally(() => {
+                            this.isWorking = false
+                        })
+                    }
+
                 }
             })
         },
@@ -328,6 +370,7 @@
       },
       // 鍒囨崲鏂规
       changeSolution(e) {
+          this.tableData = []
           this.company.forEach(item => {
               if (item.id === e) {
                   // this.price = item.price
@@ -339,6 +382,19 @@
               item.fee = this.price
           })
       },
+        // 鍒囨崲鏂规
+        changeSolution1(e) {
+            this.company.forEach(item => {
+                if (item.id === e) {
+                    // this.price = item.price
+                    this.item = item
+                    this.updatePickerOptions()
+                }
+            })
+            this.tableData.forEach(item => {
+                item.fee = this.price
+            })
+        },
       dele(index) {
           this.tableData.splice(index, 1)
       },

--
Gitblit v1.9.3