<template> <div id="spaceSelect"> <span class="buildFloor" style="padding-right:12px">业务空间</span> <el-select v-model="value" placeholder="请选择" :props="props" filterable :style="isWidth ? '' : 'width:160px;'" size="small" @change="changeVal"> <el-option v-for="(item, key) in options" :key="key" :label="item.Name" :value="item.Code"></el-option> </el-select> </div> </template> <script> import { queryDictionaryHead } from '@/api/scan/request'; export default { props: { isWidth: { type: Boolean, default: true } }, data() { return { value:null, spaceVal: null,//值 options: [], props: { isWidth:false } } }, methods: { //获取下拉框数据 getOptionData() { let pa = { Filters: `parentId = 'Space'` } queryDictionaryHead(pa, res => { this.options = res.Content.map(t => { if (t.Name == "元空间") { return undefined; } return t; }).filter(item => item); this.options.unshift({Code:null, CreateTime:null, LastUpdate:null, Name:'全部', ObjectType: null, ParentId: null, Statistics: {}}); }) }, //改变空间 changeVal(value) { this.$emit('change', value) } }, created() { this.getOptionData(); } } </script> <style lang="less" scoped> #spaceSelect { float: left; margin-left: 10px; .buildFloor { color: #999999; font-size: 14px; } } </style>