import{b as c,B6 as l,fH as h}from"./index.b8342cb4.js";import"./vendor-@yoyoboot.e8bb6d41.js";import f from"./add-member.453d5ff3.js";import{EVENT_BTN_ENUM as m}from"./event-btn-enum.dd30253d.js";import{_ as d}from"./vendor-vue-esign.3f5af73e.js";import{f as b,b8 as g,b2 as u,av as _}from"./vendor-@vue.d54eea3a.js";import"./vendor-vite-plugin-theme.cdb5aaa3.js";import"./vendor-tinycolor2.15555a92.js";import"./vendor-ant-design-vue.3e0197c8.js";import"./vendor-@babel.94f8e047.js";import"./vendor-@ant-design.ec873690.js";import"./vendor-vue.14425f25.js";import"./vendor-@amap.00a31695.js";import"./vendor-@ctrl.ce0444a4.js";import"./vendor-lodash-es.ed8922d2.js";import"./vendor-resize-observer-polyfill.33270fdf.js";import"./vendor-async-validator.848b42ae.js";import"./vendor-scroll-into-view-if-needed.db58d6e4.js";import"./vendor-compute-scroll-into-view.c149e421.js";import"./vendor-dayjs.0170481f.js";import"./vendor-lodash.7764c94d.js";import"./vendor-dom-align.af311697.js";import"./vendor-moment.713557f3.js";import"./vendor-vue-router.66f7893c.js";import"./vendor-pinia.add1bf4d.js";import"./vendor-vue-demi.7cc19214.js";import"./vendor-crypto-js.09a1bb0d.js";import"./vendor-axios.6837fb6a.js";import"./vendor-qs.9c6d4952.js";import"./vendor-side-channel.852f6196.js";import"./vendor-es-errors.109e7893.js";import"./vendor-object-inspect.a19339a7.js";import"./vendor-side-channel-list.4eb79c5d.js";import"./vendor-side-channel-map.78013cdc.js";import"./vendor-get-intrinsic.009e6d91.js";import"./vendor-es-object-atoms.6b93c911.js";import"./vendor-math-intrinsics.9d903a04.js";import"./vendor-gopd.6af85623.js";import"./vendor-es-define-property.e29486e3.js";import"./vendor-has-symbols.e17f832c.js";import"./vendor-get-proto.d34ed19c.js";import"./vendor-dunder-proto.d7ff28e4.js";import"./vendor-call-bind-apply-helpers.6ae1c6b0.js";import"./vendor-function-bind.db802abf.js";import"./vendor-hasown.dde58836.js";import"./vendor-call-bound.baa752e5.js";import"./vendor-side-channel-weakmap.d8f21310.js";import"./vendor-@microsoft.9e93d44a.js";import"./vendor-rxjs.db38d88b.js";import"./vendor-nprogress.9650c9fb.js";import"./vendor-@vueuse.a4ed2a82.js";import"./vendor-@iconify.af65c3a5.js";import"./vendor-vue-types.1c81418c.js";import"./vendor-path-to-regexp.a7bc300e.js";import"./vendor-moment-timezone.957ba584.js";import"./vendor-msal.027eacca.js";import"./vendor-mitt.f0b9d348.js";import"./vendor-xlsx.a360fe3f.js";import"./vendor-@zxcvbn-ts.ab4410b0.js";import"./vendor-mockjs.2339651a.js";import"./vendor-vite-plugin-mock.f7dc9ad7.js";const U=b({name:"organization-unit-members-panel",mixins:[c],props:{selectTree:l},data(){return{organizationUnitService:new h}},watch:{"selectTree.id":{handler(){this.refresh()}}},methods:{refresh(){this.$refs.table.reload()},fetchDataList(t){const{maxResultCount:e,skipCount:i,UserName:r,sorting:o}=this.$refs.table.getSearchProps();return new Promise((s,a)=>{var p;if(!this.selectTree||!this.selectTree.id){a();return}this.organizationUnitService.getPagedOrganizationUnitUsers((p=this.selectTree)==null?void 0:p.id,r,o,t?t.maxResultCount:e,t?t.skipCount:i).then(n=>{s(n)}).catch(n=>{a(n)})})},handleActionClick(t,e){switch(this.$refs.table.getSearchProps(),t){case m.CREATE:this.addUser();break;case m.DELETE:this.removeMember(e);break;case m.BULK_DELETE:this.batchDelete();break}},removeMember(t){var i,r;const e=(r=(i=this.selectTree)==null?void 0:i.id)!=null?r:"";this.organizationUnitService.removeUser(t.id,e).then(()=>{this.notify.success(this.l("SuccessfullyDeleted")),this.$refs.table.getDataSource().length<=1?this.$refs.table.reloadGoFirstPage():this.refresh()})},batchDelete(){const t=this.$refs.table,e=t.getSelectRowKeys().length;if(e<=0){this.message.warn(this.l("PleaseSelectAtLeastOneItem"));return}this.message.confirm(this.l("ConfirmDeleteXItemsWarningMessage",e),"",i=>{var r,o;if(i){const s=(o=(r=this.selectTree)==null?void 0:r.id)!=null?o:"";this.organizationUnitService.batchRemoveUserFromOrganizationUnit(s,t.getSelectRowKeys()).then(()=>{this.notify.success(this.l("SuccessfullyDeleted")),this.$refs.table.getDataSource().length<=e?this.$refs.table.reloadGoFirstPage():this.refresh()})}})},addUser(){var t,e;this.modalHelper.create(f,{organizationUnitId:(e=(t=this.selectTree)==null?void 0:t.id)!=null?e:""}).subscribe(i=>{i&&this.refresh()})}}});function v(t,e,i,r,o,s){const a=g("y-dynamic-table");return u(),_(a,{type:"organization-unit-members",ref:"table",class:"dynamic-table",fetch:t.fetchDataList,onActionClick:t.handleActionClick,extraHeight:48,showExport:!0},null,8,["fetch","onActionClick"])}var $t=d(U,[["render",v],["__scopeId","data-v-0151bbd8"]]);export{$t as default};
