@chewel611/naive-ui-plus 0.0.50 → 0.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(C,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("naive-ui"),require("vue"),require("@vicons/antd"),require("pinia"),require("vue-router"),require("element-resize-detector"),require("vuedraggable")):typeof define=="function"&&define.amd?define(["exports","naive-ui","vue","@vicons/antd","pinia","vue-router","element-resize-detector","vuedraggable"],n):(C=typeof globalThis<"u"?globalThis:C||self,n(C.naiveplus={},C.naiveUi,C.Vue,C.antd,C.pinia,C.vueRouter,C.elementResizeDetectorMaker,C.Draggable))})(this,(function(C,n,e,T,K,I,me,ue){"use strict";const pe=t=>!t||!t.getBoundingClientRect?0:t.getBoundingClientRect(),he=t=>{const a=document.documentElement,s=a.scrollLeft,u=a.scrollTop,h=a.clientLeft,d=a.clientTop,_=window.pageXOffset,c=window.pageYOffset,E=pe(t),{left:V,top:r,width:N,height:i}=E,m=(_||s)-(h||0),x=(c||u)-(d||0),P=V+_,b=r+c,L=P-m,f=b-x,y=window.document.documentElement.clientWidth,l=window.document.documentElement.clientHeight;return{left:L,top:f,right:y-N-L,bottom:l-i-f,rightIncludeBody:y-L,bottomIncludeBody:l-f}},ge={class:"text-lg font-medium"},_e={id:"data-content"},ye={key:0,class:"rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-4 mb-4"},be=e.defineComponent({__name:"PTable",props:{title:{},idField:{default:"id"},addPermission:{},editPermission:{},deletePermission:{},columns:{},onLoad:{},onDelete:{},onAdd:{},onEdit:{},onCheckPermission:{}},setup(t,{expose:a}){const s=e.ref(null),u=n.useDialog(),h=n.useMessage(),d=e.ref(!1),_=e.ref([]),c=e.ref([]),E=e.ref(!1),V=e.ref(!1),r=e.ref(!1),N=e.ref({}),i=e.computed(()=>V.value||r.value||Object.keys(N.value).length>0),m=t,x=async g=>!g||!m.onCheckPermission?!0:await m.onCheckPermission(g)??!1;e.watch(m,async()=>{E.value=!!m.onAdd&&await x(m.addPermission),V.value=!!m.onEdit&&await x(m.editPermission),r.value=!!m.onDelete&&await x(m.deletePermission);const g=m.columns.find(w=>w.key==="action");if(g&&g.action)for(const w of g.action){if(!w.permission)continue;const B=await x(w.permission.toLowerCase());B&&(N.value[w.permission]=B)}},{immediate:!0});const P=e.computed(()=>{const g=[{type:"selection",fixed:"left"}],w=[];return m.columns.forEach(B=>{if(B.key!=="action"){g.push({title:B.title,key:B.key,width:B.width,fixed:B.fixed??!1,render:B.render,ellipsis:B.ellipsis?{tooltip:!0}:!1});return}!B.action||B.action.length<=0||!i.value||w.push({title:"操作",key:"actions",width:100,fixed:"right",render:S=>{const M=[];if(f(M,S),y(M,S),l(M,S,B.action),!(M.length<=0))return e.h(n.NDropdown,{options:M,placement:"bottom-start"},{default:()=>e.h(n.NButton,{size:"small",type:"primary"},{default:()=>["操作",e.h(n.NIcon,()=>e.h(T.MoreOutlined))]})})}})}),[...g,...i.value?w:[]]}),b=e.ref({page:1,itemCount:0,pageSize:10,pageSizes:[10,20,30,50],showSizePicker:!0,onChange:async g=>{b.value.page=g,await z()},onUpdatePageSize:async g=>{b.value.pageSize=g,await z()}}),L=e.computed(()=>{const g=e.unref(s);if(!g)return;const w=g?.$el,B=w.querySelector(".n-data-table-thead "),{bottomIncludeBody:S}=he(B),M=48;let A=12,o=25;const p=w.querySelector(".n-data-table__pagination");if(p){const $=p.offsetHeight;A+=$||0}else A+=28;return S-(M+A+o)}),f=async(g,w)=>{V.value&&g.push({label:"编辑",key:"edit",icon:()=>e.h(n.NIcon,null,{default:()=>e.h(T.EditOutlined)}),props:{onClick:async()=>await m.onEdit(w)}})},y=async(g,w)=>{r.value&&g.push({label:"删除",key:"delete",icon:()=>e.h(n.NIcon,null,{default:()=>e.h(T.DeleteOutlined)}),props:{onClick:()=>H(w)}})},l=(g,w,B)=>{if(B)for(const S of B){if(S.key==="edit"||S.key==="delete"||!S.permission||!N.value[S.permission])return;g.push({label:S.name,key:S.key,icon:S.icon&&(()=>e.h(n.NIcon,null,{default:()=>e.h(S.icon)})),props:{onClick:()=>S.action(w)}})}},D=async()=>await z(),H=g=>F([g]),Y=()=>{const g=j();F(g)},F=g=>{!g||g.length===0||u.warning({title:"警告",content:"删除数据不可恢复, 确认删除吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(m.onDelete)try{await m.onDelete(g)?(z(),h.success("删除成功")):h.error("删除失败")}catch(w){h.error(w.message)}}})},z=async()=>{if(m.onLoad&&!d.value){d.value=!0;try{var{items:g,totalCount:w}=await m.onLoad(b.value.page,b.value.pageSize);c.value=g,b.value.itemCount=w}catch(B){h.error(B.message)}finally{d.value=!1}}},j=()=>_.value?c.value.filter(g=>_.value.includes(g.id)).map(g=>e.toRaw(g)):[],X=()=>j()[0],J=()=>e.toRaw(c.value);return e.onMounted(async()=>await z()),a({getData:J,getSelectedRow:X,getSelectedRows:j,refreshData:z,resetPage:()=>{b.value.page=1}}),(g,w)=>{const B=n.NTooltip,S=n.NSpace,M=n.NDataTable;return e.openBlock(),e.createBlock(e.unref(n.NCard),{bordered:!1},{header:e.withCtx(()=>[e.createVNode(S,{justify:"space-between",align:"center",class:"w-full"},{default:e.withCtx(()=>[e.createElementVNode("span",ge,e.toDisplayString(t.title),1),e.createVNode(S,null,{default:e.withCtx(()=>[E.value?(e.openBlock(),e.createBlock(B,{key:0,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(n.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:m.onAdd},{default:e.withCtx(()=>[e.createVNode(e.unref(T.PlusSquareOutlined))]),_:1},8,["onClick"])]),default:e.withCtx(()=>[w[1]||(w[1]=e.createElementVNode("span",null,"新增",-1))]),_:1})):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(B,{key:1,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(n.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:Y},{default:e.withCtx(()=>[e.createVNode(e.unref(T.DeleteOutlined))]),_:1})]),default:e.withCtx(()=>[w[2]||(w[2]=e.createElementVNode("span",null,"删除",-1))]),_:1})):e.createCommentVNode("",!0),e.createVNode(B,{trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(n.NIcon),{size:"18",class:"cursor-pointer hover:text-blue-600",onClick:D},{default:e.withCtx(()=>[e.createVNode(e.unref(T.ReloadOutlined))]),_:1})]),default:e.withCtx(()=>[w[3]||(w[3]=e.createElementVNode("span",null,"刷新",-1))]),_:1})]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",_e,[g.$slots.toolbar?(e.openBlock(),e.createElementBlock("div",ye,[e.renderSlot(g.$slots,"toolbar")])):e.createCommentVNode("",!0),e.createVNode(M,{remote:"",ref_key:"$table",ref:s,"checked-row-keys":_.value,"onUpdate:checkedRowKeys":w[0]||(w[0]=A=>_.value=A),"max-height":L.value,loading:d.value,bordered:!1,"single-line":!1,columns:P.value,data:c.value,pagination:b.value,"row-key":A=>A[t.idField]},null,8,["checked-row-keys","max-height","loading","columns","data","pagination","row-key"])])]),_:3})}}}),O=(t,a)=>{const s=a;return s.install=function(u){u.component(t,a)},a},Z=O("PTable",be),ke=["Redirect","RedirectSon","login"],q=K.defineStore("p-layout",()=>{const t=e.reactive({collapsed:!1,title:"输入项目名称",logo:"https://picsum.photos/id/1/100/100",avatar:"",uid:"",uname:"",tabs:[],menus:[],cacheTabs:!1,enableLanguage:!1});return{state:t,initMenus:f=>{f.sort((y,l)=>y.affix&&!l.affix?-1:!y.affix&&l.affix?1:Number(l.sort??0)-Number(y.sort??0)),t.menus=f},getMenus:()=>t.menus,initTabs:f=>{f.sort((y,l)=>y.meta.affix&&!l.meta.affix?-1:!y.meta.affix&&l.meta.affix?1:Number(l.meta.sort??0)-Number(y.meta.sort??0)),t.tabs=f},addTab:f=>ke.includes(f.name)?!1:(t.tabs?.some(l=>l.fullPath==f.fullPath)||t.tabs?.push(f),!0),getCurrentTab:()=>{const f=I.useRoute();return t.tabs.find(y=>y.fullPath==f.fullPath)},closeCurrentTab:f=>{const y=t.tabs.findIndex(l=>l.fullPath==f.fullPath);t.tabs.splice(y,1)},closeAllTabs:()=>{t.tabs=t.tabs.filter(f=>f?.meta?.affix??!1)},closeOtherTabs:f=>{t.tabs=t.tabs.filter(y=>y.fullPath==f.fullPath||(y?.meta?.affix??!1))},closeLeftTabs:f=>{const y=t.tabs.findIndex(l=>l.fullPath==f.fullPath);t.tabs=t.tabs.filter((l,D)=>D>=y||(l?.meta?.affix??!1))},closeRightTabs:f=>{const y=t.tabs.findIndex(l=>l.fullPath==f.fullPath);t.tabs=t.tabs.filter((l,D)=>D<=y||(l?.meta?.affix??!1))},collapse:()=>{t.collapsed=!t.collapsed},setTitle:f=>{t.title=f},setLogo:f=>{t.logo=f},setUser:(f,y)=>{t.uid=f,t.uname=y},setSettingPages:f=>{t.settingPages=f},setLogout:f=>{t.logout=f},enableLanguage:f=>{t.enableLanguage=f}}}),we={class:"logo"},Ce=e.defineComponent({__name:"PLogo",setup(t){const a=q();return(s,u)=>(e.openBlock(),e.createElementBlock("div",we,[e.createVNode(e.unref(n.NAvatar),{color:"var(--color-logo)",size:32,src:e.unref(a).state.logo,class:e.normalizeClass({"mr-2":!e.unref(a).state.collapsed})},null,8,["src","class"]),e.withDirectives(e.createElementVNode("h1",{class:"font-bold ease-in-out ml-2 logo-size"},e.toDisplayString(e.unref(a).state.title),513),[[e.vShow,!e.unref(a).state.collapsed]])]))}}),R=(t,a)=>{const s=t.__vccOpts||t;for(const[u,h]of a)s[u]=h;return s},Ne=R(Ce,[["__scopeId","data-v-e48aeefa"]]),Pe={translationApiUrl:"https://translate.zvo.cn/api",defaultLanguage:"chinese",currentLanguage:"",options:[],initLanguages:async()=>[],selectLanguage:async t=>{}},G=K.defineStore("language",()=>{const t=e.ref(Pe),a=async()=>(t.value.options.length===0&&(t.value.options=await t.value.initLanguages()),t.value.options);return{select:async r=>{if(t.value.currentLanguage===r)return;const N=(await a()).find(i=>i.key===r);N&&(t.value.currentLanguage=N.key,t.value.selectLanguage(N))},selectLanguageCallback:async r=>{t.value.selectLanguage=r},initLanguagesCallback:async r=>{t.value.initLanguages=r},getLanguages:a,getCurrentLanguage:async()=>{if(t.value.currentLanguage)return(await a()).find(r=>r.key===t.value.currentLanguage)},setTranslationApiUrl:r=>{t.value.translationApiUrl=r},getTranslationApiUrl:()=>t.value.translationApiUrl,getDefaultLanguage:()=>t.value.defaultLanguage?t.value.defaultLanguage:"chinese_simplified",setDefaultLanguage:r=>{(r==="Chinese"||r==="chinese")&&(r="chinese_simplified"),t.value.defaultLanguage=r}}}),xe={key:1},Q=e.defineComponent({__name:"PLanguage",setup(t){const{select:a,getLanguages:s,getCurrentLanguage:u,getDefaultLanguage:h,getTranslationApiUrl:d}=G(),_=e.ref(),c=e.ref([]),E=async r=>await a(r),V=async()=>{const r=window.translate;r&&(r.selectLanguageTag.show=!1,r.selectLanguageTag.languages=(await s()).map(N=>N.key).join(","),r.ignore.class.push("ignore-translate-flag"),r.ignore.id.push("ignore-translation"),r.language.setLocal(h()),r.request.api.translate="api/v1/translation",r.request.api.connectTest="api/v1/translation/connect-test",r.request.api.init="api/v1/translation/init",r.request.api.language="api/v1/translation/language",r.request.setHost(d()),r.request.listener.start(),r.listener.start(),r.whole.enableAll(),r.execute())};return e.onMounted(async()=>{await e.nextTick(),await V(),_.value=await u(),c.value=await s()}),(r,N)=>{const i=n.NIcon,m=n.NButton;return c.value.length>0?(e.openBlock(),e.createBlock(e.unref(n.NDropdown),{key:0,id:"ignore-translation",placement:"bottom-start",trigger:"hover",class:"flex flex-col justify-center h-full ignore",onSelect:E,options:c.value},{default:e.withCtx(()=>[e.createVNode(m,{quaternary:"",type:"info"},{default:e.withCtx(()=>[_.value?(e.openBlock(),e.createElementBlock("label",xe,e.toDisplayString(_.value?.label),1)):(e.openBlock(),e.createBlock(i,{key:0,size:"18"},{default:e.withCtx(()=>[...N[0]||(N[0]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},[e.createElementVNode("path",{d:"M478.33 433.6l-90-218a22 22 0 0 0-40.67 0l-90 218a22 22 0 1 0 40.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 0 0 458 464a22 22 0 0 0 20.32-30.4zM334.83 362L368 281.65L401.17 362z",fill:"currentColor"}),e.createElementVNode("path",{d:"M267.84 342.92a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73c39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 0 0 0-44H214V70a22 22 0 0 0-44 0v20H54a22 22 0 0 0 0 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36c-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 0 0-40.58 17c.58 1.38 14.55 34.23 52.86 83.93c.92 1.19 1.83 2.35 2.74 3.51c-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1 0 21.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59c22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z",fill:"currentColor"})],-1)])]),_:1}))]),_:1})]),_:1},8,["options"])):e.createCommentVNode("",!0)}}}),Be={class:"layout-header"},Ve={class:"layout-header-left"},Le={class:"link-text"},Se={key:1,class:"link-text"},Ee={class:"layout-header-right"},Te={key:0,class:"layout-header-trigger-min"},$e={class:"layout-header-trigger layout-header-trigger-min"},Oe={class:"layout-header-trigger layout-header-trigger-min"},De={class:"avatar"},Ie=R(e.defineComponent({__name:"PHeader",setup(t){const a=n.useMessage(),s=n.useDialog(),u=q(),h=I.useRouter(),d=I.useRoute(),_=e.inject("reloadPage"),c=P=>h.push({name:P}),E=e.computed(()=>V(d.matched)),V=P=>P.map(b=>{const L={key:b.name,label:b.meta.title,icon:b.meta.icon,meta:b.meta,disabled:b.path==="/",children:void 0};return b.children&&b.children.length>0&&(L.children=V(b.children)),L}),r=e.ref(!1),N=()=>{document.fullscreenElement?document.exitFullscreen&&(document.exitFullscreen(),r.value=!1):(document.documentElement.requestFullscreen(),r.value=!0)},i=e.computed(()=>{const P=[];return P.push({label:"退出登录",key:"logout"}),u.state.settingPages&&u.state.settingPages.length>0&&u.state.settingPages.forEach(b=>{P.push({label:b.title,key:b.route})}),P}),m=P=>{P==="logout"?x():h.push({name:P})},x=()=>{s.info({title:"提示",content:"您确定要退出登录吗",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(u.state.logout)try{await u.state.logout(),localStorage.removeItem("TABS-ROUTES"),a.error("退出成功")}catch(P){console.error(P),a.error("退出登录失败")}finally{location.reload()}else a.error("没有配置登出接口, 请配置[usePLayoutStore.logout]方法")},onNegativeClick:()=>{}})};return(P,b)=>{const L=n.NTooltip,f=n.NDivider,y=n.NAvatar;return e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("div",Ve,[e.createElementVNode("div",{class:"ml-1 layout-header-trigger layout-header-trigger-min",onClick:b[0]||(b[0]=(...l)=>e.unref(u).collapse&&e.unref(u).collapse(...l))},[e.unref(u).state.collapsed?(e.openBlock(),e.createBlock(e.unref(n.NIcon),{key:0,size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.MenuUnfoldOutlined))]),_:1})):(e.openBlock(),e.createBlock(e.unref(n.NIcon),{key:1,size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.MenuFoldOutlined))]),_:1}))]),e.createElementVNode("div",{class:"mr-1 layout-header-trigger layout-header-trigger-min",onClick:b[1]||(b[1]=(...l)=>e.unref(_)&&e.unref(_)(...l))},[e.createVNode(e.unref(n.NIcon),{size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.ReloadOutlined))]),_:1})]),e.createVNode(e.unref(n.NBreadcrumb),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,l=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l.label},[l.label?(e.openBlock(),e.createBlock(e.unref(n.NBreadcrumbItem),{key:0},{default:e.withCtx(()=>[l.children&&l.children.length?(e.openBlock(),e.createBlock(e.unref(n.NDropdown),{key:0,options:l.children,onSelect:c},{default:e.withCtx(()=>[e.createElementVNode("span",Le,[l.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(l.label),1)])]),_:2},1032,["options"])):(e.openBlock(),e.createElementBlock("span",Se,[l.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(l.label),1)]))]),_:2},1024)):e.createCommentVNode("",!0)],64))),128))]),_:1})]),e.createElementVNode("div",Ee,[e.unref(u).state.enableLanguage?(e.openBlock(),e.createElementBlock("div",Te,[e.createVNode(Q)])):e.createCommentVNode("",!0),e.createElementVNode("div",$e,[e.createVNode(L,{placement:"bottom"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(n.NIcon),{size:"18",onClick:e.withModifiers(N,["stop"])},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createBlock(e.unref(T.FullscreenExitOutlined),{key:1})):(e.openBlock(),e.createBlock(e.unref(T.FullscreenOutlined),{key:0}))]),_:1})]),default:e.withCtx(()=>[b[2]||(b[2]=e.createElementVNode("span",null,"全屏",-1))]),_:1})]),e.createElementVNode("div",Oe,[e.createVNode(e.unref(n.NDropdown),{trigger:"hover",onSelect:m,options:i.value},{default:e.withCtx(()=>[e.createElementVNode("div",De,[e.createElementVNode("span",null,e.toDisplayString(e.unref(u).state.uname),1),e.createVNode(f,{vertical:""}),e.createVNode(y,{round:"",src:e.unref(u).state.avatar},null,8,["src"])])]),_:1},8,["options"])])])])}}}),[["__scopeId","data-v-563e4e55"]]),Me={class:"mt-1"},Re=e.defineComponent({__name:"PContent",props:{loading:{type:Boolean,default:!1}},setup(t){return(a,s)=>{const u=e.resolveComponent("RouterView");return e.openBlock(),e.createElementBlock("div",Me,[t.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(u,{key:0},{default:e.withCtx(({Component:h,route:d})=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(h),{key:d.fullPath}))],1024))]),_:1}))])}}}),Ae={class:"tabs-view-main"},ze=["id","onClick","onContextmenu"],qe={class:"tabs-close"},je={class:"tabs-close-btn"},He=R(e.defineComponent({__name:"PTabs",setup(t){e.useCssVars(o=>({v4f917f8c:s.value,v1c2fb72a:u.value}));const a=n.useThemeVars(),s=e.computed(()=>a.value.cardColor),u=e.computed(()=>a.value.textColor1),h=n.useMessage(),d=I.useRoute(),_=I.useRouter(),c=e.ref(null),E=e.ref(null),V=e.ref(!1),r=q(),N=e.computed(()=>r.state.tabs),i=e.reactive({activeKey:d.fullPath,scrollable:!0,dropdownX:0,dropdownY:0,showDropdown:!1,isMultiHeaderFixed:!0,multiTabsSetting:!0}),m=["Login","Redirect","ErrorPage"],x=o=>({meta:o.meta,name:o.name,fullPath:o.fullPath??o.path,path:o.path,hash:o.hash??"",query:o.query??{},params:o.params??{}}),P=e.computed(()=>{const k=r.state.collapsed?"64px":"272px";return{left:k,width:`calc(100% - ${k})`}}),b=e.computed(()=>{const o=N.value.length<=1;return[{label:"刷新当前",key:"1",icon:()=>e.h(n.NIcon,null,{default:()=>e.h(T.ReloadOutlined)})},{label:"关闭当前",key:"2",disabled:V.value||o,icon:()=>e.h(n.NIcon,null,{default:()=>e.h(T.CloseOutlined)})},{label:"关闭其他",key:"3",disabled:o,icon:()=>e.h(n.NIcon,null,{default:()=>e.h(T.ColumnWidthOutlined)})},{label:"关闭全部",key:"4",disabled:o,icon:()=>e.h(n.NIcon,null,{default:()=>e.h(T.MinusOutlined)})}]}),L=()=>{let o=[x(d)];_.getRoutes().filter(p=>p.meta.affix).forEach(p=>{const k=x(p);o.every($=>$.name!==k.name)&&o.push(k)});try{if(r.state.cacheTabs){const p=localStorage.getItem("TABS_ROUTES");o=p?JSON.parse(p):o}}finally{return o}},f=o=>{const p=_.getRoutes();o.forEach(k=>{const $=p.find(W=>W.path===k.path);$&&(k.meta=$.meta||k.meta,k.name=$.name||k.name)}),r.state.cacheTabs&&localStorage.setItem("TABS_ROUTES",JSON.stringify(o))},y=()=>{const o=L();f(o),r.initTabs(o)},l=async o=>{if(await e.nextTick(),!c.value)return;const p=c.value.offsetWidth,k=c.value.scrollWidth;p<k?(i.scrollable=!0,o&&[...c.value.querySelectorAll(".tabs-card-scroll-item")||[]].forEach(W=>{W.id===`tag${i.activeKey.split("/").join("/")}`&&W.scrollIntoView&&W.scrollIntoView()})):i.scrollable=!1},D=o=>!(o.draggedContext.element.meta.affix||o.relatedContext.element.meta.affix),H=()=>{let o;o=me(),o.listenTo(E.value,()=>l(!0))},Y=o=>{if(!o||o.fullPath===d.fullPath)return;if(i.activeKey=o.fullPath,toString.call(o)==="[object String]"){_.replace(o).catch(console.error);return}const p=o;_.replace(p).catch(console.error)},F=(o,p)=>{o.preventDefault(),V.value=p.path==="/home",i.showDropdown=!1,e.nextTick().then(()=>{i.showDropdown=!0,i.dropdownX=o.clientX,i.dropdownY=o.clientY})},z=()=>{if(d.meta.keepAlive){var o=_.currentRoute.value.matched.find(p=>p.name==d.name);o&&o.components?.default?.name}},j=o=>{if(N.value.length===1)return h.warning("这已经是最后一页,不能再关闭了!");if(z(),r.closeCurrentTab(o),i.activeKey===o.fullPath){const p=N.value[Math.max(0,N.value.length-1)];i.activeKey=p.fullPath,_.push(p)}l()},X=o=>{const p=N.value.find(k=>k.fullPath==o.fullPath);p&&j(p)},J=o=>{r.closeOtherTabs(o),i.activeKey=o.fullPath,l()},g=()=>{r.closeAllTabs(),l()},w=e.inject("reloadPage"),B=o=>{switch(o){case"1":w();break;case"2":j(d);break;case"3":J(d);break;case"4":g();break}l(),i.showDropdown=!1},S=(o,p)=>{const k=c.value.scrollLeft,$=p>0&&k+p>=o||p<0&&k+p<=o?o:k+p;if(c.value&&c.value.scrollTo($,0),$!==o)return window.requestAnimationFrame(()=>S(o,p))},M=()=>{const o=c.value.offsetWidth,p=c.value.scrollLeft;if(!p)return;const k=p>o?p-o:0;S(k,(k-p)/20)},A=()=>{const o=c.value.offsetWidth,p=c.value.scrollWidth,k=c.value.scrollLeft;if(p-k<=o)return;const $=p-k>o*2?k+o:p-o;S($,($-k)/20)};return window.addEventListener("beforeunload",()=>{r.state.cacheTabs&&localStorage.setItem("TABS_ROUTES",JSON.stringify(N.value))}),window.addEventListener("scroll",o=>{let p=o.target.scrollTop||document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop;i.isMultiHeaderFixed=p>=64},!0),e.watch(()=>d.fullPath,o=>{m.includes(d.name)||(i.activeKey=o,r.addTab(x(d)),l(!0))},{immediate:!0}),y(),e.onMounted(()=>H()),(o,p)=>(e.openBlock(),e.createElementBlock("div",{class:"box-border tabs-view tabs-view-fix tabs-view-default-background",style:e.normalizeStyle(P.value)},[e.createElementVNode("div",Ae,[e.createElementVNode("div",{ref_key:"navWrap",ref:E,class:e.normalizeClass(["tabs-card",{"tabs-card-scrollable":i.scrollable}])},[e.createElementVNode("span",{class:e.normalizeClass(["tabs-card-prev",{"tabs-card-prev-hide":!i.scrollable}]),onClick:M},[e.createVNode(e.unref(n.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.LeftOutlined))]),_:1})],2),e.createElementVNode("span",{class:e.normalizeClass(["tabs-card-next",{"tabs-card-next-hide":!i.scrollable}]),onClick:A},[e.createVNode(e.unref(n.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.RightOutlined))]),_:1})],2),e.createElementVNode("div",{ref_key:"navScroll",ref:c,class:"tabs-card-scroll"},[e.createVNode(e.unref(ue),{animation:"300","item-key":"fullPath",class:"flex",list:N.value,move:D},{item:e.withCtx(({element:k})=>[e.createElementVNode("div",{class:e.normalizeClass(["tabs-card-scroll-item",{"active-item":i.activeKey===k.fullPath}]),id:`tag${k.fullPath.split("/").join("/")}`,onClick:e.withModifiers($=>Y(k),["stop"]),onContextmenu:$=>F($,k)},[e.createElementVNode("span",null,e.toDisplayString(k.meta.title),1),k.meta.affix?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(n.NIcon),{key:0,size:"14",onClick:e.withModifiers($=>X(k),["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(T.CloseOutlined))]),_:1},8,["onClick"]))],42,ze)]),_:1},8,["list"])],512)],2),e.createElementVNode("div",qe,[e.createVNode(e.unref(n.NDropdown),{trigger:"hover",placement:"bottom-end",options:b.value,onSelect:B},{default:e.withCtx(()=>[e.createElementVNode("div",je,[e.createVNode(e.unref(n.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.DownOutlined))]),_:1})])]),_:1},8,["options"])]),e.createVNode(e.unref(n.NDropdown),{placement:"bottom-start",show:i.showDropdown,x:i.dropdownX,y:i.dropdownY,options:b.value,onClickoutside:p[0]||(p[0]=k=>i.showDropdown=!1),onSelect:B},null,8,["show","x","y","options"])])],4))}}),[["__scopeId","data-v-50f5202c"]]),We=e.defineComponent({__name:"PMenus",setup(t){const a=e.ref([]),s=I.useRoute(),u=I.useRouter(),h=q(),d=e.ref(s.name),_=e.ref(s.matched&&s.matched.length?s.matched.map(m=>m.name):[]),c=m=>{s.name!==m&&(/http(s)?:/.test(m)?window.open(m):u.push({name:m}))},E=m=>{if(!m)return;const x=m.find(P=>_.value.indexOf(P)===-1);_.value=x?[x]:[]},V=()=>{const m=s.matched;_.value=m.map(P=>P.name);const x=s.meta?.activeMenu||"";d.value=x||s.name},r=["/:path(.*)*","/redirect","/redirect/:path(.*)","/login","/oidc-callback"],N=(m,x=[],P=!1)=>{const b=[];if(!m||m.length===0)return b;m=m.sort((L,f)=>{let y=(f.children?.length?1:0)-(L.children?.length?1:0);return y===0&&(y=Number(L.meta?.sort??0)-Number(f.meta?.sort??0)),y});for(const L of m){if(P||L.meta?.hidden||r.includes(L.path.toLowerCase())){x.push(L.name),N(L.children||[],x,!0);continue}const f=L.children?.filter(H=>!H.meta?.hidden)||[],y=f.length===1,l=y?f[0]:L,D={key:l.name,label:l.meta?.title,affix:l.meta?.affix,sort:Number(y?L.meta?.sort??0:l.meta?.sort??0),path:l.path,redirect:l.redirect,icon:y?L.meta?.icon:l.meta?.icon,permission:l.meta?.permission,meta:l.meta,children:void 0};if(l.children&&l.children.length>0&&(D.children=N(l.children,x,P),!y&&(!D.children||D.children.length===0))){x.push(l.name);continue}x.includes(l.name)||(b.push(D),x.push(l.name))}return b},i=()=>{const m=u.getRoutes();a.value=N(m)};return e.watch(()=>s.fullPath,()=>{V()}),e.onMounted(()=>{i(),V()}),(m,x)=>(e.openBlock(),e.createBlock(e.unref(n.NMenu),{class:"h-full",inverted:"",mode:"vertical",options:a.value,collapsed:e.unref(h).state.collapsed,"collapsed-width":64,"collapsed-icon-size":20,indent:24,"expanded-keys":_.value,value:d.value,"onUpdate:value":c,"onUpdate:expandedKeys":E},null,8,["options","collapsed","expanded-keys","value"]))}}),Fe={class:"layout-content-main layout-content-main-fix"},Ke={class:"main-view main-view-fix"},Ye=R(e.defineComponent({__name:"PLayout",setup(t){const a=q(),s=e.ref(!1),u=()=>{s.value=!0,e.nextTick(()=>s.value=!1)};return e.provide("reloadPage",u),(h,d)=>{const _=n.NBackTop;return e.openBlock(),e.createBlock(e.unref(n.NLayout),{"has-sider":"",class:"layout",position:"absolute"},{default:e.withCtx(()=>[e.createVNode(e.unref(n.NLayoutSider),{class:"layout-sider",inverted:"","show-trigger":"bar",position:"absolute","collapse-mode":"width","trigger-class":"!-right-5","collapsed-trigger-class":"!-right-5",collapsed:e.unref(a).state.collapsed,"native-scrollbar":!1,"collapsed-width":64,onCollapse:e.unref(a).collapse,onExpand:e.unref(a).collapse},{default:e.withCtx(()=>[e.createVNode(e.unref(n.NFlex),{vertical:""},{default:e.withCtx(()=>[e.createVNode(Ne),e.createVNode(We)]),_:1})]),_:1},8,["collapsed","onCollapse","onExpand"]),e.createVNode(e.unref(n.NLayout),null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.NLayoutHeader),{position:"absolute"},{default:e.withCtx(()=>[e.createVNode(Ie)]),_:1}),e.createVNode(e.unref(n.NLayoutContent),{class:"layout-content layout-default-background"},{default:e.withCtx(()=>[e.createElementVNode("div",Fe,[e.createVNode(He),e.createElementVNode("div",Ke,[e.createVNode(Re,{loading:s.value},null,8,["loading"])])])]),_:1}),e.createVNode(_,{right:20,class:"z-50"})]),_:1})]),_:1})}}}),[["__scopeId","data-v-0bac2e7d"]]),Xe={};function Je(t,a){const s=e.resolveComponent("router-view");return e.openBlock(),e.createBlock(s)}const U=O("PEmptyLayout",R(Xe,[["render",Je]])),v=O("PLayout",Ye),ee=O("PApplication",e.defineComponent({__name:"PApplication",props:{theme:{},themeOverrides:{default:{common:{primaryColor:"#2d8cf0",primaryColorHover:"#3c9bff",primaryColorPressed:"#3c9bff",primaryColorSuppl:"#2d8cf0"},LoadingBar:{colorLoading:"#2d8cf0"}}}},setup(t){return(a,s)=>{const u=n.NConfigProvider;return e.openBlock(),e.createBlock(u,{locale:e.unref(n.zhCN),theme:t.theme,"theme-overrides":t.themeOverrides,"date-locale":e.unref(n.dateZhCN)},{default:e.withCtx(()=>[e.createVNode(e.unref(n.NDialogProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.NNotificationProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.NMessageProvider),null,{default:e.withCtx(()=>[e.renderSlot(a.$slots,"default")]),_:3})]),_:3})]),_:3})]),_:3},8,["locale","theme","theme-overrides","date-locale"])}}})),te=O("PModal",e.defineComponent({__name:"PModal",props:{saveBtnText:{default:"保存"},cancelBtnText:{default:"取消"},hideCancelBtn:{type:Boolean,default:!1},hideSaveBtn:{type:Boolean,default:!1},title:{},width:{default:800},height:{default:500},visible:{type:Boolean},onSave:{},onClose:{},onAfterEnter:{},onAfterLeave:{},onUpdateVisible:{}},emits:["update:visible","update:loading"],setup(t,{expose:a,emit:s}){const u=n.useMessage(),h=e.ref(!1),d=e.ref(!1),_=s,c=t,E=async()=>{try{h.value=!0,c.onSave&&await c.onSave()&&V()}catch(i){i instanceof Error&&u.error(i.message),console.error(i)}finally{h.value=!1}},V=()=>{h.value=!1,d.value=!1,_("update:visible",!1)},r=async()=>{try{d.value=!0,c.onClose?await c.onClose()&&V():V()}catch(i){u.error(i.message)}finally{d.value=!1}};return a({open:()=>{h.value=!1,d.value=!1,_("update:visible",!0)},close:V}),(i,m)=>{const x=n.NText,P=n.NButton,b=n.NSpace;return e.openBlock(),e.createBlock(e.unref(n.NModal),e.mergeProps({ref:"$modal",preset:"card"},i.$attrs,{"header-class":"bg-gray-50",show:c.visible,draggable:!0,closable:!1,"close-on-esc":!1,"mask-closable":!1,bordered:!1,style:{width:`${c.width}px`},onClose:V,onAfterEnter:c.onAfterEnter,onAfterLeave:c.onAfterLeave,onUpdateVisible:c.onUpdateVisible}),{header:e.withCtx(()=>[i.$slots.header?e.renderSlot(i.$slots,"header",{key:0}):c.title?(e.openBlock(),e.createBlock(x,{key:1},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),_:1})):e.createCommentVNode("",!0)]),"header-extra":e.withCtx(()=>[e.renderSlot(i.$slots,"header-extra")]),default:e.withCtx(()=>[e.createElementVNode("div",{class:"overflow-y-auto overflow-hidden mt-5",style:e.normalizeStyle({maxHeight:`${c.height}px`})},[e.renderSlot(i.$slots,"default")],4)]),footer:e.withCtx(()=>[e.renderSlot(i.$slots,"footer")]),action:e.withCtx(()=>[e.createVNode(b,{justify:"end"},{default:e.withCtx(()=>[c.hideSaveBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(P,{key:0,type:"primary",loading:h.value,onClick:E},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.saveBtnText),1)]),_:1},8,["loading"])),e.renderSlot(i.$slots,"action-extra"),c.hideCancelBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(P,{key:1,loading:d.value,onClick:r},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.cancelBtnText),1)]),_:1},8,["loading"]))]),_:3})]),_:3},16,["show","style","onAfterEnter","onAfterLeave","onUpdateVisible"])}}})),oe=O("PLanguage",Q),Ze=e.defineComponent({name:"Redirect",setup(){const t=I.useRoute(),a=I.useRouter();return e.onBeforeMount(()=>{const{params:s,query:u}=t,{path:h}=s;a.replace({path:"/"+(Array.isArray(h)?h.join("/"):h),query:u})}),()=>React.createElement(n.NEmpty,null)}}),ne=O("PRedirect",Ze),Ge={class:"frame"},Qe=["src"],ae=O("PIframe",R(e.defineComponent({__name:"PIframe",setup(t){const a=I.useRoute(),s=e.ref(!1),u=e.ref(null),h=e.ref("");e.unref(a.meta)?.frameSrc&&(h.value=e.unref(a.meta)?.frameSrc);function d(){s.value=!1}function _(){e.nextTick(()=>{const c=e.unref(u);if(!c)return;const E=c;E.attachEvent?E.attachEvent("onload",()=>{d()}):c.onload=()=>{d()}})}return e.onMounted(()=>{s.value=!0,_()}),(c,E)=>{const V=n.NSpin;return e.openBlock(),e.createBlock(V,{show:s.value},{default:e.withCtx(()=>[e.createElementVNode("div",Ge,[e.createElementVNode("iframe",{src:h.value,class:"frame-iframe",ref_key:"frameRef",ref:u},null,8,Qe)])]),_:1},8,["show"])}}}),[["__scopeId","data-v-161a378e"]])),Ue={class:"border border-gray-100 rounded-lg"},ve={class:"text-xl font-semibold text-gray-800"},et={class:"text-sm text-gray-500 mt-1"},le=O("PPage",e.defineComponent({__name:"PPage",props:{icon:{type:Object,required:!1,default:()=>T.AlertOutlined},title:{type:String,required:!0},subtitle:{type:String,required:!1}},setup(t){const a=t;return(s,u)=>{const h=n.NIcon,d=n.NAvatar,_=n.NSpace,c=n.NCard;return e.openBlock(),e.createElementBlock("div",Ue,[a.title?(e.openBlock(),e.createBlock(c,{key:0,class:"mb-4",bordered:!1,"content-class":"py-4"},{default:e.withCtx(()=>[e.createVNode(_,{align:"center",justify:"space-between"},{default:e.withCtx(()=>[e.createVNode(_,{align:"center",size:16},{default:e.withCtx(()=>[a.icon?(e.openBlock(),e.createBlock(d,{key:0,size:48,class:"bg-linear-to-br from-blue-500 to-indigo-600"},{default:e.withCtx(()=>[e.createVNode(h,{size:24,component:a.icon,color:"#fff"},null,8,["component"])]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",null,[e.createElementVNode("div",ve,e.toDisplayString(a.title),1),e.createElementVNode("div",et,e.toDisplayString(a.subtitle??a.title+"主页"),1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),s.$slots.search?(e.openBlock(),e.createBlock(c,{key:1,class:"mb-4","content-class":"flex flex-row gap-2",bordered:!1},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"search")]),_:3})):e.createCommentVNode("",!0),s.$slots.default?(e.openBlock(),e.createBlock(c,{key:2,"content-class":"flex flex-row gap-2 p-0!",bordered:!1},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"default")]),_:3})):e.createCommentVNode("",!0)])}}})),tt={},ot={class:"flex flex-col justify-center page-container"};function nt(t,a){const s=n.NResult;return e.openBlock(),e.createElementBlock("div",ot,[e.createVNode(s,{status:"500",title:"服务器错误",description:"抱歉,服务器出错了"})])}const at=R(tt,[["render",nt],["__scopeId","data-v-89cb65c7"]]),lt={},st={class:"flex flex-col justify-center page-container"};function rt(t,a){const s=n.NResult;return e.openBlock(),e.createElementBlock("div",st,[e.createVNode(s,{status:"404",title:"资源不存在",description:"抱歉,你访问的页面不存在"})])}const ct=R(lt,[["render",rt],["__scopeId","data-v-99232671"]]),it={},dt={class:"flex flex-col justify-center page-container"};function ft(t,a){const s=n.NResult;return e.openBlock(),e.createElementBlock("div",dt,[e.createVNode(s,{status:"403",title:"禁止访问",description:"抱歉,你无权访问该页面"})])}const mt=R(it,[["render",ft],["__scopeId","data-v-3baa9c16"]]),se=O("P500",at),re=O("P404",ct),ce=O("P403",mt),ie=K.defineStore("app-oidc",()=>{const t=e.reactive({});return{setCallback:d=>t.callback=d,callCallback:async d=>await t.callback?.(d),setError:d=>t.error=d,callError:async(d,_)=>await t.error?.(d,_)}}),ut={class:"view-auth-callback"},de=O("POidc",R(e.defineComponent({__name:"POidc",setup(t){const a=I.useRouter(),{callCallback:s,callError:u}=ie();return e.onMounted(async()=>{try{await s(a)}catch(h){await u(a,h)}}),(h,d)=>(e.openBlock(),e.createElementBlock("div",ut,[...d[0]||(d[0]=[e.createElementVNode("div",{class:"view-auth-callback-content"},[e.createElementVNode("div",{class:"view-auth-callback-spinner"},[e.createElementVNode("span",null,"正在处理登录回调...")])],-1)])]))}}),[["__scopeId","data-v-167395ae"]])),pt=Object.freeze(Object.defineProperty({__proto__:null,P403:ce,P404:re,P500:se,PApplication:ee,PEmptyLayout:U,PIframe:ae,PLanguage:oe,PLayout:v,PModal:te,POidc:de,PPage:le,PRedirect:ne,PTable:Z},Symbol.toStringTag,{value:"Module"})),fe=(t,a)=>(Object.values(pt).forEach(s=>{s.install&&t.use(s)}),a?.(),t),ht={install:fe};C.P403=ce,C.P404=re,C.P500=se,C.PApplication=ee,C.PEmptyLayout=U,C.PIframe=ae,C.PLanguage=oe,C.PLayout=v,C.PModal=te,C.POidc=de,C.PPage=le,C.PRedirect=ne,C.PTable=Z,C.default=ht,C.install=fe,C.useLanguageStore=G,C.useLayoutStore=q,C.useOidcStore=ie,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(x,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("naive-ui"),require("vue"),require("@vicons/antd"),require("pinia"),require("vue-router"),require("element-resize-detector"),require("vuedraggable")):typeof define=="function"&&define.amd?define(["exports","naive-ui","vue","@vicons/antd","pinia","vue-router","element-resize-detector","vuedraggable"],a):(x=typeof globalThis<"u"?globalThis:x||self,a(x.naiveplus={},x.naiveUi,x.Vue,x.antd,x.pinia,x.vueRouter,x.elementResizeDetectorMaker,x.Draggable))})(this,(function(x,a,e,E,F,I,me,ue){"use strict";const pe=t=>!t||!t.getBoundingClientRect?0:t.getBoundingClientRect(),he=t=>{const l=document.documentElement,n=l.scrollLeft,m=l.scrollTop,y=l.clientLeft,d=l.clientTop,h=window.pageXOffset,c=window.pageYOffset,S=pe(t),{left:V,top:r,width:P,height:i}=S,C=(h||n)-(y||0),B=(c||m)-(d||0),k=V+h,N=r+c,L=k-C,f=N-B,g=window.document.documentElement.clientWidth,s=window.document.documentElement.clientHeight;return{left:L,top:f,right:g-P-L,bottom:s-i-f,rightIncludeBody:g-L,bottomIncludeBody:s-f}},ge={class:"text-lg font-medium"},_e={id:"data-content"},ye={key:0,class:"rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-4 mb-4"},be=e.defineComponent({__name:"PTable",props:{title:{},idField:{default:"id"},addPermission:{},editPermission:{},deletePermission:{},columns:{},onLoad:{},onDelete:{},onAdd:{},onEdit:{},onCheckPermission:{}},setup(t,{expose:l}){const n=t,m=e.ref(),y=a.useDialog(),d=a.useMessage(),h=e.ref(!1),c=e.ref([]),S=e.ref([]),V=e.ref(!1),r=e.ref(!1),P=e.ref(!1),i=e.ref({}),C=e.computed(()=>r.value||P.value),B=async p=>!p||!n.onCheckPermission?!0:await n.onCheckPermission(p)??!1;e.watch(n,async()=>{V.value=!!n.onAdd&&await B(n.addPermission),r.value=!!n.onEdit&&await B(n.editPermission),P.value=!!n.onDelete&&await B(n.deletePermission);const p=n.columns.find(b=>b.key==="action");if(p&&p.action)for(const b of p.action){if(!b.permission)continue;const w=await B(b.permission.toLowerCase());w&&(i.value[b.permission]=w)}},{immediate:!0});const k=e.ref({page:1,itemCount:0,pageSize:10,pageSizes:[10,20,30,50],showSizePicker:!0,onChange:async p=>{k.value.page=p,await R()},onUpdatePageSize:async p=>{k.value.pageSize=p,await R()}}),N=e.computed(()=>{const p=e.unref(m);if(!p)return;let b=12,w=25;const T=48,z=p?.$el,o=z.querySelector(".n-data-table-thead "),{bottomIncludeBody:u}=he(o),_=z.querySelector(".n-data-table__pagination");if(_){const $=_.offsetHeight;b+=$||0}else b+=28;return u-(T+b+w)}),L=e.computed(()=>{const p=[{type:"selection",fixed:"left"}];n.columns.forEach(w=>{if(w.key!=="action"){p.push({title:w.title,key:w.key,width:w.width,fixed:w.fixed??!1,render:w.render,ellipsis:w.ellipsis?{tooltip:!0}:!1});return}});const b=n.columns.reduce((w,T)=>T.key==="action"?T:w,void 0);return(b||C.value)&&p.push({title:"操作",key:"actions",width:100,fixed:"right",render:w=>f(w,b?.action)}),p}),f=(p,b)=>{const w=[];return g(w,p),s(w,p),D(w,p,b),w.length<=0?null:e.h(a.NDropdown,{options:w,placement:"bottom-start"},{default:()=>e.h(a.NButton,{size:"small",type:"primary"},{default:()=>["操作",e.h(a.NIcon,()=>e.h(E.MoreOutlined))]})})},g=async(p,b)=>{r.value&&p.push({label:"编辑",key:"edit",icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.EditOutlined)}),props:{onClick:async()=>await n.onEdit(b)}})},s=async(p,b)=>{P.value&&p.push({label:"删除",key:"delete",icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.DeleteOutlined)}),props:{onClick:()=>K(b)}})},D=async(p,b,w)=>{if(w)for(const T of w){if(T.key==="edit"||T.key==="delete"||!T.permission||!i.value[T.permission])return;p.push({label:T.name,key:T.key,icon:T.icon&&(()=>e.h(a.NIcon,null,{default:()=>e.h(T.icon)})),props:{onClick:()=>T.action(b)}})}},q=async()=>await R(),K=p=>W([p]),Y=()=>W(j()),W=p=>{!p||p.length===0||y.warning({title:"警告",content:"删除数据不可恢复, 确认删除吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(n.onDelete)try{await n.onDelete(p)?(R(),d.success("删除成功")):d.error("删除失败")}catch(b){d.error(b.message)}}})},R=async()=>{if(n.onLoad&&!h.value){h.value=!0;try{var{items:p,totalCount:b}=await n.onLoad(k.value.page,k.value.pageSize);S.value=p,k.value.itemCount=b}catch(w){d.error(w.message)}finally{h.value=!1}}},j=()=>c.value?S.value.filter(p=>c.value.includes(p.id)).map(p=>e.toRaw(p)):[],X=()=>j()[0],J=()=>e.toRaw(S.value);return e.onMounted(async()=>await R()),l({getData:J,getSelectedRow:X,getSelectedRows:j,refreshData:R,resetPage:()=>{k.value.page=1}}),(p,b)=>{const w=a.NTooltip,T=a.NSpace,z=a.NDataTable;return e.openBlock(),e.createBlock(e.unref(a.NCard),{bordered:!1},{header:e.withCtx(()=>[e.createVNode(T,{justify:"space-between",align:"center",class:"w-full"},{default:e.withCtx(()=>[e.createElementVNode("span",ge,e.toDisplayString(t.title),1),e.createVNode(T,null,{default:e.withCtx(()=>[V.value?(e.openBlock(),e.createBlock(w,{key:0,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(a.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:n.onAdd},{default:e.withCtx(()=>[e.createVNode(e.unref(E.PlusSquareOutlined))]),_:1},8,["onClick"])]),default:e.withCtx(()=>[b[1]||(b[1]=e.createElementVNode("span",null,"新增",-1))]),_:1})):e.createCommentVNode("",!0),P.value?(e.openBlock(),e.createBlock(w,{key:1,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(a.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:Y},{default:e.withCtx(()=>[e.createVNode(e.unref(E.DeleteOutlined))]),_:1})]),default:e.withCtx(()=>[b[2]||(b[2]=e.createElementVNode("span",null,"删除",-1))]),_:1})):e.createCommentVNode("",!0),e.createVNode(w,{trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(a.NIcon),{size:"18",class:"cursor-pointer hover:text-blue-600",onClick:q},{default:e.withCtx(()=>[e.createVNode(e.unref(E.ReloadOutlined))]),_:1})]),default:e.withCtx(()=>[b[3]||(b[3]=e.createElementVNode("span",null,"刷新",-1))]),_:1})]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",_e,[p.$slots.toolbar?(e.openBlock(),e.createElementBlock("div",ye,[e.renderSlot(p.$slots,"toolbar")])):e.createCommentVNode("",!0),e.createVNode(z,{remote:"",ref_key:"$table",ref:m,"checked-row-keys":c.value,"onUpdate:checkedRowKeys":b[0]||(b[0]=o=>c.value=o),"max-height":N.value,loading:h.value,bordered:!1,"single-line":!1,columns:L.value,data:S.value,pagination:k.value,"row-key":o=>o[t.idField]},null,8,["checked-row-keys","max-height","loading","columns","data","pagination","row-key"])])]),_:3})}}}),O=(t,l)=>{const n=l;return n.install=function(m){m.component(t,l)},l},Z=O("PTable",be),ke=["Redirect","RedirectSon","login"],A=F.defineStore("p-layout",()=>{const t=e.reactive({collapsed:!1,title:"输入项目名称",logo:"https://picsum.photos/id/1/100/100",avatar:"",uid:"",uname:"",tabs:[],menus:[],cacheTabs:!1,enableLanguage:!1});return{state:t,initMenus:f=>{f.sort((g,s)=>g.affix&&!s.affix?-1:!g.affix&&s.affix?1:Number(s.sort??0)-Number(g.sort??0)),t.menus=f},getMenus:()=>t.menus,initTabs:f=>{f.sort((g,s)=>g.meta.affix&&!s.meta.affix?-1:!g.meta.affix&&s.meta.affix?1:Number(s.meta.sort??0)-Number(g.meta.sort??0)),t.tabs=f},addTab:f=>ke.includes(f.name)?!1:(t.tabs?.some(s=>s.fullPath==f.fullPath)||t.tabs?.push(f),!0),getCurrentTab:()=>{const f=I.useRoute();return t.tabs.find(g=>g.fullPath==f.fullPath)},closeCurrentTab:f=>{const g=t.tabs.findIndex(s=>s.fullPath==f.fullPath);t.tabs.splice(g,1)},closeAllTabs:()=>{t.tabs=t.tabs.filter(f=>f?.meta?.affix??!1)},closeOtherTabs:f=>{t.tabs=t.tabs.filter(g=>g.fullPath==f.fullPath||(g?.meta?.affix??!1))},closeLeftTabs:f=>{const g=t.tabs.findIndex(s=>s.fullPath==f.fullPath);t.tabs=t.tabs.filter((s,D)=>D>=g||(s?.meta?.affix??!1))},closeRightTabs:f=>{const g=t.tabs.findIndex(s=>s.fullPath==f.fullPath);t.tabs=t.tabs.filter((s,D)=>D<=g||(s?.meta?.affix??!1))},collapse:()=>{t.collapsed=!t.collapsed},setTitle:f=>{t.title=f},setLogo:f=>{t.logo=f},setUser:(f,g)=>{t.uid=f,t.uname=g},setSettingPages:f=>{t.settingPages=f},setLogout:f=>{t.logout=f},enableLanguage:f=>{t.enableLanguage=f}}}),we={class:"logo"},Ce=e.defineComponent({__name:"PLogo",setup(t){const l=A();return(n,m)=>(e.openBlock(),e.createElementBlock("div",we,[e.createVNode(e.unref(a.NAvatar),{color:"var(--color-logo)",size:32,src:e.unref(l).state.logo,class:e.normalizeClass({"mr-2":!e.unref(l).state.collapsed})},null,8,["src","class"]),e.withDirectives(e.createElementVNode("h1",{class:"font-bold ease-in-out ml-2 logo-size"},e.toDisplayString(e.unref(l).state.title),513),[[e.vShow,!e.unref(l).state.collapsed]])]))}}),M=(t,l)=>{const n=t.__vccOpts||t;for(const[m,y]of l)n[m]=y;return n},Ne=M(Ce,[["__scopeId","data-v-e48aeefa"]]),Pe={translationApiUrl:"https://translate.zvo.cn/api",defaultLanguage:"chinese",currentLanguage:"",options:[],initLanguages:async()=>[],selectLanguage:async t=>{}},G=F.defineStore("language",()=>{const t=e.ref(Pe),l=async()=>(t.value.options.length===0&&(t.value.options=await t.value.initLanguages()),t.value.options);return{select:async r=>{if(t.value.currentLanguage===r)return;const P=(await l()).find(i=>i.key===r);P&&(t.value.currentLanguage=P.key,t.value.selectLanguage(P))},selectLanguageCallback:async r=>{t.value.selectLanguage=r},initLanguagesCallback:async r=>{t.value.initLanguages=r},getLanguages:l,getCurrentLanguage:async()=>{if(t.value.currentLanguage)return(await l()).find(r=>r.key===t.value.currentLanguage)},setTranslationApiUrl:r=>{t.value.translationApiUrl=r},getTranslationApiUrl:()=>t.value.translationApiUrl,getDefaultLanguage:()=>t.value.defaultLanguage?t.value.defaultLanguage:"chinese_simplified",setDefaultLanguage:r=>{(r==="Chinese"||r==="chinese")&&(r="chinese_simplified"),t.value.defaultLanguage=r}}}),xe={key:1},Q=e.defineComponent({__name:"PLanguage",setup(t){const{select:l,getLanguages:n,getCurrentLanguage:m,getDefaultLanguage:y,getTranslationApiUrl:d}=G(),h=e.ref(),c=e.ref([]),S=async r=>await l(r),V=async()=>{const r=window.translate;r&&(r.selectLanguageTag.show=!1,r.selectLanguageTag.languages=(await n()).map(P=>P.key).join(","),r.ignore.class.push("ignore-translate-flag"),r.ignore.id.push("ignore-translation"),r.language.setLocal(y()),r.request.api.translate="api/v1/translation",r.request.api.connectTest="api/v1/translation/connect-test",r.request.api.init="api/v1/translation/init",r.request.api.language="api/v1/translation/language",r.request.setHost(d()),r.request.listener.start(),r.listener.start(),r.whole.enableAll(),r.execute())};return e.onMounted(async()=>{await e.nextTick(),await V(),h.value=await m(),c.value=await n()}),(r,P)=>{const i=a.NIcon,C=a.NButton;return c.value.length>0?(e.openBlock(),e.createBlock(e.unref(a.NDropdown),{key:0,id:"ignore-translation",placement:"bottom-start",trigger:"hover",class:"flex flex-col justify-center h-full ignore",onSelect:S,options:c.value},{default:e.withCtx(()=>[e.createVNode(C,{quaternary:"",type:"info"},{default:e.withCtx(()=>[h.value?(e.openBlock(),e.createElementBlock("label",xe,e.toDisplayString(h.value?.label),1)):(e.openBlock(),e.createBlock(i,{key:0,size:"18"},{default:e.withCtx(()=>[...P[0]||(P[0]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},[e.createElementVNode("path",{d:"M478.33 433.6l-90-218a22 22 0 0 0-40.67 0l-90 218a22 22 0 1 0 40.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 0 0 458 464a22 22 0 0 0 20.32-30.4zM334.83 362L368 281.65L401.17 362z",fill:"currentColor"}),e.createElementVNode("path",{d:"M267.84 342.92a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73c39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 0 0 0-44H214V70a22 22 0 0 0-44 0v20H54a22 22 0 0 0 0 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36c-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 0 0-40.58 17c.58 1.38 14.55 34.23 52.86 83.93c.92 1.19 1.83 2.35 2.74 3.51c-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1 0 21.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59c22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z",fill:"currentColor"})],-1)])]),_:1}))]),_:1})]),_:1},8,["options"])):e.createCommentVNode("",!0)}}}),Be={class:"layout-header"},Ve={class:"layout-header-left"},Le={class:"link-text"},Se={key:1,class:"link-text"},Ee={class:"layout-header-right"},Te={key:0,class:"layout-header-trigger-min"},$e={class:"layout-header-trigger layout-header-trigger-min"},Oe={class:"layout-header-trigger layout-header-trigger-min"},De={class:"avatar"},Ie=M(e.defineComponent({__name:"PHeader",setup(t){const l=a.useMessage(),n=a.useDialog(),m=A(),y=I.useRouter(),d=I.useRoute(),h=e.inject("reloadPage"),c=k=>y.push({name:k}),S=e.computed(()=>V(d.matched)),V=k=>k.map(N=>{const L={key:N.name,label:N.meta.title,icon:N.meta.icon,meta:N.meta,disabled:N.path==="/",children:void 0};return N.children&&N.children.length>0&&(L.children=V(N.children)),L}),r=e.ref(!1),P=()=>{document.fullscreenElement?document.exitFullscreen&&(document.exitFullscreen(),r.value=!1):(document.documentElement.requestFullscreen(),r.value=!0)},i=e.computed(()=>{const k=[];return k.push({label:"退出登录",key:"logout"}),m.state.settingPages&&m.state.settingPages.length>0&&m.state.settingPages.forEach(N=>{k.push({label:N.title,key:N.route})}),k}),C=k=>{k==="logout"?B():y.push({name:k})},B=()=>{n.info({title:"提示",content:"您确定要退出登录吗",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(m.state.logout)try{await m.state.logout(),localStorage.removeItem("TABS-ROUTES"),l.error("退出成功")}catch(k){console.error(k),l.error("退出登录失败")}finally{location.reload()}else l.error("没有配置登出接口, 请配置[usePLayoutStore.logout]方法")},onNegativeClick:()=>{}})};return(k,N)=>{const L=a.NTooltip,f=a.NDivider,g=a.NAvatar;return e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("div",Ve,[e.createElementVNode("div",{class:"ml-1 layout-header-trigger layout-header-trigger-min",onClick:N[0]||(N[0]=(...s)=>e.unref(m).collapse&&e.unref(m).collapse(...s))},[e.unref(m).state.collapsed?(e.openBlock(),e.createBlock(e.unref(a.NIcon),{key:0,size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.MenuUnfoldOutlined))]),_:1})):(e.openBlock(),e.createBlock(e.unref(a.NIcon),{key:1,size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.MenuFoldOutlined))]),_:1}))]),e.createElementVNode("div",{class:"mr-1 layout-header-trigger layout-header-trigger-min",onClick:N[1]||(N[1]=(...s)=>e.unref(h)&&e.unref(h)(...s))},[e.createVNode(e.unref(a.NIcon),{size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.ReloadOutlined))]),_:1})]),e.createVNode(e.unref(a.NBreadcrumb),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,s=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:s.label},[s.label?(e.openBlock(),e.createBlock(e.unref(a.NBreadcrumbItem),{key:0},{default:e.withCtx(()=>[s.children&&s.children.length?(e.openBlock(),e.createBlock(e.unref(a.NDropdown),{key:0,options:s.children,onSelect:c},{default:e.withCtx(()=>[e.createElementVNode("span",Le,[s.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(s.label),1)])]),_:2},1032,["options"])):(e.openBlock(),e.createElementBlock("span",Se,[s.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(s.label),1)]))]),_:2},1024)):e.createCommentVNode("",!0)],64))),128))]),_:1})]),e.createElementVNode("div",Ee,[e.unref(m).state.enableLanguage?(e.openBlock(),e.createElementBlock("div",Te,[e.createVNode(Q)])):e.createCommentVNode("",!0),e.createElementVNode("div",$e,[e.createVNode(L,{placement:"bottom"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(a.NIcon),{size:"18",onClick:e.withModifiers(P,["stop"])},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createBlock(e.unref(E.FullscreenExitOutlined),{key:1})):(e.openBlock(),e.createBlock(e.unref(E.FullscreenOutlined),{key:0}))]),_:1})]),default:e.withCtx(()=>[N[2]||(N[2]=e.createElementVNode("span",null,"全屏",-1))]),_:1})]),e.createElementVNode("div",Oe,[e.createVNode(e.unref(a.NDropdown),{trigger:"hover",onSelect:C,options:i.value},{default:e.withCtx(()=>[e.createElementVNode("div",De,[e.createElementVNode("span",null,e.toDisplayString(e.unref(m).state.uname),1),e.createVNode(f,{vertical:""}),e.createVNode(g,{round:"",src:e.unref(m).state.avatar},null,8,["src"])])]),_:1},8,["options"])])])])}}}),[["__scopeId","data-v-563e4e55"]]),Me={class:"mt-1"},Re=e.defineComponent({__name:"PContent",props:{loading:{type:Boolean,default:!1}},setup(t){return(l,n)=>{const m=e.resolveComponent("RouterView");return e.openBlock(),e.createElementBlock("div",Me,[t.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(m,{key:0},{default:e.withCtx(({Component:y,route:d})=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(y),{key:d.fullPath}))],1024))]),_:1}))])}}}),Ae={class:"tabs-view-main"},ze=["id","onClick","onContextmenu"],qe={class:"tabs-close"},je={class:"tabs-close-btn"},He=M(e.defineComponent({__name:"PTabs",setup(t){e.useCssVars(o=>({v4f917f8c:n.value,v1c2fb72a:m.value}));const l=a.useThemeVars(),n=e.computed(()=>l.value.cardColor),m=e.computed(()=>l.value.textColor1),y=a.useMessage(),d=I.useRoute(),h=I.useRouter(),c=e.ref(null),S=e.ref(null),V=e.ref(!1),r=A(),P=e.computed(()=>r.state.tabs),i=e.reactive({activeKey:d.fullPath,scrollable:!0,dropdownX:0,dropdownY:0,showDropdown:!1,isMultiHeaderFixed:!0,multiTabsSetting:!0}),C=["Login","Redirect","ErrorPage"],B=o=>({meta:o.meta,name:o.name,fullPath:o.fullPath??o.path,path:o.path,hash:o.hash??"",query:o.query??{},params:o.params??{}}),k=e.computed(()=>{const _=r.state.collapsed?"64px":"272px";return{left:_,width:`calc(100% - ${_})`}}),N=e.computed(()=>{const o=P.value.length<=1;return[{label:"刷新当前",key:"1",icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.ReloadOutlined)})},{label:"关闭当前",key:"2",disabled:V.value||o,icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.CloseOutlined)})},{label:"关闭其他",key:"3",disabled:o,icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.ColumnWidthOutlined)})},{label:"关闭全部",key:"4",disabled:o,icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.MinusOutlined)})}]}),L=()=>{let o=[B(d)];h.getRoutes().filter(u=>u.meta.affix).forEach(u=>{const _=B(u);o.every($=>$.name!==_.name)&&o.push(_)});try{if(r.state.cacheTabs){const u=localStorage.getItem("TABS_ROUTES");o=u?JSON.parse(u):o}}finally{return o}},f=o=>{const u=h.getRoutes();o.forEach(_=>{const $=u.find(H=>H.path===_.path);$&&(_.meta=$.meta||_.meta,_.name=$.name||_.name)}),r.state.cacheTabs&&localStorage.setItem("TABS_ROUTES",JSON.stringify(o))},g=()=>{const o=L();f(o),r.initTabs(o)},s=async o=>{if(await e.nextTick(),!c.value)return;const u=c.value.offsetWidth,_=c.value.scrollWidth;u<_?(i.scrollable=!0,o&&[...c.value.querySelectorAll(".tabs-card-scroll-item")||[]].forEach(H=>{H.id===`tag${i.activeKey.split("/").join("/")}`&&H.scrollIntoView&&H.scrollIntoView()})):i.scrollable=!1},D=o=>!(o.draggedContext.element.meta.affix||o.relatedContext.element.meta.affix),q=()=>{let o;o=me(),o.listenTo(S.value,()=>s(!0))},K=o=>{if(!o||o.fullPath===d.fullPath)return;if(i.activeKey=o.fullPath,toString.call(o)==="[object String]"){h.replace(o).catch(console.error);return}const u=o;h.replace(u).catch(console.error)},Y=(o,u)=>{o.preventDefault(),V.value=u.path==="/home",i.showDropdown=!1,e.nextTick().then(()=>{i.showDropdown=!0,i.dropdownX=o.clientX,i.dropdownY=o.clientY})},W=()=>{if(d.meta.keepAlive){var o=h.currentRoute.value.matched.find(u=>u.name==d.name);o&&o.components?.default?.name}},R=o=>{if(P.value.length===1)return y.warning("这已经是最后一页,不能再关闭了!");if(W(),r.closeCurrentTab(o),i.activeKey===o.fullPath){const u=P.value[Math.max(0,P.value.length-1)];i.activeKey=u.fullPath,h.push(u)}s()},j=o=>{const u=P.value.find(_=>_.fullPath==o.fullPath);u&&R(u)},X=o=>{r.closeOtherTabs(o),i.activeKey=o.fullPath,s()},J=()=>{r.closeAllTabs(),s()},p=e.inject("reloadPage"),b=o=>{switch(o){case"1":p();break;case"2":R(d);break;case"3":X(d);break;case"4":J();break}s(),i.showDropdown=!1},w=(o,u)=>{const _=c.value.scrollLeft,$=u>0&&_+u>=o||u<0&&_+u<=o?o:_+u;if(c.value&&c.value.scrollTo($,0),$!==o)return window.requestAnimationFrame(()=>w(o,u))},T=()=>{const o=c.value.offsetWidth,u=c.value.scrollLeft;if(!u)return;const _=u>o?u-o:0;w(_,(_-u)/20)},z=()=>{const o=c.value.offsetWidth,u=c.value.scrollWidth,_=c.value.scrollLeft;if(u-_<=o)return;const $=u-_>o*2?_+o:u-o;w($,($-_)/20)};return window.addEventListener("beforeunload",()=>{r.state.cacheTabs&&localStorage.setItem("TABS_ROUTES",JSON.stringify(P.value))}),window.addEventListener("scroll",o=>{let u=o.target.scrollTop||document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop;i.isMultiHeaderFixed=u>=64},!0),e.watch(()=>d.fullPath,o=>{C.includes(d.name)||(i.activeKey=o,r.addTab(B(d)),s(!0))},{immediate:!0}),g(),e.onMounted(()=>q()),(o,u)=>(e.openBlock(),e.createElementBlock("div",{class:"box-border tabs-view tabs-view-fix tabs-view-default-background",style:e.normalizeStyle(k.value)},[e.createElementVNode("div",Ae,[e.createElementVNode("div",{ref_key:"navWrap",ref:S,class:e.normalizeClass(["tabs-card",{"tabs-card-scrollable":i.scrollable}])},[e.createElementVNode("span",{class:e.normalizeClass(["tabs-card-prev",{"tabs-card-prev-hide":!i.scrollable}]),onClick:T},[e.createVNode(e.unref(a.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.LeftOutlined))]),_:1})],2),e.createElementVNode("span",{class:e.normalizeClass(["tabs-card-next",{"tabs-card-next-hide":!i.scrollable}]),onClick:z},[e.createVNode(e.unref(a.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.RightOutlined))]),_:1})],2),e.createElementVNode("div",{ref_key:"navScroll",ref:c,class:"tabs-card-scroll"},[e.createVNode(e.unref(ue),{animation:"300","item-key":"fullPath",class:"flex",list:P.value,move:D},{item:e.withCtx(({element:_})=>[e.createElementVNode("div",{class:e.normalizeClass(["tabs-card-scroll-item",{"active-item":i.activeKey===_.fullPath}]),id:`tag${_.fullPath.split("/").join("/")}`,onClick:e.withModifiers($=>K(_),["stop"]),onContextmenu:$=>Y($,_)},[e.createElementVNode("span",null,e.toDisplayString(_.meta.title),1),_.meta.affix?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(a.NIcon),{key:0,size:"14",onClick:e.withModifiers($=>j(_),["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(E.CloseOutlined))]),_:1},8,["onClick"]))],42,ze)]),_:1},8,["list"])],512)],2),e.createElementVNode("div",qe,[e.createVNode(e.unref(a.NDropdown),{trigger:"hover",placement:"bottom-end",options:N.value,onSelect:b},{default:e.withCtx(()=>[e.createElementVNode("div",je,[e.createVNode(e.unref(a.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.DownOutlined))]),_:1})])]),_:1},8,["options"])]),e.createVNode(e.unref(a.NDropdown),{placement:"bottom-start",show:i.showDropdown,x:i.dropdownX,y:i.dropdownY,options:N.value,onClickoutside:u[0]||(u[0]=_=>i.showDropdown=!1),onSelect:b},null,8,["show","x","y","options"])])],4))}}),[["__scopeId","data-v-50f5202c"]]),We=e.defineComponent({__name:"PMenus",setup(t){const l=e.ref([]),n=I.useRoute(),m=I.useRouter(),y=A(),d=e.ref(n.name),h=e.ref(n.matched&&n.matched.length?n.matched.map(C=>C.name):[]),c=C=>{n.name!==C&&(/http(s)?:/.test(C)?window.open(C):m.push({name:C}))},S=C=>{if(!C)return;const B=C.find(k=>h.value.indexOf(k)===-1);h.value=B?[B]:[]},V=()=>{const C=n.matched;h.value=C.map(k=>k.name);const B=n.meta?.activeMenu||"";d.value=B||n.name},r=["/:path(.*)*","/redirect","/redirect/:path(.*)","/login","/oidc-callback"],P=(C,B=[],k=!1)=>{const N=[];if(!C||C.length===0)return N;C=C.sort((L,f)=>{let g=(f.children?.length?1:0)-(L.children?.length?1:0);return g===0&&(g=Number(L.meta?.sort??0)-Number(f.meta?.sort??0)),g});for(const L of C){if(k||L.meta?.hidden||r.includes(L.path.toLowerCase())){B.push(L.name),P(L.children||[],B,!0);continue}const f=L.children?.filter(q=>!q.meta?.hidden)||[],g=f.length===1,s=g?f[0]:L,D={key:s.name,label:s.meta?.title,affix:s.meta?.affix,sort:Number(g?L.meta?.sort??0:s.meta?.sort??0),path:s.path,redirect:s.redirect,icon:g?L.meta?.icon:s.meta?.icon,permission:s.meta?.permission,meta:s.meta,children:void 0};if(s.children&&s.children.length>0&&(D.children=P(s.children,B,k),!g&&(!D.children||D.children.length===0))){B.push(s.name);continue}B.includes(s.name)||(N.push(D),B.push(s.name))}return N},i=()=>{const C=m.getRoutes();l.value=P(C)};return e.watch(()=>n.fullPath,()=>{V()}),e.onMounted(()=>{i(),V()}),(C,B)=>(e.openBlock(),e.createBlock(e.unref(a.NMenu),{class:"h-full",inverted:"",mode:"vertical",options:l.value,collapsed:e.unref(y).state.collapsed,"collapsed-width":64,"collapsed-icon-size":20,indent:24,"expanded-keys":h.value,value:d.value,"onUpdate:value":c,"onUpdate:expandedKeys":S},null,8,["options","collapsed","expanded-keys","value"]))}}),Fe={class:"layout-content-main layout-content-main-fix"},Ke={class:"main-view main-view-fix"},Ye=M(e.defineComponent({__name:"PLayout",setup(t){const l=A(),n=e.ref(!1),m=()=>{n.value=!0,e.nextTick(()=>n.value=!1)};return e.provide("reloadPage",m),(y,d)=>{const h=a.NBackTop;return e.openBlock(),e.createBlock(e.unref(a.NLayout),{"has-sider":"",class:"layout",position:"absolute"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.NLayoutSider),{class:"layout-sider",inverted:"","show-trigger":"bar",position:"absolute","collapse-mode":"width","trigger-class":"!-right-5","collapsed-trigger-class":"!-right-5",collapsed:e.unref(l).state.collapsed,"native-scrollbar":!1,"collapsed-width":64,onCollapse:e.unref(l).collapse,onExpand:e.unref(l).collapse},{default:e.withCtx(()=>[e.createVNode(e.unref(a.NFlex),{vertical:""},{default:e.withCtx(()=>[e.createVNode(Ne),e.createVNode(We)]),_:1})]),_:1},8,["collapsed","onCollapse","onExpand"]),e.createVNode(e.unref(a.NLayout),null,{default:e.withCtx(()=>[e.createVNode(e.unref(a.NLayoutHeader),{position:"absolute"},{default:e.withCtx(()=>[e.createVNode(Ie)]),_:1}),e.createVNode(e.unref(a.NLayoutContent),{class:"layout-content layout-default-background"},{default:e.withCtx(()=>[e.createElementVNode("div",Fe,[e.createVNode(He),e.createElementVNode("div",Ke,[e.createVNode(Re,{loading:n.value},null,8,["loading"])])])]),_:1}),e.createVNode(h,{right:20,class:"z-50"})]),_:1})]),_:1})}}}),[["__scopeId","data-v-0bac2e7d"]]),Xe={};function Je(t,l){const n=e.resolveComponent("router-view");return e.openBlock(),e.createBlock(n)}const U=O("PEmptyLayout",M(Xe,[["render",Je]])),v=O("PLayout",Ye),ee=O("PApplication",e.defineComponent({__name:"PApplication",props:{theme:{},themeOverrides:{default:{common:{primaryColor:"#2d8cf0",primaryColorHover:"#3c9bff",primaryColorPressed:"#3c9bff",primaryColorSuppl:"#2d8cf0"},LoadingBar:{colorLoading:"#2d8cf0"}}}},setup(t){return(l,n)=>{const m=a.NConfigProvider;return e.openBlock(),e.createBlock(m,{locale:e.unref(a.zhCN),theme:t.theme,"theme-overrides":t.themeOverrides,"date-locale":e.unref(a.dateZhCN)},{default:e.withCtx(()=>[e.createVNode(e.unref(a.NDialogProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(a.NNotificationProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(a.NMessageProvider),null,{default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3})]),_:3})]),_:3})]),_:3},8,["locale","theme","theme-overrides","date-locale"])}}})),te=O("PModal",e.defineComponent({__name:"PModal",props:{saveBtnText:{default:"保存"},cancelBtnText:{default:"取消"},hideCancelBtn:{type:Boolean,default:!1},hideSaveBtn:{type:Boolean,default:!1},title:{},width:{default:800},height:{default:500},visible:{type:Boolean},onSave:{},onClose:{},onAfterEnter:{},onAfterLeave:{},onUpdateVisible:{}},emits:["update:visible","update:loading"],setup(t,{expose:l,emit:n}){const m=a.useMessage(),y=e.ref(!1),d=e.ref(!1),h=n,c=t,S=async()=>{try{y.value=!0,c.onSave&&await c.onSave()&&V()}catch(i){i instanceof Error&&m.error(i.message),console.error(i)}finally{y.value=!1}},V=()=>{y.value=!1,d.value=!1,h("update:visible",!1)},r=async()=>{try{d.value=!0,c.onClose?await c.onClose()&&V():V()}catch(i){m.error(i.message)}finally{d.value=!1}};return l({open:()=>{y.value=!1,d.value=!1,h("update:visible",!0)},close:V}),(i,C)=>{const B=a.NText,k=a.NButton,N=a.NSpace;return e.openBlock(),e.createBlock(e.unref(a.NModal),e.mergeProps({ref:"$modal",preset:"card"},i.$attrs,{"header-class":"bg-gray-50",show:c.visible,draggable:!0,closable:!1,"close-on-esc":!1,"mask-closable":!1,bordered:!1,style:{width:`${c.width}px`},onClose:V,onAfterEnter:c.onAfterEnter,onAfterLeave:c.onAfterLeave,onUpdateVisible:c.onUpdateVisible}),{header:e.withCtx(()=>[i.$slots.header?e.renderSlot(i.$slots,"header",{key:0}):c.title?(e.openBlock(),e.createBlock(B,{key:1},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),_:1})):e.createCommentVNode("",!0)]),"header-extra":e.withCtx(()=>[e.renderSlot(i.$slots,"header-extra")]),default:e.withCtx(()=>[e.createElementVNode("div",{class:"overflow-y-auto overflow-hidden mt-5",style:e.normalizeStyle({maxHeight:`${c.height}px`})},[e.renderSlot(i.$slots,"default")],4)]),footer:e.withCtx(()=>[e.renderSlot(i.$slots,"footer")]),action:e.withCtx(()=>[e.createVNode(N,{justify:"end"},{default:e.withCtx(()=>[c.hideSaveBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(k,{key:0,type:"primary",loading:y.value,onClick:S},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.saveBtnText),1)]),_:1},8,["loading"])),e.renderSlot(i.$slots,"action-extra"),c.hideCancelBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(k,{key:1,loading:d.value,onClick:r},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.cancelBtnText),1)]),_:1},8,["loading"]))]),_:3})]),_:3},16,["show","style","onAfterEnter","onAfterLeave","onUpdateVisible"])}}})),oe=O("PLanguage",Q),Ze=e.defineComponent({name:"Redirect",setup(){const t=I.useRoute(),l=I.useRouter();return e.onBeforeMount(()=>{const{params:n,query:m}=t,{path:y}=n;l.replace({path:"/"+(Array.isArray(y)?y.join("/"):y),query:m})}),()=>React.createElement(a.NEmpty,null)}}),ne=O("PRedirect",Ze),Ge={class:"frame"},Qe=["src"],ae=O("PIframe",M(e.defineComponent({__name:"PIframe",setup(t){const l=I.useRoute(),n=e.ref(!1),m=e.ref(null),y=e.ref("");e.unref(l.meta)?.frameSrc&&(y.value=e.unref(l.meta)?.frameSrc);function d(){n.value=!1}function h(){e.nextTick(()=>{const c=e.unref(m);if(!c)return;const S=c;S.attachEvent?S.attachEvent("onload",()=>{d()}):c.onload=()=>{d()}})}return e.onMounted(()=>{n.value=!0,h()}),(c,S)=>{const V=a.NSpin;return e.openBlock(),e.createBlock(V,{show:n.value},{default:e.withCtx(()=>[e.createElementVNode("div",Ge,[e.createElementVNode("iframe",{src:y.value,class:"frame-iframe",ref_key:"frameRef",ref:m},null,8,Qe)])]),_:1},8,["show"])}}}),[["__scopeId","data-v-161a378e"]])),Ue={class:"border border-gray-100 rounded-lg"},ve={class:"text-xl font-semibold text-gray-800"},et={class:"text-sm text-gray-500 mt-1"},le=O("PPage",e.defineComponent({__name:"PPage",props:{icon:{type:Object,required:!1,default:()=>E.AlertOutlined},title:{type:String,required:!0},subtitle:{type:String,required:!1}},setup(t){const l=t;return(n,m)=>{const y=a.NIcon,d=a.NAvatar,h=a.NSpace,c=a.NCard;return e.openBlock(),e.createElementBlock("div",Ue,[l.title?(e.openBlock(),e.createBlock(c,{key:0,class:"mb-4",bordered:!1,"content-class":"py-4"},{default:e.withCtx(()=>[e.createVNode(h,{align:"center",justify:"space-between"},{default:e.withCtx(()=>[e.createVNode(h,{align:"center",size:16},{default:e.withCtx(()=>[l.icon?(e.openBlock(),e.createBlock(d,{key:0,size:48,class:"bg-linear-to-br from-blue-500 to-indigo-600"},{default:e.withCtx(()=>[e.createVNode(y,{size:24,component:l.icon,color:"#fff"},null,8,["component"])]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",null,[e.createElementVNode("div",ve,e.toDisplayString(l.title),1),e.createElementVNode("div",et,e.toDisplayString(l.subtitle??l.title+"主页"),1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),n.$slots.search?(e.openBlock(),e.createBlock(c,{key:1,class:"mb-4","content-class":"flex flex-row gap-2",bordered:!1},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search")]),_:3})):e.createCommentVNode("",!0),n.$slots.default?(e.openBlock(),e.createBlock(c,{key:2,"content-class":"flex flex-row gap-2 p-0!",bordered:!1},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3})):e.createCommentVNode("",!0)])}}})),tt={},ot={class:"flex flex-col justify-center page-container"};function nt(t,l){const n=a.NResult;return e.openBlock(),e.createElementBlock("div",ot,[e.createVNode(n,{status:"500",title:"服务器错误",description:"抱歉,服务器出错了"})])}const at=M(tt,[["render",nt],["__scopeId","data-v-89cb65c7"]]),lt={},st={class:"flex flex-col justify-center page-container"};function rt(t,l){const n=a.NResult;return e.openBlock(),e.createElementBlock("div",st,[e.createVNode(n,{status:"404",title:"资源不存在",description:"抱歉,你访问的页面不存在"})])}const ct=M(lt,[["render",rt],["__scopeId","data-v-99232671"]]),it={},dt={class:"flex flex-col justify-center page-container"};function ft(t,l){const n=a.NResult;return e.openBlock(),e.createElementBlock("div",dt,[e.createVNode(n,{status:"403",title:"禁止访问",description:"抱歉,你无权访问该页面"})])}const mt=M(it,[["render",ft],["__scopeId","data-v-3baa9c16"]]),se=O("P500",at),re=O("P404",ct),ce=O("P403",mt),ie=F.defineStore("app-oidc",()=>{const t=e.reactive({});return{setCallback:d=>t.callback=d,callCallback:async d=>await t.callback?.(d),setError:d=>t.error=d,callError:async(d,h)=>await t.error?.(d,h)}}),ut={class:"view-auth-callback"},de=O("POidc",M(e.defineComponent({__name:"POidc",setup(t){const l=I.useRouter(),{callCallback:n,callError:m}=ie();return e.onMounted(async()=>{try{await n(l)}catch(y){await m(l,y)}}),(y,d)=>(e.openBlock(),e.createElementBlock("div",ut,[...d[0]||(d[0]=[e.createElementVNode("div",{class:"view-auth-callback-content"},[e.createElementVNode("div",{class:"view-auth-callback-spinner"},[e.createElementVNode("span",null,"正在处理登录回调...")])],-1)])]))}}),[["__scopeId","data-v-167395ae"]])),pt=Object.freeze(Object.defineProperty({__proto__:null,P403:ce,P404:re,P500:se,PApplication:ee,PEmptyLayout:U,PIframe:ae,PLanguage:oe,PLayout:v,PModal:te,POidc:de,PPage:le,PRedirect:ne,PTable:Z},Symbol.toStringTag,{value:"Module"})),fe=(t,l)=>(Object.values(pt).forEach(n=>{n.install&&t.use(n)}),l?.(),t),ht={install:fe};x.P403=ce,x.P404=re,x.P500=se,x.PApplication=ee,x.PEmptyLayout=U,x.PIframe=ae,x.PLanguage=oe,x.PLayout=v,x.PModal=te,x.POidc=de,x.PPage=le,x.PRedirect=ne,x.PTable=Z,x.default=ht,x.install=fe,x.useLanguageStore=G,x.useLayoutStore=A,x.useOidcStore=ie,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
@@ -1,11 +1,11 @@
1
- import { useDialog as X, useMessage as Y, NCard as Z, NDataTable as ee, NSpace as te, NTooltip as ne, NIcon as m, NDropdown as oe, NButton as ae } from "naive-ui";
2
- import { defineComponent as ie, ref as u, computed as E, watch as se, unref as c, onMounted as le, openBlock as C, createBlock as z, withCtx as i, createElementVNode as g, createElementBlock as re, renderSlot as ue, createCommentVNode as N, createVNode as s, toDisplayString as ce, h as l, toRaw as H } from "vue";
3
- import { getViewportOffset as de } from "../utils/helper.js";
4
- import { PlusSquareOutlined as fe, DeleteOutlined as A, ReloadOutlined as me, MoreOutlined as pe, EditOutlined as ge } from "@vicons/antd";
5
- const he = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ye = {
1
+ import { useDialog as Y, useMessage as Z, NDropdown as ee, NButton as te, NIcon as d, NCard as ne, NDataTable as oe, NSpace as ae, NTooltip as ie } from "naive-ui";
2
+ import { defineComponent as se, ref as r, computed as S, watch as le, unref as u, h as s, onMounted as re, openBlock as C, createBlock as E, withCtx as i, createElementVNode as p, createElementBlock as ue, renderSlot as ce, createCommentVNode as x, createVNode as l, toDisplayString as de, toRaw as H } from "vue";
3
+ import { getViewportOffset as fe } from "../utils/helper.js";
4
+ import { MoreOutlined as me, EditOutlined as pe, DeleteOutlined as O, PlusSquareOutlined as ge, ReloadOutlined as he } from "@vicons/antd";
5
+ const ye = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ke = {
6
6
  key: 0,
7
7
  class: "rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-4 mb-4"
8
- }, _e = /* @__PURE__ */ ie({
8
+ }, _e = /* @__PURE__ */ se({
9
9
  __name: "PTable",
10
10
  props: {
11
11
  title: {},
@@ -20,231 +20,230 @@ const he = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ye = {
20
20
  onEdit: {},
21
21
  onCheckPermission: {}
22
22
  },
23
- setup(P, { expose: T }) {
24
- const B = u(null), L = X(), h = Y(), v = u(!1), y = u([]), k = u([]), x = u(!1), _ = u(!1), w = u(!1), D = u({}), R = E(
25
- () => _.value || w.value || Object.keys(D.value).length > 0
26
- ), a = P, b = async (e) => !e || !a.onCheckPermission ? !0 : await a.onCheckPermission(e) ?? !1;
27
- se(
28
- a,
23
+ setup(P, { expose: A }) {
24
+ const o = P, z = r(), T = Y(), g = Z(), h = r(!1), y = r([]), v = r([]), N = r(!1), _ = r(!1), k = r(!1), B = r({}), L = S(
25
+ () => _.value || k.value
26
+ ), w = async (e) => !e || !o.onCheckPermission ? !0 : await o.onCheckPermission(e) ?? !1;
27
+ le(
28
+ o,
29
29
  async () => {
30
- x.value = !!a.onAdd && await b(a.addPermission), _.value = !!a.onEdit && await b(a.editPermission), w.value = !!a.onDelete && await b(a.deletePermission);
31
- const e = a.columns.find(
30
+ N.value = !!o.onAdd && await w(o.addPermission), _.value = !!o.onEdit && await w(o.editPermission), k.value = !!o.onDelete && await w(o.deletePermission);
31
+ const e = o.columns.find(
32
32
  (t) => t.key === "action"
33
33
  );
34
34
  if (e && e.action)
35
35
  for (const t of e.action) {
36
36
  if (!t.permission) continue;
37
- const n = await b(
37
+ const n = await w(
38
38
  t.permission.toLowerCase()
39
39
  );
40
- n && (D.value[t.permission] = n);
40
+ n && (B.value[t.permission] = n);
41
41
  }
42
42
  },
43
43
  { immediate: !0 }
44
44
  );
45
- const M = E(() => {
46
- const e = [{ type: "selection", fixed: "left" }], t = [];
47
- return a.columns.forEach((n) => {
48
- if (n.key !== "action") {
49
- e.push({
50
- title: n.title,
51
- key: n.key,
52
- width: n.width,
53
- fixed: n.fixed ?? !1,
54
- render: n.render,
55
- ellipsis: n.ellipsis ? { tooltip: !0 } : !1
56
- });
57
- return;
58
- }
59
- !n.action || n.action.length <= 0 || !R.value || t.push({
60
- title: "操作",
61
- key: "actions",
62
- width: 100,
63
- fixed: "right",
64
- render: (o) => {
65
- const r = [];
66
- if (j(r, o), q(r, o), I(r, o, n.action), !(r.length <= 0))
67
- return l(
68
- oe,
69
- {
70
- options: r,
71
- placement: "bottom-start"
72
- },
73
- {
74
- default: () => l(
75
- ae,
76
- { size: "small", type: "primary" },
77
- { default: () => ["操作", l(m, () => l(pe))] }
78
- )
79
- }
80
- );
81
- }
82
- });
83
- }), [...e, ...R.value ? t : []];
84
- }), d = u({
45
+ const c = r({
85
46
  page: 1,
86
47
  itemCount: 0,
87
48
  pageSize: 10,
88
49
  pageSizes: [10, 20, 30, 50],
89
50
  showSizePicker: !0,
90
51
  onChange: async (e) => {
91
- d.value.page = e, await p();
52
+ c.value.page = e, await f();
92
53
  },
93
54
  onUpdatePageSize: async (e) => {
94
- d.value.pageSize = e, await p();
55
+ c.value.pageSize = e, await f();
95
56
  }
96
- }), V = E(() => {
97
- const e = c(B);
57
+ }), M = S(() => {
58
+ const e = u(z);
98
59
  if (!e) return;
99
- const t = e?.$el, n = t.querySelector(".n-data-table-thead "), { bottomIncludeBody: o } = de(n), r = 48;
100
- let f = 12, Q = 25;
101
- const $ = t.querySelector(
60
+ let t = 12, n = 25;
61
+ const a = 48, b = e?.$el, m = b.querySelector(".n-data-table-thead "), { bottomIncludeBody: W } = fe(m), $ = b.querySelector(
102
62
  ".n-data-table__pagination"
103
63
  );
104
64
  if ($) {
105
- const W = $.offsetHeight;
106
- f += W || 0;
65
+ const X = $.offsetHeight;
66
+ t += X || 0;
107
67
  } else
108
- f += 28;
109
- return o - (r + f + Q);
110
- }), j = async (e, t) => {
68
+ t += 28;
69
+ return W - (a + t + n);
70
+ }), V = S(() => {
71
+ const e = [{ type: "selection", fixed: "left" }];
72
+ o.columns.forEach((n) => {
73
+ if (n.key !== "action") {
74
+ e.push({
75
+ title: n.title,
76
+ key: n.key,
77
+ width: n.width,
78
+ fixed: n.fixed ?? !1,
79
+ render: n.render,
80
+ ellipsis: n.ellipsis ? { tooltip: !0 } : !1
81
+ });
82
+ return;
83
+ }
84
+ });
85
+ const t = o.columns.reduce(
86
+ (n, a) => a.key === "action" ? a : n,
87
+ void 0
88
+ );
89
+ return (t || L.value) && e.push({
90
+ title: "操作",
91
+ key: "actions",
92
+ width: 100,
93
+ fixed: "right",
94
+ render: (n) => q(n, t?.action)
95
+ }), e;
96
+ }), q = (e, t) => {
97
+ const n = [];
98
+ return I(n, e), j(n, e), F(n, e, t), n.length <= 0 ? null : s(
99
+ ee,
100
+ {
101
+ options: n,
102
+ placement: "bottom-start"
103
+ },
104
+ {
105
+ default: () => s(
106
+ te,
107
+ { size: "small", type: "primary" },
108
+ { default: () => ["操作", s(d, () => s(me))] }
109
+ )
110
+ }
111
+ );
112
+ }, I = async (e, t) => {
111
113
  _.value && e.push({
112
114
  label: "编辑",
113
115
  key: "edit",
114
- icon: () => l(m, null, { default: () => l(ge) }),
115
- props: { onClick: async () => await a.onEdit(t) }
116
+ icon: () => s(d, null, { default: () => s(pe) }),
117
+ props: { onClick: async () => await o.onEdit(t) }
116
118
  });
117
- }, q = async (e, t) => {
118
- w.value && e.push({
119
+ }, j = async (e, t) => {
120
+ k.value && e.push({
119
121
  label: "删除",
120
122
  key: "delete",
121
- icon: () => l(m, null, { default: () => l(A) }),
122
- props: { onClick: () => K(t) }
123
+ icon: () => s(d, null, { default: () => s(O) }),
124
+ props: { onClick: () => U(t) }
123
125
  });
124
- }, I = (e, t, n) => {
126
+ }, F = async (e, t, n) => {
125
127
  if (n)
126
- for (const o of n) {
127
- if (o.key === "edit" || o.key === "delete" || !o.permission || !D.value[o.permission])
128
+ for (const a of n) {
129
+ if (a.key === "edit" || a.key === "delete" || !a.permission || !B.value[a.permission])
128
130
  return;
129
131
  e.push({
130
- label: o.name,
131
- key: o.key,
132
- icon: o.icon && (() => l(m, null, { default: () => l(o.icon) })),
133
- props: { onClick: () => o.action(t) }
132
+ label: a.name,
133
+ key: a.key,
134
+ icon: a.icon && (() => s(d, null, { default: () => s(a.icon) })),
135
+ props: { onClick: () => a.action(t) }
134
136
  });
135
137
  }
136
- }, F = async () => await p(), K = (e) => O([e]), U = () => {
137
- const e = S();
138
- O(e);
139
- }, O = (e) => {
140
- !e || e.length === 0 || L.warning({
138
+ }, K = async () => await f(), U = (e) => R([e]), G = () => R(D()), R = (e) => {
139
+ !e || e.length === 0 || T.warning({
141
140
  title: "警告",
142
141
  content: "删除数据不可恢复, 确认删除吗?",
143
142
  positiveText: "确定",
144
143
  negativeText: "取消",
145
144
  onPositiveClick: async () => {
146
- if (a.onDelete)
145
+ if (o.onDelete)
147
146
  try {
148
- await a.onDelete(e) ? (p(), h.success("删除成功")) : h.error("删除失败");
147
+ await o.onDelete(e) ? (f(), g.success("删除成功")) : g.error("删除失败");
149
148
  } catch (t) {
150
- h.error(t.message);
149
+ g.error(t.message);
151
150
  }
152
151
  }
153
152
  });
154
- }, p = async () => {
155
- if (a.onLoad && !v.value) {
156
- v.value = !0;
153
+ }, f = async () => {
154
+ if (o.onLoad && !h.value) {
155
+ h.value = !0;
157
156
  try {
158
- var { items: e, totalCount: t } = await a.onLoad(
159
- d.value.page,
160
- d.value.pageSize
157
+ var { items: e, totalCount: t } = await o.onLoad(
158
+ c.value.page,
159
+ c.value.pageSize
161
160
  );
162
- k.value = e, d.value.itemCount = t;
161
+ v.value = e, c.value.itemCount = t;
163
162
  } catch (n) {
164
- h.error(n.message);
163
+ g.error(n.message);
165
164
  } finally {
166
- v.value = !1;
165
+ h.value = !1;
167
166
  }
168
167
  }
169
- }, S = () => y.value ? k.value.filter((e) => y.value.includes(e.id)).map((e) => H(e)) : [], G = () => S()[0], J = () => H(k.value);
170
- return le(async () => await p()), T({
171
- getData: J,
172
- getSelectedRow: G,
173
- getSelectedRows: S,
174
- refreshData: p,
168
+ }, D = () => y.value ? v.value.filter((e) => y.value.includes(e.id)).map((e) => H(e)) : [], J = () => D()[0], Q = () => H(v.value);
169
+ return re(async () => await f()), A({
170
+ getData: Q,
171
+ getSelectedRow: J,
172
+ getSelectedRows: D,
173
+ refreshData: f,
175
174
  resetPage: () => {
176
- d.value.page = 1;
175
+ c.value.page = 1;
177
176
  }
178
177
  }), (e, t) => {
179
- const n = ne, o = te, r = ee;
180
- return C(), z(c(Z), { bordered: !1 }, {
178
+ const n = ie, a = ae, b = oe;
179
+ return C(), E(u(ne), { bordered: !1 }, {
181
180
  header: i(() => [
182
- s(o, {
181
+ l(a, {
183
182
  justify: "space-between",
184
183
  align: "center",
185
184
  class: "w-full"
186
185
  }, {
187
186
  default: i(() => [
188
- g("span", he, ce(P.title), 1),
189
- s(o, null, {
187
+ p("span", ye, de(P.title), 1),
188
+ l(a, null, {
190
189
  default: i(() => [
191
- x.value ? (C(), z(n, {
190
+ N.value ? (C(), E(n, {
192
191
  key: 0,
193
192
  trigger: "hover"
194
193
  }, {
195
194
  trigger: i(() => [
196
- s(c(m), {
195
+ l(u(d), {
197
196
  size: "18",
198
197
  class: "mr-1 cursor-pointer hover:text-blue-600",
199
- onClick: a.onAdd
198
+ onClick: o.onAdd
200
199
  }, {
201
200
  default: i(() => [
202
- s(c(fe))
201
+ l(u(ge))
203
202
  ]),
204
203
  _: 1
205
204
  }, 8, ["onClick"])
206
205
  ]),
207
206
  default: i(() => [
208
- t[1] || (t[1] = g("span", null, "新增", -1))
207
+ t[1] || (t[1] = p("span", null, "新增", -1))
209
208
  ]),
210
209
  _: 1
211
- })) : N("", !0),
212
- w.value ? (C(), z(n, {
210
+ })) : x("", !0),
211
+ k.value ? (C(), E(n, {
213
212
  key: 1,
214
213
  trigger: "hover"
215
214
  }, {
216
215
  trigger: i(() => [
217
- s(c(m), {
216
+ l(u(d), {
218
217
  size: "18",
219
218
  class: "mr-1 cursor-pointer hover:text-blue-600",
220
- onClick: U
219
+ onClick: G
221
220
  }, {
222
221
  default: i(() => [
223
- s(c(A))
222
+ l(u(O))
224
223
  ]),
225
224
  _: 1
226
225
  })
227
226
  ]),
228
227
  default: i(() => [
229
- t[2] || (t[2] = g("span", null, "删除", -1))
228
+ t[2] || (t[2] = p("span", null, "删除", -1))
230
229
  ]),
231
230
  _: 1
232
- })) : N("", !0),
233
- s(n, { trigger: "hover" }, {
231
+ })) : x("", !0),
232
+ l(n, { trigger: "hover" }, {
234
233
  trigger: i(() => [
235
- s(c(m), {
234
+ l(u(d), {
236
235
  size: "18",
237
236
  class: "cursor-pointer hover:text-blue-600",
238
- onClick: F
237
+ onClick: K
239
238
  }, {
240
239
  default: i(() => [
241
- s(c(me))
240
+ l(u(he))
242
241
  ]),
243
242
  _: 1
244
243
  })
245
244
  ]),
246
245
  default: i(() => [
247
- t[3] || (t[3] = g("span", null, "刷新", -1))
246
+ t[3] || (t[3] = p("span", null, "刷新", -1))
248
247
  ]),
249
248
  _: 1
250
249
  })
@@ -256,24 +255,24 @@ const he = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ye = {
256
255
  })
257
256
  ]),
258
257
  default: i(() => [
259
- g("div", ve, [
260
- e.$slots.toolbar ? (C(), re("div", ye, [
261
- ue(e.$slots, "toolbar")
262
- ])) : N("", !0),
263
- s(r, {
258
+ p("div", ve, [
259
+ e.$slots.toolbar ? (C(), ue("div", ke, [
260
+ ce(e.$slots, "toolbar")
261
+ ])) : x("", !0),
262
+ l(b, {
264
263
  remote: "",
265
264
  ref_key: "$table",
266
- ref: B,
265
+ ref: z,
267
266
  "checked-row-keys": y.value,
268
- "onUpdate:checkedRowKeys": t[0] || (t[0] = (f) => y.value = f),
269
- "max-height": V.value,
270
- loading: v.value,
267
+ "onUpdate:checkedRowKeys": t[0] || (t[0] = (m) => y.value = m),
268
+ "max-height": M.value,
269
+ loading: h.value,
271
270
  bordered: !1,
272
271
  "single-line": !1,
273
- columns: M.value,
274
- data: k.value,
275
- pagination: d.value,
276
- "row-key": (f) => f[P.idField]
272
+ columns: V.value,
273
+ data: v.value,
274
+ pagination: c.value,
275
+ "row-key": (m) => m[P.idField]
277
276
  }, null, 8, ["checked-row-keys", "max-height", "loading", "columns", "data", "pagination", "row-key"])
278
277
  ])
279
278
  ]),