|  |  |  | 
|---|
|  |  |  | <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 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: '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: '', | 
|---|
|  |  |  | 
|---|
|  |  |  | '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 = [] | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | 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) { | 
|---|