import{d as O,r as o,x as T,b as W,o as u,A as _,B as s,f as c,E as y,a as e,k as A,c as b,R as E,F as V,D as P,G as B,a2 as G,Q as K,S as Q,U as Z,V as j,as as H,at as J,W as X,K as Y,Z as $,__tla as ee}from"./index-92ad187a.js";import{_ as ae,__tla as le}from"./Dialog-44c9fa34.js";import{g as se,__tla as te}from"./index-343decc0.js";import{P as re,c as ue,u as oe,__tla as de}from"./index-a4b5469a.js";import{a as ie,D as _e,__tla as ce}from"./dict-221f3e01.js";import{u as me,__tla as ne}from"./useMessage-d9788660.js";let z,ve=Promise.all([(()=>{try{return ee}catch{}})(),(()=>{try{return le}catch{}})(),(()=>{try{return te}catch{}})(),(()=>{try{return de}catch{}})(),(()=>{try{return ce}catch{}})(),(()=>{try{return ne}catch{}})()]).then(async()=>{z=O({name:"CrmPermissionForm",__name:"PermissionForm",emits:["success"],setup(fe,{expose:C,emit:R}){const{t:f}=K(),I=me(),d=o(!1),h=o(""),m=o(!1),p=o(""),k=o([]),t=o({userId:void 0,bizType:void 0,bizId:void 0,level:void 0}),S=T({userId:[{required:!0,message:"\u4EBA\u5458\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],level:[{required:!0,message:"\u6743\u9650\u7EA7\u522B\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),n=o();C({open:async(r,l,i,v)=>{d.value=!0,h.value=f("action."+r)+"\u56E2\u961F\u6210\u5458",p.value=r,F(l,i),v&&(t.value.ids=v)}});const U=R,x=async()=>{if(n&&await n.value.validate()){m.value=!0;try{const r=t.value;p.value==="create"?(await ue(e(r)),I.success(f("common.createSuccess"))):(await oe(e(r)),I.success(f("common.updateSuccess"))),d.value=!1,U("success")}finally{m.value=!1}}},F=(r,l)=>{var i;(i=n.value)==null||i.resetFields(),t.value={userId:void 0,bizType:r,bizId:l,level:void 0}};return W(async()=>{k.value=await se()}),(r,l)=>{const i=Q,v=Z,g=j,q=H,D=J,L=X,w=Y,M=ae,N=$;return u(),_(M,{modelValue:e(d),"onUpdate:modelValue":l[3]||(l[3]=a=>G(d)?d.value=a:null),title:e(h),width:"30%"},{footer:s(()=>[c(w,{disabled:e(m),type:"primary",onClick:x},{default:s(()=>[y("\u786E \u5B9A")]),_:1},8,["disabled"]),c(w,{onClick:l[2]||(l[2]=a=>d.value=!1)},{default:s(()=>[y("\u53D6 \u6D88")]),_:1})]),default:s(()=>[A((u(),_(L,{ref_key:"formRef",ref:n,model:e(t),rules:e(S),"label-width":"100px"},{default:s(()=>[e(p)==="create"?(u(),_(g,{key:0,label:"\u9009\u62E9\u4EBA\u5458",prop:"userId"},{default:s(()=>[c(v,{modelValue:e(t).userId,"onUpdate:modelValue":l[0]||(l[0]=a=>e(t).userId=a)},{default:s(()=>[(u(!0),b(V,null,E(e(k),a=>(u(),_(i,{key:a.id,label:a.nickname,value:a.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):P("",!0),c(g,{label:"\u6743\u9650\u7EA7\u522B",prop:"level"},{default:s(()=>[c(D,{modelValue:e(t).level,"onUpdate:modelValue":l[1]||(l[1]=a=>e(t).level=a)},{default:s(()=>[(u(!0),b(V,null,E(e(ie)(e(_e).CRM_PERMISSION_LEVEL),a=>(u(),b(V,{key:a.value},[a.value!=e(re).OWNER?(u(),_(q,{key:0,label:a.value},{default:s(()=>[y(B(a.label),1)]),_:2},1032,["label"])):P("",!0)],64))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[N,e(m)]])]),_:1},8,["modelValue","title"])}}})});export{z as _,ve as __tla};
