import{u as R}from"./useInstance.233fbdde.js";import{az as r,d as w,s as x,r as g,b as L,p as S,c as n,e as F,k as U,i as d,h as o,u,f as T,j as N,F as O,a2 as P,m as B,E as b}from"./index.0308b213.js";const H=l=>r.request({url:"adminapi/setting.sqlRecord.sql_record/list",params:l}),J=l=>r.request({url:"adminapi/setting.sqlRecord.sql_record/delete",method:"POST",data:l}),Q=l=>r.request({url:"adminapi/setting.sqlRecord.sql_record/detail",params:l}),j=l=>r.request({url:"adminapi/setting.sqlRecord.sql_record/edit",method:"POST",data:l}),z=l=>r.request({url:"adminapi/setting.sqlRecord.sql_record/add",method:"POST",data:l}),K=l=>r.request({url:"adminapi/setting.sqlRecord.sql_record/download",params:l}),I=B("\u63D0\u4EA4"),M=B("\u53D6\u6D88"),W=w({props:{modelValue:{type:Boolean,default:!1},id:null},emits:["update:modelValue","onClose"],setup(l,{emit:f}){const i=l,{global:y}=R();let C=x(()=>Number(i.id)>0);const c=g(!1),q=g(),e=L({id:"",title:"",description:"",type:"",sql:""}),E=[{label:"create",value:"\u521B\u5EFA"},{label:"alter",value:"\u4FEE\u6539"},{label:"drop",value:"\u5220\u9664"}],v=()=>{e.id>0?j(e).then(a=>{b({message:"\u7F16\u8F91\u6210\u529F",type:"success"}),m()}):z(e).then(a=>{b({message:"\u65B0\u589E\u6210\u529F",type:"success"}),m()})};S(()=>i.modelValue,a=>{c.value=a,a&&i.id&&(e.id=i.id,D())});const D=()=>{Q({id:i.id}).then(a=>{a=a.data,e.title=a.title,e.description=a.description,e.type=a.type,e.sql=a.sql})},m=()=>{f("update:modelValue",!1),f("onClose"),y.$resetForm(q.value,e)};return(a,s)=>{const _=n("el-input"),p=n("el-form-item"),h=n("el-option"),k=n("el-select"),V=n("el-button"),A=n("el-dialog");return F(),U(A,{modelValue:c.value,"onUpdate:modelValue":s[4]||(s[4]=t=>c.value=t),title:u(C)?"\u67E5\u770B\u53D8\u66F4\u8BB0\u5F55":"\u65B0\u589E\u53D8\u66F4\u8BB0\u5F55",width:"70%","destroy-on-close":"",onClose:m},{default:d(()=>[o(u(P),{ref_key:"formRef",ref:q,model:u(e),"inline-message":!0,"label-width":"160px"},{default:d(()=>[o(p,{label:"\u6807\u9898"},{default:d(()=>[o(_,{modelValue:u(e).title,"onUpdate:modelValue":s[0]||(s[0]=t=>u(e).title=t),placeholder:"\u6807\u9898"},null,8,["modelValue"])]),_:1}),o(p,{label:"\u63CF\u8FF0"},{default:d(()=>[o(_,{modelValue:u(e).description,"onUpdate:modelValue":s[1]||(s[1]=t=>u(e).description=t),placeholder:"\u63CF\u8FF0"},null,8,["modelValue"])]),_:1}),o(p,{label:"\u7C7B\u578B"},{default:d(()=>[o(k,{modelValue:u(e).type,"onUpdate:modelValue":s[2]||(s[2]=t=>u(e).type=t),placeholder:"\u7C7B\u578B"},{default:d(()=>[(F(),T(O,null,N(E,t=>o(h,{key:t.label,label:t.value,value:t.label},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1}),o(p,{label:"SQL"},{default:d(()=>[o(_,{modelValue:u(e).sql,"onUpdate:modelValue":s[3]||(s[3]=t=>u(e).sql=t),type:"textarea",rows:10,placeholder:"SQL"},null,8,["modelValue"])]),_:1}),o(p,null,{default:d(()=>[o(V,{type:"primary",onClick:v},{default:d(()=>[I]),_:1}),o(V,{onClick:m},{default:d(()=>[M]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{W as _,J as a,K as d,H as g};
