import{P as w,Q as U,D as N,C as Y,F as I}from"./element-plus.8e273e86.js";import{r as _}from"./index.2078eb25.js";import{P as T}from"./index.8afed1db.js";import{d as G,s as B,Z as P,b as h,o as c,c as A,U as t,L as s,u as l,a as n,R as E,S as C,K as L,Q as b}from"./@vue.76ce7aa3.js";function ue(){return _.get({url:"/setting/storage/lists"})}function Q(d){return _.post({url:"/setting/storage/setup",params:d})}function Z(d){return _.get({url:"/setting/storage/detail",params:d})}const j={class:"edit-popup"},z={class:"form-tips"},H={key:0},J={class:"flex-1"},M={class:"flex-1"},te=G({__name:"edit",emits:["success"],setup(d,{expose:S,emit:y}){const D=y,p=B(),m=B(),u=P({engine:"",bucket:"",access_key:"",secret_key:"",domain:"",region:"",status:0}),k=[{name:"\u672C\u5730\u5B58\u50A8",type:"local",tips:"\u672C\u5730\u5B58\u50A8\u65B9\u5F0F\u4E0D\u9700\u8981\u914D\u7F6E\u5176\u4ED6\u53C2\u6570"},{name:"\u4E03\u725B\u4E91\u5B58\u50A8",type:"qiniu",tips:"\u5207\u6362\u4E03\u725B\u4E91\u5B58\u50A8\u540E\uFF0C\u7D20\u6750\u5E93\u9700\u8981\u91CD\u65B0\u4E0A\u4F20\u81F3\u4E03\u725B\u4E91"},{name:"\u963F\u91CC\u4E91OSS",type:"aliyun",tips:"\u5207\u6362\u963F\u91CC\u4E91OSS\u540E\uFF0C\u7D20\u6750\u5E93\u9700\u8981\u91CD\u65B0\u4E0A\u4F20\u81F3\u963F\u91CC\u4E91OSS"},{name:"\u817E\u8BAF\u4E91OSS",type:"qcloud",tips:"\u5207\u6362\u817E\u8BAF\u4E91OSS\u540E\uFF0C\u7D20\u6750\u5E93\u9700\u8981\u91CD\u65B0\u4E0A\u4F20\u81F3\u817E\u8BAF\u4E91OSS"}],V={bucket:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B58\u50A8\u7A7A\u95F4\u540D\u79F0",trigger:"blur"}],access_key:[{required:!0,message:"\u8BF7\u8F93\u5165ACCESS_KEY",trigger:"blur"}],secret_key:[{required:!0,message:"\u8BF7\u8F93\u5165SECRET_KEY",trigger:"blur"}],domain:[{required:!0,message:"\u8BF7\u8F93\u5165\u7A7A\u95F4\u57DF\u540D",trigger:"blur"}],region:[{required:!0,message:"\u8BF7\u8F93\u5165REGION",trigger:"blur"}]},f=h(()=>k.find(a=>a.type==u.engine)),v=async()=>{var a,e;await((a=p.value)==null?void 0:a.validate()),await Q(u),(e=m.value)==null||e.close(),D("success")},R=async()=>{const a=await Z({engine:u.engine});for(const e in a)u[e]=a[e]},q=a=>{var e;u.engine=a,(e=m.value)==null||e.open(),R()},x=()=>{var a;(a=p.value)==null||a.resetFields()};return S({open:q}),(a,e)=>{const F=w,r=N,i=Y,K=U,O=I;return c(),A("div",j,[t(T,{ref_key:"popupRef",ref:m,title:"\u8BBE\u7F6E\u5B58\u50A8",async:!0,width:"550px",onConfirm:v,onClose:x},{default:s(()=>[t(O,{ref_key:"formRef",ref:p,model:l(u),"label-width":"120px",rules:V},{default:s(()=>[t(r,{label:"\u5B58\u50A8\u65B9\u5F0F",prop:"engine"},{default:s(()=>{var o;return[n("div",null,[t(F,{"model-value":""},{default:s(()=>{var g;return[E(C((g=l(f))==null?void 0:g.name),1)]}),_:1}),n("div",z,C((o=l(f))==null?void 0:o.tips),1)])]}),_:1}),l(u).engine!=="local"?(c(),A("div",H,[t(r,{label:" \u5B58\u50A8\u7A7A\u95F4\u540D\u79F0",prop:"bucket"},{default:s(()=>[n("div",J,[t(i,{modelValue:l(u).bucket,"onUpdate:modelValue":e[0]||(e[0]=o=>l(u).bucket=o),placeholder:"\u8BF7\u8F93\u5165\u5B58\u50A8\u7A7A\u95F4\u540D\u79F0(Bucket)",clearable:""},null,8,["modelValue"])])]),_:1}),t(r,{label:"ACCESS_KEY",prop:"access_key"},{default:s(()=>[t(i,{modelValue:l(u).access_key,"onUpdate:modelValue":e[1]||(e[1]=o=>l(u).access_key=o),placeholder:"\u8BF7\u8F93\u5165ACCESS_KEY(AK)",clearable:""},null,8,["modelValue"])]),_:1}),t(r,{label:"SECRET_KEY",prop:"secret_key"},{default:s(()=>[t(i,{modelValue:l(u).secret_key,"onUpdate:modelValue":e[2]||(e[2]=o=>l(u).secret_key=o),placeholder:"\u8BF7\u8F93\u5165SECRET_KEY(SK)",clearable:""},null,8,["modelValue"])]),_:1}),t(r,{label:"\u7A7A\u95F4\u57DF\u540D",prop:"domain"},{default:s(()=>[n("div",M,[n("div",null,[t(i,{modelValue:l(u).domain,"onUpdate:modelValue":e[3]||(e[3]=o=>l(u).domain=o),placeholder:"\u8BF7\u8F93\u5165\u7A7A\u95F4\u57DF\u540D(Domain)",clearable:""},null,8,["modelValue"])]),e[6]||(e[6]=n("div",{class:"form-tips"}," \u8BF7\u8865\u5168http://\u6216https://\uFF0C\u4F8B\u5982https://static.cloud.com ",-1))])]),_:1}),l(u).engine=="qcloud"?(c(),L(r,{key:0,label:"REGION",prop:"region"},{default:s(()=>[t(i,{modelValue:l(u).region,"onUpdate:modelValue":e[4]||(e[4]=o=>l(u).region=o),placeholder:"\u8BF7\u8F93\u5165region",clearable:""},null,8,["modelValue"])]),_:1})):b("",!0)])):b("",!0),t(r,{label:"\u72B6\u6001",prop:"status"},{default:s(()=>[t(K,{modelValue:l(u).status,"onUpdate:modelValue":e[5]||(e[5]=o=>l(u).status=o)},{default:s(()=>[t(F,{label:0},{default:s(()=>e[7]||(e[7]=[E("\u5173\u95ED")])),_:1}),t(F,{label:1},{default:s(()=>e[8]||(e[8]=[E("\u5F00\u542F")])),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},512)])}}});export{te as _,ue as s};
