assets/admin/build was gitignored, so servers deployed by git pull kept running a stale admin bundle — the icon picker integration in the tabbar and floating-button settings pages never reached them. Track the build directory (rebuild with: cd assets/admin && npm run build) and commit the current bundle containing the universal icon picker.
2 lines
4.2 KiB
JavaScript
2 lines
4.2 KiB
JavaScript
import{a as V}from"./shared-api.DnsQ5cxS.js";import{P as T}from"./PageHeader.CtT29f8Y.js";import{_ as U}from"./index.js";import{u as q,b as C,c as H,d as I}from"./vendor-naive.CKYCZmXD.js";import{o as L,X as w,a4 as l,a3 as n,r as f,e as P,a1 as u,W as h,f as d,a2 as j,Y as c,N as S,Z as v,a5 as W,F as X,R as Y,k as p}from"./vendor-vue.BxZIRU0_.js";import"./vendor-misc.bELTaXdf.js";const Z={class:"aksrt-page-container"},A={class:"aksrt-cap-matrix__header"},G={class:"aksrt-cap-matrix__title"},K={class:"aksrt-cap-matrix__desc"},Q={class:"aksrt-form-actions"},$={__name:"PermissionsCapabilities",setup(ee){const y=q(),g=f(!0),k=f(!1),b=f([]),x=f({}),_=P({cap_count:0,group_count:0,column_count:0}),o=P({}),N=f({});L(B);async function B(){g.value=!0;try{const e=await V.getCapabilities(),a=(e==null?void 0:e.data)||{};x.value=a.columns||{},b.value=a.groups||[],Object.assign(_,a.summary||{cap_count:0,group_count:0,column_count:0});const s={};for(const t of b.value)for(const i of t.items||[])s[i.cap_id]={...i.values||{}};O(o,s),N.value=JSON.parse(JSON.stringify(s))}catch(e){y.error((e==null?void 0:e.message)||"加载能力矩阵失败")}finally{g.value=!1}}function O(e,a){Object.keys(e).forEach(s=>delete e[s]),Object.entries(a).forEach(([s,t])=>{e[s]={...t}})}function z(e){const a=[{title:"能力项",key:"label",fixed:"left",width:280,render:t=>p("div",{class:"aksrt-cap-matrix__cap"},[p("strong",t.label),p("code",t.cap_id)])}],s=new Set;for(const t of e.items||[])for(const i of t.visible_columns||[])s.add(i);for(const t of Object.keys(x.value||{}))s.has(t)&&a.push({title:x.value[t],key:t,width:t==="level"||t==="vip"?110:100,render:i=>E(i,t)});return a}function E(e,a){var t,i;return(e.visible_columns||[]).includes(a)?(o[e.cap_id]||(o[e.cap_id]={...e.values||{}}),a==="level"||a==="vip"?p(H,{value:((t=o[e.cap_id])==null?void 0:t[a])??-1,min:-1,max:a==="level"?10:2,step:1,size:"small",style:"width: 90px",onUpdateValue:r=>J(e.cap_id,a,r??-1)}):p(I,{value:!!((i=o[e.cap_id])!=null&&i[a]),size:"small",onUpdateValue:r=>J(e.cap_id,a,r)})):p("span",{class:"aksrt-cap-matrix__empty"},"—")}function J(e,a,s){o[e]||(o[e]={}),o[e][a]=s}function M(){O(o,JSON.parse(JSON.stringify(N.value||{}))),y.info("已恢复默认矩阵")}async function D(){k.value=!0;try{await V.saveCapabilities(JSON.parse(JSON.stringify(o))),N.value=JSON.parse(JSON.stringify(o)),y.success("能力矩阵已保存")}catch(e){y.error((e==null?void 0:e.message)||"保存能力矩阵失败")}finally{k.value=!1}}return(e,a)=>{const s=u("n-button"),t=u("n-space"),i=u("n-alert"),r=u("n-card"),F=u("n-data-table"),R=u("n-spin");return h(),w("div",Z,[l(T,{title:"基本权限 / 能力矩阵",desc:"统一管理用户治理、投稿和评论的角色能力矩阵。"},{actions:n(()=>[l(t,null,{default:n(()=>[l(s,{quaternary:"",onClick:M},{default:n(()=>[...a[0]||(a[0]=[d("恢复默认",-1)])]),_:1})]),_:1})]),_:1}),l(i,{type:"warning","show-icon":!0,style:{margin:"12px 0 16px"}},{default:n(()=>[...a[1]||(a[1]=[d(" 每项能力都通过“所有人、已登录、等级、VIP、已认证”五列治理;管理员(manage_options)始终可通过。 ",-1)])]),_:1}),l(R,{show:g.value,style:{width:"100%","min-height":"240px"}},{default:n(()=>[_.cap_count?(h(),j(r,{key:0,class:"aksrt-section-card"},{default:n(()=>[a[2]||(a[2]=c("div",{class:"aksrt-section-header"},[c("h3",null,"矩阵概览")],-1)),l(t,null,{default:n(()=>[l(S(C),{round:"",type:"info"},{default:n(()=>[d("能力项:"+v(_.cap_count),1)]),_:1}),l(S(C),{round:"",type:"info"},{default:n(()=>[d("分组:"+v(_.group_count),1)]),_:1}),l(S(C),{round:"",type:"info"},{default:n(()=>[d("角色列:"+v(_.column_count),1)]),_:1})]),_:1})]),_:1})):W("",!0),(h(!0),w(X,null,Y(b.value,m=>(h(),j(r,{key:m.key,class:"aksrt-section-card"},{header:n(()=>[c("div",A,[c("div",null,[c("h3",G,v(m.title),1),c("p",K,"共 "+v(m.items.length)+" 项能力",1)])])]),default:n(()=>[l(F,{columns:z(m),data:m.items,bordered:!0,size:"small","single-line":!1,"scroll-x":1200},null,8,["columns","data"])]),_:2},1024))),128)),c("div",Q,[l(s,{type:"primary",loading:k.value,onClick:D},{default:n(()=>[...a[3]||(a[3]=[d("保存能力矩阵",-1)])]),_:1},8,["loading"])])]),_:1},8,["show"])])}}},le=U($,[["__scopeId","data-v-01a5a887"]]);export{le as default};
|