From 5019ed6016b47221321bf395cd102dc4b51b4724 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期一, 05 二月 2024 09:40:43 +0800
Subject: [PATCH] Mr.Shi

---
 company/src/components/enterprise/OperaInsuranceApplyWindow.vue |  122 +++++++++++++++++++++++++++++++---------
 1 files changed, 95 insertions(+), 27 deletions(-)

diff --git a/company/src/components/enterprise/OperaInsuranceApplyWindow.vue b/company/src/components/enterprise/OperaInsuranceApplyWindow.vue
index 424cb7b..0eaba33 100644
--- a/company/src/components/enterprise/OperaInsuranceApplyWindow.vue
+++ b/company/src/components/enterprise/OperaInsuranceApplyWindow.vue
@@ -25,10 +25,11 @@
                             @change="getTimeVal"
                             v-model="form.applyStartTime"
                             type="date"
+                            class="date_picker"
                             :disabled="!form.solutionId"
                             :picker-options="pickerOptions"
-                            value-format="yyyy-MM-dd"
-                            format="yyyy 骞� MM 鏈� dd 鏃�"
+                            value-format="yyyy-MM-dd HH:mm:ss"
+                            format="yyyy-MM-dd HH:mm:ss"
                             placeholder="閫夋嫨鏃ユ湡">
                         </el-date-picker>
                         <span style="color: #F95601; font-size: 14px;">锛堟鏃ョ敓鏁堟姇淇濊浜�17:30鍓嶆彁浜わ紝瓒呮椂鎻愪氦浠ヤ繚闄╁崟涓哄噯锛�</span>
@@ -39,8 +40,10 @@
                         disabled
                         v-model="form.applyEndTime"
                         type="date"
-                        value-format="yyyy-MM-dd"
-                        format="yyyy 骞� MM 鏈� dd 鏃�"
+                        class="date_picker"
+                        :picker-options="pickerOptions"
+                        value-format="yyyy-MM-dd HH:mm:ss"
+                        format="yyyy-MM-dd HH:mm:ss"
                         placeholder="閫夋嫨鏃ユ湡">
                     </el-date-picker>
                 </el-form-item>
@@ -142,7 +145,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 +154,7 @@
     return {
       form: {
           id: null,
+          ID: null,
           solutionId: '',
           applyStartTime: '',
           applyEndTime: ''
@@ -187,14 +191,38 @@
           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.$nextTick(() => {
+                  this.$refs.form.resetFields()
+                  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 +273,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
+                        })
+                    }
+
                 }
             })
         },
@@ -271,7 +319,7 @@
                 startDate: time
             }).then(res => {
                 this.price = res.cyclePrice
-                this.form.applyEndTime = res.endDate.substring(0, 10)
+                this.form.applyEndTime = res.endDate
                 this.tableData.forEach(item => {
                     item.fee = res.cyclePrice
                 })
@@ -328,6 +376,7 @@
       },
       // 鍒囨崲鏂规
       changeSolution(e) {
+          this.tableData = []
           this.company.forEach(item => {
               if (item.id === e) {
                   // this.price = item.price
@@ -339,6 +388,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)
       },
@@ -409,6 +471,12 @@
 }
 </script>
 
+<style>
+    .el-picker-panel__footer .el-button--text.el-picker-panel__link-btn {
+        display: none;
+    }
+</style>
+
 <style lang="scss" scoped>
     .list {
         width: 100%;

--
Gitblit v1.9.3