MrShi
2024-03-08 d2bc6e096f0806b78ea92d4b90a21d3627d406c7
company/src/components/enterprise/factoryChange.vue
@@ -77,7 +77,7 @@
                <el-table-column
                    prop="currentFee"
                    align="center"
                    label="产生费用(元)">
                    label="已产生费用(元)">
                </el-table-column>
                <el-table-column
                    prop="fee"
@@ -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: {
@@ -181,6 +185,7 @@
                    applyEndTime: '',
                    factory: []
                },
                newVersionSolutionId: '',
                pickerOptions: {},
                price: '',
                endTime: '',    //    实际保险生效止期
@@ -231,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 })
@@ -253,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(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)
@@ -292,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
                        // })
                    }
                })
            },
@@ -381,7 +423,7 @@
                    this.$message.warning('请选择员工')
                    return
                }
                this.$refs.confirmJobType.open('确认工种', { solutionId: this.form.solutionId })
                this.$refs.confirmJobType.open('确认工种', { solutionId: this.newVersionSolutionId })
            },
            // 查询全部方案
            getCompany() {