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-BkgeZpOO.js";import{f as G}from"./user.data-BmeJpriz.js";import{u as $,B as q}from"./index-qSr7C5NQ.js";import{g as z,b as E,c as H,e as J,s as M}from"./user.api-BUwWVSBN.js";import{useDrawerAdaptiveWidth as Q}from"./useAdaptiveWidth-Bn089Ulv.js";import{bj as X}from"./index-CYriLmQo.js";import{u as Y,B as Z}from"./useForm-8o5KRzWo.js";import"./componentMap-7D1QIeNI.js";import"./antd-vue-vendor-CDWW6V_M.js";import"./useFormItem-CWa0w7fA.js";import"./index-CF_FJn6P.js";import"./BasicModal-BBgVjypv.js";import"./ModalHeader-jGKMr-DQ.js";import"./useTimeout-DC8132dd.js";import"./vxe-table-vendor-B5h3MVdD.js";import"./index-CxQILSKV.js";import"./useWindowSizeFn-BxrEMPtP.js";import"./index-BRTtls-l.js";import"./index-DOuVMe-q.js";import"./index-ByLO0zSl.js";import"./useIntersectionObserver-FVRzwlSd.js";import"./download-CkbK5et1.js";import"./base64Conver-24EVOS6V.js";import"./index-QMJkXEyl.js";import"./index-Bb_NRLur.js";import"./useCountdown-C3-PRPLY.js";import"./useFormItemSingle-DM34aWgK.js";import"./JSelectUser-nVFm3ao2.js";import"./props-DoGpHXAD.js";import"./JSelectBiz-BW6f3e--.js";import"./JAddInput-CXT54-j9.js";import"./areaDataUtil-DFHnz1wu.js";import"./china-area-data-vendor-D0sJ9kfX.js";import"./index-BTSd5ebC.js";import"./index-BTAl55Kt.js";import"./bem-2ra1afoV.js";import"./props-BLY2qIO5.js";import"./useContextMenu-DYyhcDf7.js";import"./depart.api-C9T5xfw6.js";import"./JDictSelectTag-Jqy9TBcS.js";import"./JSelectDept-DorRVguN.js";import"./JPopup-KP1kIsae.js";import"./JEllipsis-287cEHxd.js";import"./JUpload-pyrTRFCz.js";import"./index-Bx9Mnn3N.js";import"./index-B1-pj6uh.js";import"./index-isxCPgHp.js";import"./JAreaLinkage-DFTeDmm8.js";import"./JCodeEditor-_KZ8XnNK.js";import"./htmlmixed-DRe7JlAp.js";import"./vue-B0b3nX1K.js";/* empty css             */import"./EasyCronInput-XK54XB3r.js";import"./validator-0TDlyteC.js";import"./renderUtils-CGtepdOw.js";const tr=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{tr as default};
