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