|  |  |  | 
|---|
|  |  |  | @change="getTimeVal" | 
|---|
|  |  |  | v-model="form.applyStartTime" | 
|---|
|  |  |  | type="date" | 
|---|
|  |  |  | class="date_picker" | 
|---|
|  |  |  | :clearable="false" | 
|---|
|  |  |  | :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> | 
|---|
|  |  |  | 
|---|
|  |  |  | 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> | 
|---|
|  |  |  | 
|---|
|  |  |  | <el-table-column | 
|---|
|  |  |  | label="年龄"> | 
|---|
|  |  |  | <template slot-scope="{row}"> | 
|---|
|  |  |  | <span v-if="row.idCard">{{ getAgeByIdCard(row.idCard) }}</span> | 
|---|
|  |  |  | <template v-if="item"> | 
|---|
|  |  |  | <span style="color: red;" v-if="row.idCard && (getAgeByIdCard(row.idCard) < item.minAge || getAgeByIdCard(row.idCard) > item.maxAge)">{{ getAgeByIdCard(row.idCard) }}</span> | 
|---|
|  |  |  | <span v-else>{{ getAgeByIdCard(row.idCard) }}</span> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </el-table-column> | 
|---|
|  |  |  | <el-table-column | 
|---|
|  |  |  | 
|---|
|  |  |  | <importEmployees ref="importEmployees" @result="getValue" /> | 
|---|
|  |  |  | <!--    确认工种    --> | 
|---|
|  |  |  | <confirmJobType ref="confirmJobType" @result="getUser" /> | 
|---|
|  |  |  | <!--    查看详单    --> | 
|---|
|  |  |  | <detailsPolicyholder ref="detailsPolicyholder" @success="successEvent" /> | 
|---|
|  |  |  | </GlobalWindow> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | import addEmployee from '@/components/enterprise/addEmployee' | 
|---|
|  |  |  | import importEmployees from '@/components/enterprise/importEmployees' | 
|---|
|  |  |  | import confirmJobType from '@/components/enterprise/confirmJobType' | 
|---|
|  |  |  | import { all } from '@/api/business/solutions' | 
|---|
|  |  |  | import detailsPolicyholder from '@/components/business/detailsPolicyholder' | 
|---|
|  |  |  | import { all, getNewVersion } from '@/api/business/solutions' | 
|---|
|  |  |  | import { mapState } from 'vuex' | 
|---|
|  |  |  | import { create, getCountCyclePriceVO, getDetail, findList, updateData } from '@/api/business/insuranceApply' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'OperaInsuranceApplyWindow', | 
|---|
|  |  |  | name: 'OperaInsuranceApplyWindow2', | 
|---|
|  |  |  | extends: BaseOpera, | 
|---|
|  |  |  | components: { GlobalWindow, selectEmployees, addEmployee, importEmployees, confirmJobType }, | 
|---|
|  |  |  | components: { GlobalWindow, selectEmployees, addEmployee, importEmployees, confirmJobType, detailsPolicyholder }, | 
|---|
|  |  |  | data () { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | form: { | 
|---|
|  |  |  | 
|---|
|  |  |  | applyStartTime: '', | 
|---|
|  |  |  | applyEndTime: '' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | solutionName: '', | 
|---|
|  |  |  | type: '', | 
|---|
|  |  |  | pickerOptions: {}, // 存放picker options的变量 | 
|---|
|  |  |  | price: '', | 
|---|
|  |  |  | company: [], | 
|---|
|  |  |  | 
|---|
|  |  |  | 'field.id': 'id' | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | computed: { | 
|---|
|  |  |  | ...mapState(['userInfo']) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | successEvent() { | 
|---|
|  |  |  | let arr = JSON.parse(JSON.stringify(this.tableData)) | 
|---|
|  |  |  | arr.forEach(item => { | 
|---|
|  |  |  | item.idcardNo = item.idCard | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.isWorking = true | 
|---|
|  |  |  | // 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 | 
|---|
|  |  |  | //         }) | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | open (title, target) { | 
|---|
|  |  |  | this.title = title | 
|---|
|  |  |  | this.tableData = [] | 
|---|
|  |  |  | this.form.id = null | 
|---|
|  |  |  | this.item = null | 
|---|
|  |  |  | if (target.type) { | 
|---|
|  |  |  | this.type = target.type | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.form.solutionId = '' | 
|---|
|  |  |  | this.form.applyStartTime = '' | 
|---|
|  |  |  | this.form.applyEndTime = '' | 
|---|
|  |  |  | if (target && target.id) { | 
|---|
|  |  |  | this.form.id = target.id | 
|---|
|  |  |  | this.getDetails() | 
|---|
|  |  |  | this.$nextTick(() => { | 
|---|
|  |  |  | this.$refs.form.resetFields() | 
|---|
|  |  |  | this.form.id = target.id | 
|---|
|  |  |  | this.getDetails() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.$nextTick(() => { | 
|---|
|  |  |  | this.$refs.form.resetFields() | 
|---|
|  |  |  | 
|---|
|  |  |  | findList({ applyId: this.form.id }) | 
|---|
|  |  |  | .then(res => { | 
|---|
|  |  |  | res.forEach(item => { | 
|---|
|  |  |  | console.log(item) | 
|---|
|  |  |  | item.idCard = item.idcardNo | 
|---|
|  |  |  | item.fee = '' | 
|---|
|  |  |  | if (this.type === 1) { | 
|---|
|  |  |  | item.duName = '' | 
|---|
|  |  |  | item.duId = '' | 
|---|
|  |  |  | item.worktypeId = '' | 
|---|
|  |  |  | item.workTypeName = '' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.tableData = res | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | getDetail(this.form.id) | 
|---|
|  |  |  | .then(res => { | 
|---|
|  |  |  | this.form.solutionId = res.solutionId | 
|---|
|  |  |  | // this.form.solutionId = res.solutionId | 
|---|
|  |  |  | this.changeSolution1(res.solutionId) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.seleData.forEach(item => { | 
|---|
|  |  |  | this.tableData.forEach((row, index) => { | 
|---|
|  |  |  | if (item === row.name) { | 
|---|
|  |  |  | if (item === row.idCard) { | 
|---|
|  |  |  | this.tableData.splice(index, 1) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (let i = 0; i < this.tableData.length; i++) { | 
|---|
|  |  |  | console.log(this.tableData[i].worktypeId, this.tableData[i].duId) | 
|---|
|  |  |  | console.log(this.tableData[i].worktypeId) | 
|---|
|  |  |  | console.log(this.tableData[i].duId) | 
|---|
|  |  |  | if (!this.tableData[i].worktypeId || !this.tableData[i].duId) { | 
|---|
|  |  |  | this.$message.warning('请完善派遣单位和工种信息') | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | let arr = JSON.parse(JSON.stringify(this.tableData)) | 
|---|
|  |  |  | arr.forEach(item => { | 
|---|
|  |  |  | item.idcardNo = item.idCard | 
|---|
|  |  |  |  | 
|---|
|  |  |  | let price = 0 | 
|---|
|  |  |  | this.tableData.forEach(item => { | 
|---|
|  |  |  | price = price + item.fee | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.isWorking = true | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.$refs.detailsPolicyholder.open('投保详情单', { | 
|---|
|  |  |  | companyName: this.userInfo.company.name, | 
|---|
|  |  |  | solutionName: this.item.name, | 
|---|
|  |  |  | applyStartTime: this.form.applyStartTime, | 
|---|
|  |  |  | applyEndTime: this.form.applyEndTime, | 
|---|
|  |  |  | insureNum: this.tableData.length, | 
|---|
|  |  |  | totalPrice: price, | 
|---|
|  |  |  | detailList: this.tableData | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // let arr = JSON.parse(JSON.stringify(this.tableData)) | 
|---|
|  |  |  | // arr.forEach(item => { | 
|---|
|  |  |  | //     item.idcardNo = item.idCard | 
|---|
|  |  |  | // }) | 
|---|
|  |  |  | // this.isWorking = true | 
|---|
|  |  |  | // 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 | 
|---|
|  |  |  | //     }) | 
|---|
|  |  |  | // } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | console.log(this.tableData) | 
|---|
|  |  |  | this.$forceUpdate() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | return time.getTime() <= new Date(currentDate.toLocaleString()).getTime() - 8.64e7; | 
|---|
|  |  |  | } else if (that.item.validType === 0) { | 
|---|
|  |  |  | // 多少日后生效 | 
|---|
|  |  |  | return time.getTime() <= new Date(that.getDate(that.item.validTypeNum)).getTime(); | 
|---|
|  |  |  | return time.getTime() <= new Date(that.getDate(that.item.validTypeNum - 1)).getTime(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | 
|---|
|  |  |  | this.$message.warning('请先选择保险方案') | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.$refs.selectEmployees.open('选取员工', { arr: this.tableData, price: this.price }) | 
|---|
|  |  |  | this.$refs.selectEmployees.open('选取员工', { arr: this.tableData, price: this.price, type: 1 }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | addUser() { | 
|---|
|  |  |  | if (!this.form.solutionId) { | 
|---|
|  |  |  | 
|---|
|  |  |  | this.$message.warning('请先选择保险方案') | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.$refs.importEmployees.open('上传名单', { arr: this.tableData, price: this.price }) | 
|---|
|  |  |  | this.$refs.importEmployees.open('上传名单', { arr: this.tableData, solutionId: this.form.solutionId, type: 1, price: this.price }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 切换方案 | 
|---|
|  |  |  | changeSolution(e) { | 
|---|
|  |  |  | this.tableData = [] | 
|---|
|  |  |  | if (!this.form.id) { | 
|---|
|  |  |  | this.tableData = [] | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.price = '' | 
|---|
|  |  |  | this.form.applyEndTime = '' | 
|---|
|  |  |  | this.form.applyStartTime = '' | 
|---|
|  |  |  | this.tableData.forEach(item => { | 
|---|
|  |  |  | item.fee = '' | 
|---|
|  |  |  | item.duName = '' | 
|---|
|  |  |  | item.duId = '' | 
|---|
|  |  |  | item.workTypeName = '' | 
|---|
|  |  |  | item.workTypeId = '' | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.company.forEach(item => { | 
|---|
|  |  |  | if (item.id === e) { | 
|---|
|  |  |  | // this.price = item.price | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 切换方案 | 
|---|
|  |  |  | changeSolution1(e) { | 
|---|
|  |  |  | this.company.forEach(item => { | 
|---|
|  |  |  | if (item.id === e) { | 
|---|
|  |  |  | // this.price = item.price | 
|---|
|  |  |  | this.item = item | 
|---|
|  |  |  | this.updatePickerOptions() | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | getNewVersion(e) | 
|---|
|  |  |  | .then(res => { | 
|---|
|  |  |  | this.form.solutionId = res.id | 
|---|
|  |  |  | this.company.forEach(item => { | 
|---|
|  |  |  | if (item.id === res.id) { | 
|---|
|  |  |  | // this.price = item.price | 
|---|
|  |  |  | this.item = item | 
|---|
|  |  |  | this.updatePickerOptions() | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.tableData.forEach(item => { | 
|---|
|  |  |  | item.fee = this.price | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | this.tableData.splice(index, 1) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getUser(obj) { | 
|---|
|  |  |  | this.seleData.forEach(item => { | 
|---|
|  |  |  | this.seleData.forEach(id => { | 
|---|
|  |  |  | this.tableData.forEach(row => { | 
|---|
|  |  |  | if (item === row.name) { | 
|---|
|  |  |  | if (id === row.idCard) { | 
|---|
|  |  |  | row.workTypeName = obj.workTypeName | 
|---|
|  |  |  | row.worktypeId = obj.worktypeId | 
|---|
|  |  |  | row.duName = obj.duName | 
|---|
|  |  |  | 
|---|
|  |  |  | return sexAndAge.age | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | handleSelectionChange (e) { | 
|---|
|  |  |  | this.seleData = e.map(item => item.name) | 
|---|
|  |  |  | this.seleData = e.map(item => item.idCard) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getValue(list) { | 
|---|
|  |  |  | this.tableData.push(...list) | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <style> | 
|---|
|  |  |  | .el-picker-panel__footer .el-button--text.el-picker-panel__link-btn { | 
|---|
|  |  |  | display: none; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </style> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <style lang="scss" scoped> | 
|---|
|  |  |  | .list { | 
|---|
|  |  |  | width: 100%; | 
|---|