| | |
| | | :confirm-working="isWorking" |
| | | @confirm="confirm" |
| | | > |
| | | <p class="tip-warn" v-if="type ==1"><i class="el-icon-warning"></i>提醒:<br> |
| | | <span style="">加保人员名单中,人员姓名、身份证号、派遣单位和工种信息均为必填项,备注信息可为空,请录入合法数据。</span> |
| | | </p> |
| | | <p class="tip-warn" v-if="type !=1"><i class="el-icon-warning"></i>提醒:<br> |
| | | <span style="">减保人员名单中,人员姓名、身份证号均为必填项,备注信息可为空,请录入合法数据。</span> |
| | | </p> |
| | | <el-form class="demo-form-inline"> |
| | | <el-form-item label="上传名单" required> |
| | | <div style="width: 100%;display: flex;align-items: center;"> |
| | |
| | | <script> |
| | | import BaseOpera from '@/components/base/BaseOpera' |
| | | import GlobalWindow from '@/components/common/GlobalWindow' |
| | | import { importExcel } from '@/api/business/member' |
| | | import { importExcel,importReuduceExcel } from '@/api/business/member' |
| | | export default { |
| | | name: 'importEmployees', |
| | | extends: BaseOpera, |
| | |
| | | price: 0, |
| | | type: null, |
| | | solutionId: null, |
| | | applyId: null, |
| | | addList: [], |
| | | delList: [], |
| | | fileName: '' |
| | | } |
| | | }, |
| | |
| | | open (title, obj) { |
| | | this.title = title |
| | | this.addList = [] |
| | | this.delList = [] |
| | | this.fileName = '' |
| | | this.type = obj.type |
| | | this.visible = true |
| | | this.solutionId = obj.solutionId |
| | | this.applyId = obj.insuranceApplyId |
| | | this.list = obj.arr |
| | | this.price = obj.price |
| | | this.importing=false |
| | | this.confirming=false |
| | | this.importing= false |
| | | this.confirming= false |
| | | }, |
| | | // 导出模板 |
| | | exportTemplate () { |
| | | // 投保申请 |
| | | if (this.type === 1) { |
| | | window.open('/template/personnel_add.xlsx') |
| | | // window.open(process.env.VUE_APP_MEMBER1_URL) |
| | | } else { |
| | | window.open('/template/personnel_add.xlsx') |
| | | // window.open(process.env.VUE_APP_MEMBER_URL) |
| | | window.open('/template/personnel_reduce.xlsx') |
| | | } |
| | | }, |
| | | clickRef () { |
| | |
| | | this.importing=true |
| | | this.$refs.fileExcel.click() |
| | | }, |
| | | result (e) { |
| | | result(e){ |
| | | if (this.type === 1) { |
| | | this.result1(e) |
| | | } else { |
| | | this.result2(e) |
| | | } |
| | | }, |
| | | result1 (e) { |
| | | this.addList = [] |
| | | const data = new FormData() |
| | | data.append('file', e.target.files[0]) |
| | | data.append('solutionId', this.solutionId) |
| | |
| | | this.$refs.fileExcel.value = null |
| | | }) |
| | | }, |
| | | result2 (e) { |
| | | this.delList = [] |
| | | const data = new FormData() |
| | | data.append('file', e.target.files[0]) |
| | | data.append('applyId', this.applyId) |
| | | importReuduceExcel(data) |
| | | .then(res => { |
| | | res.forEach(item => { |
| | | item.memberName = item.name |
| | | }) |
| | | this.delList = res |
| | | this.fileName = e.target.files[0].name |
| | | this.importing =false |
| | | }) |
| | | .catch(err => { |
| | | this.importing = false |
| | | this.$message.error(err) |
| | | this.fileName = '' |
| | | }) |
| | | .finally(() => { |
| | | this.importing =false |
| | | this.$refs.fileExcel.value = null |
| | | }) |
| | | }, |
| | | confirm () { |
| | | if (this.type === 1) { |
| | | this.confirm1() |
| | | } else { |
| | | this.confirm2() |
| | | } |
| | | }, |
| | | confirm1 () { |
| | | if(this.addList==null || this.addList.length ==0){ |
| | | this.$message.error('导入人员名单为空,请先上传人员名单') |
| | | return; |
| | | return |
| | | } |
| | | if(this.confirming){ |
| | | return |
| | |
| | | for (let i = 0; i < this.addList.length; i++) { |
| | | for (let a = 0; a < this.list.length; a++) { |
| | | if (this.addList[i].idCard === this.list[a].idcardNo) { |
| | | this.$message.warning(`[${this.addList[i].name}]员工重复`) |
| | | this.$message.warning(`【${this.addList[i].name}】员工身份证【${this.addList[i].idCard}】重复`) |
| | | this.confirming = false |
| | | return |
| | | } |
| | | if (this.addList[i].idCard === this.list[a].idCard) { |
| | | this.$message.warning(`【${this.addList[i].name}】员工身份证【${this.addList[i].idCard}】重复`) |
| | | this.confirming = false |
| | | return |
| | | } |
| | | } |
| | |
| | | this.addList.forEach(item => { |
| | | item.fee = this.price |
| | | }) |
| | | |
| | | // this.confirming = false |
| | | this.visible = false |
| | | this.$emit('result', this.addList) |
| | | }, |
| | | confirm2() { |
| | | if(this.delList==null || this.delList.length ==0){ |
| | | this.$message.error('导入人员名单为空,请先上传人员名单') |
| | | return |
| | | } |
| | | if(this.confirming){ |
| | | return |
| | | } |
| | | this.confirming = true |
| | | for (let i = 0; i < this.delList.length; i++) { |
| | | for (let a = 0; a < this.list.length; a++) { |
| | | if (this.delList[i].idCard === this.list[a].idcardNo) { |
| | | this.$message.warning(`【${this.delList[i].name}】员工身份证【${this.delList[i].idCard}】重复`) |
| | | this.confirming = false |
| | | return |
| | | } |
| | | if (this.delList[i].idCard === this.list[a].idCard) { |
| | | this.$message.warning(`【${this.delList[i].name}】员工身份证【${this.delList[i].idCard}】重复`) |
| | | this.confirming = false |
| | | return |
| | | } |
| | | } |
| | | } |
| | | this.visible = false |
| | | this.$emit('result', this.delList) |
| | | } |
| | | } |
| | | } |