import{aC as m,a2 as L,_ as U,d as $,w as D,aD as O,aF as G,W,ad as j,r as d,al as P,o as E,G as B,C as o,H as X,u as n,aG as Y,l as r,c as z,F as H,D as M,M as g,L as Q,b as J}from"./index.1d5f2f42.js";const{VITE_PROXY_DOMAIN_REAL:ue,VITE_PROXY_USER_REAL:K}=L(),c=K+"/admin/",ae=e=>m.request("post",`${c}account/list`,{data:e}),T=e=>m.request("post",`${c}role/query`,{data:e}),oe=e=>m.request("post",`${c}usersave`,{data:e}),re=e=>m.request("post",`${c}setcompanystatus`,{data:e}),se=e=>m.request("post",`${c}menustatus`,{data:e}),ne=e=>m.request("post",`${c}account/delWx`,{data:e});var v=(e=>(e[e.update=0]="update",e[e.preview=1]="preview",e[e.create=2]="create",e))(v||{});const Z={class:"flex w-full justify-end"},ee=$({__name:"role-modal",emits:["finance-save"],setup(e,{expose:w,emit:y}){const p=D(!1),f=D(v.create),R=D(null),V=O(0),{run:q,data:x,loading:A}=G({initalData:[],isList:!1}),k={nickname:"",mobile:"",roleid:""},u=D({...k}),C=W(()=>{const a="\u8D26\u53F7\u89D2\u8272\u8BBE\u7F6E";switch(f.value){case v.create:return"\u521B\u5EFA"+a;case v.preview:return"\u67E5\u770B"+a;default:return"\u4FEE\u6539"+a}}),I=j({nickname:[{required:!0,message:"\u8BF7\u8F93\u5165\u771F\u5B9E\u59D3\u540D",trigger:"blur"}],mobile:[{required:!0,message:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7",trigger:"blur"}],roleid:[{required:!0,validator:(a,l,s)=>{Number(l)===0?s(new Error("\u8BF7\u9009\u62E9\u89D2\u8272")):s()},trigger:"blur"}]});function N(){R.value.validate(a=>{!a||(y("finance-save",{...n(u)},n(f)),p.value=!1)})}return w({onDisplay:(a,l)=>{if(u.value={...k},p.value=!0,f.value=l,q(T({})),a){const{mobile:s,nickname:i,role_id:b,id:F,level:_}=a;V.value=Number(_),u.value={mobile:s,nickname:i,roleid:b,id:F}}else V.value=0}}),(a,l)=>{const s=d("ElInput"),i=d("ElFormItem"),b=d("ElRadio"),F=d("ElRadioGroup"),_=d("ElButton"),S=d("ElDialog"),h=P("loading");return E(),B(S,{center:"",modelValue:p.value,"onUpdate:modelValue":l[5]||(l[5]=t=>p.value=t),title:n(C),"close-on-click-modal":!1},{default:o(()=>[X((E(),B(n(Y),{ref_key:"formRef",ref:R,labelWidth:"100px","label-position":"left",model:u.value,rules:I,disabled:f.value===n(v).preview},{default:o(()=>[r(i,{label:"\u771F\u5B9E\u59D3\u540D",prop:"nickname"},{default:o(()=>[r(s,{placeholder:"\u8BF7\u8F93\u5165\u771F\u5B9E\u59D3\u540D",modelValue:u.value.nickname,"onUpdate:modelValue":l[0]||(l[0]=t=>u.value.nickname=t),disabled:""},null,8,["modelValue"])]),_:1}),r(i,{label:"\u624B\u673A\u53F7",prop:"mobile"},{default:o(()=>[r(s,{placeholder:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7",modelValue:u.value.mobile,"onUpdate:modelValue":l[1]||(l[1]=t=>u.value.mobile=t),disabled:""},null,8,["modelValue"])]),_:1}),r(i,{label:"\u89D2\u8272",prop:"roleid"},{default:o(()=>[r(F,{modelValue:u.value.roleid,"onUpdate:modelValue":l[2]||(l[2]=t=>u.value.roleid=t)},{default:o(()=>[(E(!0),z(H,null,M(n(x),t=>(E(),B(b,{disabled:String(t.status)==="0",key:t.id,label:t.id},{default:o(()=>[g(Q(t.role_name),1)]),_:2},1032,["disabled","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),r(i,null,{default:o(()=>[J("div",Z,[r(_,{type:"\u53D6\u6D88",onClick:l[3]||(l[3]=()=>p.value=!1)},{default:o(()=>[g("\u53D6\u6D88")]),_:1}),r(_,{type:"primary",onClick:l[4]||(l[4]=()=>N())},{default:o(()=>[g("\u4FDD\u5B58")]),_:1})])]),_:1})]),_:1},8,["model","rules","disabled"])),[[h,n(A)]])]),_:1},8,["modelValue","title"])}}});var le=U(ee,[["__file","D:/work/rep-v3/report-v3/src/views/system/accountRole/components/role-modal.vue"]]),ie=Object.freeze(Object.defineProperty({__proto__:null,default:le},Symbol.toStringTag,{value:"Module"}));export{v as M,le as R,se as a,re as b,oe as c,ne as d,ae as h,ie as r};
