import{bU as e,l as t,K as l,t as a,M as s,d6 as r,b as i}from"./utils-lib.js?v=20260328163632";import{B as n}from"./naive-ui.js?v=20260328163632";import{r as p,O as o,c,u,k as m,V as d,_ as v,Y as y}from"./base-lib.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";const{pageOptions:b,tabDeployActive:f,rowData:h,refreshDeployList:x}=e(),g=p({label:t("英文名"),ruleKey:"name",rules:[l({message:t("请输入项目英文名")})],children:[{type:"input",key:"name",attrs:{placeholder:t("项目英文名")}},{type:"custom",render:()=>o("div",{class:"text-[#999] flex items-center ml-10px"},[t("格式: [0-9A-Za-z_-]+，不要带有空格和特殊字符")])}]}),_=p({label:t("中文名"),ruleKey:"title",rules:[l({message:t("请输入项目中文名")})],children:[{type:"input",key:"title",attrs:{placeholder:t("项目中文名")}},{type:"custom",render:()=>o("div",{class:"text-[#999] flex items-center ml-10px"},[t("用于显示到列表的名称")])}]}),j=p({label:t("PHP版本"),ruleKey:"php",rules:[l({message:t("请输入PHP版本")})],children:[{type:"input",key:"php",attrs:{placeholder:t("如：53,54,55,56,70,71,72")}},{type:"custom",render:()=>o("div",{class:"text-[#999] flex items-center ml-10px"},[t("多个请使用{0}(逗号)隔开，不要使用PHP5.2",['","'])])}]}),k=p({label:t("解禁的函数"),children:[{type:"input",key:"enable_functions",attrs:{placeholder:t("如：system,exec")}},{type:"custom",render:()=>o("div",{class:"text-[#999] flex items-center ml-10px"},[t("多个请使用{0}(逗号)隔开，只解禁必要函数",['","'])])}]}),z=p({label:t("项目版本"),ruleKey:"version",rules:[l({message:t("请输入项目版本")})],children:[{type:"input",key:"version",attrs:{placeholder:""}}]}),K=p({label:t("简介"),ruleKey:"ps",rules:[l({message:t("请输入简介")})],children:[{type:"input",key:"ps",attrs:{placeholder:""}}]}),w=()=>{const e=document.createElement("input");e.type="file",e.style.display="none",e.accept=".zip",e.id="update_zip",e.multiple=!0,e.addEventListener("change",(async()=>{const t=e.files||[];0!==t.length&&(A.value.blob=t[0])})),e.click()},O=c((()=>({label:t("上传项目包"),ruleKey:"blob",rules:[{validator:(e,l,a)=>"application/x-zip-compressed"===A.value.blob.type||new Error(t("只支持zip格式的文件！")),trigger:["blur","change"]}],children:[{type:"custom",render:()=>{let e;return o("div",{class:"flex flex-col"},[o("div",{class:"flex items-center mt-4px"},[o(n,{title:t("导入项目"),size:"tiny",class:"!mr-[.5rem]",onclick:w},(l=e=t("选择文件"),"function"==typeof l||"[object Object]"===Object.prototype.toString.call(l)&&!u(l)?e:{default:()=>[e]})),o("span",null,[A.value.blob.name])]),o("div",{class:"text-[#999] mt-5px"},[t("请上传zip格式的项目包,里面必需包含auto_insatll.json配置文件")])]);var l}}]}))),P=p({formAttrs:{labelWidth:"100px"},formItems:[g.value,_.value,j.value,k.value,z.value,K.value,O.value]}),[H,A,D]=a(P),E=async e=>{await D.value.validate();try{let l={headers:{"Content-Type":"multipart/form-data","x-http-token":window.vite_public_request_token}};const a=s.load(t("正在导入项目，请稍后...")),n=await r.post((i?"/api":"")+"/deployment/add_package",A.value,l);a.close(),n.data.status?(b.value.page=1,f.value=100,x(),e&&e(),s.success(n.data.msg)):s.error(n.data.msg)}catch(l){}},C=m({__name:"index",setup:(e,{expose:t})=>((()=>{if(Object.assign(A.value,{name:"",title:"",php:"",enable_functions:"",version:"",ps:"",blob:{}}),h.value){const{name:e,title:t,php:l,enable_functions:a,version:s,ps:r}=h.value;Object.assign(A.value,{name:e,title:t,php:l,enable_functions:a,version:s,ps:r})}})(),t({onConfirm:E}),(e,t)=>(d(),v(y(H),{class:"p-20px"})))});export{C as default};
