var P=Object.defineProperty;var D=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var b=(s,o,r)=>o in s?P(s,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[o]=r,A=(s,o)=>{for(var r in o||(o={}))L.call(o,r)&&b(s,r,o[r]);if(D)for(var r of D(o))k.call(o,r)&&b(s,r,o[r]);return s};var y=(s,o,r)=>new Promise((v,i)=>{var h=p=>{try{n(r.next(p))}catch(c){i(c)}},u=p=>{try{n(r.throw(p))}catch(c){i(c)}},n=p=>p.done?v(p.value):Promise.resolve(p.value).then(h,u);n((r=r.apply(s,o)).next())});import{d as O,K as j,f as w,u as t,e as C,a2 as V,ad as W,af as x,k as K,ag as N}from"./vue-vendor-CxLCUzY4.js";import"./index-ByX9XNkE.js";import{f as G}from"./user.data-DNJy-IxE.js";import{u as $,B as q}from"./index-BjHivc1K.js";import{g as z,b as E,c as H,e as J,s as M}from"./user.api-DAu0nuTv.js";import{useDrawerAdaptiveWidth as Q}from"./useAdaptiveWidth-CuheMf5X.js";import{bj as X}from"./index-CLZzJyTP.js";import{u as Y,B as Z}from"./useForm-Dx3lJ3DG.js";import"./componentMap-DpsJvoqz.js";import"./antd-vue-vendor-CahNzUUa.js";import"./useFormItem-IOFWTdED.js";import"./index-XZKTTfG1.js";import"./BasicModal-B8XmAOm7.js";import"./ModalHeader-DIFQSP_0.js";import"./useTimeout-KpZCXEcl.js";import"./vxe-table-vendor-Cdi8WfTx.js";import"./index-DvqyyN77.js";import"./useWindowSizeFn-D9PllI8g.js";import"./index-DS3utcig.js";import"./index-BZbg0EjM.js";import"./index-CrdW4fN1.js";import"./useIntersectionObserver-FVRzwlSd.js";import"./download-DopMSmFN.js";import"./base64Conver-24EVOS6V.js";import"./index-CDa2_aYE.js";import"./index-D0jTtUNS.js";import"./useCountdown-BpP55PQ2.js";import"./useFormItemSingle-BEyrYQqf.js";import"./JSelectUser-CfAGgHjD.js";import"./props-BtZrRNiI.js";import"./JSelectBiz-CLnJTMe2.js";import"./JAddInput-B36c3B5x.js";import"./areaDataUtil-Dk3xkGfK.js";import"./china-area-data-vendor-ByvEpbzN.js";import"./index-C7yPiS0L.js";import"./index-44tRnyoF.js";import"./bem-DT3DdmOs.js";import"./props-CG-jAkbI.js";import"./useContextMenu-BGU2vdqV.js";import"./depart.api-DHG2p2Yd.js";import"./JImageUpload-BFwNYdm5.js";import"./JDictSelectTag-CfF54ALX.js";import"./JSelectDept-CaEHrQp6.js";import"./JPopup-BvqhHpPl.js";import"./JEllipsis-C_gT_vEQ.js";import"./JUpload-DgDEmizw.js";import"./index-Bn2zmO2L.js";import"./index-CEznvAVZ.js";import"./index-CfAukas3.js";import"./JAreaLinkage-M9TGy8nY.js";import"./JCodeEditor-CR57XeIe.js";import"./htmlmixed-DoVLO6sG.js";import"./vue-DY75b9GC.js";/* empty css             */import"./EasyCronInput-CWOTSpxK.js";import"./validator-Dx9kcZ5e.js";import"./renderUtils-BgFeePLc.js";const sr=O({__name:"UserDrawer",emits:["success","register"],setup(s,{emit:o}){const r=o,v=j(),i=w(!0),h=w(""),u=w([]),[n,{setProps:p,resetFields:c,setFieldsValue:g,validate:F,updateSchema:R}]=Y({labelWidth:90,schemas:G,showActionButtonGroup:!1}),d=w(!0),[S,{setDrawerProps:I,closeDrawer:T}]=$(e=>y(this,null,function*(){var l;if(yield c(),d.value=(l=e==null?void 0:e.showFooter)!=null?l:!0,I({confirmLoading:!1,showFooter:d.value}),i.value=!!(e!=null&&e.isUpdate),t(i)){h.value=e.record.id,e.record.relTenantIds&&!Array.isArray(e.record.relTenantIds)&&(e.record.relTenantIds=e.record.relTenantIds.split(","));try{const m=yield z({userid:e.record.id});m&&m.length>0&&(e.record.selectedroles=m)}catch(m){}const a=yield E({userId:e.record.id});if(a&&a.length>0){e.record.selecteddeparts=a;let m=Array.from(a,({key:f})=>f);e.record.selecteddeparts=m.join(","),u.value=a.map(f=>({label:f.title,value:f.key}))}e.record.departIds&&!Array.isArray(e.record.departIds)&&(e.record.departIds=e.record.departIds.split(",")),e.record.departIds=!e.record.departIds||e.record.departIds==""?[]:e.record.departIds}e.selectedroles&&(yield g({selectedroles:e.selectedroles})),R([{field:"password",ifShow:!t(i)},{field:"confirmPassword",ifShow:!t(i)},{field:"selectedroles",show:!e.isRole},{field:"departIds",componentProps:{options:u}},{field:"selecteddeparts",show:!(e!=null&&e.departDisabled)},{field:"selectedroles",show:!(e!=null&&e.departDisabled),componentProps:{api:e.tenantSaas?H:J}},{field:"relTenantIds",componentProps:{disabled:!!e.tenantSaas}}]),!t(i)&&e.tenantSaas&&(yield g({relTenantIds:X().toString()})),typeof e.record=="object"&&g(A({},e.record)),p({disabled:!d.value})})),B=C(()=>t(i)?t(d)?"编辑用户":"用户详情":"新增用户"),{adaptiveWidth:U}=Q();function _(){return y(this,null,function*(){try{let e=yield F();I({confirmLoading:!0}),e.userIdentity===1&&(e.departIds="");let l=t(i);yield M(e,l),T(),r("success",{isUpdateVal:l,values:e})}finally{I({confirmLoading:!1})}})}return(e,l)=>(V(),W(t(q),N(e.$attrs,{onRegister:t(S),title:B.value,width:t(U),onOk:_,showFooter:d.value,destroyOnClose:""}),{default:x(()=>[K(t(Z),{onRegister:t(n)},null,8,["onRegister"])]),_:1},16,["onRegister","title","width","showFooter"]))}});export{sr as default};
