spaceSelect.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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, key) in options" :key="key" :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. this.options.unshift({Code:null, CreateTime:null, LastUpdate:null, Name:'全部', ObjectType: null, ParentId: null, Statistics: {}});
  42. })
  43. },
  44. //改变空间
  45. changeVal(value) {
  46. this.$emit('change', value)
  47. }
  48. },
  49. created() {
  50. this.getOptionData();
  51. }
  52. }
  53. </script>
  54. <style lang="less" scoped>
  55. #spaceSelect {
  56. float: left;
  57. margin-left: 10px;
  58. .buildFloor {
  59. color: #999999;
  60. font-size: 14px;
  61. }
  62. }
  63. </style>