jiangping
2024-01-30 a9ca0823ab8f33ca85abebcf6ec4a8da235adb49
company/src/components/enterprise/selectEmployees.vue
@@ -10,26 +10,31 @@
        <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="date"
                prop="name"
                label="姓名">
            </el-table-column>
            <el-table-column
                prop="name"
                prop="idcardNo"
                label="身份证号">
            </el-table-column>
            <el-table-column
                prop="address"
                prop="duName"
                label="派遣单位">
            </el-table-column>
            <el-table-column
                prop="address"
                prop="workTypeName"
                label="所属工种">
            </el-table-column>
        </el-table>
@@ -47,7 +52,10 @@
        data () {
            return {
                val: '',
                list: []
                list: [],
                price: '',
                seleData: [],
                oldList: []
            }
        },
        created () {
@@ -57,16 +65,49 @@
            })
        },
        methods: {
            open (title) {
            open (title, obj) {
                this.price = obj.price
                this.oldList = obj.arr
                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.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
                }).then(res => {
                    this.list = []
                    res.forEach(item => {
                        item.fee = ''
                    })
                    this.list = res
                })
            }
        }