import{u as e}from"./vue-router-c7cbbcaa.js";import{c as a,d as t,e as s,u as r,f as n,m as l,s as o,g as i,_ as p,h as c}from"./panelBox-38406f97.js";import{_ as u,m,b as d,e as h}from"./logo-4fe3e538.js";import{m as g}from"./mapbox-gl-b315653c.js";import{d as f,h as w,X as v,l as b,S as y,ad as I,k as D,ag as k,o as C,c as x,P as _,a4 as L,b as P,I as S,J as F,a as M,O as j,Q as T,e as U,E as z,L as A,aq as H,u as $}from"./@vue-37836d09.js";import{_ as E}from"./vue-next-wxlogin-91e03b70.js";import{c as R}from"./index-6530d0f6.js";import{d as q}from"./pinia-0c8641d4.js";import{a as N}from"./login-4259abe5.js";import{b as Q}from"./weather-6f401959.js";import{E as B}from"./element-plus-842069d4.js";import{S as G}from"./@element-plus-bb6eebe0.js";const J=f({components:{
// servicePopup,
mbPopup:a,mbHtml:t,mbMarker:s},emits:["showDistribution"],props:{},setup(a,{emit:t}){const s=r(),p=e();let c,f="";const{proxy:k}=D(),C=w(),x=w(),_=w(),L=v({farmCenterData:[],showContentType:"",step:1,showMap:!1,userInfo:k.$sessionCache.getItem("userInfo"),pointIndex:null,landMarker:[],popUp:null,servicePointList:[],distributionPopupList:[],
// 当前选中农场列表图标高亮
currentServiceSelected:{},farmItemPopupList:[],
// 当前选中农场列表图标高亮
currentFarmSelected:{}}),P=e=>{f.setFilter("area-hover",["==","adcode",parseInt(e)])},S=async()=>{try{const e=await i();L.farmCenterData=e.data||[],(async e=>{let a=[];e.forEach(((e,t)=>{a.push({properties:e,index:t,lnglat:[e.longitude,e.latitude],show:!0,showDetail:!1})})),L.servicePointList=a,c&&(clearInterval(c),c=null);let t=0;c=setInterval((async()=>{t===e.length&&(t=0),t+=1}),3e3)})(L.farmCenterData)}catch(e){}};return b((()=>{s.setMapLoading(!0),f=new g.Map({container:C.value,
// style: 'mapbox://styles/18511272383/cllaua13c00d701rdb0i78mpo',
style:{glyphs:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",version:8,sources:{"background-image":{type:"image",url:m,
// 这里是你的背景图片的URL
coordinates:[[109,34],
// 左上角
[116,34],
// 右上角
[116,29],
// 右下角
[109,29]]}},layers:[{id:"background-layer",type:"raster",source:"background-image",paint:{"raster-opacity":.8}}]},center:l.center,zoom:l.zoom,
// maxZoom: 15,
// minZoom: 3,
pitch:l.pitch}),f.on("load",(()=>{o(f,h,d),setTimeout((()=>{s.setMapLoading(!1),L.showMap=!0}),0)})),f.on("click",(function(e){})),window.$map=f,S()})),y((()=>{c&&(clearInterval(c),c=null),s.setMapLoading(!1)})),{...I(L),mapStore:s,mapContainer:C,viewFarmInfo:async e=>{try{if(!e.properties.id)return k.$elMessage.warning("暂无服务中心ID");k.$sessionCache.setItem("serviceCenterItem",e.properties),p.push({path:"/serviceCenter"})}catch(a){}},mbPopupRef:x,showDistributionDetailPopup:async(e,a)=>{for(const r of L.servicePointList)r.selected=!1,r.zIndex=11;const t=L.servicePointList[a];L.currentServiceSelected.selected&&(L.currentFarmSelected.selected=!1),t.zIndex=12,t.selected=!0,L.currentServiceSelected=t,L.distributionPopupList=[{lnglat:t.lnglat,show:!0,properties:t.properties}];const s=t.properties.cityCode;s&&P(s)},filterArea:n,farmerRef:_,markerClick:(e,a)=>{},setFilter:P,flyToCenter:e=>{let a=(e=e||{}).center||a,t=e.zoom||f.getZoom();f&&f.flyTo({zoom:t,
//目标层级
bearing:0,
//目标方位角
pitch:50,
//目标俯仰角
duration:1e3,center:a,speed:1,
// 飞行速度，1为一秒一米
curve:1})},logoImg:u}}}),O={ref:"mapContainer",class:"map-container"},X={class:"service-popup-detail map-arrow map-arrow-bottom"},Z=["title"],K={class:"info"},V={class:"service__green"},W={class:"service__blue"},Y={class:"service__high"},ee=["onMouseenter","onMouseleave","onClick"],ae={class:"distribution-popup-detail"},te={class:"top-box"},se={class:"img-box"},re={class:"personInCharge"},ne=["title"],le=["title"],oe={class:"ovflow2"},ie={class:"info"},pe={class:"service__blue num"},ce={class:"num service__blue"},ue={class:"unit"},me={class:"service__green num"},de={class:"num service__green"},he={class:"unit"},ge={class:"service__high num"},fe=["onClick"];const we=E(J,[["render",function(e,a,t,s,r,n){const l=k("el-image"),o=k("mbHtml"),i=k("mbPopup");return C(),x("div",O,[e.showMap?(C(),x(_,{key:0},[(C(!0),x(_,null,L(e.servicePointList,((t,s)=>(C(),P(o,{ref_for:!0,ref:"mbPopupRef",class:z(["service-popup",[t.selected?"selected":""]]),show:t.show,"onUpdate:show":e=>t.show=e,lnglat:t.lnglat,properties:t.properties,key:s,offset:[0,-40],zIndex:t.zIndex},{default:S((()=>[F(M("div",X,[M("p",{class:"ovflow1",title:t.properties.name},j(t.properties.name),9,Z),M("div",K,[M("p",null,[a[1]||(a[1]=M("span",null,"自营农场：",-1)),M("span",V,j(t.properties.homeFarmCount),1),a[2]||(a[2]=M("span",null,"个",-1))]),a[5]||(a[5]=M("p",{class:"info-line"},"|",-1)),M("p",null,[a[3]||(a[3]=M("span",null,"签约农场：",-1)),M("span",W,j(t.properties.signFarmCount),1),a[4]||(a[4]=M("span",null,"个",-1))])]),M("p",null,[a[6]||(a[6]=M("span",null,"注册农户：",-1)),M("span",Y,j(t.properties.farmerCount),1),a[7]||(a[7]=M("span",null,"个",-1))]),M("p",null,"负责人："+j(t.properties.personInCharge),1)],512),[[T,t.showDetail]]),M("div",{class:"img-box",onMouseenter:a=>{t.showDetail=!0,e.currentServiceSelected.selected||(t.zIndex=12)},onMouseleave:a=>{t.showDetail=!1,e.currentServiceSelected.selected||(t.zIndex=11)},onClick:a=>e.showDistributionDetailPopup(t,s)},[U(l,{src:e.logoImg},null,8,["src"]),a[8]||(a[8]=M("div",{class:"map-popup-tip"},null,-1))],40,ee)])),_:2},1032,["show","onUpdate:show","lnglat","properties","zIndex","class"])))),128)),(C(!0),x(_,null,L(e.distributionPopupList,((t,s)=>(C(),P(i,{class:"distribution-popup",show:t.show,"onUpdate:show":e=>t.show=e,lnglat:t.lnglat,properties:t.properties,key:s,offset:[0,-40],showArrow:"",zIndex:2024,onClose:a[0]||(a[0]=a=>{e.currentServiceSelected.selected=!1,e.setFilter("")})},{default:S((()=>[M("div",ae,[M("div",te,[M("div",se,[U(l,{src:t.properties.titleImgUrl},null,8,["src"]),M("p",re,"负责人："+j(t.properties.personInCharge),1),M("p",{class:"ovflow1 farm-name",title:t.properties.name},j(t.properties.name),9,ne),t.properties.address?(C(),x("p",{key:0,class:"address",title:t.properties.address},[a[9]||(a[9]=M("em",{class:"iconfont"},"",-1)),M("span",oe,j(t.properties.address),1)],8,le)):A("",!0)]),M("div",ie,[M("div",null,[M("p",null,[M("span",pe,j(t.properties.homeFarmCount),1),a[10]||(a[10]=M("i",{class:"unit"},"个",-1)),M("span",ce,j(e.filterArea(t.properties.homeFarmLandArea)[1]),1),M("i",ue,j(e.filterArea(t.properties.homeFarmLandArea)[2]),1)]),a[11]||(a[11]=M("p",{class:"title"},"自营农场",-1))]),M("div",null,[M("p",null,[M("span",me,j(t.properties.signFarmCount),1),a[12]||(a[12]=M("i",{class:"unit"},"个",-1)),M("span",de,j(e.filterArea(t.properties.signFarmLandArea)[1]),1),M("i",he,j(e.filterArea(t.properties.signFarmLandArea)[2]),1)]),a[13]||(a[13]=M("p",{class:"title"},"签约农场",-1))]),M("div",null,[M("p",null,[M("span",ge,j(t.properties.farmerCount),1),a[14]||(a[14]=M("i",{class:"unit"},"个",-1))]),a[15]||(a[15]=M("p",{class:"title"},"注册农户",-1))])])]),M("p",{class:"iconfont view-btn",onClick:a=>e.viewFarmInfo(t)}," 查看农场分布",8,fe)])])),_:2},1032,["show","onUpdate:show","lnglat","properties"])))),128))],64)):A("",!0)],512)}],["__scopeId","data-v-cb69adb2"]]),ve=q("app-user",{state:()=>({userInfo:{},token:""}),getters:{getUserInfo:e=>e.userInfo,getToken:e=>e.token},actions:{
// 设置用户信息
setUserInfo(e){this.userInfo=e},
// 设置token
setToken(e){this.token=e},setEnterpriseInfo(e){this.enterpriseInfo=e},
// 获取用户信息
async GetUserInfo(){return new Promise(((e,a)=>{const t={name:"panyulong",age:18};this.setUserInfo(t),e(t)}))},
// 退出
async Logout(e){return new Promise(((a,t)=>{N(e).then((async e=>{this.setUserInfo({}),this.setToken(""),R.clear(),a(e)})).catch((e=>{t(e)}))}))}}}),be={class:"large-header"},ye={class:"large-header-left"},Ie={class:"weather","element-loading-text":"天气加载中...","element-loading-background":"rgba(0, 53, 83, 0.5)"},De={key:0},ke={key:1},Ce={class:"weather-desc"},xe={class:"large-header-right"},_e={class:"datetime"},Le=E(f({__name:"largeHeader",props:{tabIndex:{type:Number,default:0}},setup(a){const{proxy:t}=D(),s=ve(),r=e(),n=a,o=v({currentTime:"",
//   currentIndex: 0,
loading:!1,timer:null,weatherData:null,tabData:[{name:"企业概况",url:"/companyProfile"},{name:"农事管理",url:"/agriculturalManage"},{name:"经营分析",url:"/businessAnalysis"},{name:"技术赋能",url:"/technologyEmpower"}],isDay:!0}),i=e=>{const a=o.tabData[e];r.push(a.url)},u=async()=>{try{await s.Logout()}catch(e){}finally{B.success("退出成功"),r.push("/login")}},m=()=>{let e=t.$dayjs().format("HH:mm");if(!o.weatherData)return;const a=o.weatherData.sunrise,s=o.weatherData.sunset;o.isDay=e>=a&&e<=s},d=async()=>{o.currentTime=c(),await(async()=>{l.center[1],l.center[0];try{o.loading=!0;const e=await Q();o.loading=!1,o.weatherData=e||{},o.weatherData.temHigh1=o.weatherData.temHigh.replace("高温",""),o.weatherData.temLow1=o.weatherData.temLow.replace("低温","")}catch(e){}})(),m(),o.timer=setInterval((()=>{o.currentTime=c(),m()}),1e3)};return b((()=>{d()})),y((()=>{o.timer&&clearInterval(o.timer),o.timer=null})),(e,a)=>{const t=k("el-image"),s=k("el-icon"),r=k("el-button"),l=H("loading");return C(),x("div",be,[M("div",ye,[F((C(),x("div",Ie,[$(o).weatherData?(C(),x(_,{key:0},[$(o).isDay?(C(),x("p",De,[U(t,{src:$(o).weatherData.imgUrl,alt:""},null,8,["src"]),M("span",null,j($(o).weatherData.weatherTypeDaily),1),M("span",null,j($(o).weatherData.temHigh1)+"/"+j($(o).weatherData.temLow1),1)])):(C(),x("p",ke,[U(t,{src:$(o).weatherData.nightImgUrl,alt:""},null,8,["src"]),M("span",null,j($(o).weatherData.weatherTypeNight),1),M("span",null,j($(o).weatherData.temHigh1)+"/"+j($(o).weatherData.temLow1),1)])),M("p",Ce,[M("span",null,"空气质量："+j($(o).weatherData.qualityDesc),1),M("span",null,j($(o).weatherData.windDirect)+j($(o).weatherData.windPower),1)])],64)):A("",!0)])),[[l,$(o).loading]]),M("ul",null,[M("li",{class:z(["bg-1",{active:0==n.tabIndex}]),onClick:a[0]||(a[0]=e=>i(0))},null,2),M("li",{class:z(["bg-2",{active:1==n.tabIndex}]),onClick:a[1]||(a[1]=e=>i(1))},null,2)])]),a[4]||(a[4]=M("div",{class:"large-header-center"},[M("img",{src:p,alt:""})],-1)),M("div",xe,[M("ul",null,[M("li",{class:z(["bg-3",{active:2==n.tabIndex}]),onClick:a[2]||(a[2]=e=>i(2))},null,2),M("li",{class:z(["bg-4",{active:3==n.tabIndex}]),onClick:a[3]||(a[3]=e=>i(3))},null,2)]),M("div",_e,j($(o).currentTime),1),U(r,{class:"logout-btn",type:"text",onClick:u},{default:S((()=>[U(s,null,{default:S((()=>[U($(G))])),_:1})])),_:1})])])}}}),[["__scopeId","data-v-b753a8cc"]]);export{Le as l,we as m};
//# sourceMappingURL=largeHeader-f70d0a70.js.map
