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-ARbUvvsq.js";import{f as G}from"./user.data-D5VRrih7.js";import{u as $,B as q}from"./index-CC3OF1BO.js";import{g as z,b as E,c as H,e as J,s as M}from"./user.api-BLHI3_6c.js";import{useDrawerAdaptiveWidth as Q}from"./useAdaptiveWidth-B-GcgPBd.js";import{bj as X}from"./index-B_2CoVdl.js";import{u as Y,B as Z}from"./useForm-CcjrODHR.js";import"./componentMap-CzCGDP7x.js";import"./antd-vue-vendor-CDWW6V_M.js";import"./useFormItem-CWa0w7fA.js";import"./index-D2AmS0aU.js";import"./BasicModal-D3g2CFhF.js";import"./ModalHeader-C-C0dUi_.js";import"./useTimeout-CB9F1PLu.js";import"./vxe-table-vendor-B5h3MVdD.js";import"./index-DAURrYyA.js";import"./useWindowSizeFn-C3WExEpc.js";import"./index-Dz2zbQB_.js";import"./index-exs4VcBw.js";import"./index-ByLO0zSl.js";import"./useIntersectionObserver-FVRzwlSd.js";import"./download-2tYEzlDW.js";import"./base64Conver-24EVOS6V.js";import"./index-Cgt544dC.js";import"./index-BZ9ST2iq.js";import"./useCountdown-ImUE7YaG.js";import"./useFormItemSingle-DM34aWgK.js";import"./JSelectUser-BQIJUcBR.js";import"./props-BCVPj-bG.js";import"./JSelectBiz-CJyWq5s2.js";import"./JAddInput-YFlAniYT.js";import"./areaDataUtil-DFHnz1wu.js";import"./china-area-data-vendor-D0sJ9kfX.js";import"./index-CkL00Q0a.js";import"./index-BKs2x_To.js";import"./bem-C6eT35UB.js";import"./props-BLY2qIO5.js";import"./useContextMenu-CSt5a1-F.js";import"./depart.api-0qTriT9h.js";import"./JDictSelectTag-CxpDdimB.js";import"./JSelectDept-wKz_Qtmc.js";import"./JPopup-BJBYqoWe.js";import"./JEllipsis-Cn7GCKHR.js";import"./JUpload-DzM-D4DX.js";import"./index-khU3p_On.js";import"./index-DPEnuI0R.js";import"./index-Cnb8BkwG.js";import"./JAreaLinkage-CSgDAlrn.js";import"./JCodeEditor-esTLnfS3.js";import"./htmlmixed-DRe7JlAp.js";import"./vue-B0b3nX1K.js";/* empty css             */import"./EasyCronInput-DclSHT47.js";import"./validator-jM63P_3m.js";import"./renderUtils-Cbe4E0PZ.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};
