Commit 6c8e6d7d by 怪兽?别跑

岗位组件调整

1 parent f8b6e631
<script> <script>
import { getDeptUserAll } from '@/api/organization' import { getDeptUserAll } from '@/api/organization'
export default { export default {
name: 'SelectPost', name: 'SelectPost',
components: {}, components: {},
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
default: false, default: false
}, },
title: { title: {
type: String, type: String,
default: '选择岗位', default: '选择岗位'
}, },
// 是否单选 // 是否单选
isSigleSelect: { isSigleSelect: {
type: Boolean, type: Boolean,
default: false, default: false
}, },
// 默认选中 // 默认选中
defaultValues: { defaultValues: {
type: Array, type: Array,
default: () => [], default: () => []
},
// 禁止选中
disabledValues: {
type: Array,
default: () => [],
},
destroyOnClose: Boolean,
},
data() {
return {
postList: [],
selectList: [],
}
},
watch: {
defaultValues: {
handler(value) {
this.selectList = value
}, },
immediate: true, // 禁止选中
disabledValues: {
type: Array,
default: () => []
},
destroyOnClose: Boolean
}, },
Pvisible(val) { data() {
this.selectList = this.defaultValues return {
postList: [],
selectList: []
}
}, },
}, watch: {
computed: { defaultValues: {
Pvisible: { handler(value) {
get() { this.selectList = value
return this.visible },
}, immediate: true
set(val) {
this.$emit('update:visible', val)
}, },
Pvisible(val) {
this.selectList = this.defaultValues
}
}, },
}, computed: {
created() { Pvisible: {
getDeptUserAll().then(({ data }) => { get() {
this.postList = data.map((item) => { return this.visible
return item.position },
}) set(val) {
}) this.$emit('update:visible', val)
}, }
mounted() {}, }
methods: {
// 确 定
submit() {
this.Pvisible = false
this.$emit('success', [...this.selectList])
}, },
// 取消选择 created() {
cancle(index) { getDeptUserAll().then(({ data }) => {
this.selectList.splice(index, 1) let arr = data.map((item) => {
return item.position
})
this.postList = Array.from(new Set(arr))
})
}, },
}, mounted() {},
} methods: {
// 确 定
submit() {
this.Pvisible = false
this.$emit('success', [...this.selectList])
},
// 取消选择
cancle(index) {
this.selectList.splice(index, 1)
}
}
}
</script> </script>
<template> <template>
<el-dialog :title="title" :visible.sync="Pvisible" :close-on-click-modal="false" :destroy-on-close="destroyOnClose"> <el-dialog :title="title" :visible.sync="Pvisible" :close-on-click-modal="false" :destroy-on-close="destroyOnClose">
...@@ -85,11 +86,12 @@ export default { ...@@ -85,11 +86,12 @@ export default {
<el-checkbox-group v-model="selectList"> <el-checkbox-group v-model="selectList">
<template v-for="(unit, index) in postList"> <template v-for="(unit, index) in postList">
<el-checkbox <el-checkbox
style="display: block" style="display: block;"
:label="unit" :label="unit"
v-if="unit" v-if="unit"
:key="index" :key="index"
:disabled="disabledValues.includes(unit)"> :disabled="disabledValues.includes(unit)"
>
{{ unit }} {{ unit }}
</el-checkbox> </el-checkbox>
</template> </template>
...@@ -113,9 +115,9 @@ export default { ...@@ -113,9 +115,9 @@ export default {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.user-list { .user-list {
.el-row { .el-row {
line-height: 26px; line-height: 26px;
}
} }
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!