import{d as A,Q as B,r as d,x as E,o as P,A as U,B as o,f as i,a,E as V,k as K,a2 as j,a8 as Q,V as R,W,K as Z,Z as z,__tla as G}from"./index-92ad187a.js";import{_ as H,__tla as I}from"./Dialog-44c9fa34.js";import{_ as J,__tla as L}from"./UploadImgs-63184382.js";import{a as M,c as N,b as O,__tla as T}from"./page-089c30f7.js";import{u as X,__tla as Y}from"./useMessage-d9788660.js";let h,$=Promise.all([(()=>{try{return G}catch{}})(),(()=>{try{return I}catch{}})(),(()=>{try{return L}catch{}})(),(()=>{try{return T}catch{}})(),(()=>{try{return Y}catch{}})()]).then(async()=>{h=A({name:"DiyPageForm",__name:"DiyPageForm",emits:["success"],setup(ee,{expose:k,emit:b}){const{t:_}=B(),v=X(),m=d(!1),f=d(""),c=d(!1),y=d(""),l=d({id:void 0,name:void 0,remark:void 0,previewPicUrls:[]}),g=E({name:[{required:!0,message:"\u9875\u9762\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),n=d();k({open:async(s,e)=>{var t;if(m.value=!0,f.value=_("action."+s),y.value=s,C(),e){c.value=!0;try{const r=await M(e);((t=r==null?void 0:r.previewPicUrls)==null?void 0:t.length)>0&&(r.previewPicUrls=r.previewPicUrls.map(p=>({url:p}))),l.value=r}finally{c.value=!1}}}});const x=b,F=async()=>{if(n&&await n.value.validate()){c.value=!0;try{const s=l.value.previewPicUrls.map(t=>t.url?t.url:t),e={...l.value,previewPicUrls:s};y.value==="create"?(await N(e),v.success(_("common.createSuccess"))):(await O(e),v.success(_("common.updateSuccess"))),m.value=!1,x("success")}finally{c.value=!1}}},C=()=>{var s;l.value={id:void 0,name:void 0,remark:void 0,previewPicUrls:[]},(s=n.value)==null||s.resetFields()};return(s,e)=>{const t=Q,r=R,p=J,D=W,w=Z,S=H,q=z;return P(),U(S,{title:a(f),modelValue:a(m),"onUpdate:modelValue":e[4]||(e[4]=u=>j(m)?m.value=u:null)},{footer:o(()=>[i(w,{onClick:F,type:"primary",disabled:a(c)},{default:o(()=>[V("\u786E \u5B9A")]),_:1},8,["disabled"]),i(w,{onClick:e[3]||(e[3]=u=>m.value=!1)},{default:o(()=>[V("\u53D6 \u6D88")]),_:1})]),default:o(()=>[K((P(),U(D,{ref_key:"formRef",ref:n,model:a(l),rules:a(g),"label-width":"100px"},{default:o(()=>[i(r,{label:"\u9875\u9762\u540D\u79F0",prop:"name"},{default:o(()=>[i(t,{modelValue:a(l).name,"onUpdate:modelValue":e[0]||(e[0]=u=>a(l).name=u),placeholder:"\u8BF7\u8F93\u5165\u9875\u9762\u540D\u79F0"},null,8,["modelValue"])]),_:1}),i(r,{label:"\u5907\u6CE8",prop:"remark"},{default:o(()=>[i(t,{modelValue:a(l).remark,"onUpdate:modelValue":e[1]||(e[1]=u=>a(l).remark=u),placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8"},null,8,["modelValue"])]),_:1}),i(r,{label:"\u9884\u89C8\u56FE",prop:"previewPicUrls"},{default:o(()=>[i(p,{modelValue:a(l).previewPicUrls,"onUpdate:modelValue":e[2]||(e[2]=u=>a(l).previewPicUrls=u)},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[q,a(c)]])]),_:1},8,["title","modelValue"])}}})});export{h as _,$ as __tla};
