import{B as I,a8 as F,am as P,a as B,I as d,X as c,C as n,O as m,P as r,_ as b,G as V,F as v,u as e,$ as q,a7 as z,H as i,W as E,V as y,U as _,D as L}from"./vue-DweYBrEc.js";import{e as N,x as W,ao as $,ap as j,ar as K,_ as O}from"./index-fNs72j9w.js";import{F as s}from"./index-BlEwok4a.js";import{b as p}from"./validate-CEOscgyN.js";import"./index-CgMrKa77.js";import"./index-DMA3A9_B.js";const A={class:"title"},G=I({__name:"popupForm",setup(H){const g=N(),u=F("formRef"),t=P("baTable"),{t:a}=W.useI18n(),h=B({name:[p({name:"required",title:a("security.dataRecycle.Rule name")})],controller:[p({name:"required",trigger:"change",message:a("Please select field",{field:a("security.dataRecycle.controller")})})],data_table:[p({name:"required",trigger:"change",message:a("Please select field",{field:a("security.dataRecycle.data sheet")})})],primary_key:[p({name:"required",trigger:"change",title:a("security.dataRecycle.Data table primary key")})]}),R=()=>{t.form.items.data_table&&K(t.form.items.data_table,t.form.items.connection).then(f=>{t.form.items.primary_key=f.data.pk,t.form.defaultItems.primary_key=f.data.pk})};return(f,o)=>{const C=d("el-form"),x=d("el-scrollbar"),k=d("el-button"),D=d("el-dialog"),U=c("drag"),T=c("zoom"),w=c("loading"),S=c("blur");return n(),m(D,{class:"ba-operate-dialog","close-on-click-modal":!1,"model-value":["Add","Edit"].includes(e(t).form.operate),onClose:e(t).toggleForm},{header:r(()=>[b((n(),L("div",A,[y(_(e(t).form.operate?e(a)(e(t).form.operate):""),1)])),[[U,[".ba-operate-dialog",".el-dialog__header"]],[T,".ba-operate-dialog"]])]),footer:r(()=>[V("div",{style:v("width: calc(100% - "+e(t).form.labelWidth/1.8+"px)")},[i(k,{onClick:o[7]||(o[7]=l=>e(t).toggleForm(""))},{default:r(()=>[y(_(e(a)("Cancel")),1)]),_:1}),b((n(),m(k,{loading:e(t).form.submitLoading,onClick:o[8]||(o[8]=l=>e(t).onSubmit(e(u))),type:"primary"},{default:r(()=>[y(_(e(t).form.operateIds&&e(t).form.operateIds.length>1?e(a)("Save and edit next item"):e(a)("Save")),1)]),_:1},8,["loading"])),[[S]])],4)]),default:r(()=>[b((n(),m(x,{class:"ba-table-form-scrollbar"},{default:r(()=>[V("div",{class:q(["ba-operate-form","ba-"+e(t).form.operate+"-form"]),style:v(e(g).layout.shrink?"":"width: calc(100% - "+e(t).form.labelWidth/2+"px)")},[e(t).form.loading?E("",!0):(n(),m(C,{key:0,ref_key:"formRef",ref:u,onKeyup:o[6]||(o[6]=z(l=>e(t).onSubmit(e(u)),["enter"])),model:e(t).form.items,"label-position":e(g).layout.shrink?"top":"right","label-width":e(t).form.labelWidth+"px",rules:h},{default:r(()=>[i(s,{label:e(a)("security.dataRecycle.Rule name"),type:"string",modelValue:e(t).form.items.name,"onUpdate:modelValue":o[0]||(o[0]=l=>e(t).form.items.name=l),prop:"name",placeholder:e(a)("security.dataRecycle.The rule name helps to identify deleted data later")},null,8,["label","modelValue","placeholder"]),i(s,{label:e(a)("security.dataRecycle.controller"),type:"select",modelValue:e(t).form.items.controller,"onUpdate:modelValue":o[1]||(o[1]=l=>e(t).form.items.controller=l),prop:"controller","input-attr":{content:e(t).form.extend.controllerList},placeholder:e(a)("security.dataRecycle.The data collection mechanism will monitor delete operations under this controller")},null,8,["label","modelValue","input-attr","placeholder"]),i(s,{label:e(a)("Database connection"),modelValue:e(t).form.items.connection,"onUpdate:modelValue":o[2]||(o[2]=l=>e(t).form.items.connection=l),type:"remoteSelect","block-help":e(a)("Database connection help"),"input-attr":{pk:"key",field:"key",remoteUrl:e($),valueOnClear:""}},null,8,["label","modelValue","block-help","input-attr"]),(n(),m(s,{label:e(a)("security.dataRecycle.Corresponding data sheet"),type:"remoteSelect",modelValue:e(t).form.items.data_table,"onUpdate:modelValue":o[3]||(o[3]=l=>e(t).form.items.data_table=l),key:e(t).form.items.connection,"input-attr":{pk:"table",field:"comment",params:{connection:e(t).form.items.connection,samePrefix:1,excludeTable:["area","token","captcha","admin_group_access","user_money_log","user_score_log"]},remoteUrl:e(j),onRow:R},prop:"data_table"},null,8,["label","modelValue","input-attr"])),i(s,{label:e(a)("security.dataRecycle.Data table primary key"),type:"string",modelValue:e(t).form.items.primary_key,"onUpdate:modelValue":o[4]||(o[4]=l=>e(t).form.items.primary_key=l),prop:"primary_key"},null,8,["label","modelValue"]),i(s,{label:e(a)("State"),type:"radio",modelValue:e(t).form.items.status,"onUpdate:modelValue":o[5]||(o[5]=l=>e(t).form.items.status=l),prop:"status","input-attr":{border:!0,content:{0:e(a)("Disable"),1:e(a)("Enable")}}},null,8,["label","modelValue","input-attr"])]),_:1},8,["model","label-position","label-width","rules"]))],6)]),_:1})),[[w,e(t).form.loading]])]),_:1},8,["model-value","onClose"])}}}),ee=O(G,[["__scopeId","data-v-603d646d"]]);export{ee as default};
