SearchBox.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <transition
  3. appear
  4. name="animate__animated animate__move"
  5. enter-active-class="animate__flipInX"
  6. leave-active-class="animate__flipOutX"
  7. >
  8. <div class="widget-SearchBox" ref="widget-SearchBox">
  9. <div class="search">
  10. <el-input placeholder="" v-model="inputText" class="input-with-select" size="small" clearable>
  11. <el-select v-model="selectValue" slot="prepend" placeholder="请选择" :popper-append-to-body="false">
  12. <el-option label="工程" value="1"></el-option>
  13. </el-select>
  14. <el-button slot="append" icon="el-icon-search"></el-button>
  15. </el-input>
  16. </div>
  17. <div class="lifting">
  18. <span>抬升:</span>
  19. <el-input-number v-model="layerdown" size="small" controls-position="right"></el-input-number>
  20. <span class="unit">米</span>
  21. </div>
  22. <div class="setOpacity">
  23. <span>透明度:</span>
  24. <el-input-number v-model="opacity" size="small" controls-position="right" :min="0" :max="100" :step="10">
  25. </el-input-number>
  26. <span class="unit">%</span>
  27. </div>
  28. </div>
  29. </transition>
  30. </template>
  31. <script lang="ts">
  32. import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
  33. import _ from 'lodash'
  34. const Cesium = (window as any).Cesium
  35. const gLayerList = [
  36. 'NETWORK_SJ_PSWS@sxgk#1',
  37. 'NETWORK_SJ_PSYS@sxgk#1',
  38. 'NETWORK_SJ_PSWS_Node@sxgk#1',
  39. 'NETWORK_SJ_PSYS_Node@sxgk#1',
  40. 'TF_SJ_PSYS_JG_B_3D@sxgk#1',
  41. 'TF_SJ_PSYS_JG_B_3D@sxgk#2',
  42. 'TF_SJ_PSWS_JG_B_3D@sxgk#2',
  43. 'TF_SJ_PSWS_JG_B_3D@sxgk#1'
  44. ]
  45. //搜索栏
  46. @Component({ name: 'SearchBox' })
  47. export default class SearchBox extends Vue {
  48. inputText = ''
  49. selectValue = '1'
  50. layerdown = 0
  51. //地表透明度配置
  52. opacity = 0
  53. disVisibleLayers = ['Config']
  54. g_modelTransparent = false
  55. mounted() {
  56. let target = this.$refs['widget-SearchBox'] as any
  57. target.style.setProperty('--left', '2.34375rem')
  58. }
  59. viewer
  60. get mapConfig() {
  61. return this.$store.state.bigScreen.mapConfig
  62. }
  63. get isInitViewer() {
  64. return this.$store.state.bigScreen.isInitViewer
  65. }
  66. @Watch('isInitViewer')
  67. onChangeMethod() {
  68. this.viewer = (window as any).viewer
  69. }
  70. //透明度变化
  71. @Watch('opacity')
  72. changeOpacity(newVal) {
  73. const val = parseFloat(newVal)
  74. const alpha = parseFloat((1 - val / 100).toString())
  75. const layers = this.disVisibleLayers
  76. if (this.g_modelTransparent && layers.length > 0) {
  77. this.viewer.scene.layers.layerQueue.forEach((layer) => {
  78. if (_.indexOf(layers, layer.name) !== -1) {
  79. layer.style3D.fillForeColor.alpha = alpha
  80. }
  81. })
  82. }
  83. this.viewer.scene.globe.globeAlpha = 1 - val / 100
  84. for (var i = 0; i < this.viewer.scene.imageryLayers.length; i++) {
  85. var ly = this.viewer.scene.imageryLayers.get(i)
  86. ly.alpha = alpha
  87. }
  88. }
  89. //管线抬升
  90. @Watch('layerdown')
  91. changeDepth(value) {
  92. let height = parseFloat(value)
  93. if (isNaN(height)) {
  94. return
  95. }
  96. this.mapConfig.upDepth = height
  97. const style3D = new Cesium.Style3D()
  98. style3D.altitudeMode = 0
  99. style3D.bottomAltitude = height
  100. gLayerList.forEach((item) => {
  101. var layer = this.viewer.scene.layers.find(item)
  102. if (layer) {
  103. layer.style3D = style3D
  104. layer.refresh()
  105. }
  106. })
  107. }
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. .animate__flipInX,
  112. .animate__flipOutX {
  113. animation-duration: 3s; //动画持续时间
  114. animation-delay: 0s; //动画延迟时间
  115. }
  116. .widget-SearchBox {
  117. $size10: 0.052083rem /* 10/192 */;
  118. $size20: 0.104167rem /* 20/192 */;
  119. z-index: 2;
  120. //position
  121. top: 0.505208rem /* 97/192 */;
  122. margin-left: var(--left); //2.34375rem /* 450/192 */;
  123. position: absolute;
  124. left: 0;
  125. //size
  126. //background
  127. background-color: rgba(20, 24, 47, 0.5);
  128. color: #eee;
  129. box-shadow: 0 0 20px rgba(1, 9, 20, 1);
  130. //font
  131. font-family: Source Han Sans CN;
  132. .search {
  133. float: left;
  134. margin-right: 0.052083rem /* 10/192 */;
  135. & ::placeholder {
  136. color: rgba(43, 167, 255, 1);
  137. }
  138. /deep/ .el-input {
  139. $backgroundColor: rgba(7, 48, 80, 0.9);
  140. width: 1.25rem /* 240/192 */;
  141. .el-select .el-input {
  142. width: 0.46875rem /* 90/192 */;
  143. }
  144. .el-input__inner {
  145. color: #eee;
  146. background-color: $backgroundColor;
  147. border: none;
  148. }
  149. .el-input-group__append,
  150. .el-input-group__prepend {
  151. background-color: $backgroundColor;
  152. border: none;
  153. color: #2ba7ff;
  154. }
  155. .el-input-group__prepend {
  156. .el-select {
  157. margin: -0.015625rem /* 3/192 */ -0.109375rem /* 21/192 */;
  158. position: relative;
  159. }
  160. .el-input__inner {
  161. font-size: 0.072917rem /* 14/192 */;
  162. font-family: Source Han Sans CN;
  163. font-weight: 500;
  164. color: #2ba7ff;
  165. position: relative;
  166. }
  167. .el-input::after {
  168. content: '';
  169. position: absolute;
  170. top: 0;
  171. bottom: 0;
  172. right: 0;
  173. margin: auto 0;
  174. width: 1px;
  175. height: 80%;
  176. background-color: rgba(41, 177, 255, 0.3);
  177. }
  178. .el-icon-arrow-up:before {
  179. content: '';
  180. display: block;
  181. // 定义元素宽高
  182. margin-top: 0.041667rem /* 8/192 */;
  183. width: 0.130208rem /* 25/192 */;
  184. height: 0.078125rem /* 15/192 */;
  185. background: url('~@/views/groupPage/images/三角下.png') no-repeat center center;
  186. background-size: 100% 100%;
  187. transform: rotate(180deg);
  188. }
  189. }
  190. }
  191. }
  192. .lifting,
  193. .setOpacity {
  194. float: left;
  195. $background: rgba(7, 48, 80, 0.9);
  196. background: $background;
  197. border-radius: 0.010417rem /* 2/192 */;
  198. margin-right: 0.052083rem /* 10/192 */;
  199. span {
  200. padding: 0.052083rem /* 10/192 */ 0 0.052083rem /* 10/192 */ 0.052083rem /* 10/192 */;
  201. font-size: 0.072917rem /* 14/192 */;
  202. font-family: Source Han Sans CN;
  203. font-weight: 500;
  204. color: #82bae2;
  205. }
  206. .unit {
  207. padding: 0.052083rem /* 10/192 */ 0.052083rem /* 10/192 */ 0 0 !important;
  208. }
  209. /deep/ .el-input-number {
  210. width: 0.3125rem /* 60/192 */;
  211. .el-input-group__append,
  212. .el-input-group__prepend {
  213. padding: 0 0.026042rem /* 5/192 */;
  214. }
  215. .el-input__inner {
  216. color: rgba(43, 167, 255, 1);
  217. border: none;
  218. background-color: $background;
  219. position: relative;
  220. padding-right: 0.15625rem /* 30/192 */;
  221. padding-left: 0;
  222. }
  223. .el-input-number__decrease,
  224. .el-input-number__increase {
  225. background: transparent;
  226. border: none;
  227. height: 50%;
  228. }
  229. .el-input-number__increase .el-icon-arrow-up:before {
  230. content: '';
  231. display: block;
  232. // 定义元素宽高
  233. margin-top: 0.010417rem /* 2/192 */;
  234. width: 0.130208rem /* 25/192 */;
  235. height: 0.078125rem /* 15/192 */;
  236. background: url('~@/views/groupPage/images/三角上.png') no-repeat center center;
  237. background-size: 100% 100%;
  238. object-fit: contain;
  239. }
  240. .el-input-number__decrease .el-icon-arrow-down:before {
  241. content: '';
  242. display: block;
  243. // 定义元素宽高
  244. // margin-top: 0.010417rem /* 2/192 */;
  245. width: 0.130208rem /* 25/192 */;
  246. height: 0.078125rem /* 15/192 */;
  247. background: url('~@/views/groupPage/images/三角下.png') no-repeat center center;
  248. background-size: 100% 100%;
  249. object-fit: contain;
  250. }
  251. }
  252. }
  253. }
  254. </style>