南昌市物联网技防平台-前端
jxdnsong
2021-02-03 45c7addf91f1aa3778626eb82ee6148093c55c15
地图定位添加
3 files modified
23 ■■■■■ changed files
public/map/index.html 7 ●●●● patch | view | raw | blame | history
public/map/widgets/map/MapWidget.js 4 ●●●● patch | view | raw | blame | history
src/views/realTimePolice/real.vue 12 ●●●●● patch | view | raw | blame | history
public/map/index.html
@@ -4,7 +4,7 @@
 * @Author: yangsx
 * @Date: 2019-11-28 09:50:16
 * @LastEditors: song
 * @LastEditTime: 2021-01-29 16:25:05
 * @LastEditTime: 2021-02-01 17:14:21
 -->
<!DOCTYPE html>
<html lang="zh">
@@ -61,9 +61,12 @@
    }
    function showFun(id) {
      console.log(_AppEvent)
      _AppEvent.dispatchAppEvent(_AppEvent.RUN_WIDGET, id);
    }
    function dw(x,y) {
      _AppEvent.dispatchAppEvent("goto", {x:x,y:y});
    }
  </script>
</head>
public/map/widgets/map/MapWidget.js
@@ -124,6 +124,10 @@
            this._eventHandlers.push(this.map.on("mouse-move", lang.hitch(this, this._onMouseMove)));
            AppEvent.addAppEventListener(AppEvent.SWITCH_BASEMAP, lang.hitch(this, this.onSwitchBaseMap));
            AppEvent.addAppEventListener(AppEvent.ADD_TOP_MOST_LAYER, lang.hitch(this, this.onAddTopMostLayer));
            AppEvent.addAppEventListener("goto", lang.hitch(this, this.goto));
        },
        goto: function (evt) {
            this.map.centerAndZoom(new Point(evt.x,evt.y, new SpatialReference({ wkid: 4326 })), 14);
        },
        onload: function () {
            //var listNode = this.map.attribution.listNode;
src/views/realTimePolice/real.vue
@@ -89,7 +89,7 @@
          icon="el-icon-check"
          :size="size"
          :type="type"
          @click.stop="handleMap()"
          @click.stop="handleMap(row)"
          >定位</el-button
        >
      </template>
@@ -279,7 +279,8 @@
      :visible.sync="showMap"
    >
      <iframe
        :src="mapUrl"
        id="mapDiv"
        src="https://s16s652780.51mypc.cn/jfpt/map/index.html"
        frameborder="0"
        width="100%"
        height="100%"
@@ -302,7 +303,6 @@
  data() {
    return {
      showMap: false,
      mapUrl:"https://s16s652780.51mypc.cn/jfpt/map/index.html",
      hls: "",
      videoSource: "",
      dialogTableVisible: false,
@@ -762,9 +762,11 @@
    handleHistory(row) {
      this.$router.push({ path: `/real/history/${row.deviceNumber}` });
    },
    handleMap() {
    handleMap(row) {
      this.showMap = true;
      this.mapUrl = "https://s16s652780.51mypc.cn/jfpt/map/index.html?openid=PatrolManagement"
      debugger;
      var sddsds = document.getElementById("mapDiv");
      document.getElementById("mapDiv").contentWindow.dw(row.jd,row.wd)
    },
    handleManage(row) {
      this.form = row;