spaceSelect.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <div id="spaceSelect">
  3. <span class="buildFloor" style="padding-right:12px">业务空间</span>
  4. <el-select v-model="value" placeholder="请选择" :props="props" filterable :style="isWidth ? '' : 'width:160px;'" size="small" @change="changeVal">
  5. <el-option v-for="item in options" :key="item.Code" :label="item.Name" :value="item.Code"></el-option>
  6. </el-select>
  7. </div>
  8. </template>
  9. <script>
  10. import { queryDictionaryHead } from '@/api/scan/request';
  11. export default {
  12. props: {
  13. isWidth: {
  14. type: Boolean,
  15. default: true
  16. }
  17. },
  18. data() {
  19. return {
  20. value:null,
  21. spaceVal: null,//值
  22. options: [],
  23. props: {
  24. isWidth:false
  25. }
  26. }
  27. },
  28. methods: {
  29. //获取下拉框数据
  30. getOptionData() {
  31. let pa = {
  32. Filters: `parentId = 'Space'`
  33. }
  34. queryDictionaryHead(pa, res => {
  35. this.options = res.Content.map(t => {
  36. if (t.Name == "元空间") {
  37. return undefined;
  38. }
  39. return t;
  40. }).filter(item => item);
  41. })
  42. },
  43. //改变空间
  44. changeVal(value) {
  45. this.$emit('change', value)
  46. }
  47. },
  48. created() {
  49. this.getOptionData();
  50. }
  51. }
  52. </script>
  53. <style lang="less" scoped>
  54. #spaceSelect {
  55. float: left;
  56. margin-left: 10px;
  57. .buildFloor {
  58. color: #999999;
  59. font-size: 14px;
  60. }
  61. }
  62. </style>