2 lines
6.3 KiB
JavaScript
2 lines
6.3 KiB
JavaScript
import{i as W}from"./echarts-e5otCyz6.js";import{x as H,_ as Z}from"./index-r_E2mS1x.js";import{a as $}from"./moneyLog-BGTVpcaS.js";import{B as X,b as f,l as C,a as z,w as q,o as J,j as K,I as j,X as Q,C as l,D as u,G as o,U as r,u as d,H as ee,P as te,Z as R,Y as b,O as ae,_ as oe,n as B}from"./vue-DweYBrEc.js";const ne={class:"default-main annual-report"},re={class:"report-heading"},le={class:"report-content"},se={class:"report-table-wrap"},ie={class:"report-table"},ue={class:"year-total"},ce={class:"chart-card"},me={class:"chart-card"},pe=X({name:"user/moneyLog/annualReport",__name:"annualReport",setup(ye){const{locale:F,t:e}=H.useI18n(),A=new Date().getFullYear(),m=f(A),v=f(!1),L=f(),_=f();let s,i;const k=C(()=>[e("user.moneyLog.annualReport.months.jan"),e("user.moneyLog.annualReport.months.feb"),e("user.moneyLog.annualReport.months.mar"),e("user.moneyLog.annualReport.months.apr"),e("user.moneyLog.annualReport.months.may"),e("user.moneyLog.annualReport.months.jun"),e("user.moneyLog.annualReport.months.jul"),e("user.moneyLog.annualReport.months.aug"),e("user.moneyLog.annualReport.months.sep"),e("user.moneyLog.annualReport.months.oct"),e("user.moneyLog.annualReport.months.nov"),e("user.moneyLog.annualReport.months.dec")]),U=[{key:"deposit",label:"user.moneyLog.annualReport.deposit",currency:!0},{key:"withdraw",label:"user.moneyLog.annualReport.withdraw",currency:!0},{key:"transactionDeposit",label:"user.moneyLog.annualReport.transactionDeposit",currency:!1},{key:"transactionWithdraw",label:"user.moneyLog.annualReport.transactionWithdraw",currency:!1},{key:"activePlayer",label:"user.moneyLog.annualReport.activePlayer",currency:!1},{key:"firstDeposit",label:"user.moneyLog.annualReport.firstDeposit",currency:!1},{key:"unclaimReceipt",label:"user.moneyLog.annualReport.unclaimReceipt",currency:!1},{key:"unclaimAmount",label:"user.moneyLog.annualReport.unclaimAmount",currency:!0}],S=()=>({deposit:Array(12).fill(0),withdraw:Array(12).fill(0),transactionDeposit:Array(12).fill(0),transactionWithdraw:Array(12).fill(0),activePlayer:Array(12).fill(0),firstDeposit:Array(12).fill(0),unclaimReceipt:Array(12).fill(0),unclaimAmount:Array(12).fill(0)}),x=()=>({deposit:0,withdraw:0,transactionDeposit:0,transactionWithdraw:0,activePlayer:0,firstDeposit:0,unclaimReceipt:0,unclaimAmount:0}),c=z(S()),D=z(x()),V=C(()=>Array.from({length:8},(n,t)=>A-t)),M={DEPOSIT:"deposit",WITHDRAW:"withdraw","TRANSACTION (DEPOSIT)":"transactionDeposit","TRANSACTION (WITHDRAW)":"transactionWithdraw","ACTIVE PLAYER":"activePlayer","FIRST DEPOSIT":"firstDeposit","UNCLAIM RECEIPT":"unclaimReceipt","UNCLAIM AMOUNT":"unclaimAmount"},I=n=>{const t=Number(n);return Number.isFinite(t)?t:0},Y=n=>{var h;const t=S(),p=x(),g=(n==null?void 0:n.report_table)??((h=n==null?void 0:n.data)==null?void 0:h.report_table);return Array.isArray(g)?(g.forEach(a=>{const y=M[String(a.title||"").trim().toUpperCase()];y&&(t[y]=Array.from({length:12},(O,G)=>I(a[`month_${G+1}`])),p[y]=I(a.year_total))}),{data:t,totals:p}):{data:t,totals:p}},T=(n,t)=>new Intl.NumberFormat(void 0,{minimumFractionDigits:t?2:0,maximumFractionDigits:t?2:0}).format(n),w=()=>({animationDuration:500,grid:{left:58,right:24,top:52,bottom:70},toolbox:{right:14,feature:{saveAsImage:{title:e("user.moneyLog.annualReport.download")}}},tooltip:{trigger:"axis"},xAxis:{type:"category",boundaryGap:!1,data:k.value,axisLine:{lineStyle:{color:"#d8d8d8"}},axisLabel:{color:"#777"}},yAxis:{type:"value",splitLine:{lineStyle:{color:"#ededed"}},axisLabel:{color:"#777"}},dataZoom:[{type:"slider",height:18,bottom:14,start:0,end:100},{type:"inside"}]}),E=()=>{L.value&&(s||(s=W(L.value)),s.setOption({...w(),legend:{top:10,data:[e("user.moneyLog.annualReport.deposit"),e("user.moneyLog.annualReport.withdraw")]},series:[{name:e("user.moneyLog.annualReport.deposit"),type:"line",smooth:!0,symbolSize:6,data:c.deposit,itemStyle:{color:"#32b36b"},lineStyle:{width:2},areaStyle:{color:"rgba(50, 179, 107, 0.22)"}},{name:e("user.moneyLog.annualReport.withdraw"),type:"line",smooth:!0,symbolSize:6,data:c.withdraw,itemStyle:{color:"#ef5b5b"},lineStyle:{width:2},areaStyle:{color:"rgba(239, 91, 91, 0.18)"}}]})),_.value&&(i||(i=W(_.value)),i.setOption({...w(),xAxis:{...w().xAxis,boundaryGap:!0},legend:{top:10,data:[e("user.moneyLog.annualReport.activePlayer"),e("user.moneyLog.annualReport.transactionDeposit"),e("user.moneyLog.annualReport.transactionWithdraw")]},series:[{name:e("user.moneyLog.annualReport.activePlayer"),type:"bar",data:c.activePlayer,itemStyle:{color:"#4f8edc"}},{name:e("user.moneyLog.annualReport.transactionDeposit"),type:"bar",data:c.transactionDeposit,itemStyle:{color:"#32b36b"}},{name:e("user.moneyLog.annualReport.transactionWithdraw"),type:"bar",data:c.transactionWithdraw,itemStyle:{color:"#f2b441"}}]}))},P=async()=>{v.value=!0;try{const n=await $({year:m.value}),t=Y(n.data);Object.assign(c,t.data),Object.assign(D,t.totals),await B(),E()}finally{v.value=!1}},N=()=>{s==null||s.resize(),i==null||i.resize()};return q(F,async()=>{await B(),E()}),J(()=>{window.addEventListener("resize",N),P()}),K(()=>{window.removeEventListener("resize",N),s==null||s.dispose(),i==null||i.dispose()}),(n,t)=>{const p=j("el-option"),g=j("el-select"),h=Q("loading");return l(),u("div",ne,[o("div",re,[o("h1",null,r(d(e)("user.moneyLog.annualReport.title")),1),ee(g,{modelValue:m.value,"onUpdate:modelValue":t[0]||(t[0]=a=>m.value=a),class:"year-select",onChange:P},{default:te(()=>[(l(!0),u(R,null,b(V.value,a=>(l(),ae(p,{key:a,label:a,value:a},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),oe((l(),u("div",le,[o("div",se,[o("table",ie,[o("thead",null,[o("tr",null,[t[1]||(t[1]=o("th",null,null,-1)),(l(!0),u(R,null,b(k.value,a=>(l(),u("th",{key:a},r(a),1))),128)),o("th",null,r(d(e)("user.moneyLog.annualReport.year")),1)])]),o("tbody",null,[(l(),u(R,null,b(U,a=>o("tr",{key:a.key},[o("th",null,r(d(e)(a.label)),1),(l(!0),u(R,null,b(c[a.key],(y,O)=>(l(),u("td",{key:O},r(T(y,a.currency)),1))),128)),o("td",ue,r(T(D[a.key],a.currency)),1)])),64))])])]),o("div",ce,[o("h2",null,r(m.value)+" "+r(d(e)("user.moneyLog.annualReport.depositWithdraw")),1),o("div",{ref_key:"depositChartRef",ref:L,class:"report-chart"},null,512)]),o("div",me,[o("h2",null,r(m.value)+" "+r(d(e)("user.moneyLog.annualReport.transactionActive")),1),o("div",{ref_key:"transactionChartRef",ref:_,class:"report-chart"},null,512)])])),[[h,v.value]])])}}}),Re=Z(pe,[["__scopeId","data-v-909448c8"]]);export{Re as default};
|