管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2022-12-13 950c7bf191b173b45eedd08fd2d576bb093186ca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<template>
  <div class="spaceBox">
    <el-select v-model="menuTopFrom.queryLayer" placeholder="请选择...">
      <el-option :value="menuTopFrom.queryLayer" style="height: 100%">
        <div style="height: 200px; overflow: auto">
          <el-tree
            :data="layerData"
            :props="defaultProps"
            :show-checkbox="true"
            :check-on-click-node="true"
            :check-strictly="true"
            node-key="id"
            @check="menuTreeCheck"
            ref="treeForm"
            :default-expanded-keys="[1]"
            accordion
          >
          </el-tree>
        </div>
        <div style="margin-top: 5px">
          <el-button size="mini" plain @click="getCheckedNodes">确认</el-button>
          <el-button size="mini" type="info" plain @click="resetCheckedNodes"
            >重置</el-button
          >
        </div>
      </el-option>
    </el-select>
  </div>
</template>
 
<script>
import { inquiry_SelectTabs } from '../../api/api.js';
export default {
  data() {
    return {
      menuTopFrom: {
        queryLayer: '',
      },
      layerData: [
        {
          id: 1,
          label: '基础数据',
          tabDesc: '基础数据',
          value: 'BD',
          children: [],
        },
        {
          id: 2,
          label: '基础数据',
          tabDesc: '业务数据',
          value: 'BS',
          children: [],
        },
      ],
      defaultProps: {
        children: 'children',
        label: 'label',
      },
      mapSpaceQueryLayer: null,
    };
  },
  mounted() {
    this.getAllTable();
  },
  methods: {
    async getAllTable() {
      const data = await inquiry_SelectTabs();
      if (data.code != 200) {
        this.$message.error('列表调用失败');
      }
      var option = data.result;
 
      for (var i in option) {
        var val_Data = option[i];
        val_Data.id = '1' + i;
        val_Data.label = val_Data.tabDesc + '(' + val_Data.tab + ')';
        if (option[i].ns == 'bd') {
          this.layerData[0].children.push(val_Data);
        } else {
          this.layerData[1].children.push(val_Data);
        }
      }
    },
    getCheckedNodes() {
      this.$store.state.mapSpaceQueryLayer = this.mapSpaceQueryLayer;
      this.$store.state.mapPopBoolean = true;
      this.$store.state.mapPopBoxFlag = '2';
    },
    resetCheckedNodes() {
      this.menuTopFrom.queryLayer = null;
      this.$refs.treeForm.setCheckedKeys([]);
    },
    menuTreeCheck(node, list) {
      if (list.checkedNodes.length > 0) {
        this.menuTopFrom.queryLayer = node.tabDesc;
        this.mapSpaceQueryLayer = node.entity;
        if (list.checkedKeys.length == 2) {
          //单选实现
          this.$refs.treeForm.setCheckedKeys([node.id]);
        }
      } else {
        this.menuid = null;
      }
    },
  },
};
</script>
 
<style scoped lang="less">
.spaceBox {
  width: 98%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
</style>
<style lang="less" scoped>
.el-tree .el-tree-node .is-leaf + .el-checkbox .el-checkbox__inner {
  display: inline-block;
}
.el-tree .el-tree-node .el-checkbox .el-checkbox__inner {
  display: none;
}
 
/deep/.el-form-item__label {
  color: white;
}
/deep/.el-input__inner {
  background-color: transparent !important ;
  color: #fff !important;
  border: 1px solid;
}
 
/deep/ .el-input__inner {
  border-color: #fff !important;
}
/deep/.el-select-dropdown {
  border-color: white;
  opacity: 0.85;
}
</style>