|  |  | 
 |  |  | <template> | 
 |  |  |     <GlobalWindow | 
 |  |  |         :title="title" | 
 |  |  |         width="100%" | 
 |  |  |         width="30%" | 
 |  |  |         :visible.sync="visible" | 
 |  |  |         :confirm-working="isWorking" | 
 |  |  |         @confirm="confirm" | 
 |  |  |     > | 
 |  |  |         <el-form class="demo-form-inline"> | 
 |  |  |             <el-form-item label="上传名单" required> | 
 |  |  |                 <el-button type="primary" @click="clickRef">点击上传</el-button> | 
 |  |  |                 <el-button type="text">名单模板.EXCEL</el-button> | 
 |  |  |                 <div style="width: 100%;display: flex;align-items: center;"> | 
 |  |  |                     <el-button type="primary" @click="clickRef">点击上传</el-button> | 
 |  |  |                     <el-button type="text" @click="exportTemplate">名单模板.EXCEL</el-button> | 
 |  |  |                 </div> | 
 |  |  |                 <div style="font-size: 14px; color: black;" v-if="fileName">{{fileName}}</div> | 
 |  |  |             </el-form-item> | 
 |  |  |         </el-form> | 
 |  |  |         <input type="file" accept=".excel" ref="fileExcel" @change="result" /> | 
 |  |  |         <input type="file" style="position: fixed; left: 0; top: -50px;" accept=".xlsx" ref="fileExcel" @change="result" /> | 
 |  |  |     </GlobalWindow> | 
 |  |  | </template> | 
 |  |  |  | 
 |  |  | <script> | 
 |  |  |     import BaseOpera from '@/components/base/BaseOpera' | 
 |  |  |     import GlobalWindow from '@/components/common/GlobalWindow' | 
 |  |  |     import { importExcel } from '@/api/business/member' | 
 |  |  |     export default { | 
 |  |  |         name: 'importEmployees', | 
 |  |  |         extends: BaseOpera, | 
 |  |  |         components: { GlobalWindow }, | 
 |  |  |         data () { | 
 |  |  |             return { | 
 |  |  |                 list: [] | 
 |  |  |                 list: [], | 
 |  |  |                 price: 0, | 
 |  |  |                 type: null, | 
 |  |  |                 solutionId: null, | 
 |  |  |                 addList: [], | 
 |  |  |                 fileName: '' | 
 |  |  |             } | 
 |  |  |         }, | 
 |  |  |         methods: { | 
 |  |  |             open (title, arr) { | 
 |  |  |             open (title, obj) { | 
 |  |  |                 this.title = title | 
 |  |  |                 this.addList = [] | 
 |  |  |                 this.fileName = '' | 
 |  |  |                 this.type = obj.type | 
 |  |  |                 this.visible = true | 
 |  |  |                 this.solutionId = obj.solutionId | 
 |  |  |                 this.list = obj.arr | 
 |  |  |                 this.price = obj.price | 
 |  |  |             }, | 
 |  |  |             // 导出模板 | 
 |  |  |             exportTemplate () { | 
 |  |  |                 // 投保申请 | 
 |  |  |                 if (this.type === 1) { | 
 |  |  |                     window.open(process.env.VUE_APP_MEMBER1_URL) | 
 |  |  |                 } else { | 
 |  |  |                     window.open(process.env.VUE_APP_MEMBER_URL) | 
 |  |  |                 } | 
 |  |  |             }, | 
 |  |  |             clickRef () { | 
 |  |  |                 this.$refs.fileExcel.click() | 
 |  |  |             }, | 
 |  |  |             result (e) { | 
 |  |  |                 console.log(e) | 
 |  |  |                 const data = new FormData() | 
 |  |  |                 data.append('file', e.target.files[0]) | 
 |  |  |                 data.append('solutionId', this.solutionId) | 
 |  |  |                 importExcel(data) | 
 |  |  |                     .then(res => { | 
 |  |  |                         res.forEach(item => { | 
 |  |  |                             item.memberName = item.name | 
 |  |  |                             item.fee = '' | 
 |  |  |                         }) | 
 |  |  |                         this.addList = res | 
 |  |  |                         this.fileName = e.target.files[0].name | 
 |  |  |                     }) | 
 |  |  |                     .catch(err => { | 
 |  |  |                         this.$message.error(err) | 
 |  |  |                         this.fileName = '' | 
 |  |  |                     }) | 
 |  |  |                     .finally(() => { | 
 |  |  |                         this.$refs.fileExcel.value = null | 
 |  |  |                     }) | 
 |  |  |             }, | 
 |  |  |             confirm () { | 
 |  |  |                 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}]员工重复`) | 
 |  |  |                             return | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 this.addList.forEach(item => { | 
 |  |  |                     item.fee = this.price || '' | 
 |  |  |                 }) | 
 |  |  |                 this.$emit('result', this.addList) | 
 |  |  |                 this.visible = false | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } |