43.ef7a3f4f95483dc6fbe5.js 8.8 KB

1
  1. webpackJsonp([43],{Gpyo:function(t,i){},LzJj:function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var a={components:{},data:function(){return{map:null,data:[],mapData:[],topAdcodes:[1e5],center:[116.3683244,39.915085],zoom:4.5,form:{province:"",city:"",district:""},provinceList:[],cityList:[],districtList:[],district:null,input:"",polygons:[],distCluster:null,pointSimplifierIns:null}},computed:{},watch:{},methods:{initMap:function(){var t=this;this.map=new AMap.Map("container",{center:t.center,zoom:t.zoom}),AMapUI.loadUI(["control/BasicControl"],function(i){t.map.addControl(new i.Zoom({position:"rb",showZoomNum:!0}))}),AMapUI.load(["ui/geo/DistrictCluster","lib/$","ui/misc/PointSimplifier"],function(i,e,a){t.initPage(i,e,a)})},initPage:function(t,i,e){var a=this,s=this;this.pointSimplifierIns=new e({map:this.map,zIndex:113,autoSetFitView:!1,compareDataItem:function(t,i,e,a){},getPosition:function(t){return t.lnglat?[parseFloat(t.lnglat[0]),parseFloat(t.lnglat[1])]:null},getHoverTitle:function(t,i){return'<div style="font-size:14px">'+t.projectname+"</div>"},renderOptions:{pointStyle:{content:function(t,i,e,a,s){t.moveTo(i,e),t.lineTo(i+25,e),t.lineTo(i,e+s/1.5),t.lineTo(i,e+s),t.lineTo(i,e+s),t.lineTo(i,e)},width:33,height:30,fillStyle:"red",lineWidth:1,offset:["0","-100%"],strokeStyle:"#000"}}}),this.pointSimplifierIns.setData(this.mapData),this.pointSimplifierIns.on("pointClick",function(t,i){a.$store.commit("setData",{name:"disasterWarnUserId",val:i.data.uid}),a.$store.commit("setData",{name:"wran_project_name",val:i.data.projectname}),a.$router.push("/plantGuard/disasterWarn")}),this.distCluster=new t({map:s.map,zIndex:13,autoSetFitView:!1,topAdcodes:s.topAdcodes,getPosition:function(t){return t.lnglat?[parseFloat(t.lnglat[0]),parseFloat(t.lnglat[1])]:null},renderOptions:{featureStyle:{fillStyle:"rgba(102,170,0,0.5)",lineWidth:2,strokeStyle:"#4e6ef2",hoverOptions:{fillStyle:"rgba(78,110,242,0.4)"}},featureStyleByLevel:{country:{fillStyle:"rgba(78,110,242,0)"},province:{fillStyle:"rgba(78,110,242,0)"},city:{fillStyle:"rgba(78,110,242,0)"},district:{fillStyle:"rgba(78,110,242,0)"}},getClusterMarker:function(t,e,a){if(e.length){var s,n,o,r={title:"amap-ui-district-cluster-marker-title",body:"amap-ui-district-cluster-marker-body",container:"amap-ui-district-cluster-marker"};console.log(a),a?(console.log(a.getContent()),s=a.getContent(),n=i(s).find("."+r.title)[0],o=i(s).find("."+r.body)[0]):(s=document.createElement("div"),(n=document.createElement("span")).className=r.title,(o=document.createElement("span")).className=r.body,s.appendChild(n),s.appendChild(o)),console.log(t.properties);var l=t.properties,c=[],d=[r.container,"level_"+l.level,"adcode_"+l.adcode];s.className=d.join(" "),c.length>0?(c.push(l.name),s.setAttribute("title",c.join(">"))):s.removeAttribute("title"),i(n).html(l.name),i(o).html(e.length);var u=a||new AMap.Marker({topWhenClick:!0,offset:new AMap.Pixel(-20,-30),content:s});return console.log(s),console.log(u),u}}}}),this.distCluster.on("clusterMarkerClick",function(t,i){console.log(t),console.log(i),console.log(s)}),i('<div id="loadingTip">加载数据,请稍候...</div>').appendTo(document.body),i.get("https://a.amap.com/amap-ui/static/data/10w.txt",function(t){i("#loadingTip").remove();t.split("\n").slice(0,1e3);a.distCluster.setData(s.data)})},getEquipList:function(){var t=this;this.$axios({method:"POST",url:"/api/api_gateway?method=user.login.user_project_addr",data:this.qs.stringify({projectname:this.input})}).then(function(i){""==i.data.message?(t.data=i.data.data.user_project,t.mapData=i.data.data.user_project,t.$nextTick(function(){t.initMap()})):t.$message.error(i.data.message)})},districtFun:function(){var t=this;this.map=new AMap.Map("container",{resizeEnable:!0,center:[116.30946,39.937629],zoom:3});this.district=new AMap.DistrictSearch({subdistrict:1,showbiz:!1}),this.district.search("中国",function(i,e){"complete"==i&&t.getData(e.districtList[0],"country")})},getData:function(t,i){console.log(t);var e=t.boundaries;if(e){for(var a=0,s=e.length;a<s;a++){var n=new AMap.Polygon({map:this.map,zIndex:5,bubble:!0,strokeWeight:2,strokeColor:"red",fillOpacity:.2,path:e[a]});this.polygons.push(n)}this.map.setFitView()}var o=t.districtList;"country"===i?(console.log("country"),this.provinceList=o,this.cityList=[],this.districtList=[],this.form.province="",this.form.city="",this.form.district=""):"province"===i?(console.log("province"),this.cityList=o,this.districtList=[],this.form.city="",this.form.district=""):"city"===i&&(console.log("city"),this.districtList=o,this.form.district=""),console.log(o)},searchPro:function(){var t=this,i=this.form.province;console.log(this.form.province),console.log(this.form.city),console.log(this.form.district),i?this.distCluster.getClusterRecord(i,function(i,e){t.mapData=[],e.dataItems.forEach(function(i){t.mapData.push(i.dataItem)}),t.$nextTick(function(){t.pointSimplifierIns.setData(t.mapData)})}):(this.cityList=[],this.districtList=[],this.form.city="",this.form.district="",this.mapData=this.data,this.pointSimplifierIns.setData(this.mapData)),this.search("province",i)},searchCity:function(){var t=this,i=this.form.city;if(!i)return this.districtList=[],void(this.form.district="");this.distCluster.getClusterRecord(i,function(i,e){t.mapData=[],e.dataItems.forEach(function(i){t.mapData.push(i.dataItem)}),t.$nextTick(function(){t.pointSimplifierIns.setData(t.mapData)})}),this.search("city",i)},searchDis:function(){var t=this,i=this.form.district;i&&(this.distCluster.getClusterRecord(i,function(i,e){t.mapData=[],e.dataItems.forEach(function(i){t.mapData.push(i.dataItem)}),t.$nextTick(function(){t.pointSimplifierIns.setData(t.mapData)})}),this.search("district",i))},search:function(t,i){for(var e=this,a=0,s=this.polygons.length;a<s;a++)this.polygons[a].setMap(null);console.log(this.distCluster),i&&(this.district.setLevel(t),this.district.setExtensions("all"),this.district.search(i,function(i,a){"complete"===i&&e.getData(a.districtList[0],t)}))},equipLocate:function(t){this.map.setCenter(t.lnglat),this.map.setZoom(10)},enterBase:function(t){this.$store.commit("setData",{name:"disasterWarnUserId",val:t.uid}),this.$store.commit("setData",{name:"wran_project_name",val:t.projectname}),this.$router.push("/plantGuard/disasterWarn")}},created:function(){},mounted:function(){this.getEquipList(),this.districtFun()},beforeCreate:function(){},beforeMount:function(){},beforeUpdate:function(){},updated:function(){},beforeDestroy:function(){},destroyed:function(){},activated:function(){}},s={render:function(){var t=this,i=t.$createElement,a=t._self._c||i;return a("div",{staticClass:"map"},[a("div",{attrs:{id:"container"}},[t._v("加载数据,请稍候...")]),t._v(" "),a("div",{staticClass:"leftNavBox"},[a("div",{staticClass:"searchBox"},[a("el-select",{attrs:{size:"small",filterable:"",placeholder:"选择省"},on:{change:function(i){return t.searchPro()}},model:{value:t.form.province,callback:function(i){t.$set(t.form,"province",i)},expression:"form.province"}},[a("el-option",{attrs:{label:"--请选择--",value:""}}),t._v(" "),t._l(t.provinceList,function(t){return a("el-option",{key:t.adcode,attrs:{label:t.name,value:t.adcode}})})],2),t._v(" "),a("el-select",{attrs:{size:"small",filterable:"",placeholder:"选择市"},on:{change:function(i){return t.searchCity()}},model:{value:t.form.city,callback:function(i){t.$set(t.form,"city",i)},expression:"form.city"}},[a("el-option",{attrs:{label:"--请选择--",value:""}}),t._v(" "),t._l(t.cityList,function(t){return a("el-option",{key:t.adcode,attrs:{label:t.name,value:t.adcode}})})],2),t._v(" "),a("el-select",{attrs:{size:"small",filterable:"",placeholder:"选择区"},on:{change:function(i){return t.searchDis()}},model:{value:t.form.district,callback:function(i){t.$set(t.form,"district",i)},expression:"form.district"}},[a("el-option",{attrs:{label:"--请选择--",value:""}}),t._v(" "),t._l(t.districtList,function(t){return a("el-option",{key:t.adcode,attrs:{label:t.name,value:t.adcode}})})],2)],1),t._v(" "),a("div",{staticClass:"listBox"},[a("div",{staticClass:"projectSearch"},[a("div",[t._v("项目列表")]),t._v(" "),a("div",[a("el-input",{attrs:{size:"small",placeholder:"请输入项目名称","suffix-icon":"el-icon-search",clearable:""},on:{change:t.getEquipList},model:{value:t.input,callback:function(i){t.input=i},expression:"input"}})],1)]),t._v(" "),a("div",{staticClass:"inner"},[a("div",{staticClass:"scroll"},[a("el-scrollbar",[a("div",{staticClass:"equipList"},[t._l(t.mapData,function(i){return a("div",{key:i.uuid,staticClass:"item",on:{click:function(e){return t.equipLocate(i)},dblclick:function(e){return t.enterBase(i)}}},[a("img",{attrs:{src:e("MMlr"),width:"25px",alt:""}}),t._v("\n "+t._s(i.projectname)+"\n ")])}),t._v(" "),t.mapData.length?t._e():a("div",{staticClass:"item noDate"},[t._v("暂无数据")])],2)])],1)])])])])},staticRenderFns:[]};var n=e("C7Lr")(a,s,!1,function(t){e("Gpyo")},"data-v-7ce90d2a",null);i.default=n.exports}});