Files
financial_system_frontend/dist/assets/Layout-BMYa5Pan.js
T

2 lines
15 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{d as nt,u as at,k as ot,a as st,o as it,l as lt,m as rt,w as ce,c as f,b as t,n as T,p as g,q as G,s as S,e as R,F as H,v as z,t as b,x as ue,y as ct,z as ut,f as P,h as dt,g as pt,r as N,A as Y,B as u,C as vt,i as ft,D as p,j as l,G as A,H as ht,I as bt,J as mt,K as yt,E as gt}from"./index-DU2fjqYh.js";import{_ as _t}from"./_plugin-vue_export-helper-DlAUqK2U.js";const kt=["a[href]","button","input","select","textarea","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable="true"]',"[tabindex]"].join(","),Ct=o=>o.tabIndex>=0&&!o.hidden&&!o.disabled&&!o.ariaHidden&&!o.ariaDisabled&&o.display!=="none"&&o.visibility!=="hidden"&&o.rendered,Et=(o,s,d)=>s<=0?-1:o<0?d?s-1:0:d?(o-1+s)%s:(o+1)%s,St=o=>{const s=o.ownerDocument.defaultView,d=s==null?void 0:s.getComputedStyle(o);return Ct({tabIndex:o.tabIndex,hidden:o.hidden,disabled:o.hasAttribute("disabled"),ariaHidden:o.getAttribute("aria-hidden")==="true",ariaDisabled:o.getAttribute("aria-disabled")==="true",display:(d==null?void 0:d.display)||"",visibility:(d==null?void 0:d.visibility)||"",rendered:o.getClientRects().length>0})},de=o=>Array.from(o.querySelectorAll(kt)).filter(St),wt=o=>{(de(o)[0]||o).focus()},Tt=(o,s)=>{var i;if(s.key!=="Tab")return!1;const d=de(o);if(s.preventDefault(),!d.length)return o.focus(),!0;const m=o.ownerDocument.activeElement,$=m instanceof HTMLElement&&o.contains(m)?d.indexOf(m):-1;return(i=d[Et($,d.length,s.shiftKey)])==null||i.focus(),!0},Nt={class:"app-shell"},At=["aria-hidden","inert"],Rt=["role","aria-modal","aria-hidden","inert"],Dt={class:"main-nav","aria-label":"主导航"},xt={key:0,class:"nav-group"},Mt={"aria-hidden":"true"},Bt={key:0,class:"nav-count"},It={key:1,class:"nav-group"},$t={"aria-hidden":"true"},Lt={class:"nav-count warning"},Ft=["open"],Ut={class:"settings-category-toggle"},Pt={class:"settings-category-children"},Ot={"aria-hidden":"true"},Wt={class:"sidebar-foot"},qt=["aria-hidden","inert"],Vt={class:"topbar"},Ht={class:"topbar-left"},zt=["aria-expanded","aria-label"],Kt={class:"breadcrumb"},jt={class:"topbar-tools"},Qt={class:"search-box"},Gt=["aria-label"],Yt={key:0,class:"notification-count","aria-hidden":"true"},Jt={class:"avatar","aria-hidden":"true"},Zt={key:0,class:"data-sync-banner",role:"status"},Xt={id:"main-content",class:"page-stage","aria-live":"polite"},en={class:"app-dialog__panel notification-dialog-panel","aria-describedby":"notification-dialog-description"},tn={class:"notification-modal-head","data-dialog-drag-handle":"",title:"拖动通知面板"},nn={id:"notification-dialog-description"},an={key:0,class:"notification-modal-body"},on={class:"notification-list","aria-label":"通知列表"},sn=["aria-label","onClick"],ln={class:"notification-item-copy"},rn={key:0,class:"notification-item-link","aria-hidden":"true"},cn={key:1,class:"notification-empty empty-state"},un={class:"notification-empty-icon","aria-hidden":"true"},dn=nt({__name:"Layout",setup(o){const s=dt(),d=pt(),m=at(),$=ot(),i=st(),h=N(!1),_=N(!1),L=N(null),J=N(null),O=N(""),pe=N(null),D=N(null),x=N([]);let M=null;const K=window.matchMedia("(max-width: 1080px)"),F=(e=!0)=>{h.value&&(h.value=!1,e&&Y(()=>{var n;return(n=J.value)==null?void 0:n.focus()}))},ve=async()=>{if(h.value){F();return}h.value=!0,await Y(),L.value&&wt(L.value)},j=()=>F(),Z=(e=K.matches)=>{_.value=e,e||F(!1)},X=e=>{if(!(!_.value||!h.value)){if(e.key==="Escape"){e.preventDefault(),F();return}L.value&&Tt(L.value,e)}},ee=e=>Z(e.matches);it(async()=>{var v,y,a;Z(),K.addEventListener("change",ee),window.addEventListener("keydown",X);const e=(v=m.userInfo)==null?void 0:v.userType;let n=!1;if(m.token)try{const C=await m.refreshToken();n=!!(e&&e!==((y=C.user)==null?void 0:y.userType))}catch{try{await m.fetchUserInfo(),n=!!(e&&e!==((a=m.userInfo)==null?void 0:a.userType))}catch{}}n&&i.reset();try{await Promise.all([m.loadPermissions(),$.loadCapabilities(m.token)])}catch{}n&&await d.replace(lt(ne,ae)),le()}),rt(()=>{K.removeEventListener("change",ee),window.removeEventListener("keydown",X)});const Q=u(()=>{var e;return((e=m.userInfo)==null?void 0:e.realName)||"用户"}),fe=e=>{const n={SUPER_ADMIN:"超级管理员",ADMIN:"系统管理员",FINANCE:"财务人员",EMPLOYEE:"员工"};if(typeof(e==null?void 0:e.isSuperAdmin)=="boolean"||Array.isArray(e==null?void 0:e.roleCodes)){const a=((e==null?void 0:e.roleCodes)||[]).map(U=>String(U).trim().toUpperCase());if((e==null?void 0:e.isSuperAdmin)===!0||a.includes("SUPER_ADMIN"))return n.SUPER_ADMIN;const C=["ADMIN","FINANCE","EMPLOYEE"].find(U=>a.includes(U));return C?n[C]:"普通用户"}const y=String((e==null?void 0:e.userType)||"").trim().toUpperCase();return n[y]||(e==null?void 0:e.userType)||"普通用户"},te=u(()=>fe(m.userInfo)),he=u(()=>{var n;return((n=s.meta)==null?void 0:n.title)||"申请中心"}),ne=e=>m.canRead(e),ae=e=>$.can(e),r=e=>bt(e,ne,ae),oe=u(()=>r("applications")?"/applications":r("applicationCreate")?"/applications/new":""),be=u(()=>r("financeReceipt")?"/finance-receipt":{path:"/finance-receipt",query:{tab:"payment"}}),me=u(()=>r("userGroups")||r("userRoles")),ye=u(()=>r("logs")),ge=u(()=>r("financeReceipt")||r("payments")),_e=u(()=>yt({expenseTypes:r("expenseTypes"),payees:r("payees"),legalEntities:r("legalEntities"),costCenters:r("costCenters"),currencies:r("currencies"),budgets:r("budgets"),paymentMethods:r("paymentMethods"),paymentAccounts:r("paymentAccounts"),integration:r("integration"),kingdee:r("kingdee"),scheduledTasks:r("scheduledTasks"),iam:me.value,directory:r("directory"),audit:ye.value},{path:s.path,tab:String(s.query.tab||"")})),ke={Applications:"applications",ApplicationNew:"applicationCreate",ApplicationDetail:"applications",ApplicationEdit:"applicationEdit"},se=u(()=>ke[String(s.name||"")]),ie=u(()=>!!se.value&&r(se.value)),le=async()=>{!ie.value||i.reimbursements.length||i.loading||await i.load()};ce(()=>s.name,()=>{le()});const Ce=u(()=>i.reimbursements.filter(e=>e.applicantName===Q.value).length),Ee=u(()=>i.reimbursements.filter(e=>e.receiptStatus==="待收单").length),Se=u(()=>i.reimbursements.filter(e=>i.balance(e)>0&&e.receiptStatus==="已收单").length),we=u(()=>Ee.value+Se.value),Te=u(()=>i.error?"同步异常":{api:"已同步",error:"同步异常",connecting:"同步中"}[i.source]),Ne=u(()=>i.error?"error":i.source),Ae=u(()=>i.source==="error"?"暂时无法同步业务数据,当前未展示业务记录。":i.error?"数据同步需要关注,请稍后重试。":i.source==="api"?"业务数据已更新。":"正在同步业务数据…"),B=u(()=>Math.max(0,Math.floor(Number(i.notifications)||0))),Re=u(()=>B.value?`打开通知(${B.value}条未读)`:"打开通知(暂无未读)"),De=()=>{O.value.trim()&&d.push({path:"/applications",query:{q:O.value.trim()}})},xe=()=>vt.alert("申请、审批、收单和付款是四个独立状态;金蝶来源单据只读,付款登记支持分次付款并保留幂等键。","平台帮助",{confirmButtonText:"知道了"}),k=(e,n)=>{const v=String(e??"").trim();return v&&v!=="undefined"&&v!=="null"?v:n},w=e=>k(e.applicationNo,`报销单 ${k(e.id,"待处理")}`),W=e=>{const n=k(e.id,"");return n?`/applications/${encodeURIComponent(n)}`:"/applications"},Me=e=>{const n=Number(e);return`¥ ${Number.isFinite(n)?n.toLocaleString("zh-CN",{minimumFractionDigits:2}):"0.00"}`},q=e=>k(e.updatedAt||e.createdAt,"刚刚"),Be=e=>r("financeReceipt")?"/finance-receipt":W(e),Ie=e=>{const n=i.reimbursements,v=[],y=a=>{v.some(C=>C.id===a.id)||v.push(a)};return n.filter(a=>a.approvalStatus==="退回").forEach(a=>y({id:`returned-${k(a.id,w(a))}`,title:"报销需要补充材料",message:`${w(a)} 已退回:${k(a.returnReason,"请查看退回原因并补充材料。")}`,time:q(a),icon:"WarningFilled",tone:"danger",route:W(a)})),n.filter(a=>["审批中","已提交"].includes(a.approvalStatus)&&a.approvalStatus!=="退回").forEach(a=>y({id:`approval-${k(a.id,w(a))}`,title:"报销审批进行中",message:`${w(a)} 正在${k(a.currentApprovalNode,"审批流程")},请留意审批进度。`,time:q(a),icon:"Refresh",tone:"pending",route:W(a)})),n.filter(a=>a.receiptStatus==="待收单").forEach(a=>y({id:`receipt-${k(a.id,w(a))}`,title:"有报销单待收单",message:`${w(a)} 已审批通过,等待财务收单。`,time:q(a),icon:"Tickets",tone:"info",route:Be(a)})),n.filter(a=>a.receiptStatus==="已收单"&&i.balance(a)>0).forEach(a=>y({id:`payment-${k(a.id,w(a))}`,title:"报销单待付款",message:`${w(a)} 已完成收单,待付款金额 ${Me(i.balance(a))}。`,time:q(a),icon:"Wallet",tone:"success",route:r("payments")?"/finance-receipt?tab=payment":W(a)})),v.slice(0,e>0?e:v.length).map((a,C)=>({...a,id:`${a.id}-${C}`}))},re=()=>{M!=null&&M.isConnected&&M.focus(),M=null},$e=()=>{x.value=[],re()},V=()=>{var e;(e=D.value)!=null&&e.open?D.value.close():re()},Le=e=>{e.target===e.currentTarget&&V()},Fe=()=>{},Ue=async()=>{var e,n,v,y;(e=D.value)!=null&&e.open||(M=document.activeElement instanceof HTMLElement?document.activeElement:null,x.value=Ie(B.value),(n=D.value)==null||n.showModal(),await Y(),(y=(v=D.value)==null?void 0:v.querySelector("[data-notification-autofocus]"))==null||y.focus())},Pe=e=>{V(),e.route&&d.push(e.route)},Oe=()=>{m.token&&ft.logout().catch(()=>{}),i.reset(),m.logout(),$.reset(),d.push("/login")};return ce(()=>s.query.denied,e=>{e&&gt.warning(`无权访问「${String(e)}」,已跳转至可访问页面`)},{immediate:!0}),(e,n)=>{const v=p("DocumentCopy"),y=p("router-link"),a=p("Tickets"),C=p("CollectionTag"),U=p("User"),We=p("Connection"),qe=p("Setting"),Ve=p("Refresh"),He=p("Memo"),ze=p("Menu"),Ke=p("Search"),je=p("QuestionFilled"),Qe=p("Bell"),Ge=p("UserFilled"),Ye=p("SwitchButton"),Je=p("router-view"),Ze=p("Close"),Xe=p("ArrowRight"),et=p("CircleCheckFilled"),tt=mt("dialog-drag");return l(),f("div",Nt,[t("a",{class:"skip-link",href:"#main-content","aria-hidden":_.value&&h.value?"true":void 0,inert:_.value&&h.value},"跳转到主内容",8,At),t("div",{class:T(["mobile-mask",{open:h.value}]),onClick:n[0]||(n[0]=c=>F()),"aria-hidden":"true"},null,2),t("aside",{id:"primary-navigation",ref_key:"sidebarElement",ref:L,class:T(["sidebar",{open:h.value}]),role:_.value&&h.value?"dialog":void 0,"aria-label":"主导航","aria-modal":_.value&&h.value?"true":void 0,"aria-hidden":_.value&&!h.value?"true":void 0,inert:_.value&&!h.value,tabindex:"-1"},[n[8]||(n[8]=t("div",{class:"brand"},[t("span",{class:"brand-mark","aria-hidden":"true"},[t("i"),t("i")]),t("span",null,[t("strong",null,"零差云控"),t("small",null,"ZEROERR")])],-1)),n[9]||(n[9]=t("div",{class:"product-name"},[t("strong",null,"费用与付款"),t("span",null,"SPEND OPERATIONS")],-1)),t("nav",Dt,[oe.value?(l(),f("div",xt,[n[4]||(n[4]=t("span",null,"申请",-1)),g(y,{to:oe.value,onClick:j,class:T({active:S(s).path.startsWith("/applications")}),"aria-current":S(s).path.startsWith("/applications")?"page":void 0},{default:G(()=>[t("b",Mt,[g(v)]),n[3]||(n[3]=P(" 申请中心 ",-1)),r("applications")?(l(),f("i",Bt,b(Ce.value),1)):R("",!0)]),_:1},8,["to","class","aria-current"])])):R("",!0),ge.value?(l(),f("div",It,[n[6]||(n[6]=t("span",null,"财务处理",-1)),g(y,{to:be.value,onClick:j,class:T({active:S(s).path.startsWith("/finance-receipt")||S(s).path.startsWith("/payments")}),"aria-current":S(s).path.startsWith("/finance-receipt")||S(s).path.startsWith("/payments")?"page":void 0},{default:G(()=>[t("b",$t,[g(a)]),n[5]||(n[5]=P(" 财务处理中心 ",-1)),t("i",Lt,b(we.value),1)]),_:1},8,["to","class","aria-current"])])):R("",!0),(l(!0),f(H,null,z(_e.value,c=>(l(),f("div",{key:c.key,class:"nav-group admin-nav"},[t("span",null,b(c.label),1),(l(!0),f(H,null,z(c.groups,I=>(l(),f("details",{key:I.key,class:"settings-category",open:I.active||I.openByDefault},[t("summary",Ut,b(I.label),1),t("div",Pt,[(l(!0),f(H,null,z(I.children,E=>(l(),A(y,{key:E.key,to:E.to,class:T({active:E.active}),"aria-current":E.active?"page":void 0,onClick:j},{default:G(()=>[t("b",Ot,[E.icon==="expense"?(l(),A(C,{key:0})):E.icon==="payee"?(l(),A(U,{key:1})):E.icon==="integration"?(l(),A(We,{key:2})):E.icon==="people"?(l(),A(qe,{key:3})):E.icon==="tasks"?(l(),A(Ve,{key:4})):(l(),A(He,{key:5}))]),P(" "+b(E.label),1)]),_:2},1032,["to","class","aria-current"]))),128))])],8,Ft))),128))]))),128))]),t("div",Wt,[n[7]||(n[7]=t("span",{class:"status-dot"},null,-1)),t("div",null,[t("strong",null,b(Q.value),1),t("small",null,b(te.value),1)])])],10,Rt),t("div",{class:"main-area","aria-hidden":_.value&&h.value?"true":void 0,inert:_.value&&h.value},[t("header",Vt,[t("div",Ht,[t("button",{ref_key:"mobileMenuButton",ref:J,class:"icon-button mobile-menu",type:"button","aria-expanded":h.value,"aria-controls":"primary-navigation",onClick:ve,"aria-label":h.value?"关闭导航":"打开导航"},[g(ze)],8,zt),t("div",Kt,[n[10]||(n[10]=t("span",null,"统一费用付款平台",-1)),n[11]||(n[11]=t("i",null,"/",-1)),t("strong",null,b(he.value),1)])]),t("div",jt,[t("label",Qt,[g(Ke,{"aria-hidden":"true"}),ue(t("input",{"onUpdate:modelValue":n[1]||(n[1]=c=>O.value=c),type:"search",placeholder:"搜索付款申请、业务单据或收款对象","aria-label":"全局搜索",onKeyup:ut(De,["enter"])},null,544),[[ct,O.value]])]),t("button",{class:"icon-button",type:"button",onClick:xe,"aria-label":"查看帮助",title:"帮助"},[g(je)]),t("button",{ref_key:"notificationButton",ref:pe,class:"icon-button notification",onClick:Ue,"aria-label":Re.value,title:"通知"},[g(Qe,{"aria-hidden":"true"}),B.value?(l(),f("span",Yt,b(B.value>99?"99+":B.value),1)):R("",!0)],8,Gt),t("button",{class:"role-switch",type:"button",onClick:Oe,"aria-label":"退出登录"},[t("span",Jt,[g(Ge)]),t("span",null,[t("strong",null,b(Q.value),1),t("small",null,b(te.value),1)]),t("i",null,[g(Ye),n[12]||(n[12]=P(" 退出登录",-1))])])])]),ie.value?(l(),f("div",Zt,[t("span",{class:T(["source-pill",Ne.value])},b(Te.value),3),t("p",null,b(Ae.value),1),S(i).error||S(i).source==="error"?(l(),f("button",{key:0,class:"btn small",type:"button",onClick:n[2]||(n[2]=(...c)=>S(i).load&&S(i).load(...c))},"重新同步")):R("",!0)])):R("",!0),t("main",Xt,[g(Je)])],8,qt),ue((l(),f("dialog",{ref_key:"notificationDialog",ref:D,class:"app-dialog notification-dialog","aria-labelledby":"notification-dialog-title","aria-modal":"true",onClick:Le,onCancel:Fe,onClose:$e},[t("section",en,[t("header",tn,[t("div",null,[n[13]||(n[13]=t("span",{class:"eyebrow"},"NOTIFICATION CENTER",-1)),n[14]||(n[14]=t("h2",{id:"notification-dialog-title"},"通知",-1)),t("p",nn,b(x.value.length?`共 ${x.value.length} 条待关注事项`:"暂无待关注事项"),1)]),t("button",{class:"modal-close",type:"button","aria-label":"关闭通知","data-notification-autofocus":"",onClick:V},[g(Ze)])]),x.value.length?(l(),f("div",an,[t("ul",on,[(l(!0),f(H,null,z(x.value,c=>(l(),f("li",{key:c.id},[t("button",{class:T(["notification-item",{actionable:c.route}]),type:"button","aria-label":`${c.title}:${c.message}${c.route?",点击查看详情":""}`,onClick:I=>Pe(c)},[t("span",{class:T(["notification-item-icon",c.tone]),"aria-hidden":"true"},[(l(),A(ht(c.icon)))],2),t("span",ln,[t("strong",null,b(c.title),1),t("span",null,b(c.message),1),t("small",null,b(c.time),1)]),c.route?(l(),f("span",rn,[n[15]||(n[15]=P("查看 ",-1)),g(Xe)])):R("",!0)],10,sn)]))),128))])])):(l(),f("div",cn,[t("span",un,[g(et)]),n[16]||(n[16]=t("strong",null,"暂无未读通知",-1)),n[17]||(n[17]=t("span",null,"新的报销进度和付款状态会显示在这里。",-1))])),t("footer",{class:"notification-modal-actions"},[t("button",{class:"btn",type:"button",onClick:V},"关闭")])])],32)),[[tt]])])}}}),fn=_t(dn,[["__scopeId","data-v-b1f7f15e"]]);export{fn as default};