k94314517
2024-02-23 3c456949b70671cc2ad95ad5395dfaceda519f17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<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: 'selectEmployees',
        extends: BaseOpera,
        components: { GlobalWindow },
        data () {
            return {
                type: '',
                val: '',
                list: [],
                price: '',
                insuranceApplyId: '',
                notInInsuranceApplyId: '',
                validTime: '',
                seleData: [],
                oldList: []
            }
        },
        created () {
            this.config({
                api: '/business/dispatchUnit',
                'field.id': 'id'
            })
        },
        methods: {
            open (title, obj) {
                this.insuranceApplyId = ''
                this.notInInsuranceApplyId = ''
                this.val = ''
                this.price = obj.price
                this.oldList = obj.arr
                if (obj.type) {
                    this.type = obj.type
                }
                this.list = []
                if (obj.insuranceApplyId) {
                    this.insuranceApplyId = obj.insuranceApplyId
                }
                if (obj.notInInsuranceApplyId) {
                    this.notInInsuranceApplyId = obj.notInInsuranceApplyId
                }
                if (obj.validTime) {
                    this.validTime = obj.validTime
                }
                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
                    if (this.notInInsuranceApplyId || this.type == 1) {
                        item.workTypeName = ''
                        item.worktypeId = ''
                        item.duId = ''
                        item.duName = ''
                    }
                    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,
                    validTime: this.validTime
                }).then(res => {
                    res.forEach(item => {
                        item.fee = ''
                    })
                    this.list = res
                })
            }
        }
    }
</script>
 
<style lang="scss" scoped>
 
</style>