<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 v-if="type !== 2">
|
<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: ''
|
},
|
type: null,
|
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.type = arr.type
|
this.visible = true
|
this.options=[]
|
if (arr.type === 2) {
|
worktype({ id: arr.solutionId, queryType: 0 })
|
.then(res => {
|
this.options = res
|
})
|
} else {
|
this.getFindListByDTO()
|
}
|
},
|
getFindListByDTO () {
|
findListByDTO({
|
solutionId: this.form.solutionId,
|
// dataType: 0
|
}).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() {
|
if (this.type === 2) {
|
if(!this.gz){
|
this.$message.error("请先选择工种!")
|
return;
|
}
|
} else {
|
if(!this.dw || !this.gz){
|
this.$message.error("请先选择派遣单位和工种!")
|
return;
|
}
|
}
|
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>
|