role-modal.2e4460a3.js 3.5 KB

1
  1. import{aC as p,a2 as L,_ as h,d as O,w as E,aD as $,aF as j,W as G,ad as P,r as d,al as W,o as b,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.916a7946.js";const{VITE_PROXY_DOMAIN_REAL:ue,VITE_PROXY_USER_REAL:K}=L(),v=K+"/admin/",ae=e=>p.request("post",`${v}account/list`,{data:e}),T=e=>p.request("post",`${v}role/query`,{data:e}),oe=e=>p.request("post",`${v}usersave`,{data:e}),re=e=>p.request("post",`${v}setcompanystatus`,{data:e}),se=e=>p.request("post",`${v}menustatus`,{data:e});var c=(e=>(e[e.update=0]="update",e[e.preview=1]="preview",e[e.create=2]="create",e))(c||{});const Z={class:"flex w-full justify-end"},ee=O({__name:"role-modal",emits:["finance-save"],setup(e,{expose:w,emit:y}){const m=E(!1),f=E(c.create),R=E(null),V=$(0),{run:q,data:A,loading:C}=j({initalData:[],isList:!1}),k={nickname:"",mobile:"",roleid:""},u=E({...k}),x=G(()=>{const a="\u8D26\u53F7\u89D2\u8272\u8BBE\u7F6E";switch(f.value){case c.create:return"\u521B\u5EFA"+a;case c.preview:return"\u67E5\u770B"+a;default:return"\u4FEE\u6539"+a}}),I=P({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)),m.value=!1)})}return w({onDisplay:(a,l)=>{if(u.value={...k},m.value=!0,f.value=l,q(T({})),a){const{mobile:s,nickname:i,role_id:D,id:F,level:_}=a;V.value=Number(_),u.value={mobile:s,nickname:i,roleid:D,id:F}}else V.value=0}}),(a,l)=>{const s=d("ElInput"),i=d("ElFormItem"),D=d("ElRadio"),F=d("ElRadioGroup"),_=d("ElButton"),S=d("ElDialog"),U=W("loading");return b(),B(S,{center:"",modelValue:m.value,"onUpdate:modelValue":l[5]||(l[5]=t=>m.value=t),title:n(x),"close-on-click-modal":!1},{default:o(()=>[X((b(),B(n(Y),{ref_key:"formRef",ref:R,labelWidth:"100px","label-position":"left",model:u.value,rules:I,disabled:f.value===n(c).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(()=>[(b(!0),z(H,null,M(n(A),t=>(b(),B(D,{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]=()=>m.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"])),[[U,n(C)]])]),_:1},8,["modelValue","title"])}}});var le=h(ee,[["__file","C:/Users/a/Desktop/projects/report-v3/src/views/system/accountRole/components/role-modal.vue"]]),ne=Object.freeze(Object.defineProperty({__proto__:null,default:le},Symbol.toStringTag,{value:"Module"}));export{c as M,le as R,se as a,re as b,oe as c,ae as h,ne as r};