FloatPanelTsjsGis.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div class="panel-tsjs-gis" :class="{ collapse: layoutStore.rightCollapse }">
  3. <div class="options">
  4. <div class="switch" v-for="item in optionList" @click="toggleOption(item)">
  5. <span>{{ item.label }}</span>
  6. <i :class="{ on: item.status }"></i>
  7. </div>
  8. </div>
  9. </div>
  10. </template>
  11. <script setup>
  12. import useLayoutStore from '@/store/layout'
  13. import { AddSingleLayer, toggleMoveCube, toggleMovePath } from '@/utils/map/addLayer'
  14. import { onBeforeUnmount, ref } from 'vue'
  15. const layoutStore = useLayoutStore()
  16. const optionList = ref([
  17. { label: '航线', id: 'airLine', status: false },
  18. { label: '网格', id: 'mesh', status: false },
  19. { label: '建筑物', id: 'buildings', status: false },
  20. ])
  21. function toggleBuildings(status) {
  22. AddSingleLayer({
  23. title: '全市白模',
  24. D_CODE: 'D85030103202409',
  25. id: 'D8503010320240901',
  26. url: 'https://cimweb.zjw.sh.cegn.cn:2008/MapProxyApi/getSceneServer/ptgl/05195418',
  27. visible: status,
  28. opacity: 1,
  29. type: 'scene',
  30. })
  31. AddSingleLayer({
  32. title: '五角场精模',
  33. D_CODE: 'D9999990120241225',
  34. id: 'D9999990120241225',
  35. url: 'https://cimweb.zjw.sh.cegn.cn:2008/MapProxyApi/getSceneServer/gxjh_fwjk/D9999990120241225',
  36. visible: false,
  37. opacity: 1,
  38. type: 'scene',
  39. })
  40. }
  41. function toggleOption(item) {
  42. item.status = !item.status
  43. switch (item.id) {
  44. case 'airLine':
  45. toggleMovePath(item.status)
  46. break
  47. case 'mesh':
  48. toggleMoveCube(item.status)
  49. break
  50. case 'buildings':
  51. toggleBuildings(item.status)
  52. }
  53. }
  54. function clearStatus() {
  55. toggleMovePath(false)
  56. toggleMoveCube(false)
  57. toggleBuildings(false)
  58. }
  59. onBeforeUnmount(() => {
  60. clearStatus()
  61. })
  62. </script>
  63. <style lang="scss" scoped>
  64. .panel-tsjs-gis {
  65. position: absolute;
  66. right: var(--panel-left);
  67. bottom: calc(var(--footer-height) - var(--aside-height));
  68. background-color: rgba(0, 17, 50, 0.5);
  69. border: 1px solid #055f8d;
  70. border-radius: 5px;
  71. visibility: visible;
  72. transition:
  73. right 0.5s ease,
  74. opacity 0.3s ease,
  75. transform 0.3s ease-out;
  76. &.collapse {
  77. right: var(--panel-gap);
  78. }
  79. }
  80. .options {
  81. padding: 15px;
  82. .switch {
  83. display: flex;
  84. align-items: center;
  85. width: fit-content;
  86. cursor: pointer;
  87. &:not(:last-child) {
  88. margin-bottom: 7px;
  89. }
  90. span {
  91. display: block;
  92. width: 55px;
  93. margin-right: 15px;
  94. font-size: 18px;
  95. text-align: right;
  96. }
  97. i {
  98. display: block;
  99. width: 76px;
  100. height: 35px;
  101. background: url('@/assets/images/buttons/switch-off.png');
  102. background-repeat: no-repeat !important;
  103. background-size: cover !important;
  104. transition: all 0.1s ease;
  105. &.on {
  106. background: url('@/assets/images/buttons/switch-on.png');
  107. background-position: -8px center;
  108. }
  109. }
  110. }
  111. }
  112. </style>