import{B as z,a8 as x,am as G,a as P,I as s,X as u,C as m,O as p,P as a,_,G as C,F as w,u as e,$ as T,H as i,a7 as $,a6 as L,V as b,U as g,D as U}from"./vue-DweYBrEc.js";import{e as W,x as q,_ as H}from"./index-fNs72j9w.js";import{F as A}from"./index-BlEwok4a.js";import{b as M}from"./validate-CEOscgyN.js";import"./index-CgMrKa77.js";import"./index-DMA3A9_B.js";const O={class:"title"},X=z({__name:"popupForm",setup(J,{expose:V}){const v=W(),f=x("formRef"),c=x("treeRef"),o=G("baTable"),{t:l}=q.useI18n(),R=P({name:[M({name:"required",title:l("user.group.Group name")})],auth:[{required:!0,validator:(y,t,r)=>h().length<=0?r(new Error(l("Please select field",{field:l("user.group.jurisdiction")}))):r()}]}),h=()=>c.value.getCheckedKeys().concat(c.value.getHalfCheckedKeys()),S=(y,t)=>{if(t.isLeaf)return"";let r=!0;for(const d in t.childNodes)t.childNodes[d].isLeaf||(r=!1);return r?"penultimate-node":""};return V({getCheckeds:h}),(y,t)=>{const r=s("el-input"),d=s("el-form-item"),F=s("el-tree"),I=s("el-form"),D=s("el-scrollbar"),k=s("el-button"),K=s("el-dialog"),N=u("drag"),B=u("zoom"),E=u("loading"),j=u("blur");return m(),p(K,{class:"ba-operate-dialog",top:"10vh","close-on-click-modal":!1,"model-value":["Add","Edit"].includes(e(o).form.operate),onClose:e(o).toggleForm,"destroy-on-close":!0},{header:a(()=>[_((m(),U("div",O,[b(g(e(o).form.operate?e(l)(e(o).form.operate):""),1)])),[[N,[".ba-operate-dialog",".el-dialog__header"]],[B,".ba-operate-dialog"]])]),footer:a(()=>[C("div",{style:w("width: calc(100% - "+e(o).form.labelWidth/1.8+"px)")},[i(k,{onClick:t[4]||(t[4]=n=>e(o).toggleForm(""))},{default:a(()=>[b(g(e(l)("Cancel")),1)]),_:1}),_((m(),p(k,{loading:e(o).form.submitLoading,onClick:t[5]||(t[5]=n=>e(o).onSubmit(e(f))),type:"primary"},{default:a(()=>[b(g(e(o).form.operateIds&&e(o).form.operateIds.length>1?e(l)("Save and edit next item"):e(l)("Save")),1)]),_:1},8,["loading"])),[[j]])],4)]),default:a(()=>[_((m(),p(D,{class:"ba-table-form-scrollbar"},{default:a(()=>[C("div",{class:T(["ba-operate-form","ba-"+e(o).form.operate+"-form"]),style:w(e(v).layout.shrink?"":"width: calc(100% - "+e(o).form.labelWidth/2+"px)")},[i(I,{ref_key:"formRef",ref:f,onSubmit:t[2]||(t[2]=L(()=>{},["prevent"])),onKeyup:t[3]||(t[3]=$(n=>e(o).onSubmit(e(f)),["enter"])),model:e(o).form.items,"label-position":e(v).layout.shrink?"top":"right","label-width":e(o).form.labelWidth+"px",rules:R},{default:a(()=>[i(d,{prop:"name",label:e(l)("user.group.Group name")},{default:a(()=>[i(r,{modelValue:e(o).form.items.name,"onUpdate:modelValue":t[0]||(t[0]=n=>e(o).form.items.name=n),type:"string",placeholder:e(l)("Please input field",{field:e(l)("user.group.Group name")})},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),i(d,{prop:"auth",label:e(l)("user.group.jurisdiction")},{default:a(()=>[(m(),p(F,{ref_key:"treeRef",ref:c,key:e(o).form.extend.treeKey,"default-checked-keys":e(o).form.extend.defaultCheckedKeys,"default-expand-all":!0,"show-checkbox":"","node-key":"id",props:{children:"children",label:"title",class:S},data:e(o).form.extend.menuRules,class:"w100"},null,8,["default-checked-keys","props","data"]))]),_:1},8,["label"]),i(A,{label:e(l)("State"),modelValue:e(o).form.items.status,"onUpdate:modelValue":t[1]||(t[1]=n=>e(o).form.items.status=n),type:"radio","input-attr":{border:!0,content:{0:e(l)("Disable"),1:e(l)("Enable")}}},null,8,["label","modelValue","input-attr"])]),_:1},8,["model","label-position","label-width","rules"])],6)]),_:1})),[[E,e(o).form.loading]])]),_:1},8,["model-value","onClose"])}}}),le=H(X,[["__scopeId","data-v-d4438010"]]);export{le as default};
