supermap.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. <template>
  2. <div>
  3. <div id="qksupermap" ref="map" style="height: 100%;width: 100%"></div>
  4. <div>
  5. <el-dialog title="防汛物资" :visible.sync="suppliesOpen" width="700px" append-to-body>
  6. <el-table :data="suppliesData" height="350">
  7. <el-table-column width="60" label="序号" align="center" type="index"/>
  8. <el-table-column label="品种" align="center" prop="varieties"/>
  9. <el-table-column label="价值(万元)" align="center" prop="cost"/>
  10. <el-table-column label="备注" align="center" prop="remarks"/>
  11. </el-table>
  12. </el-dialog>
  13. </div>
  14. <div>
  15. <el-dialog title="抢险救援队" :visible.sync="teamOpen" width="1200px" append-to-body>
  16. <el-table :data="teamData" height="350">
  17. <el-table-column width="60" label="序号" align="center" type="index"/>
  18. <el-table-column width="100" label="姓名" align="center" prop="name"/>
  19. <el-table-column label="职务" align="center" prop="post"/>
  20. <el-table-column label="手机号" align="center" prop="phone"/>
  21. <el-table-column label="组织归属" align="center" prop="dept"/>
  22. <el-table-column label="所属乡镇" align="center" prop="township"/>
  23. <el-table-column label="所属村" align="center" prop="village"/>
  24. </el-table>
  25. </el-dialog>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. import {iconList, selectSuperMap, listForMark, getIcon, yjIconList} from '@/api/components/supermap.js';
  31. import {
  32. selectQkEmergencyRescueTeamAllList,
  33. selectQkEmergencyShelterAllList,
  34. selectQkRescueSuppliesAllList,
  35. selectQkRescueSuppliesByDeptId,
  36. selectQkEmergencyRescueTeamByDeptId
  37. } from "@/api/system/aqyj";
  38. export default {
  39. name: "sookaSuperMap",
  40. data() {
  41. return {
  42. suppliesOpen: false,
  43. suppliesData: [],
  44. teamOpen: false,
  45. teamData: [],
  46. isAdmin: false,
  47. isJieDao: false,
  48. mapId: "qksupermap",
  49. layers: [],
  50. map_shequList: [],
  51. datasource_datasetNames: [],
  52. map: null,
  53. layerId: "",
  54. zoom: "",
  55. iServerJieDaoSheQuMap: "",
  56. iServerQkYingxiangtuMap: "",
  57. iServerQkYingxiangtuMapLunKuo: "",
  58. iServerJilinshengAndQikaiMap: "",
  59. datasourceName: "",
  60. datasetName: "",
  61. centerpointLon: "",
  62. centerpointLat: "",
  63. iServerMap: "",
  64. marker: "",
  65. editableLayers: [],
  66. url: "",
  67. dataUrl: "",
  68. workspace_qk: "",
  69. workspace_jdsq: "",
  70. workspace_qkyxt: "",
  71. workspace_qkyxtlk: "",
  72. map_jilinShiLiang: "",
  73. map_qikaiYingXiang: "",
  74. map_qikaiYingXiangLunKuo: "",
  75. //选择用到的
  76. resultData: [],
  77. resultLayer: [],
  78. // 街道
  79. jieDao: null,
  80. // 社区
  81. sheQu: null,
  82. // 社区集合
  83. sqOptions: null,
  84. // 影像图/矢量图
  85. yxtSlt: null,
  86. // 人房户/事件
  87. rfhSj: null,
  88. // 年份
  89. year: null,
  90. //事件落点类型
  91. markType: ['sxt'],
  92. //事件详情页是否显示
  93. eventDetailVisible: null,
  94. // 路由参数
  95. routeType: null,
  96. showLatLng: null,
  97. closeChoseBuilding: null,
  98. lockReconnect: false,
  99. userId: null,
  100. layerGroup: null, // 地图标点图标
  101. myLayerGroup: []
  102. }
  103. },
  104. mounted() {
  105. this.getSupermap(this.sqOptionsProps, this.jieDaoProps, this.sheQuProps, this.yxtSltProps, this.rfhSjProps, this.yearProps);
  106. },
  107. props: {
  108. // 社区集合
  109. sqOptionsProps: null,
  110. // 街道
  111. jieDaoProps: null,
  112. // 社区
  113. sheQuProps: null,
  114. // 影像图/矢量图
  115. yxtSltProps: null,
  116. // 人房户/事件
  117. rfhSjProps: null,
  118. // 年份
  119. yearProps: null,
  120. },
  121. methods: {
  122. getSupermap: async function (sqOptions, jieDao, sheQu, yxtSlt, rfhSj, year) {
  123. this.sqOptions = sqOptions;
  124. this.jieDao = jieDao;
  125. this.sheQu = sheQu;
  126. this.yxtSlt = yxtSlt;
  127. this.rfhSj = rfhSj;
  128. this.year = year;
  129. this.mapId = "";
  130. this.layers = [];
  131. this.map_shequList = [];
  132. this.datasource_datasetNames = [];
  133. selectSuperMap().then(response => {
  134. this.centerpointLat = response.data.superMapIServerQiKaiQuMapCenterPoint.split(",")[0];
  135. this.centerpointLon = response.data.superMapIServerQiKaiQuMapCenterPoint.split(",")[1];
  136. // this.datasetName="汽开区";
  137. // this.datasourceName="building";
  138. this.iServerMap = response.data.superMapIServer;
  139. this.layerId = response.data.layerId;
  140. this.zoom = response.data.zoom;
  141. this.iServerJilinshengAndQikaiMap = response.data.superMapIServerJilinshengAndQikaiMap;
  142. this.iServerJieDaoSheQuMap = response.data.superMapIServerJiedaoshequMap;
  143. this.iServerQkYingxiangtuMap = response.data.superMapIServerJilinshengYingxaingAndQikaiMap;
  144. this.iServerQkYingxiangtuMapLunKuo = response.data.superMapIServerQikaiOutlineMap;
  145. this.dataUrl = response.data.superMapIServerJiedaoshequMap;
  146. this.url = response.data.superMapIServerJiedaoshequMap;
  147. this.workspace_qk = this.iServerJilinshengAndQikaiMap;//省矢量及区影像,固定加载。
  148. this.workspace_jdsq = this.iServerJieDaoSheQuMap;//街道社区的地图服务路径
  149. this.workspace_qkyxt = this.iServerQkYingxiangtuMap;//汽开区影像图
  150. this.workspace_qkyxtlk = this.iServerQkYingxiangtuMapLunKuo;//汽开区影像轮廓图
  151. this.map_jilinShiLiang = window.L.supermap.tiledMapLayer(this.workspace_qk, {
  152. noWrap: true
  153. });
  154. this.map_qikaiYingXiang = window.L.supermap.tiledMapLayer(this.workspace_qkyxt + '/经开影像', {
  155. noWrap: true
  156. });
  157. this.map_qikaiYingXiangLunKuo = window.L.supermap.tiledMapLayer(this.workspace_qkyxtlk, {
  158. noWrap: true
  159. });
  160. this.initSlt();
  161. });
  162. },
  163. /**
  164. * 矢量图
  165. */
  166. initSlt: async function () {
  167. this.layers.push(this.map_jilinShiLiang);//吉林矢量
  168. this.initYxt();
  169. },
  170. /**
  171. * 影像图
  172. */
  173. initYxt: async function () {
  174. if (this.yxtSlt == 'yxt') {//影像图
  175. this.layers.push(this.map_qikaiYingXiang);//汽开影像
  176. this.layers.push(this.map_qikaiYingXiangLunKuo);//汽开影像轮廓
  177. }
  178. this.initZxd();
  179. },
  180. /**
  181. * 事件落点
  182. */
  183. initSjd: async function () {
  184. this.init(this.markType, this.map);
  185. },
  186. /**
  187. * 中心点、zoom
  188. */
  189. initZxd: async function () {
  190. this.initMap();
  191. },
  192. /**
  193. * 落点定位
  194. */
  195. dropLocation: function (lat, lng) {
  196. this.map.flyTo([lat, lng], 16, {duration: 3})
  197. },
  198. /**
  199. * 加载地图
  200. */
  201. initMap: async function () {
  202. let _that = this;
  203. this.map && this.map.remove();
  204. this.map = window.L.map('qksupermap', {
  205. preferCanvas: true,
  206. center: [this.centerpointLat, this.centerpointLon],//[43.876540660858154,125.24094343185425],
  207. zoom: this.zoom,
  208. crs: window.L.CRS.EPSG4326,
  209. zoomControl: false,
  210. doubleClickZoom: false,
  211. layers: this.layers,
  212. attributionControl: false,
  213. logoControl: false,
  214. });
  215. this.initSjd();
  216. },
  217. //事件落点相关方法
  218. init: function () {
  219. this.selectCameraList()
  220. },
  221. addMarkers(options, type) {
  222. let marker;
  223. let markers = [];
  224. let layerGroups = [];
  225. let clusterGroup = L.markerClusterGroup({
  226. //设置为true时显示聚类所占据的范围
  227. showCoverageOnHover: false,
  228. //设置为true时会向低一级聚类缩放
  229. zoomToBoundsOnClick: true,
  230. //增加点位时增加聚合动画(否则会出问题)
  231. animateAddingMarkers: true,
  232. //最大缩放级别点击聚合图标展开图标
  233. spiderfyOnMaxZoom: true
  234. });
  235. for (let i = 0; i < options.length; i++) {
  236. if (type == "sxt") {
  237. marker = this.addMarker(options[i], type);
  238. } else if (type == "yjcs") {
  239. marker = this.addShelterMarker(options[i], type);
  240. } else if (type == "jyd") {
  241. marker = this.addTeamMarker(options[i], type);
  242. } else if (type == "fxwz") {
  243. marker = this.addSuppliesMark(options[i], type);
  244. }
  245. clusterGroup.addLayer(marker);
  246. this.myLayerGroup.push({type: type, myGroup: clusterGroup});
  247. }
  248. this.map.addLayer(clusterGroup);
  249. },
  250. addMarker(option, type) {
  251. let markers = [];
  252. //定义图标
  253. let icon = new window.L.Icon({
  254. iconUrl: getIcon(option.buildType),
  255. iconAnchor: [50, 50],
  256. iconSize: [37, 64],
  257. popupAnchor: [-33, -47],
  258. shadowSize: [41, 41]
  259. });
  260. //定义落点
  261. let marker = L.marker([option.latitude, option.longitude], {
  262. icon: icon
  263. });
  264. //定义泡泡层
  265. marker.on('mouseover', function () {
  266. let html = "";
  267. html += "<p class='v-p-color'>摄像头名称:" + option.cameraName + "</p>";
  268. html += "<p class='v-p-color'>摄像头类型:" + option.buildTypeName + "</p>";
  269. html += "<p class='v-p-color'>所属派出所:" + option.policeName + "</p>";
  270. this.bindPopup(html).openPopup(this.getLatLng());
  271. });
  272. /**鼠标移开关闭popup**/
  273. marker.on('mouseout', function () {
  274. this.closePopup();
  275. });
  276. return marker;
  277. },
  278. addShelterMarker(option, type) {
  279. let markers = [];
  280. //定义图标
  281. let icon = new window.L.Icon({
  282. iconUrl: yjIconList[type],
  283. iconAnchor: [50, 50],
  284. iconSize: [37, 64],
  285. popupAnchor: [-33, -47],
  286. shadowSize: [41, 41]
  287. });
  288. //定义落点
  289. let marker = L.marker([option.latitude, option.longitude], {
  290. icon: icon
  291. });
  292. //定义泡泡层
  293. marker.on('mouseover', function () {
  294. let html = "";
  295. html += "<p class='v-p-color'>摄像头名称:" + option.cameraName + "</p>";
  296. html += "<p class='v-p-color'>点位具体位置:" + option.address + "</p>";
  297. html += "<p class='v-p-color'>视频点:" + option.videoSpot + "</p>";
  298. html += "<p class='v-p-color'>型号:" + option.cameraModel + "</p>";
  299. html += "<p class='v-p-color'>数量:" + option.number + "</p>";
  300. html += "<p class='v-p-color'>单位:" + option.unit + "</p>";
  301. html += "<p class='v-p-color'>备注:" + option.remark + "</p>";
  302. this.bindPopup(html).openPopup(this.getLatLng());
  303. });
  304. // /**鼠标移开关闭popup**/
  305. marker.on('mouseout', function () {
  306. this.closePopup();
  307. });
  308. return marker;
  309. },
  310. addTeamMarker(option, type) {
  311. let that = this;
  312. let markers = [];
  313. //定义图标
  314. let icon = new window.L.Icon({
  315. iconUrl: yjIconList[type],
  316. iconAnchor: [50, 50],
  317. iconSize: [37, 64],
  318. popupAnchor: [-33, -47],
  319. shadowSize: [41, 41]
  320. });
  321. //定义落点
  322. let marker = L.marker([option.latitude, option.longitude], {
  323. icon: icon
  324. });
  325. //定义泡泡层
  326. marker.on('click', function () {
  327. that.selectQkEmergencyRescueTeamByDeptId(option.deptId)
  328. that.suppliesOpen = false
  329. });
  330. return marker;
  331. },
  332. addSuppliesMark(option, type) {
  333. let that = this;
  334. let markers = [];
  335. //定义图标
  336. let icon = new window.L.Icon({
  337. iconUrl: yjIconList[type],
  338. iconAnchor: [50, 50],
  339. iconSize: [37, 64],
  340. popupAnchor: [-33, -47],
  341. shadowSize: [41, 41]
  342. });
  343. //定义落点
  344. let marker = L.marker([option.latitude, option.longitude], {
  345. icon: icon
  346. });
  347. //定义泡泡层
  348. marker.on('click', function () {
  349. that.selectQkRescueSuppliesByDeptId(option.deptId)
  350. that.suppliesOpen = false
  351. });
  352. return marker;
  353. },
  354. /**
  355. * 清理地图标点
  356. */
  357. clearM: function () {
  358. let that = this;
  359. if (that.myLayerGroup != null && that.myLayerGroup.length > 0) {
  360. for (var i = this.myLayerGroup.length - 1; i >= 0; i--) {
  361. that.myLayerGroup[i].myGroup.clearLayers()
  362. that.myLayerGroup.splice(i, 1)
  363. }
  364. }
  365. },
  366. //查询摄像头落点列表
  367. selectCameraList() {
  368. let that = this;
  369. listForMark().then(response => {
  370. that.addMarkers(response.data, "sxt");
  371. });
  372. },
  373. //查询应急避难所落点列表
  374. selectQkEmergencyShelterAllList() {
  375. let that = this;
  376. selectQkEmergencyShelterAllList().then(response => {
  377. that.addMarkers(response.data, "yjcs");
  378. })
  379. },
  380. //查询抢险救援队落点列表
  381. selectQkEmergencyRescueTeamAllList() {
  382. let that = this;
  383. selectQkEmergencyRescueTeamAllList().then(response => {
  384. that.addMarkers(response.data, "jyd");
  385. })
  386. },
  387. selectQkEmergencyRescueTeamByDeptId(deptId) {
  388. selectQkEmergencyRescueTeamByDeptId(deptId).then(res => {
  389. this.teamData = res.data;
  390. this.teamOpen = true
  391. })
  392. },
  393. //查询防汛抗旱物资储备落点列表
  394. selectQkRescueSuppliesAllList() {
  395. let that = this;
  396. selectQkRescueSuppliesAllList().then(response => {
  397. that.addMarkers(response.data, 'fxwz');
  398. })
  399. },
  400. selectQkRescueSuppliesByDeptId(deptId) {
  401. selectQkRescueSuppliesByDeptId(deptId).then(res => {
  402. this.suppliesData = res.data;
  403. this.suppliesOpen = true
  404. })
  405. },
  406. }
  407. }
  408. </script>
  409. <style>
  410. .header .nav {
  411. z-index: 0;
  412. }
  413. th {
  414. width: 100px; /* 设置宽度 */
  415. color: white; /* 设置字体颜色为白色 */
  416. }
  417. td {
  418. color: white; /* 设置字体颜色为白色 */
  419. }
  420. /*地图DOM*/
  421. #qksupermap {
  422. width: 100%;
  423. /* height: 1080px !important; */
  424. background: none;
  425. }
  426. .el-dialog {
  427. background: #014f9f;
  428. }
  429. .el-dialog__title {
  430. color: #ffffff;
  431. }
  432. .el-dialog__headerbtn .el-dialog__close {
  433. color: #ffffff;
  434. }
  435. .el-table {
  436. background-color: #014f9f;
  437. color: #fff;
  438. border-bottom: 1px solid #335d81;
  439. }
  440. .el-table .el-table__header-wrapper th, .el-table .el-table__fixed-header-wrapper th {
  441. background-color: #032d58c9;
  442. color: #fff;
  443. }
  444. .el-table .cell{
  445. color: #fff;
  446. }
  447. .el-table tr {
  448. background-color: #04346f61;
  449. }
  450. .el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell {
  451. background-color: #1c7fdb;
  452. }
  453. .el-table td.el-table__cell div{
  454. color: #fff;
  455. }
  456. .el-table th.el-table__cell.is-leaf, .el-table td.el-table__cell {
  457. border-bottom: 1px solid #335d81;
  458. }
  459. .el-table::before, .el-table--group::after, .el-table--border::after {
  460. background-color: #335d81;
  461. }
  462. .el-table__body-wrapper::-webkit-scrollbar{
  463. background: #294f76;
  464. }
  465. .el-table__body-wrapper::-webkit-scrollbar-thumb {
  466. background-color: #34669c;
  467. }
  468. .el-table__body-wrapper::-webkit-scrollbar-track {
  469. background-color: #294f76;
  470. }
  471. /* popup */
  472. .leaflet-popup {
  473. position: absolute;
  474. text-align: center;
  475. margin-bottom: 20px;
  476. }
  477. .leaflet-popup-content-wrapper {
  478. padding: 1px;
  479. text-align: left;
  480. border-radius: 12px;
  481. }
  482. .leaflet-popup-content {
  483. margin: 13px 19px;
  484. line-height: 1.4;
  485. width: 298px!important;
  486. }
  487. .leaflet-popup-content p {
  488. margin: 18px 0;
  489. color: #fff;
  490. }
  491. .leaflet-popup-tip-container {
  492. width: 40px;
  493. height: 20px;
  494. position: absolute;
  495. left: 50%;
  496. margin-left: -20px;
  497. overflow: hidden;
  498. pointer-events: none;
  499. }
  500. .leaflet-popup-tip {
  501. width: 17px;
  502. height: 17px;
  503. padding: 1px;
  504. margin: -10px auto 0;
  505. -webkit-transform: rotate(45deg);
  506. -moz-transform: rotate(45deg);
  507. -ms-transform: rotate(45deg);
  508. transform: rotate(45deg);
  509. }
  510. .leaflet-popup-content-wrapper,
  511. .leaflet-popup-tip {
  512. background: rgba(4, 45, 106, 0.7);
  513. color: #333;
  514. box-shadow: 0 3px 14px rgba(0,0,0,0.4);
  515. }
  516. .leaflet-container a.leaflet-popup-close-button {
  517. position: absolute;
  518. top: 0;
  519. right: 0;
  520. padding: 4px 4px 0 0;
  521. border: none;
  522. text-align: center;
  523. width: 18px;
  524. height: 14px;
  525. font: 16px/14px Tahoma, Verdana, sans-serif;
  526. color: #c3c3c3;
  527. text-decoration: none;
  528. font-weight: bold;
  529. background: transparent;
  530. }
  531. .leaflet-container a.leaflet-popup-close-button:hover {
  532. color: #999;
  533. }
  534. .leaflet-popup-scrolled {
  535. overflow: auto;
  536. border-bottom: 1px solid #ddd;
  537. border-top: 1px solid #ddd;
  538. }
  539. .leaflet-oldie .leaflet-popup-content-wrapper {
  540. -ms-zoom: 1;
  541. }
  542. .leaflet-oldie .leaflet-popup-tip {
  543. width: 24px;
  544. margin: 0 auto;
  545. -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
  546. filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
  547. }
  548. .leaflet-oldie .leaflet-popup-tip-container {
  549. margin-top: -1px;
  550. }
  551. .leaflet-oldie .leaflet-control-zoom,
  552. .leaflet-oldie .leaflet-control-layers,
  553. .leaflet-oldie .leaflet-popup-content-wrapper,
  554. .leaflet-oldie .leaflet-popup-tip {
  555. border: 1px solid #999;
  556. }
  557. </style>