lixuliang
2024-04-19 1fef6dcc04ffe09336e4983c2b05962ad901e545
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
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
<template>
  <div>
    <div class="TapContainer">
      <div class="fileContainer">
        <div
          class="fileBtn"
          @mouseover="showFileDetails(true)"
          @mouseout="showFileDetails(false)"
        >
          <i class="el-icon-menu"></i>
        </div>
        <div
          class="fileDetails"
          v-show="fileDetailsShow"
          @mouseover="showFileDetails(true)"
          @mouseout="showFileDetails(false)"
        >
          <ul>
            <div @click.stop>
              <el-upload
                action=""
                :auto-upload="false"
                :show-file-list="false"
                :on-change="openFile"
                accept=".json"
              >
                <li>打开文件</li>
              </el-upload>
            </div>
            <li
              v-for="fileFunc in fileFuncs"
              :key="fileFunc.id"
              @click.stop="btnEvent(fileFunc.func)"
            >
              {{ fileFunc.name }}
            </li>
          </ul>
        </div>
      </div>
 
      <el-tabs
        type="border-card"
        v-model="activeName"
        @tab-click="clickTabs"
        :before-leave="beforeLeave"
      >
        <el-tab-pane
          :key="tab.name"
          v-for="tab in tabs"
          :label="tab.title"
          :name="tab.name"
        >
          <div v-if="!hideTools" class="tabPaneContainer">
            <div
              class="buttondiv"
              :key="button.name"
              v-for="button in tab.content"
            >
              <div class="title">
                {{ button.class }}
              </div>
              <div
                class="ButtonContainer"
                :key="bt.name"
                v-for="bt in button.content"
              >
                <div class="buttonBox" v-if="bt.children">
                  <el-dropdown
                    @command="dropDownClick($event, bt.name)"
                    :popper-append-to-body="false"
                  >
                    <span class="el-dropdown-link">
                      <el-button type="text" class="el-button">
                        <div class="icondiv">
                          <img
                            :src="bt.icon"
                            alt=""
                            width="25px"
                            height="25px"
                          />
                        </div>
                        {{ bt.label }}
                        <i class="el-icon-arrow-down el-icon--right"></i>
                      </el-button>
                    </span>
                    <el-dropdown-menu slot="dropdown">
                      <el-dropdown-item
                        v-for="child in bt.children"
                        :key="child.name"
                        :command="child.name"
                      >
                        {{ child.label }}
                      </el-dropdown-item>
                    </el-dropdown-menu>
                  </el-dropdown>
                </div>
                <div class="buttonBox" v-else>
                  <el-button
                    type="text"
                    class="el-button"
                    :style="
                      bt.checked
                        ? 'color: #409EFF;background: rgba(64, 158, 255, 0.3);'
                        : ''
                    "
                    @click="btnEvent(bt.name, bt)"
                  >
                    <div class="icondiv">
                      <img :src="bt.icon" alt="" width="25px" height="25px" />
                    </div>
                    {{ bt.label }}
                  </el-button>
                </div>
              </div>
            </div>
          </div>
        </el-tab-pane>
      </el-tabs>
      <div class="rightBtn">
        <el-button type="text" class="el-button" @click="exit">
          退出登录
        </el-button>
      </div>
    </div>
    <!-- 功能窗口 -->
    <div class="functions">
      <mapinfo ref="mapinfo" />
      <contour ref="contour" />
      <slope ref="slope" />
      <terrainOutline ref="terrainOutline" />
      <flood ref="flood" />
      <bufferArea ref="bufferArea" />
      <terrainDig ref="terrainDig" />
      <terrainPress ref="terrainPress" />
      <modelPress ref="modelPress" />
      <POISearch ref="POISearch" />
      <routerSearch ref="routerSearch" />
      <spaceSearch ref="spaceSearch" />
      <localtion ref="localtion" />
      <bufferSearch ref="bufferSearch" />
      <skyTexture ref="skyTexture" />
      <undergroundModel ref="undergroundModel" />
      <SunshineAnalysis ref="SunshineAnalysis" />
      <ShadowAnalysis ref="ShadowAnalysis" />
      <DemoAnimation ref="DemoAnimation" />
      <ColorAdjustment ref="colorAdjustment" />
      <Demolition ref="Demolition" />
      <ModelLibrary ref="ModelLibrary" />
      <PathAnimation ref="PathAnimation" />
      <AddVideo ref="AddVideo" />
      <ProjectSeting ref="ProjectSeting" />
      <Gisserver ref="Gisserver" @success="addServerData" />
      <Geoserver ref="Geoserver" @success="addServerData" />
      <Light ref="light" />
      <ImportPolylineVolume
        ref="importPolylineVolume"
        @success="addServerData"
      />
      <EffectCone ref="EffectCone" />
      <Tetrahedron ref="Tetrahedron" />
      <EffectCylinder ref="EffectCylinder" />
      <FlyingLine ref="FlyingLine" />
      <RotateEffectCircle ref="RotateEffectCircle" />
    </div>
  </div>
</template>
<script>
//#region
import baseVuex from "@mixin/baseVuex";
import Bus from "@tools/Bus";
// 各大类工具
import index from "./mixin/index";
import measure from "./mixin/measure";
import layer from "./mixin/layer";
import analyse from "./mixin/analyse";
import scene from "./mixin/scene";
import effect from "./mixin/effect";
import object from "./mixin/object";
import view from "./mixin/view";
// 工具栏配置
import tabs from "@config/config";
// 测量-信息弹窗
import mapinfo from "./mapinfo";
// 各类分析弹窗
import contour from "@c/analysis/contour";
import slope from "@c/analysis/slope";
import terrainOutline from "@c/analysis/terrainOutline";
import flood from "@c/analysis/flood";
import bufferArea from "@c/analysis/bufferArea";
import terrainDig from "@c/analysis/terrainDig";
import terrainPress from "@c/analysis/terrainPress";
import modelPress from "@c/analysis/modelPress";
// 主页-poi查询弹窗
import POISearch from "@c/indexPopup/POISearch";
import routerSearch from "@c/indexPopup/routerSearch";
import spaceSearch from "@c/indexPopup/spaceSearch";
import bufferSearch from "@c/indexPopup/bufferSearch";
import ProjectSeting from "@c/indexPopup/ProjectSeting";
import Light from "@c/indexPopup/Light";
// 场景弹窗
import skyTexture from "@c/scene/skyTexture";
import DemoAnimation from "@c/scene/DemoAnimation";
import ColorAdjustment from "@c/scene/ColorAdjustment";
import Demolition from "@c/scene/Demolition";
import undergroundModel from "@c/scene/undergroundModel";
import SunshineAnalysis from "@c/analysis/SunshineAnalysis";
import ShadowAnalysis from "@c/analysis/ShadowAnalysis";
import ModelLibrary from "@c/tools/ModelLibrary";
import localtion from "@c/scene/location";
//对象弹窗
import PathAnimation from "@c/object/PathAnimation";
import AddVideo from "@c/object/AddVideo";
//服务弹窗
import Gisserver from "@c/indexPopup/Gisserver";
import Geoserver from "@c/indexPopup/Geoserver";
import ImportPolylineVolume from "@c/map/layerTree/ImportPolylineVolume";
// 特效弹窗
import EffectCone from "@c/effect/EffectCone";
import RotateEffectCircle from "@c/effect/RotateEffectCircle";
import EffectCylinder from "@c/effect/EffectCylinder";
import FlyingLine from "@c/effect/FlyingLine";
import Tetrahedron from "@c/effect/Tetrahedron";
 
//#endregion
export default {
  name: "top",
  components: {
    Light,
    POISearch,
    routerSearch,
    spaceSearch,
    bufferSearch,
    mapinfo,
    contour,
    slope,
    terrainOutline,
    flood,
    bufferArea,
    terrainDig,
    terrainPress,
    modelPress,
    skyTexture,
    ColorAdjustment,
    undergroundModel,
    SunshineAnalysis,
    ShadowAnalysis,
    DemoAnimation,
    Demolition,
    ModelLibrary,
    PathAnimation,
    AddVideo,
    ProjectSeting,
    localtion,
    Gisserver,
    Geoserver,
    ImportPolylineVolume,
    EffectCone,
    Tetrahedron,
    RotateEffectCircle,
    FlyingLine,
    EffectCylinder,
  },
  mixins: [
    baseVuex,
    index,
    measure,
    layer,
    analyse,
    scene,
    effect,
    object,
    view,
  ],
  data() {
    return {
      tabs: [],
      activeName: "index",
      clickTime: undefined,
      // 左侧文件下拉列表
      fileDetailsShow: false,
      fileFuncs: [
        { id: "001", name: "添加数据", func: "addFile" },
        { id: "002", name: "保存文件", func: "saveFile" },
      ],
    };
  },
  mounted() {
    this.tabs = tabs.tabs;
    Bus.$off("checkTab");
    Bus.$on("checkTab", (name, checked) => {
      let tab = this.getTabByName(name);
      if (tab) {
        tab.checked = checked;
      }
    });
  },
  methods: {
    getTabByName(name) {
      let names = name.split("/");
      let _tab;
      let tabs = this.tabs;
      for (let nameIndex = 0; nameIndex < names.length; nameIndex++) {
        for (let tabIndex = 0; tabIndex < tabs.length; tabIndex++) {
          if (tabs[tabIndex].name === names[nameIndex]) {
            if (nameIndex === names.length - 1) {
              _tab = tabs[tabIndex];
            } else {
              tabs = tabs[tabIndex].content;
            }
            break;
          }
        }
      }
      return _tab;
    },
    showFileDetails(show) {
      this.fileDetailsShow = show;
    },
    // 退出
    exit() {
      localStorage.removeItem("loginscene");
      this.$router.push({
        name: "login",
      });
    },
    // 打开文件
    openFile(file) {
      Bus.$emit("openFile", file);
    },
    // 添加数据
    addFile() {
      Bus.$emit("addFile");
    },
    // 保存文件
    saveFile() {
      Bus.$emit("saveFile");
    },
    // 点击tap栏
    clickTabs() {
      if (this.clickTime && new Date().getTime() - this.clickTime < 200) {
        // 双击-改变工具栏显示状态
        this.changeMapToolsVisible("hideTools");
        return;
      }
      this.clickTime = new Date().getTime();
    },
    // 切换标签之前的钩子
    beforeLeave() {
      // 单击Tab栏-如果隐藏则显示
      if (this.hideTools) {
        this.changeMapToolsVisible("hideTools");
      }
      return true;
    },
    // 提示信息
    message(type, info) {
      this.$notify({
        message: info,
        type: type,
        duration: "1000",
        offset: 140,
      });
    },
    // 点击事件
    btnEvent(type, btn) {
      if (this[type]) {
        this[type](btn);
      } else {
        this.$message("待开发...");
      }
    },
    // 下拉框点击事件
    dropDownClick(type, parentName) {
      // 二维军标 三维军标
      if (parentName == "twoDArmyLabel" || parentName == "threeDArmyLabel") {
        this.armyLabel(type, parentName);
      }
      // 2D图形 3D图形
      else if (parentName == "twoDGraph" || parentName == "threeDGraph") {
        this.graphObject(type, parentName);
      }
      // 通视
      else if (parentName == "lineOfSight") {
        this.lineSight(type);
      } else if (this[type]) {
        this[type]();
      } else {
        this.$message("待开发...");
      }
    },
  },
};
</script>
 
<style scoped lang="less">
.fileContainer {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1000;
 
  .fileDetails {
    ul {
      width: 150px;
 
      li {
        text-align: center;
        padding-top: 10px;
        cursor: pointer;
        width: 150px;
        height: 30px;
        background-color: rgb(71, 71, 71);
        color: white;
 
        &:hover {
          color: #fff;
          background: rgb(107, 107, 107);
        }
      }
    }
 
    /deep/ .el-upload {
      cursor: default;
      display: block;
    }
  }
 
  .fileBtn {
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    cursor: pointer;
    background-color: rgb(71, 71, 71);
    border: none;
    color: white;
 
    &:hover {
      color: rgb(231, 225, 225);
    }
  }
}
 
.rightBtn {
  position: absolute;
  right: 10px;
  top: 0;
  z-index: 1000;
  .el-button {
    height: 40px;
  }
}
 
/deep/ .el-tabs__header {
  margin-left: 40px !important;
}
.el-dropdown-link {
  cursor: pointer;
  color: #fff;
  font-size: 12px;
}
.el-icon-arrow-down {
  font-size: 12px;
}
.el-dropdown-menu__item {
  color: #fff;
  background-color: rgb(71, 71, 71);
  border: none;
}
.el-dropdown-menu__item:hover {
  background-color: rgb(71, 71, 71) !important;
  color: #409eff !important;
}
.el-dropdown-menu {
  background-color: rgb(71, 71, 71);
  border: none;
}
/deep/ .el-radio__label {
  color: white;
}
.tabPaneContainer {
  padding: 5px 10px;
  height: 79px;
  overflow: hidden;
}
.buttondiv,
.ButtonContainer {
  display: inline-block;
}
.icondiv {
  font-size: 20px;
  margin-bottom: 5px;
}
.buttondiv {
  border-right: 2px solid rgb(71, 71, 71);
  margin-right: 7px;
}
.buttonBox {
  font-size: 12px;
}
.buttondiv:last-child {
  border-right: 0;
}
.title {
  color: rgb(192, 192, 192);
}
.el-button {
  padding: 0 10px;
  margin: 0 1px;
  height: 60px;
  color: #fff;
}
.ButtonContainer :hover {
  color: rgb(102, 177, 255);
}
/deep/ .el-tabs__item:hover {
  color: rgb(231, 225, 225) !important;
}
/deep/ .el-tabs__item:focus {
  background: rgb(107, 107, 107) !important;
  color: #fff !important;
}
/deep/ .el-tabs__item,
/deep/ .el-tabs__nav-scroll {
  background: rgb(71, 71, 71) !important;
  color: #fff;
  height: 40px;
  border: none !important;
}
/deep/ .el-tabs__content {
  background: rgb(107, 107, 107) !important;
  border: none !important;
  padding: 0 !important;
}
/deep/ .el-tabs--border-card {
  border: none;
}
/deep/ .el-tabs--border-card > .el-tabs__header {
  border-bottom: 0px;
}
/deep/ .el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active {
  color: #fff;
  background: rgb(107, 107, 107) !important;
}
/deep/ .popper__arrow,
/deep/ .popper__arrow:after {
  border-style: none !important; //bug
}
</style>