var Y=Object.defineProperty,Z=Object.defineProperties;var tt=Object.getOwnPropertyDescriptors;var v=Object.getOwnPropertySymbols;var et=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable;var M=(l,o,n)=>o in l?Y(l,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):l[o]=n,B=(l,o)=>{for(var n in o||(o={}))et.call(o,n)&&M(l,n,o[n]);if(v)for(var n of v(o))ot.call(o,n)&&M(l,n,o[n]);return l},L=(l,o)=>Z(l,tt(o));var c=(l,o,n)=>new Promise((S,b)=>{var f=m=>{try{g(n.next(m))}catch(h){b(h)}},k=m=>{try{g(n.throw(m))}catch(h){b(h)}},g=m=>m.done?S(m.value):Promise.resolve(m.value).then(f,k);g((n=n.apply(l,o)).next())});import it from"./BasicTable-C6eG0bgK.js";import nt from"./TableAction-BiXnWkvt.js";import"./TableImg.vue_vue_type_style_index_0_lang-65ZOQtFn.js";import{aR as rt,aS as lt}from"./index-X7Y8jykP.js";import{_ as at,s as pt,c as st}from"./CategoryModal.vue_vue_type_script_setup_true_lang-BKsapJ85.js";import"./index-BDvqZ5j4.js";import{useMethods as mt}from"./useMethods-D3efiSSd.js";import{a as dt,b as ct,c as ut,d as ft,g as gt,e as A,f as ht}from"./category.api-C2m9Yu44.js";import{u as _t}from"./useListPage-CK9oQ-1O.js";import{u as Ct}from"./useModal-DaJ3Bflg.js";import"./index-CfNJyBRj.js";import{D as yt}from"./dropdown-jkliuVyN.js";import{e as U,C as bt,z as K,f as a,A as s,r as wt,u as r,K as R,y as xt,H as Rt,E as y}from"./vue-vendor-DNhG1Cve.js";import"./BasicTable.vue_vue_type_style_index_0_lang-B9DxrWas.js";import"./BasicForm-ClUSoD_-.js";import"./helper-DcLcf4v6.js";import"./index-BzChaRPg.js";import"./useAppInject-DPZGPcR3.js";import"./emoji-mart-vue-fast-R0uJEDq-.js";import"./BasicForm.vue_vue_type_style_index_0_lang-B29PWQy0.js";import"./index-DO7ZhK45.js";import"./index-ByCwbQDV.js";import"./index-Upeu4GGa.js";import"./index-C4wWpZeQ.js";import"./useTimeout-D5AmIBZw.js";import"./index-M9QP6cvf.js";import"./Skeleton-CimgOdM7.js";import"./useScrollTo-0FPEw5-K.js";import"./useIntersectionObserver-BGOgyKyu.js";import"./index-saD4h7VJ.js";import"./useBreakpoint-DXhPW7nV.js";import"./useEventListener-BRXjwk7A.js";import"./breakpointEnum-BhAg6bcX.js";import"./uniqBy--vsL0WVB.js";import"./BasicModal-xH56XuRZ.js";import"./ModalHeader-Sr8KwhJJ.js";import"./useWindowSizeFn-C-0M9_Ul.js";import"./index-CuWaQdlK.js";import"./useForm-D61zovon.js";import"./injectionKey-DPVn4AgL.js";import"./index-DSsDi_fL.js";import"./Group-UHkub2tu.js";import"./Checkbox-Dbxs4we4.js";import"./index-BuONesFs.js";import"./FormOutlined-Y84itqS0.js";import"./useTableContext-CncNVXgp.js";import"./index-DTjkSGYl.js";import"./eagerComputed-BTlOruLW.js";import"./fromPairs-Dx9PT-t0.js";import"./useMaxLevel-DE205ncc.js";import"./index-DfHu-LAS.js";import"./Group-DBzJABA_.js";import"./RadioButton-DRBix2Fq.js";import"./index-C7ckZv9Z.js";import"./DirectoryTree-nk_YTTIy.js";import"./FolderOpenOutlined-SzIPA7z0.js";import"./index-Cl-8Hzo4.js";import"./scrollTo-D49dA-9c.js";import"./operationUnit-vCu2co3e.js";import"./index-C69VKHba.js";import"./index-DklMb9Qc.js";import"./UpOutlined-B1UMbtrP.js";import"./index-DsixALRt.js";import"./dayjs-jnKD3YGS.js";import"./index-aCD42OrZ.js";import"./quarterOfYear-BU2sPnff.js";import"./index-J2mOtM3w.js";import"./dayjs-ALi1pEeb.js";import"./clickOutside-DHfwTU6R.js";import"./onMountedOrActivated-DhSdLlqP.js";import"./throttle-De_jAmBh.js";import"./uuid-CODpppBC.js";import"./sortable.esm-DJNoJSdJ.js";import"./RedoOutlined-Cq2g4Slp.js";import"./index-CeNCCWzL.js";import"./TableAction.vue_vue_type_style_index_0_lang-BIWZ0bGo.js";import"./index-fAAIzD3j.js";import"./index-DfX9t4DO.js";import"./isNumeric-DjvBa-1E.js";import"./category.constants-CeuPmr3i.js";import"./useTable-DbHE4FHE.js";import"./useApprovalSelection-D4wlWO_T.js";const St=U({name:"system-category"}),eo=U(L(B({},St),{setup(l){const o=wt([]),{handleExportXls:n,handleImportXls:S}=mt(),[b,{openModal:f}]=Ct(),{prefixCls:k,onExportXls:g,onImportXls:m,tableContext:h}=_t({designScope:"category-template",tableProps:{title:"分类字典",api:ut,columns:st,actionColumn:{width:180},formConfig:{schemas:pt},isTreeTable:!0},exportConfig:{name:"分类字典列表",url:ct},importConfig:{url:dt}}),[N,{reload:T,collapseAll:kt,updateTableDataRecord:D,findTableDataRecord:X,getDataSource:j},{rowSelection:V,selectedRowKeys:x}]=h;function F(){f(!0,{isUpdate:!1})}function H(e){return c(this,null,function*(){f(!0,{record:e,isUpdate:!0})})}function P(e){return c(this,null,function*(){yield ht({id:e.id},E)})}function z(){return c(this,null,function*(){const e=x.value.filter(t=>!t.includes("loading"));yield ft({ids:e},E)})}function E(){(x.value=[])&&T()}function O(e){f(!0,{record:e,isUpdate:!1})}function $(C){return c(this,arguments,function*({isUpdate:e,isSubAdd:t,values:i,expandedArr:_}){if(e)D(i.id,i);else if(!i.pid)T();else if(t)yield I(i.pid);else for(let d of r(_))yield I(d)})}function q(e){w(e.items)&&G()}function G(){return c(this,null,function*(){if(r(o).length>0){const e=yield gt({parentIds:r(o).join(",")});if(e.success&&e.result.records.length>0){let t=e.result.records;const i=new Map;for(let d of t){let p=d.pid;if(r(o).includes(p)){let u=i.get(p);u==null&&(u=[]),u.push(d),i.set(p,u)}}let _=i,C=d=>{d&&d.forEach(p=>{r(o).includes(p.id)&&(p.children=w(_.get(p.id)),C(p.children))})};C(j())}}})}function w(e){if(e&&e.length>0)return e.map(t=>{if(t.hasChild=="1"){let i={id:t.id+"_loadChild",name:"loading...",isLoading:!0};t.children=[i]}return t})}function J(e,t){return c(this,null,function*(){if(e){if(o.value.push(t.id),t.children.length>0&&t.children[0].isLoading){let i=yield A({pid:t.id});i&&i.length>0?t.children=w(i):(t.children=null,t.hasChild="0")}}else{let i=o.value.indexOf(t.id);i>=0&&o.value.splice(i,1)}})}function I(e){return c(this,null,function*(){let t=X(e);o.value.includes(e)||o.value.push(e);let i=yield A({pid:e});i&&i.length>0?t.children=w(i):(t.children=null,t.hasChild="0"),D(e,t)})}function Q(e){return[{label:"编辑",onClick:H.bind(null,e)},{label:"删除",popConfirm:{title:"确定删除吗?",confirm:P.bind(null,e)}},{label:"添加下级",onClick:O.bind(null,{pid:e.id})}]}return(e,t)=>{const i=R("a-button"),_=R("j-upload-button"),C=R("Icon"),d=lt,p=rt,u=yt;return K(),bt("div",null,[a(r(it),{onRegister:r(N),rowSelection:r(V),expandedRowKeys:o.value,onExpand:J,onFetchSuccess:q},{tableTitle:s(()=>[a(i,{type:"primary",preIcon:"ant-design:plus-outlined",onClick:F},{default:s(()=>[...t[0]||(t[0]=[y(" 新增",-1)])]),_:1}),a(i,{type:"primary",preIcon:"ant-design:export-outlined",onClick:r(g)},{default:s(()=>[...t[1]||(t[1]=[y(" 导出",-1)])]),_:1},8,["onClick"]),a(_,{type:"primary",preIcon:"ant-design:import-outlined",onClick:r(m)},{default:s(()=>[...t[2]||(t[2]=[y("导入",-1)])]),_:1},8,["onClick"]),r(x).length>0?(K(),xt(u,{key:0},{overlay:s(()=>[a(p,null,{default:s(()=>[a(d,{key:"1",onClick:z},{default:s(()=>[a(C,{icon:"ant-design:delete-outlined"}),t[3]||(t[3]=y(" 删除 ",-1))]),_:1})]),_:1})]),default:s(()=>[a(i,null,{default:s(()=>[t[4]||(t[4]=y("批量操作 ",-1)),a(C,{icon:"ant-design:down-outlined"})]),_:1})]),_:1})):Rt("",!0)]),action:s(({record:W})=>[a(r(nt),{actions:Q(W)},null,8,["actions"])]),_:1},8,["onRegister","rowSelection","expandedRowKeys"]),a(at,{onRegister:r(b),onSuccess:$},null,8,["onRegister"])])}}}));export{eo as default};