import{_ as L}from"./index-DIKmrNCq.js?v=1773287522785";import{_ as k}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{ei as B,n as C,hu as M,i as R,p as V,m as j}from"./index-BTglIPU2.js?v=1773287522785";import{u as O}from"./useLoading-CZ2gSAW7.js?v=1773287522785";import{u as q}from"./index-CNMkGSax.js?v=1773287522785";import{_ as D}from"./index.vue_vue_type_script_setup_true_lang-zxYX_mVh.js?v=1773287522785";import{k as N,R as A,e as I,r as T,$ as U,Z,a0 as m,a9 as f,_ as u,S as c,aa as g}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{a1 as z,a6 as F}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";const G={class:"p-20px"},J={class:"w-200px"},ae=N({__name:"php",props:{rows:{},showStatic:{type:Boolean,default:!0},refresh:{}},setup(P,{expose:h}){const{t:o}=A(),S=P,{rows:_,showStatic:w,refresh:p}=S,x=q(),n=I({version:null}),b={version:{trigger:"change",validator:()=>n.version===null?new Error(o("Site.PHP.add_site_27")):!0}},d=T([]),{loading:H,setLoading:v}=O();(async()=>{try{v(!0);const{message:e}=await B();if(C(e)&&e.length>0){const t=w?e:e.filter(s=>s.version!=="00");d.value=t.map(s=>({label:s.name,value:s.version})),n.version=t[0].version}else n.version=null,d.value=[]}finally{v(!1)}})();const y=e=>{const{success:t,error:s}=e,r=[];t.forEach(l=>{const i=_.find(a=>a.name===l);i&&r.push({name:i.name,batchStatus:"success",reqMsg:o("Site.PHP.index_64")})}),Object.entries(s).forEach(([l,i])=>{const a=_.find(E=>E.name===l);a&&r.push({name:a.name,batchStatus:"error",reqMsg:i})}),V({title:o("Site.PHP.index_65"),width:440,footer:!0,component:D,data:{title:o("Site.PHP.index_66"),data:r,status:"done",columns:[{key:"name",title:o("Site.TableRow.index_1"),ellipsis:{tooltip:{width:"trigger"}}}]}})},$=()=>{const{version:e}=n;if(e===null)throw j.error(o("Site.PHP.index_67")),new Error(o("Site.PHP.index_67"));return{version:e,sites_id:_.map(t=>t.id).join(",")}};return h({onConfirm:async({hide:e})=>{const{message:t}=await M($());x.setRefresh(!0),p==null||p(),R(t)&&y(t),e()}}),(e,t)=>{const s=F,r=z,l=k,i=L;return U(),Z("div",G,[m(l,{model:c(n),rules:b},{default:f(()=>[m(r,{label:e.$t("Site.PHP.add_site_21"),path:"version"},{default:f(()=>[u("div",J,[m(s,{value:c(n).version,"onUpdate:value":t[0]||(t[0]=a=>c(n).version=a),loading:c(H),options:c(d)},null,8,["value","loading","options"])])]),_:1},8,["label"])]),_:1},8,["model"]),m(i,{class:"mt-8px"},{default:f(()=>[u("li",null,g(e.$t("Site.PHP.index_61")),1),u("li",null,g(e.$t("Site.PHP.index_62")),1),u("li",null,g(e.$t("Site.PHP.index_63")),1)]),_:1})])}}});export{ae as default};
