局长信箱-内网端(前端)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

51 lines
1.1 KiB

<template>
<el-select
v-model="value"
filterable
placeholder="请选择"
:loading="loading"
@change="handleChange">
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.empNo"
>{{ item.name + ' ' + item.empNo }}</el-option>
</el-select>
</template>
<script setup>
import { listByCurrentDept } from '@/api/perms/admin'
const loading = ref(false)
const options = ref([])
const props = defineProps({
data: {
type: Object,
default: null
}
})
console.log('props', props.data)
const value = ref(props.data ? props.data.empNo : '')
watch(() => props.data, () => {
console.log('watch', props.data)
})
const emit = defineEmits(['update:data', 'select'])
getList();
function getList() {
listByCurrentDept().then(data => {
loading.value = false
options.value = data
})
}
function handleChange(empNo) {
emit('update:data', options.value.filter(item => item.empNo === empNo)[0])
emit('select')
}
</script>
<style lang="scss" scoped>
</style>