import{d as R,a as E,az as W,a2 as $,r as C,K as g,aq as _,e as s,y as u,L as n,u as e,t as D,m as F,f as S,am as v,n as w,j as p,i as h,G as j,ac as A,F as G,B as H,C as J,p as M,l as O}from"./vue-A59npLRR.js";import{F as d}from"./index-r6iTpmP6.js";import{b}from"./validate-_EUdkMt3.js";import{v as Q,_ as X}from"./index-EwE51S_X.js";import"./index-K8IR974I.js";import"./baTable-MdxYOkAk.js";import"./index-XALue448.js";import"./echarts-cxb9vJr1.js";const I=y=>(M("data-v-e31eae01"),y=y(),O(),y),Y={class:"title"},Z=I(()=>h("hr",{class:"form-hr"},null,-1)),ee=I(()=>h("hr",{class:"form-hr"},null,-1)),te=R({__name:"popupForm",setup(y,{expose:U}){const k=Q(),V=E(),t=W("baTable"),{t:a}=$(),i=C({dataFields:[]}),q=C({name:[b({name:"required",title:a("security.sensitiveData.Rule name")})],controller:[b({name:"required",trigger:"change",message:a("Please select field",{field:a("security.sensitiveData.controller")})})],data_table:[b({name:"required",trigger:"change",message:a("Please select field",{field:a("security.sensitiveData.data sheet")})})],primary_key:[b({name:"required",trigger:"change",title:a("security.sensitiveData.Data table primary key")})],data_fields:[b({name:"required",message:a("Please select field",{field:a("security.sensitiveData.Sensitive fields")})})]}),L=r=>{let l=[];for(const m in r){let f=!1;for(const c in i.dataFields)i.dataFields[c].name==r[m]&&(f=i.dataFields[c]);l[m]=f||{name:r[m],value:t.form.extend.fieldList[r[m]]??""}}i.dataFields=l};return U({getDataFields:()=>i.dataFields,setDataFields:r=>{i.dataFields=r}}),(r,l)=>{const m=g("el-form"),f=g("el-scrollbar"),c=g("el-button"),T=g("el-dialog"),z=_("drag"),B=_("zoom"),x=_("loading"),K=_("blur");return s(),u(T,{class:"ba-operate-dialog","close-on-click-modal":!1,"model-value":["Add","Edit"].includes(e(t).form.operate),onClose:e(t).toggleForm},{header:n(()=>[v((s(),S("div",Y,[F(D(e(t).form.operate?e(a)(e(t).form.operate):""),1)])),[[z,[".ba-operate-dialog",".el-dialog__header"]],[B,".ba-operate-dialog"]])]),footer:n(()=>[h("div",{style:w("width: calc(100% - "+e(t).form.labelWidth/1.8+"px)")},[p(c,{onClick:l[7]||(l[7]=o=>e(t).toggleForm(""))},{default:n(()=>[F(D(e(a)("Cancel")),1)]),_:1}),v((s(),u(c,{loading:e(t).form.submitLoading,onClick:l[8]||(l[8]=o=>e(t).onSubmit(V.value)),type:"primary"},{default:n(()=>[F(D(e(t).form.operateIds&&e(t).form.operateIds.length>1?e(a)("Save and edit next item"):e(a)("Save")),1)]),_:1},8,["loading"])),[[K]])],4)]),default:n(()=>[v((s(),u(f,{class:"ba-table-form-scrollbar"},{default:n(()=>[h("div",{class:j(["ba-operate-form","ba-"+e(t).form.operate+"-form"]),style:w(e(k).layout.shrink?"":"width: calc(100% - "+e(t).form.labelWidth/2+"px)")},[e(t).form.loading?J("",!0):(s(),u(m,{key:0,ref_key:"formRef",ref:V,onKeyup:l[6]||(l[6]=A(o=>e(t).onSubmit(V.value),["enter"])),model:e(t).form.items,"label-position":e(k).layout.shrink?"top":"right","label-width":e(t).form.labelWidth+"px",rules:q},{default:n(()=>[p(d,{label:e(a)("security.sensitiveData.Rule name"),type:"string",modelValue:e(t).form.items.name,"onUpdate:modelValue":l[0]||(l[0]=o=>e(t).form.items.name=o),prop:"name",placeholder:e(a)("security.sensitiveData.The rule name helps to identify the modified data later")},null,8,["label","modelValue","placeholder"]),p(d,{label:e(a)("security.sensitiveData.controller"),type:"select",modelValue:e(t).form.items.controller,"onUpdate:modelValue":l[1]||(l[1]=o=>e(t).form.items.controller=o),prop:"controller",data:{content:e(t).form.extend.controllerList},placeholder:e(a)("security.sensitiveData.The data listening mechanism will monitor the modification operations under this controller")},null,8,["label","modelValue","data","placeholder"]),p(d,{label:e(a)("security.sensitiveData.Corresponding data sheet"),type:"select",modelValue:e(t).form.items.data_table,"onUpdate:modelValue":l[2]||(l[2]=o=>e(t).form.items.data_table=o),prop:"data_table",data:{content:e(t).form.extend.tableList},"input-attr":{onChange:e(t).onTableChange}},null,8,["label","modelValue","data","input-attr"]),p(d,{label:e(a)("security.sensitiveData.Data table primary key"),type:"string",modelValue:e(t).form.items.primary_key,"onUpdate:modelValue":l[3]||(l[3]=o=>e(t).form.items.primary_key=o),prop:"primary_key"},null,8,["label","modelValue"]),Z,v((s(),u(d,{label:e(a)("security.sensitiveData.Sensitive fields"),type:"selects",modelValue:e(t).form.items.data_fields,"onUpdate:modelValue":l[4]||(l[4]=o=>e(t).form.items.data_fields=o),key:e(t).form.extend.fieldSelectKey,prop:"data_fields",data:{content:e(t).form.extend.fieldSelect},"input-attr":{onChange:L}},null,8,["label","modelValue","data","input-attr"])),[[x,e(t).form.extend.fieldLoading]]),(s(!0),S(G,null,H(i.dataFields,(o,N)=>(s(),u(d,{key:N,label:o.name,type:"string",modelValue:o.value,"onUpdate:modelValue":P=>o.value=P,placeholder:e(a)("security.sensitiveData.Filling in field notes helps you quickly identify fields later")},null,8,["label","modelValue","onUpdate:modelValue","placeholder"]))),128)),ee,p(d,{label:e(a)("State"),type:"radio",modelValue:e(t).form.items.status,"onUpdate:modelValue":l[5]||(l[5]=o=>e(t).form.items.status=o),prop:"status",data:{content:{0:e(a)("Disable"),1:e(a)("Enable")}}},null,8,["label","modelValue","data"])]),_:1},8,["model","label-position","label-width","rules"]))],6)]),_:1})),[[x,e(t).form.loading]])]),_:1},8,["model-value","onClose"])}}}),pe=X(te,[["__scopeId","data-v-e31eae01"]]);export{pe as default};