role-modal.628944bb.js 3.2 KB

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