From 84b74d64ecc519882b89278f1011f7ac7525d190 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 05 三月 2024 19:23:40 +0800
Subject: [PATCH] mrshi

---
 company/src/components/enterprise/factoryChange.vue |   81 ++++++++++++++++++++++++++++++----------
 1 files changed, 60 insertions(+), 21 deletions(-)

diff --git a/company/src/components/enterprise/factoryChange.vue b/company/src/components/enterprise/factoryChange.vue
index 6335c16..5d0f09c 100644
--- a/company/src/components/enterprise/factoryChange.vue
+++ b/company/src/components/enterprise/factoryChange.vue
@@ -154,6 +154,8 @@
         <importEmployees ref="importEmployees" @result="getValue" />
         <!--    纭宸ョ    -->
         <confirmJobType ref="confirmJobType" @result="getUser" />
+        <!--    璇﹀崟    -->
+        <ApplyChangeUnitDetails1 ref="ApplyChangeUnitDetails1" @success="success" />
     </GlobalWindow>
 </template>
 
@@ -164,13 +166,15 @@
     import addEmployee from '@/components/enterprise/addEmployee'
     import importEmployees from '@/components/enterprise/importEmployees'
     import confirmJobType from '@/components/enterprise/confirmJobType'
+    import ApplyChangeUnitDetails1 from '@/components/business/ApplyChangeUnitDetails1'
     import { all } from '@/api/business/solutions'
     import { getDetail, findList } from '@/api/business/insuranceApply'
     import { create } from '@/api/business/applyChange'
+    import { getDate, compareDates, getTomorrow } from '@/utils/util'
     export default {
         name: 'factoryChange',
         extends: BaseOpera,
-        components: { GlobalWindow, selectEmployees, addEmployee, importEmployees, confirmJobType },
+        components: { GlobalWindow, selectEmployees, addEmployee, importEmployees, confirmJobType, ApplyChangeUnitDetails1 },
         data () {
             return {
                 form: {
@@ -232,6 +236,26 @@
                 this.visible = true
                 // this.updatePickerOptions()
             },
+            success() {
+                this.form.factory.forEach(item => {
+                    item.idcardNo = item.idCard
+                })
+                this.isWorking = true
+                create({
+                    applyId: this.form.id,
+                    changeDetailList: this.form.factory,
+                    validTime: this.form.applyStartTime,
+                    type: 1
+                }).then(() => {
+                    this.visible = false
+                    this.$tip.apiSuccess('鎿嶄綔鎴愬姛')
+                    this.$emit('success')
+                }).catch(e => {
+                    this.$tip.apiFailed(e)
+                }).finally(() => {
+                    this.isWorking = false
+                })
+            },
             // 鑾峰彇鎶曚繚璇︽儏
             getDetails() {
                 findList({ applyId: this.form.id })
@@ -262,8 +286,22 @@
                         this.form.solutionsName = res.solutionsName
                         this.pickerOptions = {
                             disabledDate(time) {
-                                // - 8.64e7
-                                return time.getTime() > new Date(res.endTime).getTime() || time.getTime() < new Date(res.lastChangeDate ? res.lastChangeDate : res.startTime).getTime()
+                                // 褰撳墠鏃ユ湡澶т簬绛変簬鐢熸晥鏃ユ湡骞朵笖鏈�鍚庝竴娆℃搷浣滄椂闂寸瓑浜庣┖
+                                if ([1,3].includes(compareDates(getDate(), res.startTime)) && !res.lastChangeDate) {
+                                    return time.getTime() > new Date(res.endTime).getTime() || time.getTime() < new Date(getTomorrow()).getTime()
+                                    // 褰撳墠鏃ユ湡灏忎簬鐢熸晥鏃ユ湡骞朵笖鏈�鍚庝竴娆℃搷浣滄椂闂寸瓑浜庣┖
+                                } else if (compareDates(getDate(), res.startTime) === 2 && !res.lastChangeDate) {
+                                    return time.getTime() > new Date(res.endTime).getTime() || time.getTime() < new Date(res.startTime).getTime()
+                                    // 鏈�鍚庝竴娆℃搷浣滄椂闂存湁鍊�
+                                } else if (res.lastChangeDate) {
+                                    // 褰撳墠鏃ユ湡澶т簬鏈�鍚庝竴娆℃搷浣滄椂闂�
+                                    if ([1,3].includes(compareDates(getDate(), res.lastChangeDate))) {
+                                        return time.getTime() > new Date(res.endTime).getTime() || time.getTime() < new Date(getTomorrow()).getTime()
+                                        // 褰撳墠鏃堕棿灏忎簬鏈�鍚庝竴娆℃搷浣滄椂闂�
+                                    } else if (compareDates(getDate(), res.lastChangeDate) === 2) {
+                                        return time.getTime() > new Date(res.endTime).getTime() || time.getTime() < new Date(res.lastChangeDate).getTime()
+                                    }
+                                }
                             }
                         };
                         this.changeSolution1(res.solutionId)
@@ -295,28 +333,29 @@
                                 return
                             }
                         }
-                        this.form.factory.forEach(item => {
-                            item.idcardNo = item.idCard
-                        })
+                        this.$refs.ApplyChangeUnitDetails1.open('鎹㈠巶璇﹀崟', this.form.factory, {...this.list[0], applyStartTime: this.form.applyStartTime})
+                        // this.form.factory.forEach(item => {
+                        //     item.idcardNo = item.idCard
+                        // })
                         // let arr = JSON.parse(JSON.stringify(this.form.factory))
                         // arr.forEach(item => {
                         //     item.idcardNo = item.idCard
                         // })
-                        this.isWorking = true
-                        create({
-                            applyId: this.form.id,
-                            changeDetailList: this.form.factory,
-                            validTime: this.form.applyStartTime,
-                            type: 1
-                        }).then(() => {
-                            this.visible = false
-                            this.$tip.apiSuccess('鎿嶄綔鎴愬姛')
-                            this.$emit('success')
-                        }).catch(e => {
-                            this.$tip.apiFailed(e)
-                        }).finally(() => {
-                            this.isWorking = false
-                        })
+                        // this.isWorking = true
+                        // create({
+                        //     applyId: this.form.id,
+                        //     changeDetailList: this.form.factory,
+                        //     validTime: this.form.applyStartTime,
+                        //     type: 1
+                        // }).then(() => {
+                        //     this.visible = false
+                        //     this.$tip.apiSuccess('鎿嶄綔鎴愬姛')
+                        //     this.$emit('success')
+                        // }).catch(e => {
+                        //     this.$tip.apiFailed(e)
+                        // }).finally(() => {
+                        //     this.isWorking = false
+                        // })
                     }
                 })
             },

--
Gitblit v1.9.3