ah_jjzhgd_webservice/ah-jjzhgd-web/src/views/device/sideband/components/DeviceSelect.vue

56 lines
1021 B
Vue

<template>
<el-select v-model="currentOption" placeholder="请选择" style="width: 100%" clearable @change="handleChange">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<script>
import { getDictSelectList } from '@/api/public'
export default {
name: 'DeviceSelect',
props: ['bindValue', 'disabled'],
data() {
return {
options: []
}
},
computed: {
currentOption: {
get() {
return this.bindValue
},
set(val) {
this.$emit('update:bindValue', val)
}
}
},
mounted() {
this.getList()
},
methods: {
getList() {
getDictSelectList(350).then(res => {
this.options = res.data.map(item => {
const { id, name } = item
return {
value: id,
label: name
}
})
})
},
handleChange(value) {
}
}
}
</script>
<style scoped lang="less"></style>