import{at as j,b_ as q,by as c,a1 as p,bq as A,bs as G,an as M,ak as f,aq as e,y as N,ct as a,p as I,q as B,ap as r,bO as y,Z as F,bT as d,g as z,cp as D,A as Y,F as U,aR as W,u as Z,_ as $}from"./index-BVAEVuZQ.js";import{E as H}from"./el-select-v2-Bi4SQfgN.js";import{a as J,E as K}from"./el-col-CztUE8lk.js";import{M as Q,V as X,q as ee,b as te}from"./TileImage-B-0PORC6.js";import{T as ae}from"./TileWMS-Wnr0cw94.js";const le={class:"vector-layer-container"},oe={class:"content"},ne={class:"footer"},se=j({__name:"VectorLayer",props:{fileOption:{type:Object,required:!0},layer:{type:Object,required:!0}},emits:["cancle"],setup(S,{emit:re}){const w=q("layer_type"),t=S,b=W("cancle"),v=c([]);p.style.getStyleList({pageNum:1,pageSize:1e6}).then(n=>{v.value=n.data.data?.map(o=>({label:o.name,value:o.name}))||[]});const l=c({name:t.layer.name,type:t.layer.geometryType,dataSourceId:t.fileOption.id,filePath:t.fileOption.filePath,bbox:t.layer.bbox,crs:t.layer.crs,style:"",attributes:[],fileType:t.fileOption.type}),m=c([]),g=c(),E=c();p.tools.postToolsGetAttributes({filePath:t.fileOption.filePath,type:t.fileOption.type,layerName:t.layer.name}).then(n=>{m.value=n.data.data||[],l.value.attributes=n.data.data,E.value?.toggleAllSelection()});let i;A(()=>{i=new Q({target:g.value,view:new X({zoom:1,center:[0,0],projection:"EPSG:4326"})})});const x=async()=>{let n;t.layer.crs=="EPSG:4326"?n=t.layer.bbox:n=await p.tools.postToolsTransformExtent({destCrs:"EPSG:4326",sourceCrs:t.layer.crs,extent:t.layer.bbox}).then(s=>s.data.data);const o=ee(n,"EPSG:4326",i.getView().getProjection());i.getLayers().clear(),i.addLayer(new te({source:new ae({url:"/mapserver/wms/overview",params:{LAYERS:l.value.name,FORMAT:"image/png",VERSION:"1.3.0",datasourceId:t.fileOption.id,STYLES:l.value.style},projection:"EPSG:4326"})})),i.getView().fit(o,{padding:[10,10,10,10]})},V=n=>{l.value.attributes=n},h=()=>{l.value.attributes.length==m.value.length&&(l.value.attributes=[{name:"*",type:"*"}]),p.layer.addLayer(l.value).then(()=>{Z.success("图层发布成功"),b?.()})};return(n,o)=>{const s=B,T=K,O=J,C=F,L=H,_=z,u=U,P=I,k=N;return G(),M("div",le,[f("div",oe,[e(k,null,{default:a(()=>[e(P,{"label-width":"90px",inline:""},{default:a(()=>[e(s,{label:"图层名称"},{default:a(()=>[r(y(l.value.name),1)]),_:1}),e(s,{label:"坐标参考"},{default:a(()=>[r(y(l.value.crs),1)]),_:1}),e(O,null,{default:a(()=>[e(T,{span:24},{default:a(()=>[e(s,{label:"数据范围"},{default:a(()=>[r(y(l.value.bbox.join(",")),1)]),_:1})]),_:1})]),_:1}),e(s,{label:"矢量类型"},{default:a(()=>[e(C,{dicts:d(w).layer_type,value:l.value.type},null,8,["dicts","value"])]),_:1}),e(s,{label:"样式"},{default:a(()=>[e(L,{filterable:"",options:v.value,modelValue:l.value.style,"onUpdate:modelValue":o[0]||(o[0]=R=>l.value.style=R)},null,8,["options","modelValue"])]),_:1}),e(s,{label:" "},{default:a(()=>[e(_,{onClick:x,icon:d(D)},{default:a(()=>[...o[1]||(o[1]=[r("预览",-1)])]),_:1},8,["icon"])]),_:1}),f("div",{class:"map",ref_key:"mapRef",ref:g},null,512),e(s,{label:"属性列表"}),e(d(Y),{ref_key:"tableRef",ref:E,data:m.value,onSelectionChange:V},{default:a(()=>[e(u,{type:"selection"}),e(u,{label:"序号",type:"index",width:"60",align:"center"}),e(u,{label:"属性名称",prop:"name",align:"center"}),e(u,{label:"属性类型",prop:"type",align:"center"})]),_:1},8,["data"])]),_:1})]),_:1})]),f("div",ne,[e(_,{onClick:h},{default:a(()=>[...o[2]||(o[2]=[r("提交",-1)])]),_:1}),e(_,{type:"info",onClick:d(b)},{default:a(()=>[...o[3]||(o[3]=[r("取消",-1)])]),_:1},8,["onClick"])])])}}}),me=$(se,[["__scopeId","data-v-db501c16"]]);export{me as default};
