<template> 
 | 
    <GlobalWindow 
 | 
            :title="title" 
 | 
            width="100%" 
 | 
            :visible.sync="visible" 
 | 
            :confirm-working="isWorking" 
 | 
            @confirm="confirm" 
 | 
    > 
 | 
        <el-input v-model="val" placeholder="查询员工姓名" @keypress.enter.native="getList" style="margin-bottom: 15px;"></el-input> 
 | 
        <el-table 
 | 
                :data="list" 
 | 
                border 
 | 
                @selection-change="handleSelectionChange" 
 | 
                style="width: 100%"> 
 | 
            <el-table-column 
 | 
                    type="selection" 
 | 
                    width="55"> 
 | 
            </el-table-column> 
 | 
            <el-table-column label="序号" width="80px"> 
 | 
                <template slot-scope="scope"> 
 | 
                    <span>{{scope.$index + 1}}</span> 
 | 
                </template> 
 | 
            </el-table-column> 
 | 
            <el-table-column 
 | 
                    prop="name" 
 | 
                    label="姓名"> 
 | 
            </el-table-column> 
 | 
            <el-table-column 
 | 
                    prop="idcardNo" 
 | 
                    label="身份证号"> 
 | 
            </el-table-column> 
 | 
            <el-table-column 
 | 
                    prop="duName" 
 | 
                    label="派遣单位"> 
 | 
            </el-table-column> 
 | 
            <el-table-column 
 | 
                    prop="workTypeName" 
 | 
                    label="所属工种"> 
 | 
            </el-table-column> 
 | 
        </el-table> 
 | 
    </GlobalWindow> 
 | 
</template> 
 | 
  
 | 
<script> 
 | 
    import BaseOpera from '@/components/base/BaseOpera' 
 | 
    import GlobalWindow from '@/components/common/GlobalWindow' 
 | 
    import { findListByDTO } from '@/api/business/member' 
 | 
    export default { 
 | 
        name: 'selectEmployeesCopy', 
 | 
        extends: BaseOpera, 
 | 
        components: { GlobalWindow }, 
 | 
        data () { 
 | 
            return { 
 | 
                val: '', 
 | 
                list: [], 
 | 
                price: '', 
 | 
                insuranceApplyId: '', 
 | 
                notInInsuranceApplyId: '', 
 | 
                seleData: [], 
 | 
                oldList: [] 
 | 
            } 
 | 
        }, 
 | 
        created () { 
 | 
            this.config({ 
 | 
                api: '/business/dispatchUnit', 
 | 
                'field.id': 'id' 
 | 
            }) 
 | 
        }, 
 | 
        methods: { 
 | 
            open (title, obj) { 
 | 
                this.insuranceApplyId = '' 
 | 
                this.notInInsuranceApplyId = '' 
 | 
                this.price = obj.price 
 | 
                this.oldList = obj.arr 
 | 
                this.list = [] 
 | 
                if (obj.insuranceApplyId) { 
 | 
                    this.insuranceApplyId = obj.insuranceApplyId 
 | 
                } 
 | 
                if (obj.notInInsuranceApplyId) { 
 | 
                    this.notInInsuranceApplyId = obj.notInInsuranceApplyId 
 | 
                } 
 | 
                this.title = title 
 | 
                this.visible = true 
 | 
                this.getList() 
 | 
            }, 
 | 
            confirm() { 
 | 
                if (this.seleData.length === 0) { 
 | 
                    this.$message.warning('至少选择一项内容') 
 | 
                    return 
 | 
                } 
 | 
                for (let i = 0; i < this.seleData.length; i++) { 
 | 
                    for (let a = 0; a < this.oldList.length; a++) { 
 | 
                        if (this.seleData[i].name === this.oldList[a].memberName || this.seleData[i].idCard === this.oldList[a].idcardNo) { 
 | 
                            this.$message.warning(`[${this.seleData[i].name}]员工重复`) 
 | 
                            return 
 | 
                        } 
 | 
                    } 
 | 
                } 
 | 
                this.seleData.forEach(item => { 
 | 
                    item.idCard = item.idcardNo 
 | 
                    item.memberName = item.name 
 | 
                    item.memberId = item.id 
 | 
  
 | 
                    item.oldDuId = JSON.parse(JSON.stringify(item.duId)) 
 | 
                    item.oldDuName = JSON.parse(JSON.stringify(item.duName)) 
 | 
                    item.oldWorkTypeName = JSON.parse(JSON.stringify(item.workTypeName)) 
 | 
                    item.oldWorktypeId = JSON.parse(JSON.stringify(item.worktypeId)) 
 | 
  
 | 
                    item.duId = '' 
 | 
                    item.duName = '' 
 | 
                    item.workTypeName = '' 
 | 
                    item.worktypeId = '' 
 | 
  
 | 
                    item.fee = this.price 
 | 
                }) 
 | 
                this.$emit('result', this.seleData) 
 | 
                this.visible = false 
 | 
            }, 
 | 
            handleSelectionChange (e) { 
 | 
                this.seleData = e 
 | 
            }, 
 | 
            getList() { 
 | 
                findListByDTO({ 
 | 
                    name: this.val, 
 | 
                    insuranceApplyId: this.insuranceApplyId, 
 | 
                    notInInsuranceApplyId: this.notInInsuranceApplyId 
 | 
                }).then(res => { 
 | 
                    res.forEach(item => { 
 | 
                        item.fee = '' 
 | 
                    }) 
 | 
                    this.list = res 
 | 
                }) 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
</script> 
 | 
  
 | 
<style lang="scss" scoped> 
 | 
  
 | 
</style> 
 |