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-BN26Feep.js";import{f as G}from"./user.data-CKKSq6sB.js";import{u as $,B as q}from"./index-CJ4Xt1FM.js";import{g as z,b as E,c as H,e as J,s as M}from"./user.api-CoaMxYm2.js";import{useDrawerAdaptiveWidth as Q}from"./useAdaptiveWidth-Bz6tJGsL.js";import{bj as X}from"./index-Cy4uayzW.js";import{u as Y,B as Z}from"./useForm-DfoT2G6J.js";import"./componentMap-0iK4HQBq.js";import"./antd-vue-vendor-CahNzUUa.js";import"./useFormItem-IOFWTdED.js";import"./index-zKZnG1QC.js";import"./BasicModal-sKcs_9Ir.js";import"./ModalHeader-ByCVDoqO.js";import"./useTimeout-gJpgadD6.js";import"./vxe-table-vendor-Cdi8WfTx.js";import"./index-Bdn0r8CG.js";import"./useWindowSizeFn-DDyhhqyw.js";import"./index-CYoRlduV.js";import"./index-DYB8Ashr.js";import"./index-CrdW4fN1.js";import"./useIntersectionObserver-FVRzwlSd.js";import"./download-Bn4f3tzD.js";import"./base64Conver-24EVOS6V.js";import"./index-D6H6KsT6.js";import"./index-CLxBW_h0.js";import"./useCountdown-2P9HvnfJ.js";import"./useFormItemSingle-BEyrYQqf.js";import"./JSelectUser-B98pRPrS.js";import"./props-CtlWAg-s.js";import"./JSelectBiz-vYDBA0SK.js";import"./JAddInput-DP4caUmw.js";import"./areaDataUtil-Dk3xkGfK.js";import"./china-area-data-vendor-ByvEpbzN.js";import"./index-tDBMxW9-.js";import"./index-CNQBnF3P.js";import"./bem-IZKqD41e.js";import"./props-CG-jAkbI.js";import"./useContextMenu-Q6J5bB_u.js";import"./depart.api-B8q8MC-j.js";import"./JImageUpload-C5OCTlCG.js";import"./JDictSelectTag-CalJXNVe.js";import"./JSelectDept-D-TUaHvK.js";import"./JPopup-CVHkQZFq.js";import"./JEllipsis-TuDc52fh.js";import"./JUpload-DSWoDwh2.js";import"./index-B4vNk56t.js";import"./index-Dc7Jr5-j.js";import"./index-Dm1rPBfc.js";import"./JAreaLinkage-CTMEfTuh.js";import"./JCodeEditor-U9QIstNN.js";import"./htmlmixed-DoVLO6sG.js";import"./vue-DY75b9GC.js";/* empty css             */import"./EasyCronInput-CZdChTcP.js";import"./validator-CyHCj96y.js";import"./renderUtils-BcsccCoe.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};
