import{P as a,j as e,b as l}from"./utils-lib.js?v=1761009159";import{c as s,s as t,r as i,q as o,v as n,x as u,z as r,C as m,e as d,B as c,F as p,b0 as v,y as f,N as x,Q as y,A as _,ak as b,al as j,b1 as w,G as g}from"./base-lib.js?v=1761009159";import{B as h}from"./index115.js?v=1761009159";import{h as V,i as k,o as C}from"./validator.js?v=1761009159";import{S as D}from"./useStore4.js?v=1761009159";import{getRewriteLists as P,batchPhpRewrite as S}from"./site.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./ace.js?v=1761009159";import"./index106.js?v=1761009159";import"./column.js?v=1761009159";const U={class:"p-2rem"},H={class:"flex items-center"},N={class:"relative h-full"},q={class:"p-20px"},B={class:"overflow-auto h-[12rem] border border-lighter p-12px"},F={class:"absolute bottom-0 w-full bg-light flex items-center justify-end p-12px"},J=s({__name:"index",props:{compData:{default:()=>{}}},emits:["close"],setup(s,{expose:J,emit:O}){const{batchConfig:z}=t(D()),{getFileEvent:A}=D(),E=l(),G=s,Q=O,I=i(""),K=i(!1),L=i([]),M=i([]),R=i(),T=i(),W=async a=>{await Y(a),T.value=""},X=async a=>{await Y(a),R.value=""},Y=async a=>{try{const{data:e}=await A({path:a});I.value=e.data}catch(e){}},Z=async()=>{const e=JSON.stringify(G.compData.map(a=>{const e=L.value.find(e=>e.id===a.id);return{id:a.id,name:a.name,file:e.file}})),{exclude:l,enable:s}=z.value,t=V(!1,l,s,{params:{site_list:e,project_type:"PHP",rewrite_data:I.value}});a({loading:"正在部署，请稍后...",request:S(t),success:a=>{const{data:e}=k(a.data);C(e,{title:"部署伪静态"}),K.value=!1,Q("close")}})};return J({onConfirm:()=>{R.value||T.value?K.value=!0:E.error("请选择一种伪静态规则")}}),o(async()=>{await(async()=>{try{const a=await P({site_ids:JSON.stringify(G.compData.map(a=>a.id)),site_type:"PHP"});L.value=a.data.site_rewrites,M.value=a.data.template_rewrites}catch(a){}})()}),(a,l)=>{const s=b,t=j,i=w,o=h,V=g,k=e;return n(),u("div",U,[r("div",H,[l[5]||(l[5]=m(" 站点已有伪静态规则： ",-1)),d(t,{class:"mx-12px !w-16rem",modelValue:f(R),"onUpdate:modelValue":l[0]||(l[0]=a=>y(R)?R.value=a:null),onChange:W},{default:c(()=>[(n(!0),u(p,null,v(f(L),a=>(n(),x(s,{key:a.id,label:a.name+"站点的伪静态配置",value:a.file},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),l[6]||(l[6]=m(" 模板伪静态规则： ",-1)),d(t,{class:"mx-12px !w-16rem",modelValue:f(T),"onUpdate:modelValue":l[1]||(l[1]=a=>y(T)?T.value=a:null),onChange:X},{default:c(()=>[(n(!0),u(p,null,v(f(M),a=>(n(),x(s,{key:a.id,label:a.name+"模板的伪静态配置",value:a.file},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),d(i),d(o,{modelValue:f(I),"onUpdate:modelValue":l[2]||(l[2]=a=>y(I)?I.value=a:null),class:"!h-[42rem]"},null,8,["modelValue"]),d(k,{title:"部署当前伪静态",modelValue:f(K),"onUpdate:modelValue":l[4]||(l[4]=a=>y(K)?K.value=a:null),area:[52,28]},{default:c(()=>[r("div",N,[r("div",q,[l[7]||(l[7]=r("span",{class:"!mb-4px inline-block"},"如下是需要批量部署伪静态的站点：",-1)),r("div",B,[(n(!0),u(p,null,v(a.compData,(a,e)=>(n(),u("div",{key:e,class:"p-4px w-full"},_(a.name),1))),128))]),l[8]||(l[8]=r("div",{class:"text-danger mt-4px"},"注意：批量设置站点伪静态后，原有站点伪静态配置将被覆盖。",-1))]),r("div",F,[d(V,{type:"warning",onClick:l[3]||(l[3]=a=>K.value=!1)},{default:c(()=>l[9]||(l[9]=[m("取消",-1)])),_:1,__:[9]}),d(V,{type:"primary",onClick:Z},{default:c(()=>[m("部署("+_(a.compData.length)+"项)",1)]),_:1})])])]),_:1},8,["modelValue"])])}}});export{J as default};
