From d2bc6e096f0806b78ea92d4b90a21d3627d406c7 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 08 三月 2024 18:28:42 +0800
Subject: [PATCH] mrshi

---
 company/src/components/enterprise/factoryChange.vue |  128 +++++++++++++++++++++++++++++++++---------
 1 files changed, 101 insertions(+), 27 deletions(-)

diff --git a/company/src/components/enterprise/factoryChange.vue b/company/src/components/enterprise/factoryChange.vue
index b2fe3b0..83d76ed 100644
--- a/company/src/components/enterprise/factoryChange.vue
+++ b/company/src/components/enterprise/factoryChange.vue
@@ -18,8 +18,8 @@
                             v-model="form.applyStartTime"
                             type="date"
                             :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>
@@ -77,7 +77,7 @@
                 <el-table-column
                     prop="currentFee"
                     align="center"
-                    label="褰撳墠璐圭敤(鍏�)">
+                    label="宸蹭骇鐢熻垂鐢�(鍏�)">
                 </el-table-column>
                 <el-table-column
                     prop="fee"
@@ -147,13 +147,15 @@
             <span v-if="item.ortherInfo">{{item.ortherInfo}}</span>
         </div>
         <!--    閫夋嫨鍛樺伐    -->
-        <selectEmployees ref="selectEmployees" @result="getValue" />
+        <selectEmployees ref="selectEmployees" @result="getValue1" />
         <!--    娣诲姞鍛樺伐    -->
         <addEmployee ref="addEmployee" @result="getValue" />
         <!--    瀵煎叆鍚嶅崟    -->
         <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: {
@@ -181,6 +185,7 @@
                     applyEndTime: '',
                     factory: []
                 },
+                newVersionSolutionId: '',
                 pickerOptions: {},
                 price: '',
                 endTime: '',    // 	瀹為檯淇濋櫓鐢熸晥姝㈡湡
@@ -208,6 +213,7 @@
                 this.form.addDetailList = []
                 this.form.delDetailList = []
                 this.list = []
+                this.form.factory = []
                 this.form.id = null
                 this.item = null
                 this.form.solutionId = ''
@@ -229,6 +235,26 @@
                 this.getCompany()
                 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() {
@@ -252,14 +278,30 @@
                     })
                 getDetail(this.form.id)
                     .then(res => {
+                        console.log(res)
                         this.list.push(res)
                         this.endTime = res.endTime
                         this.form.solutionId = res.solutionId
+                        this.newVersionSolutionId = res.newVersionSolutionId
                         this.form.solutionsName = res.solutionsName
                         this.pickerOptions = {
                             disabledDate(time) {
-                                // - 8.64e7
-                                return time.getTime() > new Date(res.endTime).getTime() || time.getTime() < new Date().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)
@@ -291,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
+                        // })
                     }
                 })
             },
@@ -321,7 +364,11 @@
                     this.$message.warning('璇峰厛閫夋嫨淇濋櫓鏂规')
                     return
                 }
-                this.$refs.selectEmployees.open('閫夊彇鍛樺伐', { arr: this.form.delDetailList, price: this.price, insuranceApplyId: this.form.id })
+                if (!this.form.applyStartTime) {
+                    this.$message.warning('璇峰厛閫夋嫨鎵瑰崟鐢熸晥璧锋湡')
+                    return
+                }
+                this.$refs.selectEmployees.open('閫夊彇鍛樺伐', { arr: this.form.delDetailList, price: this.price, insuranceApplyId: this.form.id, validTime: this.form.applyStartTime })
             },
             addUser() {
                 if (!this.form.solutionId) {
@@ -376,7 +423,7 @@
                     this.$message.warning('璇烽�夋嫨鍛樺伐')
                     return
                 }
-                this.$refs.confirmJobType.open('纭宸ョ', { solutionId: this.form.solutionId })
+                this.$refs.confirmJobType.open('纭宸ョ', { solutionId: this.newVersionSolutionId })
             },
             // 鏌ヨ鍏ㄩ儴鏂规
             getCompany() {
@@ -412,6 +459,33 @@
             handleSelectionChange (e) {
                 this.seleData = e.map(item => item.memberName)
             },
+            // 閫夊彇鍛樺伐
+            getValue1 (list) {
+                let arr = JSON.parse(JSON.stringify(list))
+
+                arr.forEach(item => {
+                    item.oldDuId = item.duId
+                    item.oldDuName = item.duName
+                    item.oldWorkTypeName = item.workTypeName
+                    item.oldWorktypeId = item.worktypeId
+
+                    item.duId = ''
+                    item.duName = ''
+                    item.workTypeName = ''
+                    item.worktypeId = ''
+                })
+
+                for (let a = 0; a < arr.length; a++) {
+                    for (let b = 0; b < this.form.factory.length; b++) {
+                        if (arr[a].id === this.form.factory[b].id) {
+                            this.$message.warning(`${arr[a].companyName}鍛樺伐閲嶅锛乣)
+                            return
+                        }
+                    }
+                }
+
+                this.form.factory.push(...arr)
+            },
             getValue(list) {
                 let arr = JSON.parse(JSON.stringify(list))
 

--
Gitblit v1.9.3