Surpriseplus
2022-11-12 50f52beb0ed100105166f62027cd0b15e6b596dc
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
<template>
  <div class="archive">
    <div class="left_active">
      <el-card class="arch_card">
        <div class="title_active">{{ $t('archive.name') }}</div>
        <el-divider />
        <el-tree
          ref="tree"
          :data="tree"
          :props="defaultProps"
          show-checkbox
          default-expand-all="true"
        />
      </el-card>
    </div>
    <div class="right_active">
      <el-card class="arch_card">
        <div>
          <el-form :inline="true" :model="formInline" class="demo-form-inline">
            <el-form-item>
              <el-input
                v-model="formInline.name"
                placeholder="请输入"
              ></el-input>
            </el-form-item>
            <el-form-item>
              <el-button plain @click="getArchTableData">查询</el-button>
            </el-form-item>
            <el-form-item>
              <el-button plain>重置</el-button>
            </el-form-item>
            <el-form-item>
              <el-button plain>下载</el-button>
            </el-form-item>
            <el-form-item>
              <el-button plain @click="showDialogBox">空间查询</el-button>
            </el-form-item>
          </el-form>
        </div>
        <el-divider />
        <div class="centerBox">
          <el-collapse v-model="activeNames" @change="handleChange" accordion>
            <el-collapse-item
              v-for="(item, index) in companyList"
              :key="index"
              :name="item.entity"
              :title="item.tabDesc"
            >
              <div class="centerTable">
                <el-table :data="tableData" height="550" border stripe>
                  <el-table-column type="selection" width="55" />
                  <el-table-column
                    align="center"
                    type="index"
                    label="序号"
                    width="50"
                  />
                  <el-table-column
                    v-for="(item, index) in attributeData"
                    :key="index"
                    :label="item.alias"
                    :prop="item.field"
                    show-overflow-tooltip
                    align="center"
                  ></el-table-column>
                </el-table>
                <el-divider />
                <el-pagination
                  :current-page="listdata.pageIndex"
                  :page-sizes="[10, 20, 30, 40]"
                  :page-size="listdata.pageSize"
                  :small="small"
                  :disabled="disabled"
                  :background="background"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="count"
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                />
              </div>
            </el-collapse-item>
          </el-collapse>
        </div>
      </el-card>
    </div>
 
    <el-dialog
      title="空间查询"
      :visible.sync="dialogVisible"
      width="92%"
      style="margin-left: 16%"
      top="5vh"
      :before-close="handleClose"
    >
      <div style="height: 720px; width: 100%">
        <mapsdk></mapsdk>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import mapsdk from '../../components/mapsdk.vue';
import {
  inquiry_SelectTabs,
  dataLib_selectFields,
  dataLib_selectByPage,
  dataLib_selectDomains,
} from '../../api/api.js';
export default {
  components: {
    mapsdk,
  },
  data() {
    return {
      dialogVisible: false,
      activeNames: null,
      listdata: {
        pageIndex: 1,
        pageSize: 10,
        filter: null,
        name: null,
        wkt: null,
      },
      companyList: [],
      formInline: {},
      count: 0,
      tree: [
        {
          tabDesc: '基础数据',
          value: 'BD',
          children: [],
        },
        {
          tabDesc: '业务数据',
          value: 'BS',
          children: [],
        },
      ],
      defaultProps: {
        chilren: 'children', //"children"内的每个对象解析为一个子项;
        label: 'tabDesc', //所有"label"所在的对象解析为一个父项
      },
      attributeData: [],
      tableData: [],
      archStatus: {
        download: false,
      },
      archOption: [],
      queryLayer: null,
    };
  },
 
  methods: {
    handleClose() {
      this.dialogVisible = false;
      this.$store.state.mapMenuBoolean = false;
      this.$store.state.mapMenuBoxFlag = null;
      this.$store.state.mapPopBoolean = false;
      this.$store.state.mapPopBoxFlag = null;
    },
    showDialogBox() {
      this.$store.state.mapMenuBoolean = true;
      this.$store.state.mapMenuBoxFlag = '1';
      this.dialogVisible = true;
    },
    //获取表格数据
    getArchTableData() {
      this.companyList = [];
      this.activeNames = null;
      var valTree = this.$refs.tree.getCheckedNodes();
      if (valTree.length == 0) {
        this.$message.error('请选择要查询的图层资料!');
        return;
      }
      for (var i in valTree) {
        this.listdata.name = valTree[i].entity;
        var filedData = this.getCollapseDomFiled();
        this.archOption.push({
          name: valTree[i].entity,
          fileds: filedData,
          table: this.getCollapseTable(filedData),
        });
      }
 
      this.companyList = valTree;
    },
    //获取每个表字段名称及阈值
    async getCollapseDomFiled() {
      //查询字段信息;
      const fileds = await dataLib_selectFields({
        name: this.listdata.name,
      });
      if (fileds.code != 200) {
        this.$message.error('调用列表失败,请联系工作人员!');
        return;
      }
      //查询阈值信息;
      const domains = await dataLib_selectDomains({
        name: this.listdata.name,
      });
      if (domains.code != 200) {
        this.$message.error('调用列表失败,请联系工作人员!');
        return;
      }
      var data1 = fileds.result;
      var data2 = domains.result;
      var std = [];
      for (var i in data1) {
        if (data1[i].showtype == 1) {
          if (data1[i].domainNa != null) {
            data1[i].domainNa = this.getDomainNaFild(data1[i].domainNa, data2);
          }
          std.push(data1[i]);
        }
      }
      return std;
    },
    //值域字段匹配
    getDomainNaFild(res, result) {
      for (var i in result) {
        if (result[i].domName == res) {
          return result[i].codeDesc;
        }
      }
      return null;
    },
 
    //获取每个表的table
    async getCollapseTable(res) {
      var res_val;
      res.then((val) => {
        res_val = val;
      });
 
      if (this.formInline.name != null) {
        this.listdata.filter = 'name like ' + this.formInline.name;
      }
      const fileds = await dataLib_selectByPage(this.listdata);
      if (fileds.code != 200) {
        this.$message.error('调用列表失败,请联系工作人员!');
        return;
      }
      for (var i in fileds.result) {
        let val_Data = fileds.result[i];
 
        for (var j in res_val) {
          if (res_val[j].domainNa != null && res_val[j].domainNa != undefined) {
            val_Data[res_val[j].field] = res_val[j].domainNa;
          }
        }
      }
      return fileds;
    },
 
    //折叠面板切换事件
    handleChange(val) {
      if (val == '') return;
      var that = this;
      this.listdata.name = val;
      this.listdata.pageSize = 10;
      this.listdata.pageIndex = 1;
      for (var i in this.archOption) {
        if (this.archOption[i].name == val) {
          this.queryLayer = this.archOption[i].fileds;
          this.archOption[i].fileds.then((res) => {
            that.attributeData = res;
          });
          this.archOption[i].table.then((res) => {
            this.count = res.count;
            this.tableData = res.result;
          });
        }
      }
    },
    //分页点击事件
    handleSizeChange(val) {
      this.listdata.pageSize = val;
      this.listdata.pageIndex = 1;
      var res = this.getCollapseTable(this.queryLayer);
      res.then((res) => {
        this.tableData = res.result;
      });
    },
    handleCurrentChange(val) {
      this.listdata.pageIndex = val;
      var res = this.getCollapseTable(this.queryLayer);
      res.then((res) => {
        this.tableData = res.result;
      });
    },
    //获取树
    async getTreeData() {
      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;
        if (option[i].ns == 'bd') {
          this.tree[0].children.push(val_Data);
        } else {
          this.tree[1].children.push(val_Data);
        }
      }
    },
    //权限管理
    showArchMenu(res) {
      switch (res.tag) {
        case '/download':
          this.archStatus.download = true;
          break;
      }
    },
  },
  created() {
    var val = this.$store.state.currentPerms;
    var permsEntity = this.$store.state.permsEntity;
    for (var i = 0; i < permsEntity.length; i++) {
      if (permsEntity[i].perms == val) {
        // this.showMenuChange(permsEntity[i], permsEntity);
        this.showArchMenu(permsEntity[i]);
      }
    }
    this.getTreeData();
  },
};
</script>
 
<style scped lang="less">
.archive {
  width: 100%;
  height: 100%;
  position: relative;
}
 
.archive .left_active {
  width: 21%;
  height: 100%;
  float: left;
}
 
.archive .right_active {
  width: 78.5%;
  height: 100%;
  float: right;
}
.archive .arch_card {
  width: 100%;
  height: 100%;
}
.archive .centerBox {
  max-height: 800px;
  overflow: auto;
}
 
.archive .centerBox::-webkit-scrollbar {
  /*滚动条整体样式*/
  width: 10px; /*高宽分别对应横竖滚动条的尺寸*/
  height: 1px;
}
.archive .centerBox::-webkit-scrollbar-thumb {
  /*滚动条里面小方块*/
  border-radius: 10px;
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  background: #e5e5e5;
}
.archive .centerBox::-webkit-scrollbar-track {
  /*滚动条里面轨道*/
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  background: #ffffff;
}
 
.archive .centerTable {
  height: 600px;
}
.archive .arch_card .el-card__body {
  padding: 10px;
  overflow-y: auto;
}
 
.archive .el-divider--horizontal {
  margin: 10px 0 !important;
}
.archive .left_active .title_active {
  font-size: 22px;
  font-family: Microsoft YaHei;
  font-weight: bold;
  color: #3b4d6e;
}
.archive .middle_div {
  border: 1px solid red;
}
.archive .middle_card {
  width: 100%;
  height: 81vh;
  border: transparent;
}
 
.archive .el-table .warning-row {
  --el-table-tr-bg-color: var(--el-color-warning-light-9);
}
</style>