7
0

HomeView.vue 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415
  1. <template>
  2. <div class="home">
  3. <Header></Header>
  4. <Map />
  5. <div :class="{ 'yjdp-btn': true, isActive: yjdpShow }" @click="addyjdp" v-if="!isMobile">沿街店铺</div>
  6. <div :class="{ 'kzdp-btn': true, isActive: kzdpShow }" @click="addkzdp" v-if="!isMobile">空置店铺</div>
  7. <div class="yhfk-btn" @click="openYHFK" v-if="!isMobile">用户反馈</div>
  8. <div :class="{ 'yjdp-btn-mb': true, isActive: yjdpShow }" @click="addyjdp" v-if="isMobile">沿街店铺</div>
  9. <div :class="{ 'kzdp-btn-mb': true, isActive: kzdpShow }" @click="addkzdp" v-if="isMobile">空置店铺</div>
  10. <div class="yhfk-btn-mb" @click="openYHFK" v-if="isMobile">用户反馈</div>
  11. <!-- 智小青 -->
  12. <div class="zxq-btn" @click="openZXQ" v-if="!isMobile"></div>
  13. <div class="zxq-btn-mb" @click="openZXQ" v-if="isMobile"></div>
  14. <div :class="isMobile == true ? zxqIframeContainer:'zxqIframeContainer'" v-if="isShowZXQ">
  15. <!-- <div class="wind" @click="tiggerWind" v-if="isMobile">口</div> -->
  16. <div class="close" @click="closeZXQ">×</div>
  17. <iframe :src="zxqUrl" frameborder="0" ></iframe>
  18. </div>
  19. <!-- <div class="control3D">
  20. <div class="label">三维模型</div>
  21. <el-switch v-model="isShow3D" size="large" active-text @change="changeModel" />
  22. </div> -->
  23. <div class="changeBaseMap" v-if="!isMobile">
  24. <div class="container">
  25. <div v-for="(item, index) in baseMapArr" :key="index" @click="changeMap(item)" >
  26. <div :class="{ 'content': true, 'active': item.isActive }">
  27. <div class="label">{{ item.label }}</div>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="changeBaseMap-mb" v-if="isMobile" @click="changeBaseMapType()">
  33. <div>{{baseMap}}</div>
  34. </div>
  35. <div class="heatmapContorl">
  36. <div :class="{ 'ckzb-btn': true, isActive: heatmapPanelShow }" @click="handleOpenHeatmapPanelShow" v-if="!isMobile">热力图层</div>
  37. <div :class="{ 'ckzb-btn-mb': true, isActive: heatmapPanelShow }" @click="handleOpenHeatmapPanelShow" v-if="isMobile">热力图层</div>
  38. <div class="heatmapPanel" v-show="heatmapPanelShow">
  39. <el-scrollbar>
  40. <ul>
  41. <li v-for="(item, index) in heatmapList" :key="index">
  42. <el-checkbox v-model="item.isAdd" :label="item.name" size="large"
  43. @change="judgeLayerType($event, item)" />
  44. </li>
  45. </ul>
  46. </el-scrollbar>
  47. </div>
  48. </div>
  49. <div :class="isMobile == true ? 'heatmapLegend-mb':'heatmapLegend'" v-show="heatmapPanelShow">
  50. </div>
  51. <div :class="{ 'zxq-ckzb-btn': true, isActive: isActiveZXQ }" @click="isActiveZXQ">智小青</div>
  52. <div class="layerContorl">
  53. <div :class="{ 'ckzb-btn': true, isActive: layerPanelShow }" @click="handleOpenLayerPanelShow" v-if="!isMobile">查看周边</div>
  54. <div :class="{ 'ckzb-btn-mb': true, isActive: layerPanelShow }" @click="handleOpenLayerPanelShow" v-if="isMobile">查看周边</div>
  55. <div :class="isMobile == true ? 'layerPanel-mb':'layerPanel'" v-show="layerPanelShow">
  56. <el-scrollbar>
  57. <ul>
  58. <li v-for="(item, index) in layerList" :key="index">
  59. <el-checkbox v-model="item.isAdd" :label="item.name" size="large"
  60. @change="judgeLayerType($event, item)" />
  61. </li>
  62. </ul>
  63. </el-scrollbar>
  64. </div>
  65. </div>
  66. <KDYJS ref="kdyjs" :message="parentMessage"></KDYJS>
  67. <div class="tips">试运行阶段服务范围:夏阳街道</div>
  68. <div class="yjdpInfoDialog" v-show="yjdpInfoDialogShow">
  69. <div class="close" @click="closeYJDP">×</div>
  70. <div class="content" v-if="nowPoint != null">
  71. <el-scrollbar>
  72. <div class="item">店铺名称: {{ nowPoint.properties["店铺名称"] }}</div>
  73. <div class="item">店铺类型: {{ nowPoint.properties["店铺类型"] }}</div>
  74. <div class="item">街镇: {{ nowPoint.properties["街镇"] }}</div>
  75. <div class="item">道路名称: {{ nowPoint.properties["道路名称"] }}</div>
  76. </el-scrollbar>
  77. </div>
  78. </div>
  79. <div class="kzdpInfoDialog" v-show="kzdpInfoDialogShow">
  80. <div class="close" @click="closeKZDP">×</div>
  81. <div class="content" v-if="nowPoint != null">
  82. <el-scrollbar>
  83. <div class="item">店铺名称: {{ nowPoint.properties["店铺名称"] }}</div>
  84. <div class="item">店铺类型: {{ nowPoint.properties["店铺类型"] }}</div>
  85. <div class="item">街镇: {{ nowPoint.properties["街镇"] }}</div>
  86. <div class="item">道路名称: {{ nowPoint.properties["道路名称"] }}</div>
  87. </el-scrollbar>
  88. </div>
  89. </div>
  90. <!-- 此处弹框样式写在App.vue中 -->
  91. <el-dialog class="yhfkInfoDialog" title="用户反馈" header-class="yhfkInfoDialogHeader"
  92. footer-class="yhfkInfoDialogfooter" v-model="yhfkInfoDialogShow" :close="closeKZDP" :close-on-click-modal="false"
  93. :append-to-body="true" :width="isMobile == true ? 'auto':600">
  94. <el-form ref="yhfkInfoDialogRef" :model="yhfkForm" label-width="auto" :rules="rules" style="max-width: 600px">
  95. <el-form-item label="姓名" prop="name">
  96. <el-input v-model="yhfkForm.name" />
  97. </el-form-item>
  98. <el-form-item label="联系方式" prop="tele">
  99. <el-input v-model="yhfkForm.tele" />
  100. </el-form-item>
  101. <el-form-item label="问题描述" prop="desc">
  102. <el-input v-model="yhfkForm.desc" type="textarea" />
  103. </el-form-item>
  104. </el-form>
  105. <template #footer>
  106. <div class="dialog-footer">
  107. <el-button @click="closeYHFK">取消</el-button>
  108. <el-button type="primary" @click="yhfkSubmit">提交</el-button>
  109. </div>
  110. </template>
  111. </el-dialog>
  112. </div>
  113. </template>
  114. <script>
  115. import { toRaw, ref, onMounted, onBeforeUnmount } from "vue";
  116. import { ElMessage } from 'element-plus'
  117. import Map from "@/components/Map.vue";
  118. import Header from "@/components/Header.vue";
  119. import KDYJS from "@/views/KDYJS.vue";
  120. import UTIL from '@/utils/util'
  121. export default {
  122. name: "HomeView",
  123. components: {
  124. Map,
  125. Header,
  126. KDYJS
  127. },
  128. data() {
  129. let arr = webConfig.layerList;
  130. arr = arr.map(function (item, index) {
  131. item.id = index;
  132. item.isAdd = false
  133. return item
  134. })
  135. let arrHeatmap = webConfig.heatmapList;
  136. arrHeatmap = arrHeatmap.map(function (item, index) {
  137. item.id = index;
  138. item.isAdd = false
  139. return item
  140. })
  141. return {
  142. isMobile:false,
  143. baseMap:'影像图层',
  144. parentMessage:'',
  145. zxqIframeContainer:'zxqIframeContainer-mb-mx',
  146. isShow3D: false,
  147. baseMapArr: [
  148. {
  149. type: "yxt",
  150. label: "影像图层",
  151. isActive: false
  152. },
  153. {
  154. type: "xht",
  155. label: "线划图层",
  156. isActive: true
  157. }
  158. ],
  159. yjdpShow: false,
  160. kzdpShow: false,
  161. mapHandle: null,
  162. yjdpInfoDialogShow: false,
  163. kzdpInfoDialogShow: false,
  164. yhfkInfoDialogShow: false,
  165. nowPoint: null,
  166. layerPanelShow: false,
  167. layerRoot: webConfig.GEOSERVER_URL_WMS,
  168. layerList: arr,
  169. wmslayer: {},
  170. heatmapPanelShow: false,
  171. heatmapList: arrHeatmap,
  172. heatmapLayer: {},
  173. yhfkForm: {
  174. name: "",
  175. tele: "",
  176. desc: ""
  177. },
  178. rules: {
  179. name: [
  180. { required: true, message: '请填写姓名', trigger: 'blur' },
  181. ],
  182. tele: [
  183. { required: true, message: '请填写联系方式', trigger: 'blur' },
  184. ],
  185. desc: [
  186. { required: true, message: '请填写问题描述', trigger: 'blur' },
  187. ],
  188. },
  189. isShowZXQ: false,
  190. zxqUrl: webConfig.zxqUrl
  191. };
  192. },
  193. mounted() {
  194. let that = this;
  195. that.isMobile = UTIL.terminalType()
  196. this.$refs.kdyjs.open();
  197. // 监听message事件
  198. window.addEventListener('message', this.handleMessage);
  199. },
  200. beforeDestroy() {
  201. // 在组件销毁前移除事件监听器
  202. window.removeEventListener('message', this.handleMessage);
  203. },
  204. methods: {
  205. handleMessage(event) {
  206. // // 确保消息来自预期的源
  207. // // 如果需要更严格的安全性,请验证event.origin
  208. // if (event.source !== window.parent) {
  209. // return;
  210. // }
  211. // 处理接收到的消息数据
  212. const data = event.data;
  213. // const imgUrl = data.imgUrl;
  214. // const otherParam = data.otherParam;
  215. // 在Vue父组件中处理数据
  216. // ...
  217. },
  218. changeModel(status) {
  219. mapTriggerEvent("changeModel", {
  220. status: status
  221. });
  222. },
  223. changeMap(item) {
  224. this.baseMapArr = this.baseMapArr.map(function (item) {
  225. item.isActive = false;
  226. return item;
  227. });
  228. item.isActive = true;
  229. switch (item.type) {
  230. case "yxt":
  231. mapTriggerEvent("changeBaseMap", { type: "yxt" });
  232. break;
  233. case "xht":
  234. mapTriggerEvent("changeBaseMap", { type: "xht" });
  235. break;
  236. }
  237. },
  238. changeBaseMapType(){
  239. let that = this;
  240. if(that.baseMap == '影像图层'){
  241. that.baseMap = '线划图层'
  242. mapTriggerEvent("changeBaseMap", { type: "yxt" });
  243. }else{
  244. that.baseMap = '影像图层'
  245. mapTriggerEvent("changeBaseMap", { type: "xht" });
  246. }
  247. },
  248. // 打开用户反馈
  249. openYHFK() {
  250. this.yhfkInfoDialogShow = true
  251. },
  252. // 关闭用户反馈
  253. closeYHFK() {
  254. this.yhfkInfoDialogShow = false;
  255. this.yhfkForm = {
  256. name: "",
  257. tele: "",
  258. desc: ""
  259. }
  260. },
  261. // 提交用户反馈
  262. yhfkSubmit() {
  263. let that = this;
  264. this.$refs.yhfkInfoDialogRef.validate((valid, fields) => {
  265. if (valid) {
  266. let formData = new FormData();
  267. let obj = {
  268. "title": that.yhfkForm.tele,
  269. "content": that.yhfkForm.name,
  270. // "c_name": that.yhfkForm.name,
  271. // "c_tele": that.yhfkForm.tele,
  272. // "c_describe": that.yhfkForm.desc
  273. }
  274. obj[webConfig.userFeedback.name] = that.yhfkForm.name
  275. obj[webConfig.userFeedback.tele] = that.yhfkForm.tele
  276. obj[webConfig.userFeedback.desc] = that.yhfkForm.desc
  277. formData.append("content", JSON.stringify(obj))
  278. formData.append("columnId", webConfig.userFeedback.columnId)
  279. formData.append("modelId", webConfig.userFeedback.modelId)
  280. // 使用 fetch API 提交数据
  281. fetch(webConfig.DMS_URL + "/content/addContent", {
  282. method: 'POST', // 或者 'PUT', 'DELETE', 等等
  283. body: formData, // 直接传递 FormData 对象
  284. headers: {
  285. // 如果需要设置 Content-Type,通常不需要,因为 fetch 会自动设置,但如果需要可以手动设置
  286. // 'Content-Type': 'application/x-www-form-urlencoded'
  287. token: localStorage.getItem(webConfig.AUTH_USER_TOKEN_KEY)
  288. }
  289. })
  290. .then(response => response.json()) // 假设服务器返回 JSON 数据
  291. .then(data => {
  292. // 处理返回的数据,例如更新页面等
  293. if (data.code == 200) {
  294. ElMessage({
  295. message: '您的反馈已提交,后续我们将与您联系确认问题,感谢您的反馈!',
  296. type: 'success',
  297. plain: true,
  298. })
  299. setTimeout(() => {
  300. that.yhfkInfoDialogShow = false
  301. }, 500);
  302. }
  303. })
  304. .catch((error) => {
  305. // console.error('Error:', error);
  306. });
  307. } else {
  308. ElMessage({
  309. message: '请您完善反馈的问题后再尝试提交!',
  310. type: 'warning',
  311. plain: true,
  312. })
  313. }
  314. })
  315. },
  316. // 打开智小青
  317. openZXQ() {
  318. this.isShowZXQ = true
  319. },
  320. tiggerWind(){
  321. if(this.zxqIframeContainer == 'zxqIframeContainer-mb'){
  322. this.zxqIframeContainer = 'zxqIframeContainer-mb-mx'
  323. }else{
  324. this.zxqIframeContainer = 'zxqIframeContainer-mb'
  325. }
  326. },
  327. // 关闭智小青
  328. closeZXQ() {
  329. this.zxqIframeContainer ='zxqIframeContainer-mb-mx'
  330. this.isShowZXQ = false
  331. },
  332. // 沿街店铺
  333. addyjdp() {
  334. let that = this;
  335. this.yjdpShow = !this.yjdpShow
  336. if (this.yjdpShow) {
  337. // 添加
  338. fetch("./static/data/沿街店铺.geojson")
  339. .then(response => response.json())
  340. .then(function (result) {
  341. that.pointYJDPArr = result.features.map(function (pointInfo) {
  342. return viewer.entities.add(new SkyScenery.Entity({
  343. position: SkyScenery.Cartesian3.fromDegrees(pointInfo.geometry.coordinates[0], pointInfo.geometry.coordinates[1]),
  344. type: "yjdp",
  345. info: {
  346. coor: [pointInfo.geometry.coordinates[0], pointInfo.geometry.coordinates[1]],
  347. properties: pointInfo.properties
  348. },
  349. billboard: {
  350. width: 48,
  351. height: 48,
  352. image: "./static/image/point-dp.png",
  353. scale: 1,
  354. horizontalOrigin: SkyScenery.HorizontalOrigin.CENTER,
  355. verticalOrigin: SkyScenery.VerticalOrigin.BOTTOM,
  356. }
  357. }));
  358. })
  359. })
  360. } else {
  361. // 删除
  362. this.pointYJDPArr.map(function (point) {
  363. viewer.entities.remove(point)
  364. })
  365. this.pointYJDPArr = []
  366. this.yjdpInfoDialogShow = false;
  367. this.nowPoint = null
  368. }
  369. this.pointTCHandle();
  370. },
  371. closeYJDP() {
  372. this.yjdpInfoDialogShow = false;
  373. this.nowPoint = null
  374. },
  375. // 空置店铺
  376. addkzdp() {
  377. let that = this;
  378. this.kzdpShow = !this.kzdpShow
  379. if (this.kzdpShow) {
  380. // 添加
  381. fetch("./static/data/沿街店铺-空置.geojson")
  382. .then(response => response.json())
  383. .then(function (result) {
  384. that.pointKZDPArr = result.features.map(function (pointInfo) {
  385. return viewer.entities.add(new SkyScenery.Entity({
  386. position: SkyScenery.Cartesian3.fromDegrees(pointInfo.geometry.coordinates[0], pointInfo.geometry.coordinates[1], 0.5),
  387. type: "kzdp",
  388. info: {
  389. coor: [pointInfo.geometry.coordinates[0], pointInfo.geometry.coordinates[1]],
  390. properties: pointInfo.properties
  391. },
  392. billboard: {
  393. width: 48,
  394. height: 48,
  395. image: "./static/image/kzdp.png",
  396. scale: 1,
  397. horizontalOrigin: SkyScenery.HorizontalOrigin.CENTER,
  398. verticalOrigin: SkyScenery.VerticalOrigin.BOTTOM,
  399. }
  400. }));
  401. })
  402. })
  403. } else {
  404. // 删除
  405. this.pointKZDPArr.map(function (point) {
  406. viewer.entities.remove(point)
  407. })
  408. this.pointKZDPArr = []
  409. this.kzdpInfoDialogShow = false;
  410. this.nowPoint = null
  411. }
  412. this.pointTCHandle();
  413. },
  414. closeKZDP() {
  415. this.kzdpInfoDialogShow = false;
  416. this.nowPoint = null
  417. },
  418. // 点击事件绑定
  419. pointTCHandle() {
  420. let that = this;
  421. if (!this.mapHandle) {
  422. this.mapHandle = new SkyScenery.ScreenSpaceEventHandler(viewer.canvas, this);
  423. this.mapHandle.setInputAction(function (movement) {
  424. // 获取鼠标位置
  425. const pickedObject = viewer.scene.pick(movement.position);
  426. if (SkyScenery.defined(pickedObject) && SkyScenery.defined(pickedObject.id)) {
  427. const entity = pickedObject.id;
  428. if (entity.type == "yjdp") {
  429. /**
  430. * 根据拾取到的点位的经纬度 转成 屏幕坐标
  431. * 添加文字描述
  432. */
  433. // let xy = viewer.scene.cartesianToCanvasCoordinates(entity.position.getValue())
  434. // "街镇": "夏阳街道",
  435. // "网格编码": "31011800101",
  436. // "居委": "祥龙居委会",
  437. // "地理编码": "310118001005",
  438. // "地址": "浦仓路437号",
  439. // "城市": "上海市",
  440. // "区县": "青浦区",
  441. // "网格名称": "第一责任网格",
  442. // "简称": "31011800101"
  443. that.yjdpInfoDialogShow = true
  444. that.nowPoint = entity.info;
  445. that.nowPoint["type"] = "yjdp";
  446. let xy = that.lonlatConvertToScreenXY(entity.info.coor)
  447. document.querySelector(".yjdpInfoDialog").style.top = (xy.y - 250) + "px";
  448. document.querySelector(".yjdpInfoDialog").style.left = (xy.x - 150) + "px";
  449. // document.querySelector("#yjdpInfoDialog")
  450. // that.removePanel();
  451. // that.addPointDivLabel(xy, entity.info.name)
  452. } else if (entity.type == "kzdp") {
  453. that.kzdpInfoDialogShow = true
  454. that.nowPoint = entity.info;
  455. that.nowPoint["type"] = "kzdp";
  456. let xy = that.lonlatConvertToScreenXY(entity.info.coor)
  457. document.querySelector(".kzdpInfoDialog").style.top = (xy.y - 250) + "px";
  458. document.querySelector(".kzdpInfoDialog").style.left = (xy.x - 150) + "px";
  459. }
  460. that.$refs.kdyjs.clickPointJGTL({
  461. lon: entity.info.coor[0],
  462. lat: entity.info.coor[1]
  463. })
  464. that.parentMessage = that.nowPoint
  465. } else {
  466. // console.log('未拾取到实体');
  467. /**
  468. * 删除文字描述
  469. */
  470. // that.removePanel();
  471. }
  472. }, SkyScenery.ScreenSpaceEventType.LEFT_CLICK);
  473. viewer.scene.postRender.addEventListener(this.updatePosition, this);
  474. } else {
  475. if (this.yjdpShow == false && this.kzdpShow == false) {
  476. toRaw(this.mapHandle).destroy();
  477. this.mapHandle = null
  478. viewer.scene.postRender.removeEventListener(this.updatePosition, this);
  479. }
  480. }
  481. },
  482. // 位置更新
  483. updatePosition() {
  484. try {
  485. if (this.nowPoint != null) {
  486. const obj = toRaw(this.nowPoint);
  487. let xy = this.lonlatConvertToScreenXY(obj.coor)
  488. if (!xy) {
  489. if (obj.type == "yjdp") {
  490. document.querySelector(".yjdpInfoDialog").style.top = "-9999px";
  491. document.querySelector(".yjdpInfoDialog").style.left = "-9999px";
  492. } else if (obj.type == "kzdp") {
  493. document.querySelector(".kzdpInfoDialog").style.top = "-9999px";
  494. document.querySelector(".kzdpInfoDialog").style.left = "-9999px";
  495. }
  496. } else {
  497. if (obj.type == "yjdp") {
  498. document.querySelector(".yjdpInfoDialog").style.top = (xy.y - 250) + "px";
  499. document.querySelector(".yjdpInfoDialog").style.left = (xy.x - 150) + "px";
  500. } else if (obj.type == "kzdp") {
  501. document.querySelector(".kzdpInfoDialog").style.top = (xy.y - 250) + "px";
  502. document.querySelector(".kzdpInfoDialog").style.left = (xy.x - 150) + "px";
  503. }
  504. }
  505. }
  506. } catch (error) {
  507. // debugger
  508. }
  509. },
  510. // 经纬度转屏幕坐标
  511. lonlatConvertToScreenXY(lonlat) {
  512. // 定义经纬度
  513. var longitude = SkyScenery.Math.toRadians(lonlat[0]); // 例如:东经116.391度
  514. var latitude = SkyScenery.Math.toRadians(lonlat[1]); // 例如:北纬39.907度
  515. var height = 0; // 高度,通常在地表为0
  516. // 将经纬度转换为笛卡尔坐标
  517. // var cartographic = SkyScenery.Cartographic.fromDegrees(longitude, latitude, height);
  518. var cartesian = SkyScenery.Cartesian3.fromRadians(longitude, latitude, height, viewer.scene.globe.ellipsoid);
  519. // 将笛卡尔坐标转换为窗口坐标
  520. var canvasCoordinates = viewer.scene.cartesianToCanvasCoordinates(cartesian);
  521. return canvasCoordinates
  522. },
  523. // 热力图列表展示
  524. handleOpenHeatmapPanelShow() {
  525. this.heatmapPanelShow = !toRaw(this.heatmapPanelShow)
  526. this.layerPanelShow = false
  527. },
  528. // 图层列表展示
  529. handleOpenLayerPanelShow() {
  530. this.layerPanelShow = !toRaw(this.layerPanelShow)
  531. this.heatmapPanelShow = false
  532. },
  533. // 区分图层类型后按照不同类型加载
  534. judgeLayerType(judge, params) {
  535. if (params.type == "heatmap") {
  536. this.addHeatMapLayer(judge, params);
  537. } else {
  538. this.addWMSLayer(judge, params);
  539. }
  540. },
  541. // 加载wms服务
  542. addWMSLayer(judge, params) {
  543. if (judge) {
  544. debugger
  545. console.log(1111);
  546. let layer = viewer.imageryLayers.addImageryProvider(
  547. new SkyScenery.WebMapServiceImageryProvider({
  548. url: this.layerRoot,
  549. layers: params.layers,
  550. parameters: {
  551. TRANSPARENT: true,
  552. format: "image/png"
  553. }
  554. })
  555. )
  556. this.wmslayer[params.name] = layer;
  557. } else {
  558. viewer.imageryLayers.remove(toRaw(this.wmslayer[params.name]))
  559. delete this.wmslayer[params.name];
  560. }
  561. },
  562. // 加载热力图
  563. addHeatMapLayer(judge, params) {
  564. let that = this;
  565. if (judge) {
  566. fetch(params.url)
  567. .then(response => response.json())
  568. .then(function (result) {
  569. let arr = result.features.map(function (item) {
  570. let coor = item.geometry.coordinates
  571. return {
  572. x: coor[0],
  573. y: coor[1],
  574. value: 1
  575. }
  576. })
  577. that.heatmapLayer[params.name] = new SkySceneryHeatmap(viewer, {
  578. data: arr,
  579. flyTo: false,
  580. height: 0,
  581. heatStyle: {
  582. // blur: 0.7,
  583. // gradient: { 0.3: 'blue', 0.6: 'green', 0.8: 'yellow', 0.9: 'red' },
  584. // maxOpacity: 0.9,
  585. // minOpacity: 0.3,
  586. radius: 1,
  587. maxOpacity: 0.6,
  588. minOpacity: 0,
  589. blur: 0.85,
  590. gradient: {
  591. 0.4: 'blue',
  592. 0.5: 'cyan',
  593. 0.6: 'green',
  594. 0.7: 'yellow',
  595. 0.8: 'orange',
  596. 0.9: 'red'
  597. }
  598. },
  599. }, SkyScenery)
  600. })
  601. } else {
  602. if (Object.keys(toRaw(this.heatmapLayer)).length > 0) {
  603. this.heatmapLayer[params.name].destroy();
  604. delete this.heatmapLayer[params.name]
  605. }
  606. }
  607. }
  608. }
  609. };
  610. </script>
  611. <style lang="less" scoped>
  612. .home {
  613. width: 100%;
  614. height: 100%;
  615. position: relative;
  616. user-select: none;
  617. /* Chrome, Opera, Safari */
  618. -moz-user-select: none;
  619. /* Firefox */
  620. -ms-user-select: none;
  621. /* Internet Explorer/Edge */
  622. -khtml-user-select: none;
  623. /* Konqueror/Safari */
  624. .control3D {
  625. height: 40px;
  626. position: absolute;
  627. bottom: 155px;
  628. right: 20px;
  629. background: #01346f99;
  630. border: 1px solid #ffffff;
  631. padding: 0px 10px;
  632. border-radius: 10px;
  633. color: #ffffff;
  634. .label {
  635. display: inline-block;
  636. height: 40px;
  637. line-height: 40px;
  638. margin-right: 5px;
  639. }
  640. .el-switch {
  641. vertical-align: top;
  642. }
  643. }
  644. .changeBaseMap {
  645. position: absolute;
  646. bottom: 50px;
  647. right: 20px;
  648. background: #01346f99;
  649. padding: 0px 10px;
  650. color: #ffffff;
  651. padding: 10px 10px;
  652. cursor: pointer;
  653. border-radius: 10px;
  654. z-index: 9;
  655. .container {
  656. position: relative;
  657. height: 80px;
  658. width: 122px;
  659. animation: animation-wdith-back 0.5s ease-in-out 1;
  660. div .content {
  661. height: 80px;
  662. width: 100px;
  663. border-radius: 10px;
  664. border: 1px solid #ffffff;
  665. }
  666. div .content.active {
  667. border-color: #00bbff;
  668. .label {
  669. color: #00bbff;
  670. }
  671. }
  672. div .content:hover {
  673. border-color: #00bbff;
  674. .label {
  675. color: #00bbff;
  676. }
  677. }
  678. >div {
  679. width: 100px;
  680. height: 80px;
  681. position: absolute;
  682. // border: 1px solid #ffffff;
  683. border-radius: 10px;
  684. .label {
  685. width: 100%;
  686. height: 24px;
  687. position: absolute;
  688. bottom: 0px;
  689. text-align: center;
  690. font-size: 16px;
  691. background: #00000080;
  692. border-bottom-right-radius: 10px;
  693. border-bottom-left-radius: 10px;
  694. }
  695. }
  696. >div:nth-child(1) {
  697. z-index: 1;
  698. right: 20px;
  699. background: url(~@/assets/images/base2.png) no-repeat center center/100% 100%;
  700. animation: animation-right-back 0.5s ease-in-out 1;
  701. }
  702. >div:nth-child(2) {
  703. z-index: 2;
  704. right: 0px;
  705. background: url(~@/assets/images/base1.png) no-repeat center center/100% 100%;
  706. }
  707. }
  708. &:hover {
  709. .container {
  710. width: 220px;
  711. animation: animation-wdith 0.5s ease-in-out 1;
  712. >div:nth-child(1) {
  713. right: 120px;
  714. animation: animation-right 0.5s ease-in-out 1;
  715. }
  716. }
  717. }
  718. }
  719. .changeBaseMap-mb {
  720. position: absolute;
  721. bottom: 50px;
  722. z-index: 9;
  723. right: 20px;
  724. width: 30px;
  725. font-size: 12px;
  726. border-radius: 10px;
  727. color: #ffffff;
  728. cursor: pointer;
  729. background: #01346f99;
  730. padding: 5px;
  731. text-align: center;
  732. border: 1px solid #eeeeee;
  733. }
  734. @keyframes animation-right {
  735. from {
  736. right: 20px;
  737. }
  738. to {
  739. right: 120px;
  740. }
  741. }
  742. @keyframes animation-right-back {
  743. from {
  744. right: 120px;
  745. }
  746. to {
  747. right: 20px;
  748. }
  749. }
  750. @keyframes animation-wdith {
  751. from {
  752. width: 124px;
  753. }
  754. to {
  755. width: 224px;
  756. }
  757. }
  758. @keyframes animation-wdith-back {
  759. from {
  760. width: 224px;
  761. }
  762. to {
  763. width: 122px;
  764. }
  765. }
  766. .layerContorl {
  767. position: absolute;
  768. right: 20px;
  769. bottom: 160px;
  770. .ckzb-btn {
  771. width: 70px;
  772. height: 40px;
  773. border-radius: 10px;
  774. color: #ffffff;
  775. cursor: pointer;
  776. background: #01346f99;
  777. line-height: 38px;
  778. padding: 0 15px;
  779. text-align: center;
  780. border: 1px solid #eeeeee;
  781. &.isActive {
  782. background: #005cc6cc
  783. }
  784. &:hover {
  785. background: #005cc6cc;
  786. }
  787. }
  788. .ckzb-btn-mb {
  789. width: 30px;
  790. font-size: 12px;
  791. border-radius: 10px;
  792. color: #ffffff;
  793. cursor: pointer;
  794. background: #01346f99;
  795. padding: 5px;
  796. text-align: center;
  797. border: 1px solid #eeeeee;
  798. &.isActive {
  799. background: #005cc6cc
  800. }
  801. &:hover {
  802. background: #005cc6cc;
  803. }
  804. }
  805. .layerPanel {
  806. position: absolute;
  807. right: 110px;
  808. bottom: 0px;
  809. background: #01346f99;
  810. border-radius: 5px;
  811. // padding: 0 10px;
  812. padding-left: 10px;
  813. height: fit-content;
  814. overflow: hidden;
  815. overflow-y: auto;
  816. height: 240px;
  817. ul {
  818. margin: 0 0;
  819. padding: 0 0;
  820. }
  821. li {
  822. list-style: none;
  823. padding-right: 10px;
  824. .el-checkbox {
  825. color: #ffffff;
  826. &.is-checked {
  827. :deep(.el-checkbox__label) {
  828. color: #ffffff;
  829. }
  830. }
  831. }
  832. }
  833. }
  834. .layerPanel-mb {
  835. position: absolute;
  836. right: 50px;
  837. bottom: 0px;
  838. background: #01346f99;
  839. border-radius: 5px;
  840. // padding: 0 10px;
  841. padding-left: 10px;
  842. height: fit-content;
  843. overflow: hidden;
  844. overflow-y: auto;
  845. height: 240px;
  846. ul {
  847. margin: 0 0;
  848. padding: 0 0;
  849. }
  850. li {
  851. list-style: none;
  852. padding-right: 10px;
  853. .el-checkbox {
  854. color: #ffffff;
  855. &.is-checked {
  856. :deep(.el-checkbox__label) {
  857. color: #ffffff;
  858. }
  859. }
  860. }
  861. }
  862. }
  863. }
  864. .heatmapContorl {
  865. position: absolute;
  866. right: 20px;
  867. bottom: 220px;
  868. .ckzb-btn {
  869. width: 70px;
  870. height: 40px;
  871. border-radius: 10px;
  872. color: #ffffff;
  873. cursor: pointer;
  874. background: #01346f99;
  875. line-height: 38px;
  876. padding: 0 15px;
  877. text-align: center;
  878. border: 1px solid #eeeeee;
  879. &.isActive {
  880. background: #005cc6cc
  881. }
  882. &:hover {
  883. background: #005cc6cc;
  884. }
  885. }
  886. .ckzb-btn-mb {
  887. width: 30px;
  888. font-size: 12px;
  889. border-radius: 10px;
  890. color: #ffffff;
  891. cursor: pointer;
  892. background: #01346f99;
  893. padding: 5px;
  894. text-align: center;
  895. border: 1px solid #eeeeee;
  896. &.isActive {
  897. background: #005cc6cc
  898. }
  899. &:hover {
  900. background: #005cc6cc;
  901. }
  902. }
  903. .heatmapPanel {
  904. position: absolute;
  905. right: 0;
  906. bottom: 50px;
  907. background: #01346f99;
  908. border-radius: 5px;
  909. padding-left: 10px;
  910. height: fit-content;
  911. overflow: hidden;
  912. overflow-y: auto;
  913. height: 280px;
  914. ul {
  915. margin: 0 0;
  916. padding: 0 0;
  917. }
  918. li {
  919. list-style: none;
  920. padding-right: 10px;
  921. .el-checkbox {
  922. color: #ffffff;
  923. &.is-checked {
  924. :deep(.el-checkbox__label) {
  925. color: #ffffff;
  926. }
  927. }
  928. }
  929. }
  930. }
  931. }
  932. .heatmapLegend {
  933. position: absolute;
  934. left: 400px;
  935. bottom: 50px;
  936. width: 50px;
  937. height: 200px;
  938. background: url(~@/assets/images/heatmapLegend.png) no-repeat center center/100% 100%;
  939. }
  940. .heatmapLegend-mb {
  941. position: absolute;
  942. left: 10px;
  943. bottom: 50px;
  944. width: 10px;
  945. height: 100px;
  946. background: url(~@/assets/images/heatmapLegend.png) no-repeat center center/100% 100%;
  947. }
  948. .tips {
  949. position: absolute;
  950. left: 0px;
  951. bottom: 0px;
  952. color: #ffffff;
  953. padding: 10px 10px;
  954. background: #01346f99;
  955. width: 100%;
  956. text-align: center;
  957. }
  958. .yjdp-btn {
  959. position: absolute;
  960. top: 80px;
  961. right: 20px;
  962. width: 70px;
  963. height: 40px;
  964. border-radius: 10px;
  965. color: #ffffff;
  966. cursor: pointer;
  967. background: #01346f99;
  968. line-height: 38px;
  969. padding: 0 15px;
  970. text-align: center;
  971. border: 1px solid #eeeeee;
  972. &.isActive {
  973. background: #005cc6cc;
  974. }
  975. &:hover {
  976. background: #005cc6cc;
  977. }
  978. }
  979. .yjdp-btn-mb {
  980. position: absolute;
  981. top: 130px;
  982. right: 20px;
  983. width: 30px;
  984. font-size: 12px;
  985. border-radius: 10px;
  986. color: #ffffff;
  987. cursor: pointer;
  988. background: #01346f99;
  989. padding: 5px;
  990. text-align: center;
  991. border: 1px solid #eeeeee;
  992. &.isActive {
  993. background: #005cc6cc;
  994. }
  995. &:hover {
  996. background: #005cc6cc;
  997. }
  998. }
  999. .kzdp-btn {
  1000. position: absolute;
  1001. top: 130px;
  1002. right: 20px;
  1003. width: 70px;
  1004. height: 40px;
  1005. border-radius: 10px;
  1006. color: #ffffff;
  1007. cursor: pointer;
  1008. background: #01346f99;
  1009. line-height: 38px;
  1010. padding: 0 15px;
  1011. text-align: center;
  1012. border: 1px solid #eeeeee;
  1013. &.isActive {
  1014. background: #005cc6cc;
  1015. }
  1016. &:hover {
  1017. background: #005cc6cc;
  1018. }
  1019. }
  1020. .kzdp-btn-mb {
  1021. position: absolute;
  1022. top: 180px;
  1023. right: 20px;
  1024. width: 30px;
  1025. font-size: 12px;
  1026. border-radius: 10px;
  1027. color: #ffffff;
  1028. cursor: pointer;
  1029. background: #01346f99;
  1030. padding: 5px;
  1031. text-align: center;
  1032. border: 1px solid #eeeeee;
  1033. &.isActive {
  1034. background: #005cc6cc;
  1035. }
  1036. &:hover {
  1037. background: #005cc6cc;
  1038. }
  1039. }
  1040. .yhfk-btn {
  1041. position: absolute;
  1042. top: 180px;
  1043. right: 20px;
  1044. width: 70px;
  1045. height: 40px;
  1046. border-radius: 10px;
  1047. color: #ffffff;
  1048. cursor: pointer;
  1049. background: #01346f99;
  1050. line-height: 38px;
  1051. padding: 0 15px;
  1052. text-align: center;
  1053. border: 1px solid #eeeeee;
  1054. &:hover {
  1055. background: #005cc6cc;
  1056. }
  1057. }
  1058. .yhfk-btn-mb {
  1059. position: absolute;
  1060. top: 230px;
  1061. right: 20px;
  1062. width: 30px;
  1063. font-size: 12px;
  1064. border-radius: 10px;
  1065. color: #ffffff;
  1066. cursor: pointer;
  1067. background: #01346f99;
  1068. padding: 5px;
  1069. text-align: center;
  1070. border: 1px solid #eeeeee;
  1071. &:hover {
  1072. background: #005cc6cc;
  1073. }
  1074. }
  1075. .zxq-btn {
  1076. position: absolute;
  1077. top: 230px;
  1078. right: 20px;
  1079. width: 80px;
  1080. height: 80px;
  1081. border-radius: 10px;
  1082. color: #ffffff;
  1083. cursor: pointer;
  1084. background: #01346f99 url(~@/assets/images/zxq.png) no-repeat center center /90% 90%;
  1085. padding: 10px 10px;
  1086. text-align: center;
  1087. line-height: 90px;
  1088. border: 1px solid #eeeeee;
  1089. &.isActive {
  1090. background: #005cc6cc url(~@/assets/images/zxq.png) no-repeat center center /90% 90%;
  1091. }
  1092. &:hover {
  1093. background: #005cc6cc url(~@/assets/images/zxq.png) no-repeat center center /90% 90%;
  1094. }
  1095. }
  1096. .zxq-btn-mb {
  1097. position: absolute;
  1098. top: 280px;
  1099. right: 10px;
  1100. width: 60px;
  1101. height: 60px;
  1102. border-radius: 10px;
  1103. color: #ffffff;
  1104. cursor: pointer;
  1105. background: url(~@/assets/images/zxq.png) no-repeat center center / 90% 90%;
  1106. text-align: center;
  1107. &.isActive {
  1108. background: #005cc6cc url(~@/assets/images/zxq.png) no-repeat center center /90% 90%;
  1109. }
  1110. &:hover {
  1111. background: #005cc6cc url(~@/assets/images/zxq.png) no-repeat center center /90% 90%;
  1112. }
  1113. }
  1114. .yjdpInfoDialog {
  1115. position: absolute;
  1116. top: 0px;
  1117. left: 0px;
  1118. width: 300px;
  1119. height: 200px;
  1120. background: #01346f99;
  1121. border-radius: 10px;
  1122. .close {
  1123. font-size: 24px;
  1124. position: absolute;
  1125. top: 6px;
  1126. right: 8px;
  1127. line-height: 24px;
  1128. width: 24px;
  1129. height: 24px;
  1130. cursor: pointer;
  1131. color: #ffffff;
  1132. }
  1133. .content {
  1134. height: 160px;
  1135. color: #ffffff;
  1136. margin: 30px 0px 10px 20px;
  1137. .item {
  1138. line-height: 30px;
  1139. margin-right: 20px;
  1140. }
  1141. }
  1142. }
  1143. .kzdpInfoDialog {
  1144. position: absolute;
  1145. top: 0px;
  1146. left: 0px;
  1147. width: 300px;
  1148. height: 200px;
  1149. background: #01346f99;
  1150. border-radius: 10px;
  1151. .close {
  1152. font-size: 24px;
  1153. position: absolute;
  1154. top: 6px;
  1155. right: 8px;
  1156. line-height: 24px;
  1157. width: 24px;
  1158. height: 24px;
  1159. cursor: pointer;
  1160. color: #ffffff;
  1161. }
  1162. .content {
  1163. height: 160px;
  1164. color: #ffffff;
  1165. margin: 30px 0px 10px 20px;
  1166. .item {
  1167. line-height: 30px;
  1168. margin-right: 20px;
  1169. }
  1170. }
  1171. }
  1172. .zxqIframeContainer {
  1173. position: absolute;
  1174. top: 100px;
  1175. bottom: 100px;
  1176. width: 600px;
  1177. right: 200px;
  1178. padding: 10px 10px;
  1179. border-radius: 10px;
  1180. overflow: hidden;
  1181. background: #01346f99;
  1182. .close {
  1183. font-size: 24px;
  1184. font-weight: bold;
  1185. position: absolute;
  1186. top: 15px;
  1187. right: 15px;
  1188. z-index: 1;
  1189. cursor: pointer;
  1190. width: 30px;
  1191. height: 30px;
  1192. text-align: center;
  1193. line-height: 30px;
  1194. }
  1195. iframe {
  1196. width: 100%;
  1197. height: 100%;
  1198. }
  1199. }
  1200. .zxqIframeContainer-mb-mx {
  1201. position: absolute;
  1202. top: 0px;
  1203. bottom: 0px;
  1204. width: 100%;
  1205. height: 100%; /* iframe高度自适应 */
  1206. border-radius: 10px;
  1207. overflow: hidden;
  1208. background: #01346f99;
  1209. z-index: 999;
  1210. .wind {
  1211. font-size: 16px;
  1212. font-weight: bold;
  1213. position: absolute;
  1214. top: 15px;
  1215. right: 40px;
  1216. z-index: 1;
  1217. cursor: pointer;
  1218. width: 30px;
  1219. height: 30px;
  1220. text-align: center;
  1221. line-height: 30px;
  1222. }
  1223. .close {
  1224. font-size: 24px;
  1225. font-weight: bold;
  1226. position: absolute;
  1227. top: 15px;
  1228. right: 15px;
  1229. z-index: 1;
  1230. cursor: pointer;
  1231. width: 30px;
  1232. height: 30px;
  1233. text-align: center;
  1234. line-height: 30px;
  1235. }
  1236. iframe {
  1237. width: 100%;
  1238. height: 100%;
  1239. }
  1240. }
  1241. .zxqIframeContainer-mb {
  1242. position: absolute;
  1243. //top: 0px;
  1244. bottom: 0px;
  1245. width: 100%;
  1246. height: 30%;
  1247. border-radius: 10px;
  1248. overflow: hidden;
  1249. background: #01346f99;
  1250. z-index: 999;
  1251. .wind {
  1252. font-size: 16px;
  1253. font-weight: bold;
  1254. position: absolute;
  1255. top: 15px;
  1256. right: 40px;
  1257. z-index: 1;
  1258. cursor: pointer;
  1259. width: 30px;
  1260. height: 30px;
  1261. text-align: center;
  1262. line-height: 30px;
  1263. }
  1264. .close {
  1265. font-size: 24px;
  1266. font-weight: bold;
  1267. position: absolute;
  1268. top: 15px;
  1269. right: 15px;
  1270. z-index: 1;
  1271. cursor: pointer;
  1272. width: 30px;
  1273. height: 30px;
  1274. text-align: center;
  1275. line-height: 30px;
  1276. }
  1277. iframe {
  1278. width: 100%;
  1279. height: 100%;
  1280. }
  1281. }
  1282. }
  1283. </style>