You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
4.1 KiB
JavaScript

var m=(y,b,p)=>new Promise((g,d)=>{var S=o=>{try{u(p.next(o))}catch(c){d(c)}},D=o=>{try{u(p.throw(o))}catch(c){d(c)}},u=o=>o.done?g(o.value):Promise.resolve(o.value).then(S,D);u((p=p.apply(y,b)).next())});import{a as j,B as q}from"./index-C8bZxGin.js";import{u as z,_ as H}from"./useForm-fILnWqWp.js";import"./BasicForm.vue_vue_type_style_index_0_lang-D499EpF5.js";import"./componentMap-zBHKqdNc.js";import{a as k,d as J,b as K,c as Q}from"./index-Bt7IuM-3.js";import{f as X}from"./index-Bi6VelBa.js";import{d as Y}from"./user.data-CMziQLRy.js";import{bv as Z,_ as ee}from"./entry/index-C2Ijy48E-1723706691540.js";import{u as te}from"./useSize-DYNfmMCU.js";import{b as ae}from"./role.data-DnprV-cO.js";import{V as N,a6 as B}from"./antd-BY-1PcYE.js";import{d as oe,f as x,c as re,_ as f,a8 as L,a9 as l,k as w,u as t,$ as O,F as C,ab as R,a0 as h,a1 as I,G as V,ad as se}from"./vue-aEZWZQSa.js";import"./FormItem.vue_vue_type_script_lang-CKJUw6EQ.js";import"./helper-D0Efh3UP.js";import"./index-fya05jI8.js";import"./useWindowSizeFn-CjdUjzGl.js";import"./RadioButtonGroup.vue_vue_type_script_setup_true_lang-CVQ-sEzT.js";import"./index-DVy1eUzr.js";import"./useSortable-Bra4jKJL.js";import"./download-Cu3oizbN.js";import"./useLoading-C2GeNIUj.js";import"./copyTextToClipboard-BBFF3Y3I.js";import"./onMountedOrActivated-BIJ0U1R1.js";import"./style-apcQnL4e.js";import"./rules-Boel_RXz.js";import"./dict-1X4Pwk-Z.js";import"./dictEnum-DeC8h6ZR.js";import"./useRender-C6_44OXE.js";import"./index-JkNHdZh2.js";const le={class:"flex flex-row gap-1.5"},ie={class:"flex flex-row gap-1.5"},pe=oe({name:"UserDrawer",__name:"UserDrawer",emits:["register","reload"],setup(y,{emit:b}){const p=N.Option,g=b,d=x(!1),S=te(700),D=re(()=>d.value?"编辑用户":"新增用户"),u=x([]),o=x([]),[c,{drawerLoading:_,closeDrawer:A}]=j(a=>m(this,null,function*(){_(!0);const{record:n,update:r}=a;d.value=r,yield P([{field:"userName",componentProps:{disabled:r}},{field:"password",ifShow:!r}]);const s=n?yield k(n.userId):yield k(),{postIds:e=[],roleIds:v=[],user:i,roles:M}=s;i&&(i.postIds=e,i.roleIds=v),o.value=M,yield T(),i&&r&&(yield $(i)),_(!1)}));function T(){return m(this,null,function*(){const a=yield J();Z(a,"label"," / "),yield P([{field:"deptId",componentProps:({formModel:n})=>({treeData:a,fieldNames:{value:"id",label:"label"},treeDefaultExpandAll:!0,treeLine:{showLeafIcon:!1},treeNodeLabelProp:"fullName",onSelect(s){return m(this,null,function*(){const e=yield X(s);u.value=e,n.postIds=[]})}})}])})}const[W,{setFieldsValue:$,resetForm:F,validate:E,updateSchema:P}]=z({labelWidth:100,name:"user-drawer",showActionButtonGroup:!1,baseColProps:{span:24},schemas:Y});function U(a){return ae.find(n=>n.value===a)}function G(){return m(this,null,function*(){try{_(!0);const a=yield E();t(d)?yield K(a):yield Q(a),g("reload"),A(),yield F()}catch(a){}finally{_(!1)}})}return(a,n)=>(f(),L(t(q),se(a.$attrs,{width:t(S),title:D.value,"show-footer":!0,onRegister:t(c),onOk:G,onClose:t(F)}),{default:l(()=>[w(t(H),{onRegister:t(W)},{postIds:l(({model:r,field:s})=>[w(t(N),{value:r[s],"onUpdate:value":e=>r[s]=e,optionFilterProp:"title",placeholder:"请选择岗位",mode:"multiple",optionLabelProp:"title"},{default:l(()=>[(f(!0),O(C,null,R(u.value,e=>(f(),L(t(p),{key:e.postId,value:e.postId,title:e.postName},{default:l(()=>[h("div",le,[h("span",null,I(e.postName),1),w(t(B),null,{default:l(()=>[V(I(e.postCode),1)]),_:2},1024)])]),_:2},1032,["value","title"]))),128))]),_:2},1032,["value","onUpdate:value"])]),roleIds:l(({model:r,field:s})=>[w(t(N),{value:r[s],"onUpdate:value":e=>r[s]=e,optionFilterProp:"title",placeholder:"请选择角色",mode:"multiple",optionLabelProp:"title"},{default:l(()=>[(f(!0),O(C,null,R(o.value,e=>(f(),L(t(p),{key:e.roleId,value:e.roleId,title:e.roleName},{default:l(()=>{var v;return[h("div",ie,[h("span",null,I(e.roleName),1),w(t(B),{color:(v=U(e.dataScope))==null?void 0:v.color},{default:l(()=>{var i;return[V(I((i=U(e.dataScope))==null?void 0:i.label),1)]}),_:2},1032,["color"])])]}),_:2},1032,["value","title"]))),128))]),_:2},1032,["value","onUpdate:value"])]),_:1},8,["onRegister"])]),_:1},16,["width","title","onRegister","onClose"]))}}),We=ee(pe,[["__scopeId","data-v-bd799cb1"]]);export{We as default};