import{h as q,y as N,r as U,p as n,M as m,N as r,a6 as y,l as z,W as b,V as _,k as e,o as V,q as s,m as k,a0 as B,a4 as P,a2 as W,an as L,t as d,a7 as p}from"./vue-a39e6937.js";import{f as $,an as E,_ as K}from"./index-ba596ae9.js";import{F as i}from"./index-f0d8af94.js";import{b as c}from"./validate-4ecec794.js";import"./index-434d719f.js";import"./controllerUrls-941681c3.js";import"./index-7e56a0fa.js";const j={class:"title"},M=q({__name:"popupForm",props:{formData:{default:()=>({})}},setup(h){const g=h,u=N(),a=L("baTable"),{t}=$(),R=U({name:[c({name:"required",title:t("security.dataRecycle.Rule name")})],controller:[c({name:"required",trigger:"change",message:t("Please select field",{field:t("security.dataRecycle.controller")})})],data_table:[c({name:"required",trigger:"change",message:t("Please select field",{field:t("security.dataRecycle.data sheet")})})],primary_key:[c({name:"required",trigger:"change",title:t("security.dataRecycle.Data table primary key")})]}),C=f=>{f&&E(f).then(l=>{a.form.items.primary_key=l.data.pk,a.form.defaultItems.primary_key=l.data.pk})};return(f,l)=>{const x=d("el-form"),D=d("el-scrollbar"),v=d("el-button"),w=d("el-dialog"),F=p("drag"),T=p("zoom"),I=p("loading"),S=p("blur");return n(),m(w,{class:"ba-operate-dialog","close-on-click-modal":!1,"model-value":!!e(a).form.operate,onClose:e(a).toggleForm},{header:r(()=>[y((n(),z("div",j,[b(_(e(a).form.operate?e(t)(e(a).form.operate):""),1)])),[[F,[".ba-operate-dialog",".el-dialog__header"]],[T,".ba-operate-dialog"]])]),footer:r(()=>[V("div",{style:k("width: calc(100% - "+e(a).form.labelWidth/1.8+"px)")},[s(v,{onClick:l[6]||(l[6]=o=>e(a).toggleForm(""))},{default:r(()=>[b(_(e(t)("Cancel")),1)]),_:1}),y((n(),m(v,{loading:e(a).form.submitLoading,onClick:l[7]||(l[7]=o=>e(a).onSubmit(u.value)),type:"primary"},{default:r(()=>[b(_(e(a).form.operateIds&&e(a).form.operateIds.length>1?e(t)("Save and edit next item"):e(t)("Save")),1)]),_:1},8,["loading"])),[[S]])],4)]),default:r(()=>[y((n(),m(D,{class:"ba-table-form-scrollbar"},{default:r(()=>[V("div",{class:W(["ba-operate-form","ba-"+e(a).form.operate+"-form"]),style:k("width: calc(100% - "+e(a).form.labelWidth/2+"px)")},[e(a).form.loading?P("",!0):(n(),m(x,{key:0,ref_key:"formRef",ref:u,onKeyup:l[5]||(l[5]=B(o=>e(a).onSubmit(u.value),["enter"])),model:e(a).form.items,"label-position":"right","label-width":e(a).form.labelWidth+"px",rules:R},{default:r(()=>[s(i,{label:e(t)("security.dataRecycle.Rule name"),type:"string",modelValue:e(a).form.items.name,"onUpdate:modelValue":l[0]||(l[0]=o=>e(a).form.items.name=o),prop:"name",placeholder:e(t)("security.dataRecycle.The rule name helps to identify deleted data later")},null,8,["label","modelValue","placeholder"]),s(i,{label:e(t)("security.dataRecycle.controller"),type:"select",modelValue:e(a).form.items.controller,"onUpdate:modelValue":l[1]||(l[1]=o=>e(a).form.items.controller=o),prop:"controller",data:{content:g.formData.controllerList},placeholder:e(t)("security.dataRecycle.The data collection mechanism will monitor delete operations under this controller")},null,8,["label","modelValue","data","placeholder"]),s(i,{label:e(t)("security.dataRecycle.Corresponding data sheet"),type:"select",modelValue:e(a).form.items.data_table,"onUpdate:modelValue":l[2]||(l[2]=o=>e(a).form.items.data_table=o),prop:"data_table",data:{content:g.formData.tableList},"input-attr":{onChange:C}},null,8,["label","modelValue","data","input-attr"]),s(i,{label:e(t)("security.dataRecycle.Data table primary key"),type:"string",modelValue:e(a).form.items.primary_key,"onUpdate:modelValue":l[3]||(l[3]=o=>e(a).form.items.primary_key=o),prop:"primary_key"},null,8,["label","modelValue"]),s(i,{label:e(t)("state"),type:"radio",modelValue:e(a).form.items.status,"onUpdate:modelValue":l[4]||(l[4]=o=>e(a).form.items.status=o),prop:"status",data:{content:{0:e(t)("Disable"),1:e(t)("Enable")}}},null,8,["label","modelValue","data"])]),_:1},8,["model","label-width","rules"]))],6)]),_:1})),[[I,e(a).form.loading]])]),_:1},8,["model-value","onClose"])}}});const Y=K(M,[["__scopeId","data-v-7fffae6e"]]);export{Y as default};
