diff --git a/config/dev.env.js b/config/dev.env.js index 1fb35de..6644302 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -10,8 +10,8 @@ // BASE_API: '"http://106.74.146.218:2031"' // BASE_API: '"http://192.168.0.123:14537"' // BASE_API: '"http://139.198.17.115:20004/smartwell"' - // BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' - BASE_API: '"https://smartlog.work/smartwell"' + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' + // BASE_API: '"https://smartlog.work/smartwell"' // BASE_API: '"http://111.198.10.15:11302/smartwell"' // BASE_API: '"http://192.168.0.225:8083"' // BASE_API: '"http://127.0.0.1:14537"' diff --git a/config/dev.env.js b/config/dev.env.js index 1fb35de..6644302 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -10,8 +10,8 @@ // BASE_API: '"http://106.74.146.218:2031"' // BASE_API: '"http://192.168.0.123:14537"' // BASE_API: '"http://139.198.17.115:20004/smartwell"' - // BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' - BASE_API: '"https://smartlog.work/smartwell"' + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' + // BASE_API: '"https://smartlog.work/smartwell"' // BASE_API: '"http://111.198.10.15:11302/smartwell"' // BASE_API: '"http://192.168.0.225:8083"' // BASE_API: '"http://127.0.0.1:14537"' diff --git a/config/index.js b/config/index.js index 835a11b..1fecefb 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/yizhuang/', // ori:/ + assetsPublicPath: '/yizhuang_inner/', // ori:/ /** * Source Maps diff --git a/config/dev.env.js b/config/dev.env.js index 1fb35de..6644302 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -10,8 +10,8 @@ // BASE_API: '"http://106.74.146.218:2031"' // BASE_API: '"http://192.168.0.123:14537"' // BASE_API: '"http://139.198.17.115:20004/smartwell"' - // BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' - BASE_API: '"https://smartlog.work/smartwell"' + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' + // BASE_API: '"https://smartlog.work/smartwell"' // BASE_API: '"http://111.198.10.15:11302/smartwell"' // BASE_API: '"http://192.168.0.225:8083"' // BASE_API: '"http://127.0.0.1:14537"' diff --git a/config/index.js b/config/index.js index 835a11b..1fecefb 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/yizhuang/', // ori:/ + assetsPublicPath: '/yizhuang_inner/', // ori:/ /** * Source Maps diff --git a/index.html b/index.html index e6d7ac3..ec5d087 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,8 @@ - + + 窨井安全监控防御中控管理平台 diff --git a/config/dev.env.js b/config/dev.env.js index 1fb35de..6644302 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -10,8 +10,8 @@ // BASE_API: '"http://106.74.146.218:2031"' // BASE_API: '"http://192.168.0.123:14537"' // BASE_API: '"http://139.198.17.115:20004/smartwell"' - // BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' - BASE_API: '"https://smartlog.work/smartwell"' + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' + // BASE_API: '"https://smartlog.work/smartwell"' // BASE_API: '"http://111.198.10.15:11302/smartwell"' // BASE_API: '"http://192.168.0.225:8083"' // BASE_API: '"http://127.0.0.1:14537"' diff --git a/config/index.js b/config/index.js index 835a11b..1fecefb 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/yizhuang/', // ori:/ + assetsPublicPath: '/yizhuang_inner/', // ori:/ /** * Source Maps diff --git a/index.html b/index.html index e6d7ac3..ec5d087 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,8 @@ - + + 窨井安全监控防御中控管理平台 diff --git a/src/components/CMap/components/cmap.vue b/src/components/CMap/components/cmap.vue index fdec804..808ada3 100644 --- a/src/components/CMap/components/cmap.vue +++ b/src/components/CMap/components/cmap.vue @@ -174,9 +174,22 @@ subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') - // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 @@ -582,8 +595,8 @@ }, getMapScript() { // 动态获取cmap的脚本 - // const TMapURL = 'http://satellite.casm.ac.cn:8020/geowinmap/api?version=tapi&map=map&utils=mapcase' - const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + // const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + const TMapURL = 'http://10.10.5.42:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' return new Promise((resolve, reject) => { console.log(window.CMapLayers) // 如果已加载直接返回 diff --git a/config/dev.env.js b/config/dev.env.js index 1fb35de..6644302 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -10,8 +10,8 @@ // BASE_API: '"http://106.74.146.218:2031"' // BASE_API: '"http://192.168.0.123:14537"' // BASE_API: '"http://139.198.17.115:20004/smartwell"' - // BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' - BASE_API: '"https://smartlog.work/smartwell"' + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' + // BASE_API: '"https://smartlog.work/smartwell"' // BASE_API: '"http://111.198.10.15:11302/smartwell"' // BASE_API: '"http://192.168.0.225:8083"' // BASE_API: '"http://127.0.0.1:14537"' diff --git a/config/index.js b/config/index.js index 835a11b..1fecefb 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/yizhuang/', // ori:/ + assetsPublicPath: '/yizhuang_inner/', // ori:/ /** * Source Maps diff --git a/index.html b/index.html index e6d7ac3..ec5d087 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,8 @@ - + + 窨井安全监控防御中控管理平台 diff --git a/src/components/CMap/components/cmap.vue b/src/components/CMap/components/cmap.vue index fdec804..808ada3 100644 --- a/src/components/CMap/components/cmap.vue +++ b/src/components/CMap/components/cmap.vue @@ -174,9 +174,22 @@ subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') - // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 @@ -582,8 +595,8 @@ }, getMapScript() { // 动态获取cmap的脚本 - // const TMapURL = 'http://satellite.casm.ac.cn:8020/geowinmap/api?version=tapi&map=map&utils=mapcase' - const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + // const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + const TMapURL = 'http://10.10.5.42:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' return new Promise((resolve, reject) => { console.log(window.CMapLayers) // 如果已加载直接返回 diff --git a/src/components/CMap/components/cmapSimple.vue b/src/components/CMap/components/cmapSimple.vue index 5164b6b..c9f9d8f 100644 --- a/src/components/CMap/components/cmapSimple.vue +++ b/src/components/CMap/components/cmapSimple.vue @@ -160,8 +160,23 @@ url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 diff --git a/config/dev.env.js b/config/dev.env.js index 1fb35de..6644302 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -10,8 +10,8 @@ // BASE_API: '"http://106.74.146.218:2031"' // BASE_API: '"http://192.168.0.123:14537"' // BASE_API: '"http://139.198.17.115:20004/smartwell"' - // BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' - BASE_API: '"https://smartlog.work/smartwell"' + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' + // BASE_API: '"https://smartlog.work/smartwell"' // BASE_API: '"http://111.198.10.15:11302/smartwell"' // BASE_API: '"http://192.168.0.225:8083"' // BASE_API: '"http://127.0.0.1:14537"' diff --git a/config/index.js b/config/index.js index 835a11b..1fecefb 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/yizhuang/', // ori:/ + assetsPublicPath: '/yizhuang_inner/', // ori:/ /** * Source Maps diff --git a/index.html b/index.html index e6d7ac3..ec5d087 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,8 @@ - + + 窨井安全监控防御中控管理平台 diff --git a/src/components/CMap/components/cmap.vue b/src/components/CMap/components/cmap.vue index fdec804..808ada3 100644 --- a/src/components/CMap/components/cmap.vue +++ b/src/components/CMap/components/cmap.vue @@ -174,9 +174,22 @@ subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') - // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 @@ -582,8 +595,8 @@ }, getMapScript() { // 动态获取cmap的脚本 - // const TMapURL = 'http://satellite.casm.ac.cn:8020/geowinmap/api?version=tapi&map=map&utils=mapcase' - const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + // const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + const TMapURL = 'http://10.10.5.42:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' return new Promise((resolve, reject) => { console.log(window.CMapLayers) // 如果已加载直接返回 diff --git a/src/components/CMap/components/cmapSimple.vue b/src/components/CMap/components/cmapSimple.vue index 5164b6b..c9f9d8f 100644 --- a/src/components/CMap/components/cmapSimple.vue +++ b/src/components/CMap/components/cmapSimple.vue @@ -160,8 +160,23 @@ url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 diff --git a/src/components/CMap/components/cmapSmart.vue b/src/components/CMap/components/cmapSmart.vue index a9baefa..faf95f5 100644 --- a/src/components/CMap/components/cmapSmart.vue +++ b/src/components/CMap/components/cmapSmart.vue @@ -184,10 +184,23 @@ subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') - + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 const opts = { diff --git a/config/dev.env.js b/config/dev.env.js index 1fb35de..6644302 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -10,8 +10,8 @@ // BASE_API: '"http://106.74.146.218:2031"' // BASE_API: '"http://192.168.0.123:14537"' // BASE_API: '"http://139.198.17.115:20004/smartwell"' - // BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' - BASE_API: '"https://smartlog.work/smartwell"' + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' + // BASE_API: '"https://smartlog.work/smartwell"' // BASE_API: '"http://111.198.10.15:11302/smartwell"' // BASE_API: '"http://192.168.0.225:8083"' // BASE_API: '"http://127.0.0.1:14537"' diff --git a/config/index.js b/config/index.js index 835a11b..1fecefb 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/yizhuang/', // ori:/ + assetsPublicPath: '/yizhuang_inner/', // ori:/ /** * Source Maps diff --git a/index.html b/index.html index e6d7ac3..ec5d087 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,8 @@ - + + 窨井安全监控防御中控管理平台 diff --git a/src/components/CMap/components/cmap.vue b/src/components/CMap/components/cmap.vue index fdec804..808ada3 100644 --- a/src/components/CMap/components/cmap.vue +++ b/src/components/CMap/components/cmap.vue @@ -174,9 +174,22 @@ subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') - // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 @@ -582,8 +595,8 @@ }, getMapScript() { // 动态获取cmap的脚本 - // const TMapURL = 'http://satellite.casm.ac.cn:8020/geowinmap/api?version=tapi&map=map&utils=mapcase' - const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + // const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + const TMapURL = 'http://10.10.5.42:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' return new Promise((resolve, reject) => { console.log(window.CMapLayers) // 如果已加载直接返回 diff --git a/src/components/CMap/components/cmapSimple.vue b/src/components/CMap/components/cmapSimple.vue index 5164b6b..c9f9d8f 100644 --- a/src/components/CMap/components/cmapSimple.vue +++ b/src/components/CMap/components/cmapSimple.vue @@ -160,8 +160,23 @@ url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 diff --git a/src/components/CMap/components/cmapSmart.vue b/src/components/CMap/components/cmapSmart.vue index a9baefa..faf95f5 100644 --- a/src/components/CMap/components/cmapSmart.vue +++ b/src/components/CMap/components/cmapSmart.vue @@ -184,10 +184,23 @@ subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') - + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 const opts = { diff --git a/src/store/modules/websocket.js b/src/store/modules/websocket.js new file mode 100644 index 0000000..eca2112 --- /dev/null +++ b/src/store/modules/websocket.js @@ -0,0 +1,104 @@ +import { Notification } from 'element-ui' +import router from '../../router' +import user from './user' +const websocket = { + state: { + wsUrl: 'ws://111.198.10.15:11304/websocket/', + websocket: null, + wsStatus: false, // websocket连接状态 + needRefresh: false, // 是否需要刷新数据 + needHeartbeat: true, // 是否需要开启心跳机制 + ws_timeout_timer: null, // 超时计时器 + ws_live_timer: null, // 在线计时器 + clock: 50 // 时间 + }, + mutations: { + SET_WEBSOCKET: (state, websocket) => { + state.websocket = websocket + }, + SET_WS_STATUS: (state, wsStatus) => { + state.wsStatus = wsStatus + }, + SET_NEED_REFRESH: (state, needRefresh) => { + state.needRefresh = needRefresh + } + }, + + actions: { + // 连接websocket + initWebSocket({ commit }) { + if (typeof (WebSocket) === 'undefined') { + Notification({ + title: '提示', + message: '当前浏览器无法接收实时报警信息,请使用谷歌浏览器或360浏览器极速模式!', + type: 'warning', + duration: 0 + }) + } else { + // 获取token保存到vuex中的用户信息,此处仅适用于本项目,注意删除或修改 + // 实例化socket,这里我把用户名传给了后台,使后台能判断要把消息发给哪个用户,其实也可以后台直接获取用户IP来判断并推送 + const socketUrl = websocket.state.wsUrl + user.state.id + console.log(socketUrl) + const socket = new WebSocket(socketUrl) + commit('SET_WEBSOCKET', socket) + commit('SET_WS_STATUS', true) + // 监听socket打开 + socket.onopen = function() { + console.log('浏览器WebSocket已打开') + } + // 监听socket消息接收 + socket.onmessage = function(msg) { + // 转换为json对象 + const data = JSON.parse(msg.data) + console.log(data) + if (data.type === 'alarm') { + commit('SET_NEED_REFRESH', true) + Notification({ + title: '新报警来了', + // 这里也可以把返回信息加入到message中显示 + message: data.message, + type: 'warning', + onClick: () => { + router.push({ + path: '/overview', + query: { refresh: true } + }) + } + }) + setTimeout(function() { + commit('SET_NEED_REFRESH', false) + }, 2000) + } + } + // 监听socket错误 + socket.onerror = function() { + Notification({ + title: '服务器错误', + message: '无法接收实时报警信息,请检查服务器后重新刷新页面', + type: 'error', + duration: 0 + }) + } + // 监听socket关闭 + socket.onclose = function() { + console.log('WebSocket已关闭') + commit('SET_WS_STATUS', false) + } + } + }, + startHeartBeat() { + console.log('开启心跳发送') + const that = this + const socket = this.socket + this.ws_live_timer = setTimeout(function() { + socket.send('heartbeat') + // 倒计时,时间超了断开连接 + that.ws_timeout_timer = setTimeout(function() { + socket.close() + }, that.clock) + }, that.clock) + } + } +} + +export default websocket diff --git a/config/dev.env.js b/config/dev.env.js index 1fb35de..6644302 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -10,8 +10,8 @@ // BASE_API: '"http://106.74.146.218:2031"' // BASE_API: '"http://192.168.0.123:14537"' // BASE_API: '"http://139.198.17.115:20004/smartwell"' - // BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' - BASE_API: '"https://smartlog.work/smartwell"' + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' + // BASE_API: '"https://smartlog.work/smartwell"' // BASE_API: '"http://111.198.10.15:11302/smartwell"' // BASE_API: '"http://192.168.0.225:8083"' // BASE_API: '"http://127.0.0.1:14537"' diff --git a/config/index.js b/config/index.js index 835a11b..1fecefb 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/yizhuang/', // ori:/ + assetsPublicPath: '/yizhuang_inner/', // ori:/ /** * Source Maps diff --git a/index.html b/index.html index e6d7ac3..ec5d087 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,8 @@ - + + 窨井安全监控防御中控管理平台 diff --git a/src/components/CMap/components/cmap.vue b/src/components/CMap/components/cmap.vue index fdec804..808ada3 100644 --- a/src/components/CMap/components/cmap.vue +++ b/src/components/CMap/components/cmap.vue @@ -174,9 +174,22 @@ subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') - // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 @@ -582,8 +595,8 @@ }, getMapScript() { // 动态获取cmap的脚本 - // const TMapURL = 'http://satellite.casm.ac.cn:8020/geowinmap/api?version=tapi&map=map&utils=mapcase' - const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + // const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + const TMapURL = 'http://10.10.5.42:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' return new Promise((resolve, reject) => { console.log(window.CMapLayers) // 如果已加载直接返回 diff --git a/src/components/CMap/components/cmapSimple.vue b/src/components/CMap/components/cmapSimple.vue index 5164b6b..c9f9d8f 100644 --- a/src/components/CMap/components/cmapSimple.vue +++ b/src/components/CMap/components/cmapSimple.vue @@ -160,8 +160,23 @@ url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 diff --git a/src/components/CMap/components/cmapSmart.vue b/src/components/CMap/components/cmapSmart.vue index a9baefa..faf95f5 100644 --- a/src/components/CMap/components/cmapSmart.vue +++ b/src/components/CMap/components/cmapSmart.vue @@ -184,10 +184,23 @@ subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') - + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 const opts = { diff --git a/src/store/modules/websocket.js b/src/store/modules/websocket.js new file mode 100644 index 0000000..eca2112 --- /dev/null +++ b/src/store/modules/websocket.js @@ -0,0 +1,104 @@ +import { Notification } from 'element-ui' +import router from '../../router' +import user from './user' +const websocket = { + state: { + wsUrl: 'ws://111.198.10.15:11304/websocket/', + websocket: null, + wsStatus: false, // websocket连接状态 + needRefresh: false, // 是否需要刷新数据 + needHeartbeat: true, // 是否需要开启心跳机制 + ws_timeout_timer: null, // 超时计时器 + ws_live_timer: null, // 在线计时器 + clock: 50 // 时间 + }, + mutations: { + SET_WEBSOCKET: (state, websocket) => { + state.websocket = websocket + }, + SET_WS_STATUS: (state, wsStatus) => { + state.wsStatus = wsStatus + }, + SET_NEED_REFRESH: (state, needRefresh) => { + state.needRefresh = needRefresh + } + }, + + actions: { + // 连接websocket + initWebSocket({ commit }) { + if (typeof (WebSocket) === 'undefined') { + Notification({ + title: '提示', + message: '当前浏览器无法接收实时报警信息,请使用谷歌浏览器或360浏览器极速模式!', + type: 'warning', + duration: 0 + }) + } else { + // 获取token保存到vuex中的用户信息,此处仅适用于本项目,注意删除或修改 + // 实例化socket,这里我把用户名传给了后台,使后台能判断要把消息发给哪个用户,其实也可以后台直接获取用户IP来判断并推送 + const socketUrl = websocket.state.wsUrl + user.state.id + console.log(socketUrl) + const socket = new WebSocket(socketUrl) + commit('SET_WEBSOCKET', socket) + commit('SET_WS_STATUS', true) + // 监听socket打开 + socket.onopen = function() { + console.log('浏览器WebSocket已打开') + } + // 监听socket消息接收 + socket.onmessage = function(msg) { + // 转换为json对象 + const data = JSON.parse(msg.data) + console.log(data) + if (data.type === 'alarm') { + commit('SET_NEED_REFRESH', true) + Notification({ + title: '新报警来了', + // 这里也可以把返回信息加入到message中显示 + message: data.message, + type: 'warning', + onClick: () => { + router.push({ + path: '/overview', + query: { refresh: true } + }) + } + }) + setTimeout(function() { + commit('SET_NEED_REFRESH', false) + }, 2000) + } + } + // 监听socket错误 + socket.onerror = function() { + Notification({ + title: '服务器错误', + message: '无法接收实时报警信息,请检查服务器后重新刷新页面', + type: 'error', + duration: 0 + }) + } + // 监听socket关闭 + socket.onclose = function() { + console.log('WebSocket已关闭') + commit('SET_WS_STATUS', false) + } + } + }, + startHeartBeat() { + console.log('开启心跳发送') + const that = this + const socket = this.socket + this.ws_live_timer = setTimeout(function() { + socket.send('heartbeat') + // 倒计时,时间超了断开连接 + that.ws_timeout_timer = setTimeout(function() { + socket.close() + }, that.clock) + }, that.clock) + } + } +} + +export default websocket diff --git a/src/utils/permission.js b/src/utils/permission.js index 43a6657..d43f991 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -38,7 +38,6 @@ // 判断用户是否为运维人员或其他管理员 export function isOperation() { const roleTips = store.getters.roleTips - console.log(roleTips) return roleTips.some(tip => { // 遍历btns,查找btn.url是否有匹配的permission,有则返回true,否则返回false return (tip === 'operation' || tip === 'administrator') }) @@ -46,7 +45,6 @@ // 判断是不是超级管理员 export function isAdministrator() { const roleTips = store.getters.roleTips - console.log(roleTips) return roleTips.some(tip => { // 遍历btns,查找btn.url是否有匹配的permission,有则返回true,否则返回false return (tip === 'administrator') }) diff --git a/config/dev.env.js b/config/dev.env.js index 1fb35de..6644302 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -10,8 +10,8 @@ // BASE_API: '"http://106.74.146.218:2031"' // BASE_API: '"http://192.168.0.123:14537"' // BASE_API: '"http://139.198.17.115:20004/smartwell"' - // BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' - BASE_API: '"https://smartlog.work/smartwell"' + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' + // BASE_API: '"https://smartlog.work/smartwell"' // BASE_API: '"http://111.198.10.15:11302/smartwell"' // BASE_API: '"http://192.168.0.225:8083"' // BASE_API: '"http://127.0.0.1:14537"' diff --git a/config/index.js b/config/index.js index 835a11b..1fecefb 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/yizhuang/', // ori:/ + assetsPublicPath: '/yizhuang_inner/', // ori:/ /** * Source Maps diff --git a/index.html b/index.html index e6d7ac3..ec5d087 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,8 @@ - + + 窨井安全监控防御中控管理平台 diff --git a/src/components/CMap/components/cmap.vue b/src/components/CMap/components/cmap.vue index fdec804..808ada3 100644 --- a/src/components/CMap/components/cmap.vue +++ b/src/components/CMap/components/cmap.vue @@ -174,9 +174,22 @@ subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') - // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 @@ -582,8 +595,8 @@ }, getMapScript() { // 动态获取cmap的脚本 - // const TMapURL = 'http://satellite.casm.ac.cn:8020/geowinmap/api?version=tapi&map=map&utils=mapcase' - const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + // const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + const TMapURL = 'http://10.10.5.42:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' return new Promise((resolve, reject) => { console.log(window.CMapLayers) // 如果已加载直接返回 diff --git a/src/components/CMap/components/cmapSimple.vue b/src/components/CMap/components/cmapSimple.vue index 5164b6b..c9f9d8f 100644 --- a/src/components/CMap/components/cmapSimple.vue +++ b/src/components/CMap/components/cmapSimple.vue @@ -160,8 +160,23 @@ url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 diff --git a/src/components/CMap/components/cmapSmart.vue b/src/components/CMap/components/cmapSmart.vue index a9baefa..faf95f5 100644 --- a/src/components/CMap/components/cmapSmart.vue +++ b/src/components/CMap/components/cmapSmart.vue @@ -184,10 +184,23 @@ subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') - + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 const opts = { diff --git a/src/store/modules/websocket.js b/src/store/modules/websocket.js new file mode 100644 index 0000000..eca2112 --- /dev/null +++ b/src/store/modules/websocket.js @@ -0,0 +1,104 @@ +import { Notification } from 'element-ui' +import router from '../../router' +import user from './user' +const websocket = { + state: { + wsUrl: 'ws://111.198.10.15:11304/websocket/', + websocket: null, + wsStatus: false, // websocket连接状态 + needRefresh: false, // 是否需要刷新数据 + needHeartbeat: true, // 是否需要开启心跳机制 + ws_timeout_timer: null, // 超时计时器 + ws_live_timer: null, // 在线计时器 + clock: 50 // 时间 + }, + mutations: { + SET_WEBSOCKET: (state, websocket) => { + state.websocket = websocket + }, + SET_WS_STATUS: (state, wsStatus) => { + state.wsStatus = wsStatus + }, + SET_NEED_REFRESH: (state, needRefresh) => { + state.needRefresh = needRefresh + } + }, + + actions: { + // 连接websocket + initWebSocket({ commit }) { + if (typeof (WebSocket) === 'undefined') { + Notification({ + title: '提示', + message: '当前浏览器无法接收实时报警信息,请使用谷歌浏览器或360浏览器极速模式!', + type: 'warning', + duration: 0 + }) + } else { + // 获取token保存到vuex中的用户信息,此处仅适用于本项目,注意删除或修改 + // 实例化socket,这里我把用户名传给了后台,使后台能判断要把消息发给哪个用户,其实也可以后台直接获取用户IP来判断并推送 + const socketUrl = websocket.state.wsUrl + user.state.id + console.log(socketUrl) + const socket = new WebSocket(socketUrl) + commit('SET_WEBSOCKET', socket) + commit('SET_WS_STATUS', true) + // 监听socket打开 + socket.onopen = function() { + console.log('浏览器WebSocket已打开') + } + // 监听socket消息接收 + socket.onmessage = function(msg) { + // 转换为json对象 + const data = JSON.parse(msg.data) + console.log(data) + if (data.type === 'alarm') { + commit('SET_NEED_REFRESH', true) + Notification({ + title: '新报警来了', + // 这里也可以把返回信息加入到message中显示 + message: data.message, + type: 'warning', + onClick: () => { + router.push({ + path: '/overview', + query: { refresh: true } + }) + } + }) + setTimeout(function() { + commit('SET_NEED_REFRESH', false) + }, 2000) + } + } + // 监听socket错误 + socket.onerror = function() { + Notification({ + title: '服务器错误', + message: '无法接收实时报警信息,请检查服务器后重新刷新页面', + type: 'error', + duration: 0 + }) + } + // 监听socket关闭 + socket.onclose = function() { + console.log('WebSocket已关闭') + commit('SET_WS_STATUS', false) + } + } + }, + startHeartBeat() { + console.log('开启心跳发送') + const that = this + const socket = this.socket + this.ws_live_timer = setTimeout(function() { + socket.send('heartbeat') + // 倒计时,时间超了断开连接 + that.ws_timeout_timer = setTimeout(function() { + socket.close() + }, that.clock) + }, that.clock) + } + } +} + +export default websocket diff --git a/src/utils/permission.js b/src/utils/permission.js index 43a6657..d43f991 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -38,7 +38,6 @@ // 判断用户是否为运维人员或其他管理员 export function isOperation() { const roleTips = store.getters.roleTips - console.log(roleTips) return roleTips.some(tip => { // 遍历btns,查找btn.url是否有匹配的permission,有则返回true,否则返回false return (tip === 'operation' || tip === 'administrator') }) @@ -46,7 +45,6 @@ // 判断是不是超级管理员 export function isAdministrator() { const roleTips = store.getters.roleTips - console.log(roleTips) return roleTips.some(tip => { // 遍历btns,查找btn.url是否有匹配的permission,有则返回true,否则返回false return (tip === 'administrator') }) diff --git a/src/views/alarmManage/components/HandlePrompt.vue b/src/views/alarmManage/components/HandlePrompt.vue index d802514..cfd1b21 100644 --- a/src/views/alarmManage/components/HandlePrompt.vue +++ b/src/views/alarmManage/components/HandlePrompt.vue @@ -67,7 +67,6 @@ methods: { // 初始化对话框 initDialog: function(dialogFormVisible, jobId, isBatch, params) { - debugger this.dialogVisible = dialogFormVisible this.isBatch = isBatch if (isBatch) { diff --git a/config/dev.env.js b/config/dev.env.js index 1fb35de..6644302 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -10,8 +10,8 @@ // BASE_API: '"http://106.74.146.218:2031"' // BASE_API: '"http://192.168.0.123:14537"' // BASE_API: '"http://139.198.17.115:20004/smartwell"' - // BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' - BASE_API: '"https://smartlog.work/smartwell"' + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' + // BASE_API: '"https://smartlog.work/smartwell"' // BASE_API: '"http://111.198.10.15:11302/smartwell"' // BASE_API: '"http://192.168.0.225:8083"' // BASE_API: '"http://127.0.0.1:14537"' diff --git a/config/index.js b/config/index.js index 835a11b..1fecefb 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/yizhuang/', // ori:/ + assetsPublicPath: '/yizhuang_inner/', // ori:/ /** * Source Maps diff --git a/index.html b/index.html index e6d7ac3..ec5d087 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,8 @@ - + + 窨井安全监控防御中控管理平台 diff --git a/src/components/CMap/components/cmap.vue b/src/components/CMap/components/cmap.vue index fdec804..808ada3 100644 --- a/src/components/CMap/components/cmap.vue +++ b/src/components/CMap/components/cmap.vue @@ -174,9 +174,22 @@ subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') - // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 @@ -582,8 +595,8 @@ }, getMapScript() { // 动态获取cmap的脚本 - // const TMapURL = 'http://satellite.casm.ac.cn:8020/geowinmap/api?version=tapi&map=map&utils=mapcase' - const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + // const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + const TMapURL = 'http://10.10.5.42:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' return new Promise((resolve, reject) => { console.log(window.CMapLayers) // 如果已加载直接返回 diff --git a/src/components/CMap/components/cmapSimple.vue b/src/components/CMap/components/cmapSimple.vue index 5164b6b..c9f9d8f 100644 --- a/src/components/CMap/components/cmapSimple.vue +++ b/src/components/CMap/components/cmapSimple.vue @@ -160,8 +160,23 @@ url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 diff --git a/src/components/CMap/components/cmapSmart.vue b/src/components/CMap/components/cmapSmart.vue index a9baefa..faf95f5 100644 --- a/src/components/CMap/components/cmapSmart.vue +++ b/src/components/CMap/components/cmapSmart.vue @@ -184,10 +184,23 @@ subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') - + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 const opts = { diff --git a/src/store/modules/websocket.js b/src/store/modules/websocket.js new file mode 100644 index 0000000..eca2112 --- /dev/null +++ b/src/store/modules/websocket.js @@ -0,0 +1,104 @@ +import { Notification } from 'element-ui' +import router from '../../router' +import user from './user' +const websocket = { + state: { + wsUrl: 'ws://111.198.10.15:11304/websocket/', + websocket: null, + wsStatus: false, // websocket连接状态 + needRefresh: false, // 是否需要刷新数据 + needHeartbeat: true, // 是否需要开启心跳机制 + ws_timeout_timer: null, // 超时计时器 + ws_live_timer: null, // 在线计时器 + clock: 50 // 时间 + }, + mutations: { + SET_WEBSOCKET: (state, websocket) => { + state.websocket = websocket + }, + SET_WS_STATUS: (state, wsStatus) => { + state.wsStatus = wsStatus + }, + SET_NEED_REFRESH: (state, needRefresh) => { + state.needRefresh = needRefresh + } + }, + + actions: { + // 连接websocket + initWebSocket({ commit }) { + if (typeof (WebSocket) === 'undefined') { + Notification({ + title: '提示', + message: '当前浏览器无法接收实时报警信息,请使用谷歌浏览器或360浏览器极速模式!', + type: 'warning', + duration: 0 + }) + } else { + // 获取token保存到vuex中的用户信息,此处仅适用于本项目,注意删除或修改 + // 实例化socket,这里我把用户名传给了后台,使后台能判断要把消息发给哪个用户,其实也可以后台直接获取用户IP来判断并推送 + const socketUrl = websocket.state.wsUrl + user.state.id + console.log(socketUrl) + const socket = new WebSocket(socketUrl) + commit('SET_WEBSOCKET', socket) + commit('SET_WS_STATUS', true) + // 监听socket打开 + socket.onopen = function() { + console.log('浏览器WebSocket已打开') + } + // 监听socket消息接收 + socket.onmessage = function(msg) { + // 转换为json对象 + const data = JSON.parse(msg.data) + console.log(data) + if (data.type === 'alarm') { + commit('SET_NEED_REFRESH', true) + Notification({ + title: '新报警来了', + // 这里也可以把返回信息加入到message中显示 + message: data.message, + type: 'warning', + onClick: () => { + router.push({ + path: '/overview', + query: { refresh: true } + }) + } + }) + setTimeout(function() { + commit('SET_NEED_REFRESH', false) + }, 2000) + } + } + // 监听socket错误 + socket.onerror = function() { + Notification({ + title: '服务器错误', + message: '无法接收实时报警信息,请检查服务器后重新刷新页面', + type: 'error', + duration: 0 + }) + } + // 监听socket关闭 + socket.onclose = function() { + console.log('WebSocket已关闭') + commit('SET_WS_STATUS', false) + } + } + }, + startHeartBeat() { + console.log('开启心跳发送') + const that = this + const socket = this.socket + this.ws_live_timer = setTimeout(function() { + socket.send('heartbeat') + // 倒计时,时间超了断开连接 + that.ws_timeout_timer = setTimeout(function() { + socket.close() + }, that.clock) + }, that.clock) + } + } +} + +export default websocket diff --git a/src/utils/permission.js b/src/utils/permission.js index 43a6657..d43f991 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -38,7 +38,6 @@ // 判断用户是否为运维人员或其他管理员 export function isOperation() { const roleTips = store.getters.roleTips - console.log(roleTips) return roleTips.some(tip => { // 遍历btns,查找btn.url是否有匹配的permission,有则返回true,否则返回false return (tip === 'operation' || tip === 'administrator') }) @@ -46,7 +45,6 @@ // 判断是不是超级管理员 export function isAdministrator() { const roleTips = store.getters.roleTips - console.log(roleTips) return roleTips.some(tip => { // 遍历btns,查找btn.url是否有匹配的permission,有则返回true,否则返回false return (tip === 'administrator') }) diff --git a/src/views/alarmManage/components/HandlePrompt.vue b/src/views/alarmManage/components/HandlePrompt.vue index d802514..cfd1b21 100644 --- a/src/views/alarmManage/components/HandlePrompt.vue +++ b/src/views/alarmManage/components/HandlePrompt.vue @@ -67,7 +67,6 @@ methods: { // 初始化对话框 initDialog: function(dialogFormVisible, jobId, isBatch, params) { - debugger this.dialogVisible = dialogFormVisible this.isBatch = isBatch if (isBatch) { diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 5aa9388..5645b88 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -68,9 +68,13 @@ data() { return { // wsPath: 'ws://139.198.17.115:20004/smartwell/websocket/' - // wsPath: 'wss://yjaqjk.bda.gov.cn/smartwell/websocket/', - wsPath: 'wss://smartlog.work/smartwell/websocket/', - showSetPwd: this.$store.getters.resetPwd + wsPath: 'wss://yjaqjk.bda.gov.cn/smartwell/websocket/', + // wsPath: 'wss://smartlog.work/smartwell/websocket/', + showSetPwd: this.$store.getters.resetPwd, + socket: null, // websocket对象 + ws_timeout_timer: null, // 超时计时器 + ws_live_timer: null, // 在线计时器 + clock: 30000 // 时间 } }, computed: { @@ -85,7 +89,15 @@ ]) }, mounted() { - this.webSocket() + if (this.socket == null) { + this.webSocket() + } + }, + activated() { + this.$refs.panelgroup.refreshData() + if (this.socket == null) { + this.webSocket() + } }, methods: { webSocket() { @@ -108,6 +120,7 @@ this.socket.onopen = function() { console.log('浏览器WebSocket已打开') // 加入心跳监测 + that.startHeartBeat() console.log(new Date()) } // 监听socket消息接收 @@ -157,6 +170,9 @@ } }) } + clearTimeout(this.ws_live_timer) + clearTimeout(this.ws_timeout_timer) + this.startHeartBeat() } // 监听socket错误 this.socket.onerror = function() { @@ -172,8 +188,21 @@ console.log('WebSocket已关闭') console.log(e) console.log(new Date()) + that.socket = null } } + }, + startHeartBeat() { + const that = this + const socket = this.socket + this.ws_live_timer = setTimeout(function() { + console.log('心跳发送') + socket.send('heartbeat') + // 倒计时,时间超了断开连接 + that.ws_timeout_timer = setTimeout(function() { + socket.close() + }, that.clock) + }, that.clock) } } } diff --git a/config/dev.env.js b/config/dev.env.js index 1fb35de..6644302 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -10,8 +10,8 @@ // BASE_API: '"http://106.74.146.218:2031"' // BASE_API: '"http://192.168.0.123:14537"' // BASE_API: '"http://139.198.17.115:20004/smartwell"' - // BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' - BASE_API: '"https://smartlog.work/smartwell"' + BASE_API: '"https://yjaqjk.bda.gov.cn/smartwell"' + // BASE_API: '"https://smartlog.work/smartwell"' // BASE_API: '"http://111.198.10.15:11302/smartwell"' // BASE_API: '"http://192.168.0.225:8083"' // BASE_API: '"http://127.0.0.1:14537"' diff --git a/config/index.js b/config/index.js index 835a11b..1fecefb 100644 --- a/config/index.js +++ b/config/index.js @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/yizhuang/', // ori:/ + assetsPublicPath: '/yizhuang_inner/', // ori:/ /** * Source Maps diff --git a/index.html b/index.html index e6d7ac3..ec5d087 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,8 @@ - + + 窨井安全监控防御中控管理平台 diff --git a/src/components/CMap/components/cmap.vue b/src/components/CMap/components/cmap.vue index fdec804..808ada3 100644 --- a/src/components/CMap/components/cmap.vue +++ b/src/components/CMap/components/cmap.vue @@ -174,9 +174,22 @@ subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') - // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 @@ -582,8 +595,8 @@ }, getMapScript() { // 动态获取cmap的脚本 - // const TMapURL = 'http://satellite.casm.ac.cn:8020/geowinmap/api?version=tapi&map=map&utils=mapcase' - const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + // const TMapURL = 'http://119.3.228.125:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' + const TMapURL = 'http://10.10.5.42:8080/geowinmap/api?version=tapi&map=map&utils=mapcase,mapv' return new Promise((resolve, reject) => { console.log(window.CMapLayers) // 如果已加载直接返回 diff --git a/src/components/CMap/components/cmapSimple.vue b/src/components/CMap/components/cmapSimple.vue index 5164b6b..c9f9d8f 100644 --- a/src/components/CMap/components/cmapSimple.vue +++ b/src/components/CMap/components/cmapSimple.vue @@ -160,8 +160,23 @@ url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 diff --git a/src/components/CMap/components/cmapSmart.vue b/src/components/CMap/components/cmapSmart.vue index a9baefa..faf95f5 100644 --- a/src/components/CMap/components/cmapSmart.vue +++ b/src/components/CMap/components/cmapSmart.vue @@ -184,10 +184,23 @@ subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) + var mapLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'map', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') + var mapLabelLayer = new CTileLayer({ + zbound: [1, 18], + tileName: 'maplabel', + zIndex: null, + subdomains: CGeowin.BaseMapServer + }) + + // const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') - + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') const { getCenterPoint, zoom } = this // 初始化配置 const opts = { diff --git a/src/store/modules/websocket.js b/src/store/modules/websocket.js new file mode 100644 index 0000000..eca2112 --- /dev/null +++ b/src/store/modules/websocket.js @@ -0,0 +1,104 @@ +import { Notification } from 'element-ui' +import router from '../../router' +import user from './user' +const websocket = { + state: { + wsUrl: 'ws://111.198.10.15:11304/websocket/', + websocket: null, + wsStatus: false, // websocket连接状态 + needRefresh: false, // 是否需要刷新数据 + needHeartbeat: true, // 是否需要开启心跳机制 + ws_timeout_timer: null, // 超时计时器 + ws_live_timer: null, // 在线计时器 + clock: 50 // 时间 + }, + mutations: { + SET_WEBSOCKET: (state, websocket) => { + state.websocket = websocket + }, + SET_WS_STATUS: (state, wsStatus) => { + state.wsStatus = wsStatus + }, + SET_NEED_REFRESH: (state, needRefresh) => { + state.needRefresh = needRefresh + } + }, + + actions: { + // 连接websocket + initWebSocket({ commit }) { + if (typeof (WebSocket) === 'undefined') { + Notification({ + title: '提示', + message: '当前浏览器无法接收实时报警信息,请使用谷歌浏览器或360浏览器极速模式!', + type: 'warning', + duration: 0 + }) + } else { + // 获取token保存到vuex中的用户信息,此处仅适用于本项目,注意删除或修改 + // 实例化socket,这里我把用户名传给了后台,使后台能判断要把消息发给哪个用户,其实也可以后台直接获取用户IP来判断并推送 + const socketUrl = websocket.state.wsUrl + user.state.id + console.log(socketUrl) + const socket = new WebSocket(socketUrl) + commit('SET_WEBSOCKET', socket) + commit('SET_WS_STATUS', true) + // 监听socket打开 + socket.onopen = function() { + console.log('浏览器WebSocket已打开') + } + // 监听socket消息接收 + socket.onmessage = function(msg) { + // 转换为json对象 + const data = JSON.parse(msg.data) + console.log(data) + if (data.type === 'alarm') { + commit('SET_NEED_REFRESH', true) + Notification({ + title: '新报警来了', + // 这里也可以把返回信息加入到message中显示 + message: data.message, + type: 'warning', + onClick: () => { + router.push({ + path: '/overview', + query: { refresh: true } + }) + } + }) + setTimeout(function() { + commit('SET_NEED_REFRESH', false) + }, 2000) + } + } + // 监听socket错误 + socket.onerror = function() { + Notification({ + title: '服务器错误', + message: '无法接收实时报警信息,请检查服务器后重新刷新页面', + type: 'error', + duration: 0 + }) + } + // 监听socket关闭 + socket.onclose = function() { + console.log('WebSocket已关闭') + commit('SET_WS_STATUS', false) + } + } + }, + startHeartBeat() { + console.log('开启心跳发送') + const that = this + const socket = this.socket + this.ws_live_timer = setTimeout(function() { + socket.send('heartbeat') + // 倒计时,时间超了断开连接 + that.ws_timeout_timer = setTimeout(function() { + socket.close() + }, that.clock) + }, that.clock) + } + } +} + +export default websocket diff --git a/src/utils/permission.js b/src/utils/permission.js index 43a6657..d43f991 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -38,7 +38,6 @@ // 判断用户是否为运维人员或其他管理员 export function isOperation() { const roleTips = store.getters.roleTips - console.log(roleTips) return roleTips.some(tip => { // 遍历btns,查找btn.url是否有匹配的permission,有则返回true,否则返回false return (tip === 'operation' || tip === 'administrator') }) @@ -46,7 +45,6 @@ // 判断是不是超级管理员 export function isAdministrator() { const roleTips = store.getters.roleTips - console.log(roleTips) return roleTips.some(tip => { // 遍历btns,查找btn.url是否有匹配的permission,有则返回true,否则返回false return (tip === 'administrator') }) diff --git a/src/views/alarmManage/components/HandlePrompt.vue b/src/views/alarmManage/components/HandlePrompt.vue index d802514..cfd1b21 100644 --- a/src/views/alarmManage/components/HandlePrompt.vue +++ b/src/views/alarmManage/components/HandlePrompt.vue @@ -67,7 +67,6 @@ methods: { // 初始化对话框 initDialog: function(dialogFormVisible, jobId, isBatch, params) { - debugger this.dialogVisible = dialogFormVisible this.isBatch = isBatch if (isBatch) { diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 5aa9388..5645b88 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -68,9 +68,13 @@ data() { return { // wsPath: 'ws://139.198.17.115:20004/smartwell/websocket/' - // wsPath: 'wss://yjaqjk.bda.gov.cn/smartwell/websocket/', - wsPath: 'wss://smartlog.work/smartwell/websocket/', - showSetPwd: this.$store.getters.resetPwd + wsPath: 'wss://yjaqjk.bda.gov.cn/smartwell/websocket/', + // wsPath: 'wss://smartlog.work/smartwell/websocket/', + showSetPwd: this.$store.getters.resetPwd, + socket: null, // websocket对象 + ws_timeout_timer: null, // 超时计时器 + ws_live_timer: null, // 在线计时器 + clock: 30000 // 时间 } }, computed: { @@ -85,7 +89,15 @@ ]) }, mounted() { - this.webSocket() + if (this.socket == null) { + this.webSocket() + } + }, + activated() { + this.$refs.panelgroup.refreshData() + if (this.socket == null) { + this.webSocket() + } }, methods: { webSocket() { @@ -108,6 +120,7 @@ this.socket.onopen = function() { console.log('浏览器WebSocket已打开') // 加入心跳监测 + that.startHeartBeat() console.log(new Date()) } // 监听socket消息接收 @@ -157,6 +170,9 @@ } }) } + clearTimeout(this.ws_live_timer) + clearTimeout(this.ws_timeout_timer) + this.startHeartBeat() } // 监听socket错误 this.socket.onerror = function() { @@ -172,8 +188,21 @@ console.log('WebSocket已关闭') console.log(e) console.log(new Date()) + that.socket = null } } + }, + startHeartBeat() { + const that = this + const socket = this.socket + this.ws_live_timer = setTimeout(function() { + console.log('心跳发送') + socket.send('heartbeat') + // 倒计时,时间超了断开连接 + that.ws_timeout_timer = setTimeout(function() { + socket.close() + }, that.clock) + }, that.clock) } } } diff --git a/src/views/deviceManage/listDevice.vue b/src/views/deviceManage/listDevice.vue index eafa3c8..bc368a3 100644 --- a/src/views/deviceManage/listDevice.vue +++ b/src/views/deviceManage/listDevice.vue @@ -64,6 +64,8 @@ {{ scope.row[column.value] }} + + + + + +