role-modal.155c033a.js 3.7 KB

1
  1. import{aD as p,a3 as L,_ as h,d as O,w as E,aE as $,aG as j,W as G,ae as P,r as d,am as H,o as D,G as g,C as o,H as M,u as n,aH as W,l as r,c as X,F as Y,D as z,M as R,L as Q,b as J,av as K}from"./index.ab2ff1c1.js";const{VITE_PROXY_DOMAIN_REAL:ae,VITE_PROXY_USER_REAL:T}=L(),v=T+"/admin/",oe=e=>p.request("post",`${v}account/list`,{data:e}),Z=e=>p.request("post",`${v}role/query`,{data:e}),re=e=>p.request("post",`${v}usersave`,{data:e}),se=e=>p.request("post",`${v}setcompanystatus`,{data:e}),ne=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 ee={class:"flex w-full justify-end"},ue=O({__name:"role-modal",emits:["finance-save"],setup(e,{expose:w,emit:y}){const m=E(!1),f=E(c.create),V=E(null),F=$(0),{run:A,data:q,loading:x}=j({initalData:[],isList:!1}),k={nickname:"",mobile:"",roleid:""},t=E({...k}),C=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,u,s)=>{Number(u)===0?s(new Error("\u8BF7\u9009\u62E9\u89D2\u8272")):s()},trigger:"blur"}]});function N(){if(F.value===3){K.warning("\u4F9B\u5E94\u5546\u7AEF\u8D26\u53F7\u4E0D\u63D0\u4F9B\u62A5\u8868\u529F\u80FD,\u4E0D\u80FD\u8BBE\u7F6E\u89D2\u8272!");return}V.value.validate(a=>{!a||(y("finance-save",{...n(t)},n(f)),m.value=!1)})}return w({onDisplay:(a,u)=>{if(t.value={...k},m.value=!0,f.value=u,A(Z({})),a){const{mobile:s,nickname:i,role_id:b,id:B,level:_}=a;F.value=Number(_),t.value={mobile:s,nickname:i,roleid:b,id:B}}else F.value=0}}),(a,u)=>{const s=d("ElInput"),i=d("ElFormItem"),b=d("ElRadio"),B=d("ElRadioGroup"),_=d("ElButton"),S=d("ElDialog"),U=H("loading");return D(),g(S,{center:"",modelValue:m.value,"onUpdate:modelValue":u[5]||(u[5]=l=>m.value=l),title:n(C),"close-on-click-modal":!1},{default:o(()=>[M((D(),g(n(W),{ref_key:"formRef",ref:V,labelWidth:"100px","label-position":"left",model:t.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:t.value.nickname,"onUpdate:modelValue":u[0]||(u[0]=l=>t.value.nickname=l),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:t.value.mobile,"onUpdate:modelValue":u[1]||(u[1]=l=>t.value.mobile=l),disabled:""},null,8,["modelValue"])]),_:1}),r(i,{label:"\u89D2\u8272",prop:"roleid"},{default:o(()=>[r(B,{modelValue:t.value.roleid,"onUpdate:modelValue":u[2]||(u[2]=l=>t.value.roleid=l)},{default:o(()=>[(D(!0),X(Y,null,z(n(q),l=>(D(),g(b,{disabled:String(l.status)==="0",key:l.id,label:l.id},{default:o(()=>[R(Q(l.role_name),1)]),_:2},1032,["disabled","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),r(i,null,{default:o(()=>[J("div",ee,[r(_,{type:"\u53D6\u6D88",onClick:u[3]||(u[3]=()=>m.value=!1)},{default:o(()=>[R("\u53D6\u6D88")]),_:1}),r(_,{type:"primary",onClick:u[4]||(u[4]=()=>N())},{default:o(()=>[R("\u4FDD\u5B58")]),_:1})])]),_:1})]),_:1},8,["model","rules","disabled"])),[[U,n(x)]])]),_:1},8,["modelValue","title"])}}});var le=h(ue,[["__file","C:/Users/a/Desktop/projects/report-v3/src/views/system/accountRole/components/role-modal.vue"]]),ie=Object.freeze(Object.defineProperty({__proto__:null,default:le},Symbol.toStringTag,{value:"Module"}));export{c as M,le as R,ne as a,se as b,re as c,oe as h,ie as r};