index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002
  1. <template>
  2. <div id="viewDiv">
  3. <!-- <tf-dialog
  4. :show.sync="panels.tfDialog.Show"
  5. :hide.sync="panels.tfDialog.Hide"
  6. :set-size.sync="panels.tfDialog.setSize"
  7. /> -->
  8. <el-container style="height: 100%; width: 100%">
  9. <el-container
  10. :style="{
  11. height: 'calc(100% - ' + footer_height + ')',
  12. width: '100%'
  13. }"
  14. >
  15. <el-main>
  16. <!-- <float-panels :data='FloatPanels' @handelClose='handelClose'></float-panels> -->
  17. <!-- <div
  18. id="antherPanel"
  19. ref="antP"
  20. style="width: 100%; display: none; width: calc(50% - 2px); height: 100%; float: left"
  21. > -->
  22. <!-- <div class="qufen" style="left:calc(50% - 175px)"><span>副视图</span><span>主视图</span></div> -->
  23. <!-- </div> -->
  24. <!-- <div
  25. style="
  26. display: none;
  27. width: 4px;
  28. height: 100%;
  29. background: #ccc;
  30. z-index: 2;
  31. float: left;
  32. position: relative;
  33. "
  34. /> -->
  35. <div id="mapView" class="mapView">
  36. <!-- <cesium-map></cesium-map> -->
  37. <!-- <div
  38. id="any"
  39. ref="any"
  40. style="position: absolute; left: calc(50% - 250px); top: calc(50% - 150px);display:none;width:600px;border"
  41. >
  42. <div
  43. id="any_title"
  44. class="label"
  45. style="width: 100%; height: 40px; background: rgb(45, 116, 231); border-radius: 5px 5px 0px 0px"
  46. >
  47. <div
  48. class="label"
  49. style="float: left; color: #fff; font-size: 18px; padding-left: 20px; padding-top: 10px"
  50. >
  51. 分析结果
  52. </div>
  53. <span
  54. class="label"
  55. style="float: right; cursor: pointer; color: #fff; margin-right: 10px; margin-top: 10px"
  56. @click="closeAny"
  57. ><i class="el-icon-close"
  58. /></span>
  59. </div>
  60. <div
  61. id="any_contant"
  62. style="
  63. width: 100%;
  64. height: 400px;
  65. background: #fff;
  66. border: 1px solid rgb(218, 218, 218);
  67. border-radius: 0px 0px 5px 5px;
  68. "
  69. />
  70. </div> -->
  71. <!-- 视图工具 -->
  72. <!-- <WidgetGroup :map-view="view" :that="this" /> -->
  73. <!-- 测量工具 -->
  74. <!-- <MeasureTool :map-view="view" /> -->
  75. <!-- 查询 -->
  76. <!-- <QueryTool :map-view="view" :that="this" /> -->
  77. <!-- 鹰眼 -->
  78. <!-- <OverviewMap :map-view="view" /> -->
  79. <!-- 弹出框 -->
  80. <!-- <popupWindow v-if="view" ref="popupWindow" :map="view"></popupWindow> -->
  81. </div>
  82. <!-- 左下角工具栏 -->
  83. <!-- <leftBottomTool
  84. :toolList="leftBottomTool.children"
  85. :map="view"
  86. v-if="leftBottomTool && leftBottomTool.children && leftBottomTool.children.length > 0"
  87. ></leftBottomTool> -->
  88. <!-- 右下角工具栏 -->
  89. <!-- <rightBottomTool
  90. :toolList="rightBottomTool.children"
  91. :map="view"
  92. v-if="rightBottomTool && rightBottomTool.children && rightBottomTool.children.length > 0"
  93. ></rightBottomTool> -->
  94. <!-- 右上角工具栏 -->
  95. <!-- <rightTopTool
  96. :toolList="rightTopTool.children"
  97. :map="view"
  98. :rootPage="this"
  99. v-if="rightTopTool && rightTopTool.children && rightTopTool.children.length > 0"
  100. ></rightTopTool> -->
  101. <!-- 左上角工具栏 -->
  102. <!-- <leftTopTool
  103. :toolList="leftTopTool.children"
  104. :map="view"
  105. v-if="leftTopTool && leftTopTool.children && leftTopTool.children.length > 0"
  106. ></leftTopTool> -->
  107. <!-- <div v-show="labelShow" id="mapLabel">
  108. <span id="mapView_title">地图图例</span>
  109. <span id="mapView_close" ref="legend_close" title="收缩" @click="legendClick">▼</span>
  110. <div id="mapView_legend" ref="legend" style="height: 350px" />
  111. </div> -->
  112. <!-- 公共图例 -->
  113. <!-- <transition name="el-zoom-in-top">
  114. <div v-show="showMapLengend" class="map-legend">
  115. <div class="map-legend-title">
  116. <span>图例</span> -->
  117. <!-- <span ref="legendCloser" style="float: right; cursor: pointer" title="收缩" @click="legendChange">▼</span> -->
  118. <!-- </div>
  119. <div v-show="showLegendBox" class="map-legend-item" v-for="(item, index) in legendData" :key="index">
  120. <div style="flex: 0.3; text-align: center">
  121. <div :class="'map-legend-' + item.type" :style="'background-color:' + item.color"></div>
  122. </div>
  123. <div style="flex: 0.7; text-align: center">
  124. <div class="map-legend-label">{{ item.label }}</div>
  125. </div>
  126. </div>
  127. </div>
  128. </transition> -->
  129. <!-- <div></div> -->
  130. <float-panels :panels="FloatPanels" :data="panels" />
  131. <div id="map-index-floatPanels" ref="floatPanels" />
  132. <!-- width: side_width,
  133. 'user-drag': 'none',
  134. height: '620px', -->
  135. <!-- draggable="true"
  136. @dragstart.native="dragstart($event)"
  137. @dragend.native="dragend($event)" -->
  138. <!-- @dragover.prevent -->
  139. <!-- width: $store.state.specialWidth || side_width, -->
  140. <!-- position: 'fixed',
  141. right: elLeft+'px',
  142. top: elTop+'px', -->
  143. <!-- <el-aside
  144. :style="{
  145. width: side_width,
  146. 'user-drag': 'none',
  147. height: '620px',
  148. borderRadius: '5px',
  149. }"
  150. >
  151. <side-panels
  152. :panels="Panels"
  153. :data="panels"
  154. :side-width.sync="side_width"
  155. :panel-visible.sync="sidepanel_visible"
  156. @handelClose="handelClose"
  157. />
  158. </el-aside> -->
  159. </el-main>
  160. <el-aside :style="{ width: side_width, height: '100%' }">
  161. <side-panels
  162. :panels="Panels"
  163. :data="panels"
  164. :side-width.sync="side_width"
  165. :panel-visible.sync="sidepanel_visible"
  166. @handelClose="handelClose"
  167. />
  168. </el-aside>
  169. </el-container>
  170. <el-footer :style="{ height: footer_height, width: '100%', padding: '0px' }">
  171. <half-panels
  172. :panels="HalfPanels"
  173. :data="panels"
  174. :footer-height.sync="footer_height"
  175. :default-height.sync="halfpanel_defaultHeight"
  176. :panel-visible.sync="halfpanel_visible"
  177. :fullpanel-visible.sync="fullpanel_visible"
  178. :style="{ display: fullpanel_visible ? 'none' : 'block' }"
  179. @handelClose="handelClose()"
  180. />
  181. <full-panels
  182. :panels="FullPanels"
  183. :data="panels"
  184. :footer-height.sync="footer_height"
  185. :panel-visible.sync="fullpanel_visible"
  186. :halfpanel-visible.sync="halfpanel_visible"
  187. :style="{ display: !fullpanel_visible ? 'none' : 'block' }"
  188. @handelClose="handelClose()"
  189. />
  190. </el-footer>
  191. </el-container>
  192. </div>
  193. </template>
  194. <script lang="ts">
  195. import { Vue, Component, Watch, Prop } from 'vue-property-decorator'
  196. // import 'ol/ol.css'
  197. // import Map from 'ol/Map'
  198. // import View from 'ol/View'
  199. // import TileLayer from 'ol/layer/Tile'
  200. // import { Logo, TileSuperMapRest, SuperMap, LayerInfoService } from '@supermap/iclient-ol'
  201. // import axios from 'axios'
  202. // import Comps from '@/layout/components/loadComps'
  203. import { HalfPanels, FullPanels, FloatPanels, SidePanels } from '@/layout/components/index'
  204. // import { appconfig } from 'staticPub/config'
  205. // import { loadCss } from '@/utils/loadResources'
  206. // import request from '@/utils/request'
  207. // import tfDialog from './common/Dialog.vue'
  208. // import WidgetGroup from './tongyonggongju/widgetGroup/widget.vue'
  209. // import MeasureTool from './tongyonggongju/measureTool/widget.vue'
  210. // import QueryTool from './tongyonggongju/queryTool/widget.vue'
  211. // import SimpleQueryTool from './tongyonggongju/simpleQueryTool/widget.vue'
  212. // import leftBottomTool from './tongyonggongju/leftBottomTool/widget.vue'
  213. // import leftTopTool from './tongyonggongju/leftTopTool/widget.vue'
  214. // import rightBottomTool from './tongyonggongju/rightBottomTool/widget.vue'
  215. // import rightTopTool from './tongyonggongju/rightTopTool/widget.vue'
  216. // import popupWindow from '@/components/PopupWindow/popupWindow.vue'
  217. import cesiumMap from '@/views/widgets/cesiumMap.vue'
  218. // 投影
  219. // import { Projection, addProjection, get as getProjection, fromLonLat, transform } from 'ol/proj'
  220. // import { register as olRegisterProj } from 'ol/proj/proj4'
  221. // import proj4 from 'proj4'
  222. // import { Feature } from 'ol'
  223. // import { LineString } from 'ol/geom'
  224. // import VectorLayer from 'ol/layer/Vector'
  225. // import VectorSource from 'ol/source/Vector'
  226. // import { comSymbol } from '@/utils/comSymbol'
  227. // import { LegendConfig } from '@/views/zhpt/common/legendConfig'
  228. // import { mapUtil } from '@/views/zhpt/common/mapUtil/common'
  229. // import { TF_Layer } from '@/views/zhpt/common/mapUtil/layer'
  230. // import { Polygon } from 'ol/geom'
  231. // import { WMTS } from 'ol/source'
  232. // import * as olExtent from 'ol/extent'
  233. // import WMTSTileGrid from 'ol/tilegrid/WMTS'
  234. // import * as olProj from 'ol/proj'
  235. // import { defaults as controls } from 'ol/control'
  236. // import * as turf from '@turf/turf'
  237. // import iQuery from './common/mapUtil/query'
  238. // import { unByKey } from 'ol/Observable'
  239. // import GeoJSON from 'ol/format/GeoJSON'
  240. @Component({
  241. components: {
  242. HalfPanels,
  243. FullPanels,
  244. FloatPanels,
  245. SidePanels,
  246. // tfDialog,
  247. // WidgetGroup,
  248. // MeasureTool,
  249. // QueryTool,
  250. // SimpleQueryTool,
  251. // leftBottomTool,
  252. // leftTopTool,
  253. // rightBottomTool,
  254. // rightTopTool,
  255. // popupWindow,
  256. cesiumMap
  257. }
  258. })
  259. export default class BaseMap extends Vue {
  260. LOADING!: (payload: boolean) => void
  261. currTitle = ''
  262. showMapLengend = false
  263. /** 开启点击事件弹窗 */
  264. openPopupSwitch = true
  265. //
  266. showLegendBox = true
  267. // 图例数据
  268. legendData = []
  269. // 用于管线定位
  270. vectorLayer = null
  271. // 空间参考
  272. projection = null
  273. /**左上角工具栏列表*/
  274. leftTopTool = null
  275. /**左下角工具栏列表*/
  276. leftBottomTool = null
  277. /**右上角工具栏列表*/
  278. rightTopTool = null //
  279. /**右下角工具栏列表*/
  280. rightBottomTool = null
  281. @Prop(Object) params: object
  282. view = null
  283. Comps
  284. show = true
  285. themSrc = ''
  286. labelShow = false
  287. side_width = '0%'
  288. footer_height = '0%'
  289. sidepanel_visible = false
  290. floatpanel_visible = false
  291. halfpanel_visible = false
  292. fullpanel_visible = false
  293. halfpanel_defaultHeight = '400px'
  294. legendHide = true
  295. loading = true
  296. loadText = ''
  297. // initWidth = 0 // 父元素的宽-自适应值
  298. // initHeight = 0 // 父元素的高-自适应值
  299. // startclientX = 0 // 元素拖拽前距离浏览器的X轴位置
  300. // startclientY = 0 //元素拖拽前距离浏览器的Y轴位置
  301. // elLeft = 20 // 元素的左偏移量
  302. // elTop = 120 // 元素的右偏移量
  303. panels = {
  304. mapView: this.view,
  305. that: this,
  306. // 当前激活的模块
  307. activeModel: null,
  308. tfDialog: { Show: null, Hide: null, setSize: null }
  309. }
  310. get Panels() {
  311. return this.$store.state.map.panels
  312. }
  313. get FullPanels() {
  314. return this.$store.state.map.fullPanels
  315. }
  316. get HalfPanels() {
  317. return this.$store.state.map.halfPanels
  318. }
  319. get FloatPanels() {
  320. return this.$store.state.map.floatPanels
  321. }
  322. get jumpText() {
  323. return this.$store.state.jumpText
  324. }
  325. get activeHeaderItem() {
  326. return this.$store.state.gis.activeHeaderItem
  327. }
  328. @Watch('Panels')
  329. PanelsChange(n, o) {
  330. if (n.length === 0) {
  331. this.$nextTick(() => {
  332. // this.view.updateSize()
  333. })
  334. }
  335. }
  336. @Watch('HalfPanels')
  337. HalfPanelsChange(n, o) {
  338. if (n.length === 0) {
  339. this.$nextTick(() => {
  340. // this.view.updateSize()
  341. })
  342. }
  343. }
  344. @Watch('FullPanels')
  345. FullPanelsChange() {
  346. this.show = true
  347. }
  348. @Watch('loading')
  349. loadingChange(value) {
  350. console.log('跳转', value)
  351. if (value == false) {
  352. var str = this.$store.state.jumpText
  353. if (!str) return
  354. str = str.split(',')
  355. this.$store.dispatch('map/changeMethod', {
  356. pathId: str[0],
  357. widgetid: str[1],
  358. label: str[2]
  359. })
  360. }
  361. }
  362. @Watch('jumpText')
  363. jumpTextChange(n, o) {
  364. if (!n) return
  365. console.log('跳转', n)
  366. n = n.split(',')
  367. this.$store.dispatch('map/changeMethod', {
  368. pathId: n[0],
  369. widgetid: n[1],
  370. label: n[2]
  371. })
  372. }
  373. @Watch('activeHeaderItem', { immediate: true })
  374. activeHeaderItemChange(n, o) {
  375. this.currTitle = n
  376. }
  377. created() {
  378. // console.log('=====', this.Comps)
  379. }
  380. mounted() {
  381. // console.log('地图重新加载')
  382. // this.loading = false
  383. // this.initConfig() // 加载配置 ==> 加载地图
  384. }
  385. // 页面初始化
  386. // initBodySize() {
  387. // this.initWidth = document.body.clientWidth // 拿到父元素宽
  388. // // this.initHeight = this.initWidth * (1080 / 1920);
  389. // this.initHeight = this.initWidth * ((1080 * 0.88) / (1920 - 1080 * 0.02)) // 根据宽计算高实现自适应
  390. // }
  391. // 拖拽开始事件
  392. // dragstart(e) {
  393. // // console.log("拖拽开始事件",e)
  394. // this.startclientX = e.clientX // 记录拖拽元素初始位置
  395. // this.startclientY = e.clientY
  396. // }
  397. // 拖拽完成事件
  398. // dragend(e) {
  399. // // console.log("拖拽完成事件",e)
  400. // let x = e.clientX - this.startclientX // 计算偏移量
  401. // let y = e.clientY - this.startclientY
  402. // this.elLeft -= x // 实现拖拽元素随偏移量移动
  403. // this.elTop += y
  404. // }
  405. handelClose() {
  406. this.show = false
  407. }
  408. // async initMap() {
  409. // let { initCenter, initZoom } = appconfig
  410. // let layerResource = appconfig.gisResource['iserver_resource'].layerService.layers
  411. // let map = new Map({
  412. // target: 'mapView',
  413. // controls: controls({
  414. // zoom: false,
  415. // attribution: false
  416. // }),
  417. // view: new View({
  418. // center: initCenter,
  419. // zoom: initZoom,
  420. // maxZoom: 21,
  421. // minZoom: 5,
  422. // projection: 'EPSG:4326'
  423. // })
  424. // })
  425. // this.panels.mapView = this.view = this.$store.state.gis.map = map
  426. // this.addLayers(layerResource)
  427. // this.loading = false
  428. // this.$store.commit('map/LOADING', false)
  429. // this.$nextTick(this.controlToolDisplay)
  430. // // 触发地图视野变化
  431. // let timer = null,
  432. // time = 500
  433. // this.view.getView().on('change', (evt) => {
  434. // // console.log('级别变化', this.view)
  435. // timer && clearTimeout(timer)
  436. // timer = setTimeout(() => {
  437. // let extent = new mapUtil(this.view).getCurrentViewExtent()
  438. // this.$store.state.gis.mapExtent = extent
  439. // }, time)
  440. // })
  441. // // 点击查询管段详情
  442. // this.view.on('click', (evt) => {
  443. // let filter = this.$store.state.routeSetting.routes[0].name === 'leftBottomTool'
  444. // if (!filter || !this.openPopupSwitch) return
  445. // this.spaceQuery(evt.coordinate)
  446. // })
  447. // this.vectorLayer = new VectorLayer({
  448. // source: new VectorSource(),
  449. // style: comSymbol.getAllStyle(3, 'f00', 5, '#00ffff', 'rgba(255, 255, 255, 0.6)')
  450. // })
  451. // this.view.addLayer(this.vectorLayer)
  452. // // this.view.getView().setCenter([101.724022, 26.580702])
  453. // }
  454. // spaceQuery(position) {
  455. // console.log('查询')
  456. // let queryFeature = turf.buffer(turf.point(position), 2, { units: 'meters' }) as any
  457. // queryFeature = new GeoJSON().readFeature(queryFeature)
  458. // let dataServerConfig = appconfig.gisResource.iserver_resource.dataService
  459. // new iQuery().spaceQuery(queryFeature).then((queryData) => {
  460. // let showData = []
  461. // for (let data of queryData as any) {
  462. // let features = data ? data.result.features.features : []
  463. // if (features.length !== 0) {
  464. // showData.push(data)
  465. // }
  466. // }
  467. // if (showData.length !== 0) {
  468. // let openData = showData.find((data) => data.result.features.features[0].geometry.type === 'Point')
  469. // // 点优于线显示
  470. // let featureData = openData ? openData : showData[0]
  471. // let layerName = featureData.tableName
  472. // //
  473. // let layer = mapUtil.getAllSubLayerNames('pipemap', 'smlayergroup')
  474. // let feature = featureData.result.features.features[0]
  475. // let findLayer
  476. // layer.sublayers.forEach((p) => {
  477. // let layername = p.title
  478. // let sublayer = p.sublayers.find((sub) => sub.name.split('@')[0] === layerName)
  479. // if (sublayer) {
  480. // feature.layerName = layername
  481. // feature.tableName = sublayer.name.split('@')[0]
  482. // }
  483. // })
  484. // let com = this.$refs.popupWindow as any
  485. // com.showPopup(position, feature, afterClosePopup, true)
  486. // let vectorLayer = new VectorLayer({
  487. // source: new VectorSource(),
  488. // style: mapUtil.getCommonStyle()
  489. // })
  490. // let ifeature = new GeoJSON().readFeature(feature)
  491. // if (ifeature) {
  492. // vectorLayer.getSource().addFeature(ifeature)
  493. // this.view.addLayer(vectorLayer)
  494. // }
  495. // // 关闭弹窗后
  496. // function afterClosePopup() {
  497. // vectorLayer.getSource().removeFeature(ifeature)
  498. // }
  499. // }
  500. // })
  501. // }
  502. // // 设置是否开启弹窗
  503. // setPopupSwitch(isopen) {
  504. // this.openPopupSwitch = isopen
  505. // }
  506. // // 加载图层
  507. // addLayers(layersSource) {
  508. // new TF_Layer().createLayers(layersSource).then((layers) => {
  509. // layers.forEach((layer) => {
  510. // layer && this.view.addLayer(layer)
  511. // })
  512. // })
  513. // }
  514. // legendClick() {
  515. // this.legendHide = !this.legendHide
  516. // var whichP = [
  517. // ['收缩', 350, '▼'],
  518. // ['展开', 0, '▲']
  519. // ][this.legendHide ? 0 : 1]
  520. // //@ts-ignore
  521. // this.$refs.legend_close.title = whichP[0]
  522. // //@ts-ignore
  523. // this.$refs.legend.style.height = whichP[1] + 'px'
  524. // //@ts-ignore
  525. // this.$refs.legend_close.innerHTML = whichP[2]
  526. // }
  527. // // 定位某条管线
  528. // setPipesView(pipes) {
  529. // let coors = pipes || [
  530. // [113.14459646427814, 29.365111002105298],
  531. // [113.14462310850658, 29.36565173168358]
  532. // ]
  533. // let feature = new Feature({ geometry: new LineString(coors) })
  534. // if (!this.vectorLayer) {
  535. // this.vectorLayer = new VectorLayer({
  536. // source: new VectorSource(),
  537. // style: comSymbol.getAllStyle(3, 'f00', 5, '#00ffff', 'fff6')
  538. // })
  539. // this.view.addLayer(this.vectorLayer)
  540. // }
  541. // this.vectorLayer.getSource().clear()
  542. // this.vectorLayer.getSource().addFeature(feature)
  543. // //
  544. // let extent = feature.getGeometry().getExtent()
  545. // this.view.getView().setCenter([(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2])
  546. // this.view.getView().setZoom(20)
  547. // }
  548. // 清除地图
  549. // clearMap() {
  550. // this.vectorLayer.getSource().clear()
  551. // }
  552. // 根据 extent 查询 数据
  553. // queryForExtent(extent) {
  554. // new mapUtil(this.view).queryForExtent(extent, this.vectorLayer)
  555. // }
  556. // 显示图例
  557. // showLegend(legendName, visible) {
  558. // if (!legendName) return
  559. // this.legendData = LegendConfig[legendName]
  560. // this.showMapLengend = visible
  561. // }
  562. // legendChange() {
  563. // this.showLegendBox = !this.showLegendBox
  564. // let dom: any = this.$refs.legendCloser
  565. // dom.innerHTML = this.showLegendBox ? '▼' : '▲'
  566. // }
  567. // closeAny() {
  568. // //@ts-ignore
  569. // this.$refs.any.style.display = 'none'
  570. // }
  571. // initConfig() {
  572. // var resource = appconfig.gisResource['iserver_resource']
  573. // var nextDo = () => {
  574. // this.loadText = '地图加载中'
  575. // this.$nextTick(this.initMap)
  576. // }
  577. // if (appconfig.isloadServer) {
  578. // this.loadText = '服务加载中'
  579. // request({ url: '/base/sourcedic/getTreeService', method: 'get' }).then((res1) => {
  580. // if (res1.code == 1) {
  581. // const res = res1.result
  582. // //通过访问天地图地址判断是否可以连接外网,先获取编码isOnlineAddress下的外网地址
  583. // let onlineIndex = res.findIndex((item) => item.code == 'isOnlineAddress')
  584. // if (onlineIndex !== -1) {
  585. // let isOnline = true
  586. // let onLineAddress = res[onlineIndex].child[0].cval
  587. // axios
  588. // .get(onLineAddress)
  589. // .then(
  590. // (res) => {
  591. // isOnline = res.status === 200
  592. // },
  593. // (error) => {
  594. // isOnline = false // 异常返回
  595. // }
  596. // )
  597. // .catch((e) => {
  598. // isOnline = false //异常返回
  599. // })
  600. // .finally(() => {
  601. // // 服务配置名称
  602. // const MAP_CONFIG = {
  603. // mapService: '地图配置服务',
  604. // layerService: '图层服务',
  605. // dataService: '数据服务',
  606. // analysisService: '网络分析服务'
  607. // }
  608. // // 需要替换的服务
  609. // const repItems = [
  610. // MAP_CONFIG.mapService,
  611. // MAP_CONFIG.layerService,
  612. // MAP_CONFIG.dataService,
  613. // MAP_CONFIG.analysisService
  614. // ]
  615. // res.forEach((service) => {
  616. // let resData = service.child,
  617. // source = null
  618. // if (repItems.includes(service.name) && resData && resData.length !== 0) {
  619. // if (service.name === MAP_CONFIG.layerService) {
  620. // source = resource.layerService.layers
  621. // console.log('图层服务配置')
  622. // resData.forEach((data) => {
  623. // let findItem = source.find((sourceItem) => {
  624. // if (sourceItem.name.includes('底图')) {
  625. // return data.name === (isOnline ? sourceItem.name : '离线' + sourceItem.name)
  626. // } else {
  627. // return data.name === sourceItem.name
  628. // }
  629. // })
  630. // if (findItem) {
  631. // findItem.url = data.cval
  632. // }
  633. // })
  634. // } else if (service.name === MAP_CONFIG.mapService) {
  635. // source = appconfig
  636. // resData.forEach((item) => {
  637. // if (item.ckey === 'center') {
  638. // source.initCenter = item.cval.split(',')
  639. // } else if (item.ckey === 'zoom') {
  640. // source.initZoom = item.cval
  641. // }
  642. // })
  643. // } else if (service.name === MAP_CONFIG.analysisService) {
  644. // source = resource.netAnalysisService
  645. // source.url = resData[0].cval
  646. // } else if (service.name === MAP_CONFIG.dataService) {
  647. // source = resource.dataService
  648. // source.url = resData[0].cval
  649. // }
  650. // }
  651. // })
  652. // nextDo()
  653. // })
  654. // }
  655. // } else this.$message('服务加载失败 启用默认服务配置')
  656. // })
  657. // } else nextDo()
  658. // }
  659. /**
  660. * 根据权限控制地图四个角的工具栏的展示
  661. */
  662. // controlToolDisplay() {
  663. // //本功能必须在权限管理-系统管理-模块管理的系统新增中分配leftTopTool,leftBottomTool,rightTopTool,rightBottomTool四个类型
  664. // //这四个类型分别对应地图工具栏的左上角,左下角,右上角,右下角
  665. // //这四个工具栏不在左边的功能列表中展示(改设置在src\layout\components\Sidebar\index.vue中)
  666. // if (this.$store.state && this.$store.state.routeSetting && this.$store.state.routeSetting.routes) {
  667. // const allModel = this.$store.state.routeSetting.dynamicRoutes['map'] //获取所有功能
  668. // if (!allModel) return
  669. // /**工具栏识别的字符集合*/
  670. // const toolBoxList = ['leftTopTool', 'leftBottomTool', 'rightBottomTool', 'rightTopTool']
  671. // const toolcomponentList = {
  672. // leftTopTool,
  673. // leftBottomTool,
  674. // rightTopTool,
  675. // rightBottomTool
  676. // }
  677. // //根据模块管理将组件注入
  678. // allModel.forEach((item) => {
  679. // let index = toolBoxList.findIndex((val) => {
  680. // return val == item.type
  681. // })
  682. // if (index != -1) {
  683. // this[item.type] = item || []
  684. // let temp = this.getComponents(item.type)
  685. // temp.forEach((item2) => {
  686. // toolcomponentList[item.type]['components'][item2.name] = item2.component
  687. // })
  688. // }
  689. // })
  690. // }
  691. // }
  692. // /**
  693. // * 获取指定层级下面的组件
  694. // * @param typeString 指定层级的名称
  695. // * */
  696. // getComponents(typeString) {
  697. // let temp = this.$store.state.routeSetting.addRoutes.find((val) => {
  698. // return val.name && val.name == typeString
  699. // })
  700. // return temp.children || []
  701. // }
  702. }
  703. </script>
  704. <style lang="scss" scoped>
  705. #viewDiv {
  706. position: absolute;
  707. margin: 0px auto;
  708. width: calc(100% - 0px);
  709. height: 100%;
  710. .el-main {
  711. padding: 0px;
  712. display: flex; // *
  713. }
  714. .mapView {
  715. position: relative;
  716. height: 100%;
  717. width: 100%;
  718. }
  719. }
  720. .close {
  721. position: absolute;
  722. right: 0;
  723. cursor: pointer;
  724. }
  725. #mapLabel {
  726. background: #fffc;
  727. position: absolute;
  728. bottom: 30px;
  729. left: 10px;
  730. padding: 5px;
  731. #mapView_legend {
  732. display: flex;
  733. width: 360px;
  734. flex-direction: column;
  735. flex-wrap: wrap;
  736. margin-top: 4px;
  737. overflow: hidden hidden;
  738. transition: 0.4s;
  739. >>> div {
  740. padding: 2px;
  741. img {
  742. width: 14px;
  743. height: 14px;
  744. margin-right: 5px;
  745. }
  746. span {
  747. padding-left: 3px;
  748. font-size: 12px;
  749. }
  750. }
  751. }
  752. #mapView_title {
  753. font-size: 15px;
  754. font-weight: bold;
  755. letter-spacing: 1px;
  756. border-left: 3px solid #2d74e7;
  757. padding-left: 4px;
  758. }
  759. #mapView_close {
  760. float: right;
  761. color: #2d74e7;
  762. font-weight: bold;
  763. cursor: pointer;
  764. user-select: none;
  765. }
  766. }
  767. .qufen {
  768. position: absolute;
  769. top: 0px;
  770. background: chartreuse;
  771. padding: 5px;
  772. }
  773. #antherPanel::after {
  774. content: '副视图 主视图';
  775. border-radius: 0px 0px 5px 5px;
  776. border: 1px solid #2d74e7;
  777. background: #ecf2ffcc;
  778. position: absolute;
  779. top: -1px;
  780. z-index: 1;
  781. left: 50%;
  782. transform: translateX(-50%);
  783. width: 150px;
  784. text-align: center;
  785. padding: 10px 0px;
  786. display: block;
  787. letter-spacing: 1px;
  788. }
  789. #map-index-floatPanels {
  790. position: absolute;
  791. left: 0;
  792. top: 0;
  793. width: 100%;
  794. height: 100%;
  795. pointer-events: none;
  796. overflow: hidden;
  797. }
  798. #map-index-floatPanels >>> .floatBox {
  799. pointer-events: all;
  800. white-space: nowrap;
  801. position: absolute;
  802. background: #fff;
  803. transform: translate(-50%, calc(-100% - 37px));
  804. border-radius: 7px;
  805. padding: 8px 8px 2px 8px;
  806. box-shadow: 0px 6px 23px #afafaf;
  807. .widgets-scadaLayer-title {
  808. font-size: 18px;
  809. font-weight: bold;
  810. margin-bottom: 6px;
  811. span {
  812. line-height: 20px;
  813. letter-spacing: 1px;
  814. }
  815. }
  816. .widgets-scadaLayer-box {
  817. max-height: 69px;
  818. overflow: hidden;
  819. transition: 0.6s;
  820. padding-top: 8px;
  821. border-top: 1px solid #e0e0e0;
  822. div {
  823. line-height: 20px;
  824. font-size: 14px;
  825. display: flex;
  826. cursor: pointer;
  827. &:hover {
  828. background: #000;
  829. color: #eee;
  830. .scadaLayer-float-name {
  831. color: #eee;
  832. }
  833. .scadaLayer-float-value {
  834. color: #eee;
  835. }
  836. }
  837. .scadaLayer-float-name {
  838. color: #373737;
  839. flex: 1;
  840. &::after {
  841. content: ':';
  842. }
  843. }
  844. .scadaLayer-float-value {
  845. color: #2d74e7;
  846. font-weight: bold;
  847. margin-left: 8px;
  848. animation: mymove 0.8s;
  849. border-radius: 3px;
  850. }
  851. // .scadaLayer-float-unit {
  852. // }
  853. .scadaLayer-float-arrow2::after {
  854. content: '↑';
  855. color: #f56c6c;
  856. animation: mymove 0.8s;
  857. }
  858. .scadaLayer-float-arrow0::after {
  859. content: '↓';
  860. color: #67c23a;
  861. animation: mymove 0.8s;
  862. }
  863. .scadaLayer-float-arrow1::after {
  864. content: '-';
  865. color: #909399;
  866. animation: mymove 0.8s;
  867. }
  868. }
  869. }
  870. &::after {
  871. content: '';
  872. width: 0;
  873. height: 0;
  874. border-top: 9px solid #fff;
  875. border-left: 9px solid transparent;
  876. border-right: 9px solid transparent;
  877. position: absolute;
  878. left: calc(50% - 9px);
  879. bottom: -9px;
  880. }
  881. &:hover {
  882. z-index: 1;
  883. .widgets-scadaLayer-box {
  884. max-height: 500px;
  885. }
  886. }
  887. @keyframes mymove {
  888. from {
  889. background: rgb(158, 54, 153);
  890. color: #fff;
  891. }
  892. to {
  893. background: #fff0;
  894. color: #2d74e7;
  895. }
  896. }
  897. }
  898. .map-legend {
  899. background: #fffc;
  900. position: absolute;
  901. bottom: 40px;
  902. left: 10px;
  903. min-height: 30px;
  904. width: 200px;
  905. border: 1px solid rgb(13, 186, 255);
  906. }
  907. .map-legend-title {
  908. color: #fff;
  909. font-weight: 600;
  910. padding: 3px 10px;
  911. height: 30px;
  912. font-size: 15px;
  913. line-height: 25px;
  914. background-color: rgb(13, 186, 255);
  915. }
  916. .map-legend-item {
  917. display: flex;
  918. height: 20px;
  919. line-height: 20px;
  920. font-size: 13px;
  921. margin: 15px 10px;
  922. }
  923. .map-legend-label {
  924. margin-left: 5px;
  925. }
  926. .map-legend-rect {
  927. display: inline-block;
  928. width: 30px;
  929. height: 100%;
  930. }
  931. .map-legend-circle {
  932. display: inline-block;
  933. width: 10px;
  934. height: 10px;
  935. border-radius: 50%;
  936. }
  937. .map-legend-line {
  938. display: inline-block;
  939. width: 50px;
  940. height: 8px;
  941. }
  942. .map-legend-traingle1 {
  943. transform: scale(0.4);
  944. background-size: 100% 100%;
  945. background-image: url('../../assets/images/traingle1.png');
  946. background-repeat: no-repeat;
  947. width: 36px;
  948. height: 36px;
  949. }
  950. .map-legend-traingle2 {
  951. transform: scale(0.4);
  952. background-size: 100% 100%;
  953. background-image: url('../../assets/images/traingle2.png');
  954. background-repeat: no-repeat;
  955. width: 36px;
  956. height: 36px;
  957. }
  958. .map-legend-traingle3 {
  959. transform: scale(0.4);
  960. background-size: 100% 100%;
  961. background-image: url('../../assets/images/traingle3.png');
  962. background-repeat: no-repeat;
  963. width: 36px;
  964. height: 36px;
  965. }
  966. .map-legend-traingle4 {
  967. transform: scale(0.4);
  968. background-size: 100% 100%;
  969. background-image: url('../../assets/images/traingle4.png');
  970. background-repeat: no-repeat;
  971. width: 36px;
  972. height: 36px;
  973. }
  974. .map-legend-traingle0 {
  975. transform: scale(0.4);
  976. background-size: 100% 100%;
  977. background-image: url('../../assets/images/traingle0.png');
  978. background-repeat: no-repeat;
  979. width: 36px;
  980. height: 36px;
  981. }
  982. </style>