You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
45 KiB
1 lines
45 KiB
var tn=Object.defineProperty,nn=Object.defineProperties;var an=Object.getOwnPropertyDescriptors;var Mt=Object.getOwnPropertySymbols;var sn=Object.prototype.hasOwnProperty,ln=Object.prototype.propertyIsEnumerable;var Pt=(k,m,_)=>m in k?tn(k,m,{enumerable:!0,configurable:!0,writable:!0,value:_}):k[m]=_,ie=(k,m)=>{for(var _ in m||(m={}))sn.call(m,_)&&Pt(k,_,m[_]);if(Mt)for(var _ of Mt(m))ln.call(m,_)&&Pt(k,_,m[_]);return k},we=(k,m)=>nn(k,an(m));var O=(k,m,_)=>new Promise((P,$)=>{var f=C=>{try{U(_.next(C))}catch(H){$(H)}},le=C=>{try{U(_.throw(C))}catch(H){$(H)}},U=C=>C.done?P(C.value):Promise.resolve(C.value).then(f,le);U((_=_.apply(k,m)).next())});import{g as Tt}from"./index-e9f36657-1786523779314.js";/* empty css */import{_ as Rt}from"./index-211f76b2-1786523779314.js";import{i as ze,g as rn,b as Dt}from"./townshipBoundaries-cae3b8e0-1786523779314.js";import{b as ot,a as ut,c as ct,e as dt,d as on,g as We,f as wt,h as kt,i as At,j as un,k as cn,l as dn,m as vn}from"./data-5b751121-1786523779314.js";import{b as gn}from"./pastureApi-826909a4-1786523779314.js";import{A as pn}from"./assets-e9e9e2ea-1786523779314.js";import{q as fn,r as mn,s as yn}from"./screen2Standard-447167ef-1786523779314.js";import{c as hn,F as _n}from"./featurePanelLayout-3e9b38ef-1786523779314.js";import{M as bn}from"./index-74449043-1786523779314.js";import{_ as Sn}from"./LayerPanel-bb27344a-1786523779314.js";import{a as Ot,_ as wn}from"./FeatureInfoPanel-b52dcca5-1786523779314.js";import{_ as kn}from"./TopicSwitcher-c573196f-1786523779314.js";import{_ as Yt,g as c,w as $e,h as qt,o as u,c as d,a as l,t as p,F as pe,y as fe,n as xe,K as Oe,s as Ct,O as jt,j as Z,d as b,N as Et,q as An,A as Ge,b as De,C as vt,x as Vt,u as gt,z as Cn}from"./index-1786523779314.js";import{r as jn,n as En}from"./index-5554c2d9-1786523779314.js";const Ln={class:"engineering-analysis-panel"},Nn={class:"analysis-card-head"},Fn={class:"analysis-type-list",role:"radiogroup","aria-label":"工程类型"},$n=["disabled","aria-checked","onClick"],xn={class:"analysis-type-main"},Mn={class:"analysis-filter-grid","aria-label":"动态筛选条件"},Pn={class:"is-wide"},Tn=["disabled"],Rn=["value"],Dn=["disabled"],On=["value"],Vn=["disabled"],In=["value"],Yn={class:"analysis-filter-note"},qn={key:0},Bn={key:1},Un={key:2},Hn={key:3},zn=["disabled","aria-busy"],Wn={key:0,class:"analysis-submit-spinner"},Gn={key:1},Qn={key:2},Jn={key:0,class:"analysis-progress","aria-live":"polite"},Zn=["aria-valuenow","aria-busy"],Xn={key:1,class:"analysis-step-list","aria-label":"空间分析步骤"},Kn={key:2,class:"analysis-error"},ea={key:0,class:"analysis-card analysis-result-card"},ta={class:"analysis-card-head is-result"},na={key:0,class:"analysis-result-summary is-loading"},aa={class:"is-final"},sa={key:1,class:"analysis-result-summary"},la={class:"is-excluded"},ra={class:"is-final"},ia={class:"analysis-result-list"},oa=["aria-pressed","onClick"],ua={key:0},ca={key:1},da={key:2},va={key:0},ga={key:1},pa={key:2,class:"analysis-excluded-projects"},fa={class:"analysis-excluded-project-list"},ma=["title"],ya=["disabled"],ha={class:"analysis-result-foot"},pt="/geoserver/ne/ows",Lt="ne:t_ecological_engineering_suitability_layer",_a="ne:t_ecological_engineering_suitability_export_layer",ba=750,It=5e3,Sa=18,wa=420,ka=18e3,Aa="#FFD43B",Ca={__name:"EngineeringAnalysisPanel",props:{analysisConfig:{type:Object,default:()=>({})},configState:{type:String,default:"idle"}},emits:["analysis-reset","analysis-batch","analysis-complete","analysis-state","result-visibility"],setup(k,{emit:m}){const _=k,P=m,$=[{key:"prepare",label:"初始化分析环境",description:"正在准备空间索引与工程参数",minimumDuration:1400},{key:"validate",label:"校验业务条件",description:"正在校验乡镇、工程类型与时间范围",minimumDuration:1500},{key:"count",label:"计算基础候选区",description:"正在统计满足基础条件的候选图斑",minimumDuration:2e3},{key:"exclude",label:"排除历史项目",description:"正在比对既有工程与重复实施范围",minimumDuration:2200},{key:"overlay",label:"执行空间叠加",description:"正在叠加生态约束与工程适宜条件",minimumDuration:1400},{key:"generate",label:"生成适宜图斑",description:"正在分批生成并渲染适宜实施区域",minimumDuration:0},{key:"verify",label:"汇总校验结果",description:"正在汇总面积、数量与空间完整性",minimumDuration:2200}],f=c(()=>{var n;return(Array.isArray((n=_.analysisConfig)==null?void 0:n.engineeringTypes)?_.analysisConfig.engineeringTypes:[]).filter(t=>(t==null?void 0:t.key)&&(t==null?void 0:t.name)).map(t=>we(ie({},t),{color:Aa}))}),le=c(()=>{var n;return Array.isArray((n=_.analysisConfig)==null?void 0:n.projectFilterModes)?_.analysisConfig.projectFilterModes.filter(t=>(t==null?void 0:t.key)&&(t==null?void 0:t.label)):[]}),U=c(()=>{var n;return Array.isArray((n=_.analysisConfig)==null?void 0:n.recentYearOptions)?_.analysisConfig.recentYearOptions.filter(t=>Number(t==null?void 0:t.value)>0&&(t==null?void 0:t.label)):[]}),C=b([]),H=b(""),Y=b(""),D=b(null),y=b(null),S=b("idle"),h=b(""),re=b(""),me=b(null),te=b("loading"),V=b(-1),G=Et({}),ye=Et({}),ne=Et({});let R=null,ve=0;const je=c(()=>{var n;return Array.isArray((n=_.analysisConfig)==null?void 0:n.townRows)?_.analysisConfig.townRows.map(t=>String((t==null?void 0:t.name)||"").trim()).filter(Boolean):[]}),L=c(()=>S.value==="running"),z=c(()=>S.value==="done"),he=c(()=>C.value.length>0&&!L.value&&te.value==="ready"),oe=c(()=>f.value),Ee=c(()=>{var n;return((n=f.value.find(t=>t.key===C.value[0]))==null?void 0:n.name)||"请选择工程"}),ue=c(()=>f.value.filter(n=>C.value.includes(n.key)).map(n=>G[n.key]||Re(n))),Le=c(()=>{const n=Number(y.value);return Number.isFinite(n)?n-Number(D.value)+1:null}),Ve=c(()=>{const n=`${Le.value}—${y.value} 年`,t=me.value?`项目库更新至 ${me.value} 年 · `:"",o=Y.value==="all"?`排除 ${n} 内实施过任一工程的相交地块`:`排除 ${n} 内实施过同类工程的相交地块`;return`${t}${o}`}),ae=c(()=>$[V.value]||null),Qe=c(()=>$.map((n,t)=>we(ie({},n),{index:t,status:z.value||t<V.value?"done":t===V.value?"active":"pending"}))),Je=c(()=>L.value?`第 ${V.value+1}/${$.length} 步`:z.value?"分析完成":"等待分析"),Me=c(()=>ue.value.reduce((n,t)=>n+Number(t.baseCount||0),0)),Pe=c(()=>ue.value.reduce((n,t)=>n+Number(t.targetCount||0),0)),ge=c(()=>ue.value.reduce((n,t)=>n+Number(t.loadedCount||0),0)),N=c(()=>Math.max(0,Me.value-Pe.value)),se=c(()=>ue.value.reduce((n,t)=>n+Number(t.loadedAreaMu||0),0)/1e4),Ie=c(()=>Math.max(0,...ue.value.map(n=>Number(n.loadedPage||0)))),Te=c(()=>Object.values(ne).map(n=>we(ie({},n),{areaMu:Number(Number(n.areaMu||0).toFixed(2))})).sort((n,t)=>t.areaMu-n.areaMu)),ce=c(()=>Te.value.reduce((n,t)=>n+Number(t.areaMu||0),0)/1e4),ke=c(()=>{var v;if(z.value)return 100;if(!L.value)return 0;const n=100/$.length,t=Math.max(0,V.value)*n,r=((v=ae.value)==null?void 0:v.key)==="generate"&&Pe.value?Math.min(.96,ge.value/Pe.value):.42;return Math.min(99,Math.max(1,Math.round(t+r*n)))}),Ye=c(()=>{var n;return L.value&&((n=ae.value)==null?void 0:n.key)==="generate"?`正在分批渲染${Ee.value}图斑,已生成 ${de(ge.value)} 个`:L.value&&ae.value?ae.value.description:z.value?`分析完成,共形成 ${de(ge.value)} 个可实施候选图斑`:"正在准备空间分析"}),Ze=c(()=>{const n=H.value||"红原县全域";return Y.value==="none"?`${n} · 未排除历史项目`:`${n} · ${Le.value}—${y.value} 年未实施条件`});$e(()=>[_.configState,_.analysisConfig],([n,t])=>{var T,q,B;if(n==="loading"||n==="idle"){te.value="loading";return}const o=Array.isArray(t==null?void 0:t.engineeringTypes)?t.engineeringTypes:[],r=Array.isArray(t==null?void 0:t.projectFilterModes)?t.projectFilterModes:[],v=Array.isArray(t==null?void 0:t.recentYearOptions)?t.recentYearOptions:[],A=Number(t==null?void 0:t.projectLatestYear);if(n!=="ready"||!o.length||!r.length||!v.length||!Number.isFinite(A)){C.value=[],Y.value="",D.value=null,me.value=null,y.value=null,te.value="error";return}const j=String(t.defaultEngineeringType||((T=o.find(K=>K.isDefault))==null?void 0:T.key)||""),F=String(t.defaultProjectFilterMode||((q=r.find(K=>K.isDefault))==null?void 0:q.key)||""),x=Number(t.defaultRecentYears||((B=v.find(K=>K.isDefault))==null?void 0:B.value));C.value=j?[j]:[],Y.value=F,D.value=Number.isFinite(x)?x:null,me.value=A,y.value=A,te.value="ready"},{immediate:!0,deep:!0}),$e([C,H,Y,D,y],()=>{!z.value&&S.value!=="error"||(S.value="idle",V.value=-1,h.value="",re.value="",Object.keys(G).forEach(n=>delete G[n]),P("analysis-reset"))}),qt(()=>it());function Re(n){return we(ie({},n),{status:"idle",baseCount:0,targetCount:0,loadedCount:0,loadedAreaMu:0,loadedPage:0,visible:!0})}function Xe(n){L.value||C.value[0]!==n&&(C.value=[n])}function _e(){return O(this,null,function*(){var r,v,A,j;if(!he.value)return;it();const n=++ve,t=((v=(r=window.performance)==null?void 0:r.now)==null?void 0:v.call(r))||Date.now();R=new AbortController,S.value="running",h.value="",re.value="";const o=lt();Object.keys(G).forEach(F=>delete G[F]),Object.keys(ye).forEach(F=>delete ye[F]),Object.keys(ne).forEach(F=>delete ne[F]),C.value.forEach(F=>{const x=f.value.find(T=>T.key===F);G[F]=Re(x),G[F].status="counting"}),P("analysis-reset");try{yield be(0,n,R.signal),yield be(1,n,R.signal),yield be(2,n,R.signal,()=>O(this,null,function*(){yield Promise.all(C.value.map(x=>O(this,null,function*(){const T=G[x],[q,B]=yield Promise.all([Be(qe(x,!1,o),R.signal),Be(qe(x,!0,o),R.signal)]);X(n),T.baseCount=q,T.targetCount=B,T.status="queued"})))})),yield be(3,n,R.signal,()=>O(this,null,function*(){yield Promise.all(C.value.map(x=>nt(x,o,n,R.signal)))})),yield be(4,n,R.signal),yield be(5,n,R.signal,()=>O(this,null,function*(){for(const x of C.value)X(n),yield Ke(G[x],o,n,R.signal)})),yield be(6,n,R.signal),X(n);const F=(((j=(A=window.performance)==null?void 0:A.now)==null?void 0:j.call(A))||Date.now())-t;yield Ne(Math.max(0,ka-F),R.signal),X(n),S.value="done",V.value=$.length,P("analysis-state",{state:"done",stepNumber:$.length,stepTotal:$.length,progress:100}),re.value=ft(o),P("analysis-complete",{rows:ue.value,filters:o,statistics:ht(o)})}catch(F){if((F==null?void 0:F.name)==="AbortError"||n!==ve)return;S.value="error",V.value=-1,P("analysis-state",{state:"error"}),h.value="工程适宜区服务暂时无法连接,请稍后重试。",re.value="",P("analysis-reset")}finally{n===ve&&(R=null)}})}function Ke(n,t,o,r){return O(this,null,function*(){if(n.status="loading",!n.targetCount){n.status="done";return}let v=0;for(;v<n.targetCount;){X(o);const A=yield mt(qe(n.key,!0,t),v,r);X(o);const j=Array.isArray(A.features)?A.features:[];if(!j.length)break;n.loadedPage+=1;const F=Math.max(40,Math.ceil(n.targetCount/Sa));for(let x=0;x<j.length;x+=F){X(o);const T=j.slice(x,x+F);n.loadedCount+=T.length,n.loadedAreaMu+=T.reduce((q,B)=>{var K;return q+Number(((K=B==null?void 0:B.properties)==null?void 0:K.source_area_mu)||0)},0),at(T,t),P("analysis-batch",{key:n.key,name:n.name,color:n.color,features:T,loadedCount:n.loadedCount,targetCount:n.targetCount}),rt(),yield St(r)}v+=j.length}n.status="done"})}function qe(n,t,o=lt()){const r=[`engineering_type='${Se(n)}'`];return r.push(...et(o,t)),r.join(" AND ")}function ft(n){const o=[`eng_type IN (${n.engineeringTypes.map(r=>`'${Se(r)}'`).join(",")})`];if(n.township&&o.push(`town_name='${Se(n.township)}'`),n.projectFilterMode!=="none"){const r=n.projectFilterMode==="all"?"last_year":"same_year";o.push(`(${r} IS NULL OR ${r}<${Number(n.startYear)})`)}return o.join(" AND ")}function et(n,t){const o=[];if(n.township&&o.push(`township_name='${Se(n.township)}'`),t&&n.projectFilterMode!=="none"){const r=n.projectFilterMode==="all"?"latest_project_year":"latest_same_type_project_year";o.push(`(${r} IS NULL OR ${r}<${Number(n.startYear)})`)}return o}function tt(n,t){const o=[`engineering_type='${Se(n)}'`];if(t.township&&o.push(`township_name='${Se(t.township)}'`),t.projectFilterMode==="none")return"EXCLUDE";const r=t.projectFilterMode==="all"?"latest_project_year":"latest_same_type_project_year";return o.push(`${r}>=${Number(t.startYear)}`),o.join(" AND ")}function Be(n,t){return O(this,null,function*(){const o=new URLSearchParams({service:"WFS",version:"2.0.0",request:"GetFeature",typeNames:Lt,resultType:"hits",CQL_FILTER:n}),r=yield fetch(`${pt}?${o}`,{credentials:"same-origin",signal:t});if(!r.ok)throw new Error(`HTTP ${r.status}`);const v=yield r.text(),A=v.match(/numberMatched="(\d+)"/i)||v.match(/numberOfFeatures="(\d+)"/i);return Number((A==null?void 0:A[1])||0)})}function mt(n,t,o){return O(this,null,function*(){const r=new URLSearchParams({service:"WFS",version:"2.0.0",request:"GetFeature",typeNames:Lt,outputFormat:"application/json",srsName:"EPSG:4326",count:String(ba),startIndex:String(t),sortBy:"id",CQL_FILTER:n}),v=yield fetch(`${pt}?${r}`,{credentials:"same-origin",signal:o});if(!v.ok)throw new Error(`HTTP ${v.status}`);return v.json()})}function nt(n,t,o,r){return O(this,null,function*(){if(t.projectFilterMode==="none")return;const v=t.projectFilterMode==="all"?"latest_project_year":"latest_same_type_project_year",A=t.projectFilterMode==="all"?"latest_project_name":"latest_same_type_project_name",j=tt(n,t);let F=0;for(;;){X(o);const x=yield yt(j,v,A,F,r);X(o);const T=Array.isArray(x.features)?x.features:[];if(T.forEach(q=>{const B=(q==null?void 0:q.properties)||{},K=String(B[A]||"未标注项目").trim()||"未标注项目",He=Number(B[v])||null,Fe=ne[K]||{name:K,latestYear:He,featureCount:0,areaMu:0};Fe.latestYear=Math.max(Number(Fe.latestYear||0),Number(He||0))||null,Fe.featureCount+=1,Fe.areaMu+=Number(B.source_area_mu||0),ne[K]=Fe}),T.length<It)break;F+=T.length}})}function yt(n,t,o,r,v){return O(this,null,function*(){const A=new URLSearchParams({service:"WFS",version:"2.0.0",request:"GetFeature",typeNames:Lt,outputFormat:"application/json",count:String(It),startIndex:String(r),sortBy:"id",propertyName:`id,source_area_mu,${t},${o}`,CQL_FILTER:n}),j=yield fetch(`${pt}?${A}`,{credentials:"same-origin",signal:v});if(!j.ok)throw new Error(`HTTP ${j.status}`);return j.json()})}function at(n,t){const o=t.township?"location_unit_name":"township_name";n.forEach(r=>{const v=(r==null?void 0:r.properties)||{},A=String(v[o]||"未标注").trim()||"未标注",j=ye[A]||{name:A,featureCount:0,areaMu:0};j.featureCount+=1,j.areaMu+=Number(v.source_area_mu||0),ye[A]=j})}function ht(n){return{engineeringType:n.engineeringTypes[0],engineeringName:Ee.value,scopeName:n.township||"红原县全域",dimensionLabel:n.township?"村":"乡镇",baseCount:Me.value,excludedCount:N.value,finalCount:ge.value,finalAreaMu:se.value*1e4,projectDataLatestYear:me.value,filters:n,excludedProjects:Te.value.map(t=>ie({},t)),distribution:Object.values(ye).map(t=>we(ie({},t),{areaMu:Number(t.areaMu.toFixed(2))})).sort((t,o)=>o.areaMu-t.areaMu)}}function _t(n){!n||n.status==="idle"||(n.visible=n.visible===!1,P("result-visibility",{key:n.key,visible:n.visible}))}function bt(){if(!z.value||!re.value||!ge.value)return;const n=new Date,o=`ecological_engineering_suitability_${[n.getFullYear(),String(n.getMonth()+1).padStart(2,"0"),String(n.getDate()).padStart(2,"0")].join("")}.zip`,r=new URLSearchParams({service:"WFS",version:"2.0.0",request:"GetFeature",typeNames:_a,outputFormat:"shape-zip",srsName:"EPSG:4326",CQL_FILTER:re.value,format_options:`charset:UTF-8;filename:${o}`}),v=document.createElement("a");v.href=`${pt}?${r}`,v.download=o,document.body.appendChild(v),v.click(),v.remove()}function st(n){return n.status==="counting"?"核对中":n.status==="queued"?"等待加载":n.status==="loading"?"加载中":n.status==="error"?"异常":n.visible===!1?"已隐藏":"地图显示"}function lt(){return{engineeringTypes:[...C.value],township:H.value,projectFilterMode:Y.value,recentYears:D.value,startYear:Le.value,endYear:y.value}}function be(n,t,o,r=null){return O(this,null,function*(){var x,T,q,B;X(t),V.value=n,rt();const v=$[n],A=((T=(x=window.performance)==null?void 0:x.now)==null?void 0:T.call(x))||Date.now(),j=r?yield r():void 0;X(t);const F=(((B=(q=window.performance)==null?void 0:q.now)==null?void 0:B.call(q))||Date.now())-A;return yield Ne(Math.max(0,Number((v==null?void 0:v.minimumDuration)||0)-F),o),X(t),j})}function rt(){const n=ae.value;P("analysis-state",{state:"running",stepKey:(n==null?void 0:n.key)||"prepare",stepLabel:(n==null?void 0:n.label)||"准备空间分析",stepDescription:(n==null?void 0:n.description)||"正在准备空间分析",stepNumber:Math.max(1,V.value+1),stepTotal:$.length,progress:ke.value})}function Ue(n){return n==="done"?"完成":n==="active"?"进行中":"等待"}function it(){R&&R.abort(),R=null}function X(n){if(n!==ve)throw new DOMException("Analysis superseded","AbortError")}function St(n){return Ne(wa,n)}function Ne(n,t){return n?t!=null&&t.aborted?Promise.reject(new DOMException("Analysis aborted","AbortError")):new Promise((o,r)=>{const v=window.setTimeout(A,n);t==null||t.addEventListener("abort",j,{once:!0});function A(){t==null||t.removeEventListener("abort",j),o()}function j(){window.clearTimeout(v),r(new DOMException("Analysis aborted","AbortError"))}}):Promise.resolve()}function Se(n){return String(n!=null?n:"").replace(/'/g,"''")}function de(n){const t=Number(n);return Number.isFinite(t)?Math.round(t).toLocaleString("zh-CN"):"0"}function Ae(n){const t=Number(n);return Number.isFinite(t)?t>=100?t.toFixed(1):t>=10?t.toFixed(2):t.toFixed(3):"0"}return(n,t)=>{var o;return u(),d("div",Ln,[l("section",{class:xe(["analysis-card analysis-workbench",{"is-running":L.value}])},[l("header",Nn,[t[3]||(t[3]=l("div",null,[l("span",null,"生态工程实施分析"),l("small",null,"基础候选区 + 动态业务条件")],-1)),l("strong",null,p(Je.value),1)]),t[9]||(t[9]=l("div",{class:"analysis-section-title"},[l("span",null,"01"),l("strong",null,"工程类型"),l("em",null,"单选")],-1)),l("div",Fn,[(u(!0),d(pe,null,fe(oe.value,r=>(u(),d("button",{key:r.key,type:"button",class:xe(["analysis-type-row",{"is-selected":C.value.includes(r.key)}]),disabled:L.value,role:"radio","aria-checked":C.value.includes(r.key),onClick:v=>Xe(r.key)},[l("i",{class:"analysis-type-check",style:Oe({"--type-color":r.color})},null,4),l("div",xn,[l("strong",null,p(r.name),1)])],10,$n))),128))]),t[10]||(t[10]=l("div",{class:"analysis-section-title is-filter"},[l("span",null,"02"),l("strong",null,"动态筛选条件"),l("em",null,"3 项条件")],-1)),l("div",Mn,[l("label",Pn,[t[5]||(t[5]=l("span",null,"所属乡镇",-1)),Ct(l("select",{"onUpdate:modelValue":t[0]||(t[0]=r=>H.value=r),"data-testid":"analysis-town",disabled:L.value},[t[4]||(t[4]=l("option",{value:""},"全县",-1)),(u(!0),d(pe,null,fe(je.value,r=>(u(),d("option",{key:r,value:r},p(r),9,Rn))),128))],8,Tn),[[jt,H.value]])]),l("label",null,[t[6]||(t[6]=l("span",null,"已有项目",-1)),Ct(l("select",{"onUpdate:modelValue":t[1]||(t[1]=r=>Y.value=r),"data-testid":"analysis-project-filter",disabled:L.value},[(u(!0),d(pe,null,fe(le.value,r=>(u(),d("option",{key:r.key,value:r.key},p(r.label),9,On))),128))],8,Dn),[[jt,Y.value]])]),l("label",null,[t[7]||(t[7]=l("span",null,"未实施年限",-1)),Ct(l("select",{"onUpdate:modelValue":t[2]||(t[2]=r=>D.value=r),"data-testid":"analysis-recent-years",disabled:L.value||Y.value==="none"},[(u(!0),d(pe,null,fe(U.value,r=>(u(),d("option",{key:r.key,value:Number(r.value)},p(r.label),9,In))),128))],8,Vn),[[jt,D.value,void 0,{number:!0}]])])]),l("div",Yn,[t[8]||(t[8]=l("i",null,null,-1)),Y.value==="none"?(u(),d("span",qn,"保留与已有工程相交的候选地块")):te.value==="loading"?(u(),d("span",Bn,"正在读取数据库分析配置…")):te.value==="error"?(u(),d("span",Un,"分析配置加载失败,暂不能执行空间分析")):(u(),d("span",Hn,p(Ve.value),1))]),l("button",{type:"button",class:"analysis-submit","data-testid":"analysis-submit",disabled:!he.value,"aria-busy":L.value,onClick:_e},[L.value?(u(),d("span",Wn)):Z("",!0),l("span",null,p(L.value?"空间分析进行中":z.value?"重新分析":"开始分析"),1),L.value?(u(),d("strong",Gn,p(((o=ae.value)==null?void 0:o.label)||"准备中"),1)):(u(),d("strong",Qn,p(Ee.value),1))],8,zn),L.value||z.value?(u(),d("div",Jn,[l("div",{role:"progressbar","aria-label":"分析进度","aria-valuenow":ke.value,"aria-busy":L.value,"aria-valuemin":"0","aria-valuemax":"100"},[l("i",{style:Oe({width:`${ke.value}%`})},null,4)],8,Zn),l("span",null,p(Ye.value),1)])):Z("",!0),L.value||z.value?(u(),d("div",Xn,[(u(!0),d(pe,null,fe(Qe.value,r=>(u(),d("div",{key:r.key,class:xe(["analysis-step-item",`is-${r.status}`])},[l("i",null,p(String(r.index+1).padStart(2,"0")),1),l("span",null,p(r.label),1),l("em",null,p(Ue(r.status)),1)],2))),128))])):Z("",!0),h.value?(u(),d("p",Kn,p(h.value),1)):Z("",!0)],2),L.value||z.value?(u(),d("section",ea,[l("header",ta,[l("div",null,[t[11]||(t[11]=l("span",null,"可实施区域",-1)),l("small",null,p(Ze.value),1)]),l("strong",null,p(de(ge.value))+" 个"+p(L.value?"已加载":""),1)]),L.value?(u(),d("div",na,[l("div",null,[t[12]||(t[12]=l("span",null,"已加载图斑",-1)),l("strong",null,p(de(ge.value)),1),t[13]||(t[13]=l("small",null,"个",-1))]),l("div",null,[t[14]||(t[14]=l("span",null,"已加载面积",-1)),l("strong",null,p(Ae(se.value)),1),t[15]||(t[15]=l("small",null,"万亩",-1))]),l("div",aa,[t[16]||(t[16]=l("span",null,"当前批次",-1)),l("strong",null,p(Ie.value||"—"),1),l("small",null,p(Ie.value?"页":"准备中"),1)])])):(u(),d("div",sa,[l("div",null,[t[17]||(t[17]=l("span",null,"基础候选",-1)),l("strong",null,p(de(Me.value)),1),t[18]||(t[18]=l("small",null,"个图斑",-1))]),l("div",la,[t[19]||(t[19]=l("span",null,"项目排除",-1)),l("strong",null,p(de(N.value)),1),t[20]||(t[20]=l("small",null,"个图斑",-1))]),l("div",ra,[t[21]||(t[21]=l("span",null,"最终可实施",-1)),l("strong",null,p(Ae(se.value)),1),t[22]||(t[22]=l("small",null,"万亩",-1))])])),l("div",ia,[(u(!0),d(pe,null,fe(ue.value,r=>(u(),d("button",{key:r.key,type:"button",class:xe(["analysis-result-row",[`is-${r.status}`,{"is-hidden":r.visible===!1}]]),"aria-pressed":r.visible!==!1,onClick:v=>_t(r)},[l("i",{style:Oe({"--type-color":r.color})},null,4),l("div",null,[l("strong",null,p(r.name),1),r.status==="loading"?(u(),d("span",ua,"正在读取第 "+p(r.loadedPage)+" 页",1)):r.status==="error"?(u(),d("span",ca,"加载失败")):(u(),d("span",da,p(Ae(r.loadedAreaMu/1e4))+" 万亩",1))]),r.status==="loading"?(u(),d("b",va,"已加载 "+p(de(r.loadedCount))+" 个",1)):(u(),d("b",ga,p(de(r.loadedCount))+" 个图斑",1)),l("em",null,p(r.visible===!1?"已隐藏":st(r)),1)],10,oa))),128))]),z.value&&Te.value.length?(u(),d("section",pa,[l("header",null,[t[23]||(t[23]=l("strong",null,"排除项目与候选面积",-1)),l("em",null,"合计 "+p(Ae(ce.value))+" 万亩",1)]),l("div",fa,[(u(!0),d(pe,null,fe(Te.value,(r,v)=>(u(),d("div",{key:r.name,class:"analysis-excluded-project-row"},[l("span",null,p(v+1),1),l("div",null,[l("strong",{title:r.name},p(r.name),9,ma),l("small",null,p(r.latestYear?`${r.latestYear} 年 · `:"")+"排除 "+p(de(r.featureCount))+" 个相交图斑",1)]),l("b",null,p(Ae(r.areaMu/1e4))+" 万亩",1)]))),128))])])):Z("",!0),z.value?(u(),d("button",{key:3,type:"button",class:"analysis-export","data-testid":"analysis-export-shp",disabled:!re.value||!ge.value,onClick:bt},[...t[24]||(t[24]=[l("span",null,"导出本次分析结果",-1),l("strong",null,"SHP",-1)])],8,ya)):Z("",!0),l("footer",ha,p(L.value?"正在逐批叠加候选图斑,最终统计将在加载完成后生成。":"结果已排除初筛禁入范围;工程立项前仍需结合连片度、权属和现场踏勘复核。"),1)])):Z("",!0)])}}},ja=Yt(Ca,[["__scopeId","data-v-093fec53"]]),Ea="/openApi";function La(){return O(this,arguments,function*(k={}){const m=yield jn(`${Ea}/ai/ecological-engineering/advice`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataJson:JSON.stringify({engineeringName:k.engineeringName,scopeName:k.scopeName,dimensionLabel:k.dimensionLabel,baseCount:k.baseCount,excludedCount:k.excludedCount,finalCount:k.finalCount,finalAreaMu:k.finalAreaMu,projectDataLatestYear:k.projectDataLatestYear,filters:k.filters,distribution:(k.distribution||[]).slice(0,30),excludedProjects:(k.excludedProjects||[]).slice(0,30)})}),timeout:7e4});if((m==null?void 0:m.success)===!1||(m==null?void 0:m.code)!==void 0&&![0,200,"0","200"].includes(m.code))throw new Error((m==null?void 0:m.message)||(m==null?void 0:m.msg)||"DeepSeek分析建议生成失败");return En(m)})}const Na={class:"engineering-statistics-panel","data-testid":"engineering-statistics-panel","aria-label":"生态工程分析统计","aria-live":"polite"},Fa={class:"statistics-head"},$a={class:"advice-section"},xa={key:0,class:"advice-loading","data-testid":"engineering-advice-status"},Ma={key:1,class:"advice-list"},Pa={key:2,class:"advice-error"},Ta={__name:"EngineeringStatisticsPanel",props:{statistics:{type:Object,required:!0}},setup(k){const m=k,_=b(!1),P=b(""),$=b("");let f=0;const le=c(()=>{var y;return Array.isArray((y=m.statistics)==null?void 0:y.distribution)?m.statistics.distribution:[]}),U=c(()=>{var h;const y=[],S=le.value[0];return S&&y.push(`优先核查${S.name}等候选面积较集中的区域,进一步评价地块连片度和施工可达性。`),Number(((h=m.statistics)==null?void 0:h.excludedCount)||0)>0?y.push(`对已排除的 ${D(m.statistics.excludedCount)} 个历史项目相交图斑复核项目边界、实施年份和工程类型,避免重复建设。`):y.push("本次年份条件未排除历史项目相交图斑,建议结合项目库更新时间确认筛选时段是否完整。"),y.push("候选结果用于工程初筛,立项前仍需完成权属核验、现场踏勘和实施方案论证。"),y}),C=c(()=>{const y=String(P.value||"").split(/\n+/).map(S=>S.replace(/^\s*(?:[-•]|\d+[.、)])\s*/,"").trim()).filter(Boolean);return y.length?y.slice(0,5):U.value}),H=c(()=>_.value?"DeepSeek自动研判中":P.value?"DeepSeek研判":"系统初步建议");$e(()=>m.statistics,y=>{const S=++f;P.value="",$.value="",_.value=!1,y&&Y(S,y)},{immediate:!0});function Y(y,S){return O(this,null,function*(){_.value=!0,$.value="";try{const h=yield La(S);if(y!==f)return;if(P.value=String((h==null?void 0:h.advice)||(h==null?void 0:h.content)||"").trim(),!P.value)throw new Error("DeepSeek未返回有效建议")}catch(h){if(y!==f)return;$.value=/404/.test(String((h==null?void 0:h.message)||""))?"DeepSeek建议接口尚未部署,已保留系统初步建议。":(h==null?void 0:h.message)||"DeepSeek暂时不可用,已保留系统初步建议。"}finally{y===f&&(_.value=!1)}})}function D(y){const S=Number(y);return Number.isFinite(S)?Math.round(S).toLocaleString("zh-CN"):"0"}return(y,S)=>(u(),d("aside",Na,[l("header",Fa,[l("div",null,[S[0]||(S[0]=l("span",null,"分析建议",-1)),l("small",null,p(k.statistics.engineeringName)+" · "+p(k.statistics.scopeName),1)]),l("strong",null,p(H.value),1)]),l("section",$a,[_.value?(u(),d("div",xa,[...S[1]||(S[1]=[l("span",{class:"advice-spinner"},null,-1),l("span",null,"DeepSeek 正在自动生成分析建议…",-1)])])):(u(),d("ol",Ma,[(u(!0),d(pe,null,fe(C.value,(h,re)=>(u(),d("li",{key:`${re}-${h}`},p(h),1))),128))])),$.value?(u(),d("p",Pa,p($.value),1)):Z("",!0)])]))}},Ra=Yt(Ta,[["__scopeId","data-v-fb17a135"]]);const Da={class:"forest-grass-wet ecological-protection"},Oa={class:"forest-grass-wet-ui ecological-protection-ui"},Va={key:0,class:"fgw-left"},Ia={class:"fgw-side-stack is-left"},Ya={key:1,class:"fgw-right"},qa={class:"fgw-side-stack is-right"},Ba={key:3,class:"engineering-map-loading",role:"status","aria-live":"polite"},Ua={class:"engineering-map-loading__description"},Ha={class:"engineering-map-loading__progress","aria-hidden":"true"},za={class:"fgw-bottom-topic ecological-bottom-topic"},Wa={key:0,class:"loading"},Ga={class:"loading-progress"},Qa={class:"value"},vs={__name:"index",props:{activeView:{type:String,default:"ecological-redline"},showLoading:{type:Boolean,default:!0},active:{type:Boolean,default:!0}},emits:["module-stats","view-change"],setup(k,{expose:m,emit:_}){const P=k,$=_,f=b(null),le=b(""),U=b(""),C=b(ot({},"ecological-redline")),H=b(ut({})),Y=b(ct({})),D=b(null),y=b(!1),S=b(!1),h=b(null),re=b(0),me=b(P.showLoading),te=b(null),V=b({type:"idle",text:"等待生态保护图层加载"}),G=b(null),ye=b(!1),ne=b({}),R=b({}),ve=b("idle");let je=null,L=!1,z=!1,he=!1,oe=null,Ee=0,ue=0,Le=0,Ve=0,ae=0;const Qe=new Map;let Je=null,Me=null,Pe=null;const ge=new Set(["code","msg","message","success","data","result","project","progress","dycolumn","geom","wkt","geometry","the_geom","raw_properties","gid","id","objectid","object_id","fid","key_uid","bsm","ysdm"]),N=c(()=>ze.some(e=>e.key===P.activeView)?P.activeView:"ecological-redline"),se=c(()=>N.value==="engineering-analysis"),Ie=c(()=>["restoration","engineering-analysis"].includes(N.value)),Te=c(()=>dt.includes(N.value)),ce=c(()=>le.value?rn(N.value,le.value):null),ke=c(()=>{var e;return(((e=ce.value)==null?void 0:e.legends)||[]).find(a=>a.key===U.value)||null}),Ye=c(()=>{var e;return((e=ce.value)==null?void 0:e.legends)||[]}),Ze=c(()=>Dt(N.value)),Re=c(()=>Ze.value.length<=2&&Ye.value.length<=6),Xe=c(()=>{if(se.value)return 112;if(!Re.value)return 430;const e=Math.max(1,Ze.value.length),a=Math.max(1,Math.ceil(Ye.value.length/2)),s=e*34+Math.max(0,e-1)*5,i=30+a*28;return Math.max(196,Math.min(340,72+s+i))}),_e=c(()=>{const e=ce.value;return e?ke.value?we(ie({},e),{cqlFilter:ke.value.cqlFilter||e.cqlFilter,activeLegend:ke.value,name:ke.value.name||e.name}):e:null}),Ke=c(()=>Te.value?C.value:N.value==="restoration"?Y.value:N.value==="engineering-analysis"?on:H.value),qe=c(()=>Ke.value.left||[]),ft=c(()=>Ke.value.right||[]),et=b(typeof window=="undefined"?1080:window.innerHeight),tt=fn.sideCardWidth,Be=c(()=>mn(et.value)),mt=c(()=>yn(Be.value,2)),nt=c(()=>!!h.value),yt=_n,at=c(()=>hn({point:h.value?t(h.value):null,rowCount:D.value?j(D.value):0,loading:S.value,empty:y.value||!D.value})),ht=c(()=>at.value.height),_t=c(()=>at.value.style),bt=c(()=>{var a;return{"ecological-redline":"生态保护红线详情","natural-protected-area":"自然保护地详情","national-park":"国家公园详情",restoration:"生态修复详情","engineering-analysis":"生态工程详情"}[N.value]||`${((a=ce.value)==null?void 0:a.name)||"生态图斑"}详情`});An(()=>{o(),window.addEventListener("resize",o),document.addEventListener("pointerdown",xt,!0),St(),st(N.value)}),qt(()=>{L=!0,oe&&window.clearTimeout(oe),window.removeEventListener("resize",o),document.removeEventListener("pointerdown",xt,!0)}),$e(N,e=>{st(e)}),$e(le,()=>{U.value="",Q()}),$e(U,()=>{Q()}),$e(()=>P.active,e=>{var a,s,i,g;f.value&&(e?(Ne(),(s=(a=f.value).resume)==null||s.call(a)):(g=(i=f.value).pause)==null||g.call(i))});function st(e){var E,M,W,I,ee,J,Ce;const a=ze.find(en=>en.key===e)||ze[0],s=Dt(e);G.value=null,ye.value=!1,ne.value={},U.value="",le.value=a.defaultLayerKey||((E=s[0])==null?void 0:E.key)||"";const i=e==="national-park",g=e==="restoration",w=e==="engineering-analysis";te.value=We(e),(W=(M=f.value)==null?void 0:M.setBoundaryDrawing)==null||W.call(M,!1),(ee=(I=f.value)==null?void 0:I.clearAnalysisBoundary)==null||ee.call(I),e!=="engineering-analysis"&&((Ce=(J=f.value)==null?void 0:J.clearEngineeringSuitability)==null||Ce.call(J)),Q(),dt.includes(e)&&(C.value=ot({},e)),i&&(H.value=ut({})),g&&(Y.value=ct({})),w&&(R.value={},ve.value="loading"),$("module-stats",{moduleKey:"ecological-protection",viewKey:e,items:dt.includes(e)?wt({},e):i?kt({}):g?At({}):[]}),dt.includes(e)?X(e):i?rt(e):g?be(e):w&<(e),Ue()}function lt(e){return O(this,null,function*(){const a=++Ve;ve.value="loading";try{const s=Pe||(yield un());if(a!==Ve||N.value!==e)return;Pe=s,R.value=s,ve.value="ready"}catch(s){if(a!==Ve||N.value!==e)return;R.value={},ve.value="error",V.value={type:"error",text:"生态工程分析配置加载失败"},console.warn("Failed to load ecological-engineering-analysis configuration",s)}})}function be(e){return O(this,null,function*(){const a=++Le;try{const s=Me||(yield cn());if(a!==Le||N.value!==e)return;Me=s,Y.value=ct(s),te.value=We(e,s),$("module-stats",{moduleKey:"ecological-protection",viewKey:e,items:At(s)})}catch(s){if(a!==Le||N.value!==e)return;Y.value=ct({}),te.value=We(e),$("module-stats",{moduleKey:"ecological-protection",viewKey:e,items:At({})}),V.value={type:"error",text:"生态修复统计加载失败"},console.warn("Failed to load ecological-restoration statistics",s)}})}function rt(e){return O(this,null,function*(){const a=++ue;try{const s=Je||(yield dn());if(a!==ue||N.value!==e)return;Je=s,H.value=ut(s),te.value=We(e,s),$("module-stats",{moduleKey:"ecological-protection",viewKey:e,items:kt(s)})}catch(s){if(a!==ue||N.value!==e)return;H.value=ut({}),te.value=We(e),$("module-stats",{moduleKey:"ecological-protection",viewKey:e,items:kt({})}),V.value={type:"error",text:"国家公园统计加载失败"},console.warn("Failed to load national-park statistics",s)}})}function Ue(e=0){const a=_e.value||ce.value;!(a!=null&&a.mapView)&&!(a!=null&&a.cameraPosition)||Ge(()=>{var i,g;!((g=(i=f.value)==null?void 0:i.focusLayerMapView)==null?void 0:g.call(i,a))&&e<12&&window.setTimeout(()=>Ue(e+1),120)})}function it(e){const a=ze.some(s=>s.key===e)?e:"ecological-redline";a!==N.value&&$("view-change",a)}function X(e){return O(this,null,function*(){const a=++Ee;try{const i=Qe.get(e)||(yield vn(e));if(a!==Ee||N.value!==e)return;Qe.set(e,i),C.value=ot(i,e),$("module-stats",{moduleKey:"ecological-protection",viewKey:e,items:wt(i,e)})}catch(s){if(a!==Ee||N.value!==e)return;C.value=ot({},e),$("module-stats",{moduleKey:"ecological-protection",viewKey:e,items:wt({},e)}),V.value={type:"error",text:"保护范围统计加载失败"},console.warn("Failed to load ecological scope statistics",s)}})}function St(){var s;je=new pn;const e={progress:0};je.instance.on("onProgress",(i,g,w)=>{const E=Math.floor(g/w*100);Tt.to(e,{progress:E,onUpdate:()=>{re.value=Math.floor(e.progress)}})});const a=()=>{L||z||(z=!0,Ne())};je.instance.on("onLoad",a),(s=je.ready)==null||s.then(a).catch(()=>{L||(V.value={type:"error",text:"地图资源加载失败"})})}function Ne(){L||!P.active||!z||he||(he=!0,oe&&window.clearTimeout(oe),oe=window.setTimeout(()=>{oe=null,Se()},600))}function Se(e=0){return O(this,null,function*(){var s,i,g,w,E;if(L)return;if(!P.active){he=!1;return}if(yield Ge(),!P.active){he=!1;return}if(!!((i=(s=f.value)==null?void 0:s.loadMap)!=null&&i.call(s,je)||(w=(g=f.value)==null?void 0:g.hasMap)!=null&&w.call(g))){yield Kt(),yield Ge(),(E=f.value)==null||E.play(),Ue();return}if(e<24){window.setTimeout(()=>Se(e+1),120);return}he=!1})}function de(){oe&&(window.clearTimeout(oe),oe=null)}function Ae(){var e,a,s,i;(a=(e=f.value)==null?void 0:e.resume)==null||a.call(e),(i=(s=f.value)==null?void 0:s.refreshView)==null||i.call(s)}function n(){var e,a,s,i,g,w;if(Q(),(a=(e=f.value)==null?void 0:e.setBoundaryDrawing)==null||a.call(e,!1),(i=(s=f.value)==null?void 0:s.clearAnalysisBoundary)==null||i.call(s),(w=(g=f.value)==null?void 0:g.hasMap)!=null&&w.call(g)){Ae();return}de(),he=!1,Ge(()=>{Ne()})}m({refreshMapView:Ae,resetMap:n});function t(e){const a=document.querySelector(".ecological-protection"),s=a==null?void 0:a.getBoundingClientRect();return!(s!=null&&s.width)||!(s!=null&&s.height)?e:{x:(e.x-s.left)/s.width*1920,y:(e.y-s.top)/s.height*1080}}function o(){et.value=typeof window=="undefined"?1080:window.innerHeight}function r(e,a){return`${N.value}-${a}-${(e==null?void 0:e.key)||(e==null?void 0:e.title)||"panel"}`}function v(e){return(e==null?void 0:e.span)===2}function A(e){return v(e)?mt.value:Be.value}function j(e){const a=(e==null?void 0:e.properties)||{};return Object.keys(a).filter(s=>F(s,a[s])).length}function F(e,a){return a==null||a===""||Array.isArray(a)||typeof a=="object"?!1:!ge.has(String(e||"").toLowerCase())}function x(e={}){const a=T(e.lng),s=T(e.lat);return a===""||s===""?"":`POINT(${a} ${s})`}function T(e){const a=Number(e);return Number.isFinite(a)?a.toFixed(8).replace(/\.?0+$/,""):""}function q(){return O(this,arguments,function*(e={}){var w,E,M,W,I,ee;if(!Ie.value||se.value)return;if(B(e.overlayLayer||_e.value||ce.value)){Q();return}const a=Number((w=e==null?void 0:e.lngLat)==null?void 0:w.lng),s=Number((E=e==null?void 0:e.lngLat)==null?void 0:E.lat);if(!Number.isFinite(a)||!Number.isFinite(s)){Q();return}const i=++ae,g=e.screen||{x:960,y:540};h.value=null,D.value=null,y.value=!1,S.value=!0;try{const J=yield gn(x({lng:a,lat:s}));if(i!==ae||L)return;const Ce=K(J,e);if(!Ce||j(Ce)<=0){Q();return}D.value=Ce,h.value=((W=(M=f.value)==null?void 0:M.getVectorFeatureAnchorScreen)==null?void 0:W.call(M,Ce))||g,y.value=!1,(ee=(I=f.value)==null?void 0:I.highlightFeature)==null||ee.call(I,Ce,{highlightTone:"v21"})}catch(J){if(i!==ae)return;Q()}finally{i===ae&&(S.value=!1)}})}function B(e=_e.value){const a=String((e==null?void 0:e.sourceType)||"").toLowerCase();return["geojson","geojson-api","wkt-api","wfs"].includes(a)||String((e==null?void 0:e.dataPath)||"").includes("ecological_restoration_projects")}function K(e,a={}){var w,E,M;const s=Fe((e==null?void 0:e.project)||((w=e==null?void 0:e.data)==null?void 0:w.project)||(e==null?void 0:e.data)||e);if(!Bt(s))return null;const i=Nt(s,e),g=s.geom||s.geometry||s.wkt||null;return{id:s.id||i.id||i.project_name||`project-${(E=a==null?void 0:a.lngLat)==null?void 0:E.lng}-${(M=a==null?void 0:a.lngLat)==null?void 0:M.lat}`,properties:i,feature:{type:"Feature",properties:i,geometry:g},geometry:g,layer:a.overlayLayer||_e.value||ce.value,lngLat:a.lngLat}}function He(e,a={}){var W,I,ee;const s=e!=null&&e.feature&&e.feature.type==="Feature"?we(ie({},e.feature),{id:e.id||e.feature.id,layer:e.layer,lngLat:e.lngLat}):e,i=(s==null?void 0:s.type)==="Feature"?s:((W=s==null?void 0:s.feature)==null?void 0:W.type)==="Feature"?s.feature:null,g=(s==null?void 0:s.properties)||(i==null?void 0:i.properties)||{},w=(s==null?void 0:s.geometry)||(i==null?void 0:i.geometry)||g.geometry||g.geom||g.wkt||null,E=Nt(g,a),M=(s==null?void 0:s.id)||(i==null?void 0:i.id)||E.id||E.gid||E.project_id||E.project_name||`project-${((I=a==null?void 0:a.lngLat)==null?void 0:I.lng)||""}-${((ee=a==null?void 0:a.lngLat)==null?void 0:ee.lat)||""}`;return{id:M,properties:E,feature:{type:"Feature",id:M,properties:E,geometry:w},geometry:w,layer:(s==null?void 0:s.layer)||a.overlayLayer||_e.value||ce.value,lngLat:(s==null?void 0:s.lngLat)||a.lngLat}}function Fe(e){return Array.isArray(e)?e.find(a=>a&&typeof a=="object")||null:e&&typeof e=="object"?e:null}function Bt(e){return!e||typeof e!="object"?!1:Array.isArray(e.dyColumn)&&e.dyColumn.some(Ut)?!0:Object.keys(e).some(a=>F(a,e[a]))}function Ut(e={}){const a=e==null?void 0:e.value;return a==null||a===""?!1:!!String((e==null?void 0:e.field)||(e==null?void 0:e.title)||"").trim()}function Nt(e={},a={}){const s=ie({},e);(Array.isArray(e.dyColumn)?e.dyColumn:[]).forEach(M=>{const W=M==null?void 0:M.value;if(W==null||W==="")return;const I=String((M==null?void 0:M.field)||"").trim();[I,Ht(I)].filter(Boolean).forEach(J=>{(s[J]===void 0||s[J]===null||s[J]==="")&&(s[J]=W)})});const g=s.project_name||s.projectName||s.name,w=s.area_mu||s.areaMu||s.acreage,E=s.project_status||s.projectStatus;return we(ie({},s),{project_name:g,name:g||s.name,area_mu:w,project_status:E,progress_count:Array.isArray(a==null?void 0:a.progress)?a.progress.length:void 0})}function Ht(e){return String(e||"").replace(/[A-Z]/g,a=>`_${a.toLowerCase()}`)}function zt(e){var s,i,g,w;const a=(i=(s=e==null?void 0:e.feature)!=null?s:e)!=null?i:null;if(!a||j(a)<=0){Q();return}if(Ie.value){ae+=1;const E=He(a,e);if(!E||j(E)<=0){Q();return}D.value=E,y.value=!1,S.value=!1,h.value=((w=(g=f.value)==null?void 0:g.getVectorFeatureAnchorScreen)==null?void 0:w.call(g,E))||(e==null?void 0:e.screen)||null;return}D.value=a,y.value=!1,e!=null&&e.screen&&(h.value=e.screen)}function Wt(e){V.value=e}function Ft(e,a){var g,w;if(N.value==="national-park"&&(a!=null&&a.name)){Q(),(w=(g=f.value)==null?void 0:g.focusTown)==null||w.call(g,a.name,{distanceScale:.66,targetLocalZ:.84,cameraOffset:{x:0,y:1.05,z:0},select:!0});return}if(N.value!=="restoration"||(e==null?void 0:e.key)!=="restoration-projects"||!((a==null?void 0:a.projectName)||(a==null?void 0:a.name)))return;Q();const i=()=>$t(a);if(U.value){U.value="",Ge(()=>window.setTimeout(i,80));return}i()}function $t(e,a=0){var w,E,M,W,I,ee,J;if(N.value!=="restoration")return;const s=(e==null?void 0:e.projectName)||(e==null?void 0:e.name);if(!s)return;const i=(E=(w=f.value)==null?void 0:w.focusProject)==null?void 0:E.call(w,{id:e==null?void 0:e.id,key:e==null?void 0:e.key,name:s,projectName:s,project_name:s,highlightTone:"white"});if(!(i!=null&&i.feature)){if(a<10){window.setTimeout(()=>$t(e,a+1),120);return}V.value={type:"warning",text:"当前项目图斑尚未加载"};return}const g=He({id:i.feature.id,properties:i.feature.properties||{},geometry:i.feature.geometry,feature:i.feature,layer:_e.value||ce.value},{});D.value=g,y.value=!1,S.value=!1,h.value=i.screen||((I=(M=f.value)==null?void 0:M.getVectorFeaturesAnchorScreen)==null?void 0:I.call(M,(W=i.highlightFeatures)!=null&&W.length?i.highlightFeatures:i.features))||((J=(ee=f.value)==null?void 0:ee.getVectorFeatureAnchorScreen)==null?void 0:J.call(ee,g))}function Gt(){var e,a;Q(),G.value=null,(a=(e=f.value)==null?void 0:e.clearEngineeringSuitability)==null||a.call(e)}function Qt(e={}){ye.value=e.state==="running",ne.value=e.state==="running"?ie({},e):{}}function Jt(e={}){var a,s;(s=(a=f.value)==null?void 0:a.addEngineeringSuitabilityBatch)==null||s.call(a,e)}function Zt(e={}){var a,s;G.value=e.statistics||null,(s=(a=f.value)==null?void 0:a.completeEngineeringSuitability)==null||s.call(a,e)}function Xt(e={}){var a,s;(s=(a=f.value)==null?void 0:a.setEngineeringSuitabilityVisibility)==null||s.call(a,e.key,e.visible)}function Q(){var e,a;ae+=1,D.value=null,y.value=!1,S.value=!1,h.value=null,(a=(e=f.value)==null?void 0:e.clearSelectedFeature)==null||a.call(e)}function xt(e){if(!nt.value)return;const a=document.querySelector(".fgw-map-feature-info"),s=e.target;a&&s instanceof Node&&a.contains(s)||Q()}function Kt(){return me.value?new Promise(e=>{Tt.to(".ecological-protection .loading",{opacity:0,duration:.8,delay:.2,onComplete:()=>{me.value=!1,e()}})}):Promise.resolve()}return(e,a)=>(u(),d("div",Da,[De(bn,{ref_key:"mapSceneRef",ref:f,"active-layer":_e.value,"map-ranking":te.value,"admin-boundary-line-scale":1.65,"auto-apply-layer-map-view":!1,"max-zoom":21,onFeatureLoading:a[0]||(a[0]=s=>S.value=s),onFeatureInfo:zt,onMapClick:q,onLayerStatus:Wt},null,8,["active-layer","map-ranking"]),l("div",Oa,[se.value?Z("",!0):(u(),d("div",Va,[l("div",Ia,[(u(!0),d(pe,null,fe(qe.value,s=>(u(),vt(Rt,{key:r(s,"left"),class:xe(["fgw-side-card left-card",[{"is-double":v(s)},`ecological-side-card--${s.key}`]]),title:s.title,width:gt(tt),height:A(s)},{default:Vt(()=>[De(Ot,{panel:s,compact:"","column-label-standard":"","visual-version":"v21",onRowSelect:i=>Ft(s,i)},null,8,["panel","onRowSelect"])]),_:2},1032,["class","title","width","height"]))),128))])])),se.value?Z("",!0):(u(),d("div",Ya,[l("div",qa,[(u(!0),d(pe,null,fe(ft.value,s=>(u(),vt(Rt,{key:r(s,"right"),class:xe(["fgw-side-card right-card",[{"is-double":v(s)},`ecological-side-card--${s.key}`]]),title:s.title,width:gt(tt),height:A(s)},{default:Vt(()=>[De(Ot,{panel:s,compact:"","column-label-standard":"","visual-version":"v21",onRowSelect:i=>Ft(s,i)},null,8,["panel","onRowSelect"])]),_:2},1032,["class","title","width","height"]))),128))])])),se.value?(u(),vt(ja,{key:2,"analysis-config":R.value,"config-state":ve.value,onAnalysisReset:Gt,onAnalysisBatch:Jt,onAnalysisComplete:Zt,onAnalysisState:Qt,onResultVisibility:Xt},null,8,["analysis-config","config-state"])):Z("",!0),se.value&&ye.value?(u(),d("div",Ba,[a[3]||(a[3]=l("span",{class:"engineering-map-loading__radar","aria-hidden":"true"},null,-1)),a[4]||(a[4]=l("strong",null,"空间分析中",-1)),l("small",null,p(ne.value.stepLabel||"初始化分析环境"),1),l("span",Ua,p(ne.value.stepDescription||"正在准备空间索引与工程参数"),1),l("div",Ha,[l("i",{style:Oe({width:`${ne.value.progress||1}%`})},null,4),l("em",null,p(ne.value.stepNumber||1)+"/"+p(ne.value.stepTotal||7),1)])])):Z("",!0),se.value&&G.value?(u(),vt(Ra,{key:4,statistics:G.value},null,8,["statistics"])):Z("",!0),l("div",{class:xe(["fgw-map-layer-tools",{"is-analysis":se.value,"is-compact":Re.value}]),style:Oe({height:`${Xe.value}px`})},[De(Sn,{modelValue:le.value,"onUpdate:modelValue":a[1]||(a[1]=s=>le.value=s),"selected-legend-key":U.value,"onUpdate:selectedLegendKey":a[2]||(a[2]=s=>U.value=s),"topic-key":N.value,legends:Ye.value,width:248,height:Xe.value,compact:Re.value,"show-legend":!se.value},null,8,["modelValue","selected-legend-key","topic-key","legends","height","compact","show-legend"])],6),nt.value?(u(),d("div",{key:5,class:"fgw-map-feature-info",style:Oe(_t.value)},[De(wn,{title:bt.value,feature:D.value,empty:y.value,loading:S.value,width:gt(yt),height:ht.value,closable:"",onClose:Q},null,8,["title","feature","empty","loading","width","height"])],4)):Z("",!0),l("div",za,[De(kn,{"model-value":N.value,topics:gt(ze),"onUpdate:modelValue":it},null,8,["model-value","topics"])])]),me.value?(u(),d("div",Wa,[a[6]||(a[6]=Cn('<div class="loading-text"><span style="--index:1;">L</span><span style="--index:2;">O</span><span style="--index:3;">A</span><span style="--index:4;">D</span><span style="--index:5;">I</span><span style="--index:6;">N</span><span style="--index:7;">G</span></div>',1)),l("div",Ga,[l("span",Qa,p(re.value),1),a[5]||(a[5]=l("span",{class:"unit"},"%",-1))])])):Z("",!0)]))}};export{vs as default};
|
|
|