DataSourceConfigForm-3ca09ad5.js 3.1 KB

1
  1. import{d as z,i as B,r as m,f as G,o as y,x as V,w as t,g as s,a,n as w,y as I,P,W as j,B as J,G as R,D as W,J as A,_ as E,__tla as H}from"./index-3fb48822.js";import{_ as K,__tla as L}from"./Dialog-7d4425a0.js";import{a as M,c as N,u as O,__tla as Q}from"./index-fe77b5db.js";import{u as T,__tla as X}from"./useMessage-b6c78c26.js";let b,Y=Promise.all([(()=>{try{return H}catch{}})(),(()=>{try{return L}catch{}})(),(()=>{try{return Q}catch{}})(),(()=>{try{return X}catch{}})()]).then(async()=>{b=E(z({name:"InfraDataSourceConfigForm",__name:"DataSourceConfigForm",emits:["success"],setup(Z,{expose:h,emit:x}){const{t:_}=B(),p=T(),o=m(!1),f=m(""),d=m(!1),v=m(""),l=m({id:void 0,name:"",url:"",username:"",password:""}),C=G({name:[{required:!0,message:"\u6570\u636E\u6E90\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],url:[{required:!0,message:"\u6570\u636E\u6E90\u8FDE\u63A5\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],username:[{required:!0,message:"\u7528\u6237\u540D\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],password:[{required:!0,message:"\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),n=m();h({open:async(u,e)=>{if(o.value=!0,f.value=_("action."+u),v.value=u,U(),e){d.value=!0;try{l.value=await M(e)}finally{d.value=!1}}}});const S=x,D=async()=>{if(n&&await n.value.validate()){d.value=!0;try{const u=l.value;v.value==="create"?(await N(u),p.success(_("common.createSuccess"))):(await O(u),p.success(_("common.updateSuccess"))),o.value=!1,S("success")}finally{d.value=!1}}},U=()=>{var u;l.value={id:void 0,name:"",url:"",username:"",password:""},(u=n.value)==null||u.resetFields()};return(u,e)=>{const i=j,c=J,q=R,g=W,F=K,k=A;return y(),V(F,{modelValue:a(o),"onUpdate:modelValue":e[5]||(e[5]=r=>P(o)?o.value=r:null),title:a(f)},{footer:t(()=>[s(g,{disabled:a(d),type:"primary",onClick:D},{default:t(()=>[w("\u786E \u5B9A")]),_:1},8,["disabled"]),s(g,{onClick:e[4]||(e[4]=r=>o.value=!1)},{default:t(()=>[w("\u53D6 \u6D88")]),_:1})]),default:t(()=>[I((y(),V(q,{ref_key:"formRef",ref:n,model:a(l),rules:a(C),"label-width":"100px"},{default:t(()=>[s(c,{label:"\u6570\u636E\u6E90\u540D\u79F0",prop:"name"},{default:t(()=>[s(i,{modelValue:a(l).name,"onUpdate:modelValue":e[0]||(e[0]=r=>a(l).name=r),placeholder:"\u8BF7\u8F93\u5165\u53C2\u6570\u540D\u79F0"},null,8,["modelValue"])]),_:1}),s(c,{label:"\u6570\u636E\u6E90\u8FDE\u63A5",prop:"url"},{default:t(()=>[s(i,{modelValue:a(l).url,"onUpdate:modelValue":e[1]||(e[1]=r=>a(l).url=r),placeholder:"\u8BF7\u8F93\u5165\u6570\u636E\u6E90\u8FDE\u63A5"},null,8,["modelValue"])]),_:1}),s(c,{label:"\u7528\u6237\u540D",prop:"username"},{default:t(()=>[s(i,{modelValue:a(l).username,"onUpdate:modelValue":e[2]||(e[2]=r=>a(l).username=r),placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D"},null,8,["modelValue"])]),_:1}),s(c,{label:"\u5BC6\u7801",prop:"password"},{default:t(()=>[s(i,{modelValue:a(l).password,"onUpdate:modelValue":e[3]||(e[3]=r=>a(l).password=r),placeholder:"\u8BF7\u8F93\u5165\u5BC6\u7801"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[k,a(d)]])]),_:1},8,["modelValue","title"])}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/views/infra/dataSourceConfig/DataSourceConfigForm.vue"]])});export{Y as __tla,b as default};