diff --git a/src/api/index.js b/src/api/index.js index 1bd1c5b..97ff4f4 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -112,6 +112,15 @@ export function getSoilSummry(data) { headers: {}, }) } + +// 获取企业列表 +export function getCompanyList() { + return requests({ + url: '/zh-applet-admin/appmana/bigScreen/getEntList', + method: 'get', + headers: {}, + }) +} // 查询设备下各检测项的历史数据 export function survItemSummary(obj) { return requests({ diff --git a/src/assets/image/enticon.png b/src/assets/image/enticon.png new file mode 100644 index 0000000..a8de825 Binary files /dev/null and b/src/assets/image/enticon.png differ diff --git a/src/pages/Home/index.vue b/src/pages/Home/index.vue index dd83506..5936223 100644 --- a/src/pages/Home/index.vue +++ b/src/pages/Home/index.vue @@ -203,6 +203,10 @@ +
+ + 企业信息 +
@@ -450,7 +454,7 @@ -
+
@@ -462,8 +466,8 @@
- {{ qyinformation.name }} - {{ qyinformation.notes }} + {{ qyinformation.entName }} + {{ qyinformation.entIntro }}
@@ -482,7 +486,7 @@ import ScaleBox from 'vue2-scale-box' import { displayInfo, fwlist, - getAllstationAndPestLight, + getAllstationAndPestLight,getCompanyList, getIndexSummry, getNewestData, getPollutionDict, @@ -626,10 +630,36 @@ export default { // }) // }, 2000) // 实时时间 + let that = this; setTimeout(() => { - this.$nextTick(() => { - this.initMap(this.zoomData, this.isShowLightNumber); - }) + getCompanyList().then(res => { + that.entList = res.result.map(item => { + item.type = 'ent'; + item.longitude = item.entLong; + item.latitude = item.entLat; + item.name = item.entName; + item.picUrl = 'temp/enticon.png'; + item.width = 0 ; + item.height = 0; + // zIndex: item.type == 'soil' ? that.lastZIndex : (that.lastZIndex+1), + // icon: this.urlimg + item.picUrl, + // position: [item.longitude, item.latitude], + // offset: new AMap.Pixel(item.width, item.height),//偏移量 + // title: item.name, + return item; + }); + // ids: item.ids, + // extPics: item.extPics, + // notes: item.notes, + // name: item.name, + // item: item, + // stationType: item.type + // + console.log(that.entList,'111222') + that.$nextTick(() => { + that.initMap(that.iniZoomData, that.isShowLightNumber); + }) + }); }, 2000) //初始化数据 this.getNowTime(); @@ -773,6 +803,7 @@ export default { }, initMap(zoomnum, isShowLight) { let that = this; + let defaultLng = 110.719361, defaultLat = 36.068184; // let isShowLight = this.isShowLightNumber getAllstationAndPestLight(isShowLight).then(res => { // 地图 @@ -780,7 +811,7 @@ export default { viewMode: '3D', resizeEnable: true, zoom: zoomnum, - center: [110.719361, 36.068184],//默认的地图中心经纬度 + center: [defaultLng, defaultLat],//默认的地图中心经纬度 mapStyle: 'amap://styles/blue', dragEnable: true,//地图是否可通过鼠标拖拽平移,默认为true。此属性可被setStatus/getStatus 方法控制 jogEnable: true,//地图是否使用缓动效果,默认值为true。此属性可被setStatus/getStatus 方法控制 @@ -795,20 +826,25 @@ export default { scale: (2, 2.5) }); that.aMap.on('complete', (e) => { - var markerData = res.result; - let Marker = markerData.filter(ele => ele.type != 'light').sort((a,b) => { + let Marker = res.result.filter(ele => ele.type != 'light').sort((a,b) => { if (b.type=='soil') return 1; if (b.type!='soil') return -1; return 0; - });//其他类型 - console.log(Marker,'Marker') + });//其他类型 + // console.log(Marker,'Marker') + Marker.push(...this.entList); + console.log("初始化地图。2", Marker) Marker.map(item => { let marker = new AMap.Marker({ - zIndex: item.type == 'soil' ? that.lastZIndex : (that.lastZIndex+1), + zIndex: (item.type == 'orient' || item.type == 'livestock' || item.type == 'watershed') ? (that.lastZIndex+1): (that.lastZIndex), icon: this.urlimg + item.picUrl, - position: [item.longitude, item.latitude], + position: [item.longitude || defaultLng, item.latitude || defaultLat], offset: new AMap.Pixel(item.width, item.height),//偏移量 title: item.name, + label: { + content: item.type == "ent"? item.name : '', + direction: 'top' + }, extData: { ids: item.ids, extPics: item.extPics, @@ -823,7 +859,6 @@ export default { let indexnumb = e.target.getExtData().ids.slice(-1); this.qcdtinfor = this.stationInfoList[indexnumb] this.qcdtdialogTableVisible = true - // console.log('livestock or orient', this.qyinformation) }) this.markersOrient.push(marker) } else if(item.type == 'soil'){//土壤弹窗,长期监测站 @@ -833,7 +868,19 @@ export default { // console.log('soil click', ) }) this.markersSoil.push(marker); - } else { + } else if(item.type == "ent"){//企业类型 + marker.on("click", e => { + this.qyinformation= e.target.getExtData().item + if(this.qyinformation.entPics){ + this.qyinformation.extPics = this.qyinformation.entPics.split(","); + }else { + this.qyinformation.extPics = [] + } + console.log("this.qyinformation",this.qyinformation) + this.qyinfordtdialogTableVisible = true + }) + this.markersOrient.push(marker); + } else { this.markersOther.push(marker) } marker.setMap(that.aMap); @@ -1128,27 +1175,34 @@ export default { this.lastClickIcon = '' } else { this.lastClickIcon = flag; - if (flag == 'livestock') { - arr = this.markersOrient.filter(item => item.getExtData().stationType.indexOf("livestock") != -1); - } else if (flag == 'orient') { - arr = this.markersOrient.filter(item => item.getExtData().stationType.indexOf("orient") != -1); - } else if (flag == 'watershed') { - arr = this.markersOrient.filter(item => item.getExtData().stationType.indexOf("watershed") != -1); - } else if (flag == 'soil') { + if (flag == 'soil') { arr = this.markersSoil; + } else { + arr = this.markersOrient.filter(item => item.getExtData().stationType.indexOf(flag) != -1); } + // if (flag == 'livestock') { + // arr = this.markersOrient.filter(item => item.getExtData().stationType.indexOf("livestock") != -1); + // } else if (flag == 'orient') { + // arr = this.markersOrient.filter(item => item.getExtData().stationType.indexOf("orient") != -1); + // } else if (flag == 'watershed') { + // arr = this.markersOrient.filter(item => item.getExtData().stationType.indexOf("watershed") != -1); + // } else if (flag == 'soil') { + // arr = this.markersSoil; + // } else if (flag == 'ent') { + // arr = this.markersSoil; + // } } if (arr && arr.length > 0) { arr.map(item => { item.setzIndex((that.lastZIndex+=2)); }); - that.aMap.setFitView(arr, false, [300, 500, 360, 360], 16); + that.aMap.setFitView(arr, false, [300, 500, 360, 360], that.focusZoomData); // setTimeout(() => { // let temp = that.aMap.getCenter();//矫正显示标点位置在正中心 // that.aMap.setZoomAndCenter(that.aMap.getZoom()-2, [temp.lng, temp.lat - 0.15]); // },2000) } else { - that.aMap.setFitView(null, false, [100, 400, 360, 360], 16); + that.aMap.setFitView(null, false, [100, 400, 360, 360], that.normalZoomData); } } }, @@ -1767,20 +1821,23 @@ a:hover { /* 企业弹窗样式 */ .tctit { font-size: 1.2vw; - color: #fff; + color: #0bf373; font-weight: bold; display: block; margin-bottom: 1.6vw; + margin: 5px auto; + text-align: center; } .tcgldw { - font-size: 1vw; + font-size: 0.8vw; color: #fff; line-height: 2vw; display: block; padding-right: 3%; height: 15vw; overflow: auto; + text-indent: 2em; } /* 定义滚动条样式 */ @@ -1944,5 +2001,49 @@ a:hover { .mywrcov_onenumjx{ font-size: 1.2vw; } +.amap-marker-label{ + //width: 60px; + font-size: 16px; + line-height: 18px; + text-align: center; + height: 18px; + font-family: STLiti; + color: #bbd6f1; + border-radius: 15px; + padding: 5px; + background-color: rgba(77, 140, 241, 0.84); + border: solid 2px rgba(100,255,200,0.8); +} + +.tz_cov{ + width: 100%; + height: 30vw; + margin: 0 auto; + /* margin-top: 4vw; */ + border: 1px solid #0169d0; + position: relative; + background: rgba(16, 45, 80, 1); + box-shadow: inset 0px 0px 16px 0px rgba(0, 145, 255, 1); + padding: 20px; +} +.tz_cov_top{ + width: 40%; + height: 3vw; + margin: 0 auto; + background: url(../../assets/image/tz_tltle_bg.png)no-repeat; + background-size: cover; + text-align: center; + line-height: 3vw; + margin-bottom: 2vw; +} +.tz_cov_top_tit{ + font-size: 1vw; + color: #fff; + text-shadow: 0px 2px 0px rgba(4,49,52,0.55); + font-family: douyuFont; +} +.grid-content{ + padding: 10px +} diff --git a/src/pages/MywrList/index.vue b/src/pages/MywrList/index.vue index 2d00a61..5ab9287 100644 --- a/src/pages/MywrList/index.vue +++ b/src/pages/MywrList/index.vue @@ -392,7 +392,7 @@
-
暂无预警数据
+
暂无预警
@@ -591,7 +591,7 @@ export default { doGetAlertRecord({stationCode: this.stationCode, pageSize: 3}).then(res => { console.warn('监测预警数据',res) if (res.code === 200) { - if(res.result.records.length === 0 && this.stationDetail.latestData !== 0){ + if(res.result.records.length === 0 && this.stationDetail && this.stationDetail.latestData && this.stationDetail.latestData.length !== 0){ //itemName survValue survUnit normalValue survUnit readStatus alertTime let tempData = []; this.stationDetail.latestData.map(item => {