负责人选择组件

This commit is contained in:
zhaoxiao
2021-08-26 17:13:31 +08:00
parent 6e7aafd5a4
commit 3c69cc2c07
2 changed files with 51 additions and 1 deletions
@@ -0,0 +1,47 @@
<template>
<a-select :value="value" v-bind="$attrs" v-on="$listeners">
<a-select-option v-for="item in userList" :key="item.id" :value="item.id">{{ `${item.username}(${item.orgCodeTxt})` }}</a-select-option>
</a-select>
</template>
<script>
import { getAllUserList } from '@api/api'
export default {
name: 'SelectPrincipal',
props: {
// 绑定值为用户id
value: {
type: String,
required: false,
default: undefined
}
},
data() {
return {
userList: [] // 用户列表
}
},
created() {
this.initUserList()
},
methods: {
/**
* 获取所有用户
*/
initUserList() {
getAllUserList().then(res => {
this.userList = res.result
})
},
},
model: {
prop: 'value',
event: 'change'
}
}
</script>
<style scoped>
</style>