import{d as O,h as T,r as o,e as j,l as A,o as u,v as _,w as s,f as m,a as e,n as y,x as Q,c as b,F as h,q as g,Q as P,t as W,P as B,y as G,z as H,A as J,ai as K,aj as X,D as Y,C as Z,I as $,_ as ee,__tla as ae}from"./index-04f8d540.js";import{_ as le,__tla as se}from"./Dialog-9afb5ba5.js";import{g as te,__tla as re}from"./index-6e48cf5a.js";import{P as ue,c as oe,u as ie,__tla as de}from"./index-0d7ba552.js";import{a as _e,D as me,__tla as ce}from"./dict-ef06f7f7.js";import{u as ne,__tla as ve}from"./useMessage-9c37e840.js";let x,fe=Promise.all([(()=>{try{return ae}catch{}})(),(()=>{try{return se}catch{}})(),(()=>{try{return re}catch{}})(),(()=>{try{return de}catch{}})(),(()=>{try{return ce}catch{}})(),(()=>{try{return ve}catch{}})()]).then(async()=>{x=ee(O({name:"CrmPermissionForm",__name:"PermissionForm",emits:["success"],setup(pe,{expose:C,emit:F}){const{t:f}=T(),I=ne(),i=o(!1),V=o(""),c=o(!1),p=o(""),w=o([]),t=o({userId:void 0,bizType:void 0,bizId:void 0,level:void 0}),S=j({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,d,v)=>{i.value=!0,V.value=f("action."+r)+"\u56E2\u961F\u6210\u5458",p.value=r,E(l,d),v&&(t.value.ids=v)}});const q=F,D=async()=>{if(n&&await n.value.validate()){c.value=!0;try{const r=t.value;p.value==="create"?(await oe(e(r)),I.success(f("common.createSuccess"))):(await ie(e(r)),I.success(f("common.updateSuccess"))),i.value=!1,q("success")}finally{c.value=!1}}},E=(r,l)=>{var d;(d=n.value)==null||d.resetFields(),t.value={userId:void 0,bizType:r,bizId:l,level:void 0}};return A(async()=>{w.value=await te()}),(r,l)=>{const d=G,v=H,k=J,R=K,U=X,L=Y,z=Z,M=le,N=$;return u(),_(M,{modelValue:e(i),"onUpdate:modelValue":l[3]||(l[3]=a=>B(i)?i.value=a:null),title:e(V),width:"30%"},{footer:s(()=>[m(z,{disabled:e(c),type:"primary",onClick:D},{default:s(()=>[y("\u786E \u5B9A")]),_:1},8,["disabled"]),m(z,{onClick:l[2]||(l[2]=a=>i.value=!1)},{default:s(()=>[y("\u53D6 \u6D88")]),_:1})]),default:s(()=>[Q((u(),_(L,{ref_key:"formRef",ref:n,model:e(t),rules:e(S),"label-width":"100px"},{default:s(()=>[e(p)==="create"?(u(),_(k,{key:0,label:"\u9009\u62E9\u4EBA\u5458",prop:"userId"},{default:s(()=>[m(v,{modelValue:e(t).userId,"onUpdate:modelValue":l[0]||(l[0]=a=>e(t).userId=a)},{default:s(()=>[(u(!0),b(h,null,g(e(w),a=>(u(),_(d,{key:a.id,label:a.nickname,value:a.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):P("",!0),m(k,{label:"\u6743\u9650\u7EA7\u522B",prop:"level"},{default:s(()=>[m(U,{modelValue:e(t).level,"onUpdate:modelValue":l[1]||(l[1]=a=>e(t).level=a)},{default:s(()=>[(u(!0),b(h,null,g(e(_e)(e(me).CRM_PERMISSION_LEVEL),a=>(u(),b(h,{key:a.value},[a.value!=e(ue).OWNER?(u(),_(R,{key:0,label:a.value},{default:s(()=>[y(W(a.label),1)]),_:2},1032,["label"])):P("",!0)],64))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[N,e(c)]])]),_:1},8,["modelValue","title"])}}}),[["__file","D:/zx/mall-newfeifan-zx-business/src/views/crm/permission/components/PermissionForm.vue"]])});export{fe as __tla,x as default};
