MrShi
2024-02-01 08603217557de17520ae5c81a30a6ba0a362f30f
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
<template>
    <GlobalWindow
        :title="title"
        width="30%"
        :visible.sync="visible"
        :confirm-working="isWorking"
        @confirm="confirm"
    >
        <el-form class="demo-form-inline">
            <el-form-item label="派遣单位" required>
                <el-select v-model="dw" @change="selectChange" placeholder="请选择">
                    <el-option
                        v-for="item in dispatching"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="所属工种" required>
                <el-select v-model="gz" placeholder="请选择">
                    <el-option
                        v-for="item in options"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
        </el-form>
    </GlobalWindow>
</template>
 
<script>
    import BaseOpera from '@/components/base/BaseOpera'
    import GlobalWindow from '@/components/common/GlobalWindow'
    import { findListByDTO } from '@/api/business/dispatchUnit'
    import { findListByDTO as worktype } from '@/api/business/worktype'
    export default {
        name: 'confirmJobType',
        extends: BaseOpera,
        components: { GlobalWindow },
        data () {
            return {
                form: {
                    solutionId: ''
                },
                data: [],
                dw: [],
                gz: [],
                dispatching: [],
                options: []
            }
        },
        methods: {
            open (title, arr) {
                this.title = title
                this.dw = ''
                this.gz = ''
                this.form.solutionId = arr.solutionId
                this.data = arr.seleData
                this.visible = true
                this.getFindListByDTO()
            },
            getFindListByDTO () {
                findListByDTO({
                    solutionId: this.form.solutionId,
                    dataType: 2
                }).then(res => {
                    this.dispatching = res
                })
            },
            selectChange(id) {
                this.gz = ''
                let duSolutionId = ''
                this.dispatching.forEach(item => {
                    if (item.id === id) {
                        duSolutionId = item.duSolutionId
                    }
                })
                worktype({ id: duSolutionId, queryType: 1 })
                    .then(res => {
                        this.options = res
                    })
            },
            confirm() {
                let obj = {
                    workTypeName: '',
                    worktypeId: '',
                    duName: '',
                    duId: ''
                }
                this.dispatching.forEach(item => {
                    if (item.id === this.dw) {
                        obj.duName = item.name
                        obj.duId = item.id
                    }
                })
                this.options.forEach(item => {
                    if (item.id === this.gz) {
                        obj.workTypeName = item.name
                        obj.worktypeId = item.id
                    }
                })
                this.$emit('result', obj)
                this.visible = false
            }
        }
    }
</script>
 
<style lang="scss" scoped>
 
</style>