beancount-gs/public/static/js/14.f98bfe64.chunk.js

1 line
23 KiB
JavaScript
Raw Normal View History

2024-10-04 13:39:35 +00:00
(this["webpackJsonpbeancount-web"]=this["webpackJsonpbeancount-web"]||[]).push([[14],{188:function(t,e,s){"use strict";var a=s(0),n=s(5);e.a=t=>class extends a.Component{constructor(){super(...arguments),this.defaultCommodity={currency:"CNY",symbol:"\uffe5"},this.currentCommodity=window.localStorage.getItem("ledgerCurrency")}render(){return Object(n.jsx)(t,{...this.props,commodity:this.currentCommodity?JSON.parse(this.currentCommodity):this.defaultCommodity})}}},204:function(t,e,s){"use strict";var a=s(91);e.a=function(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";e=Number(e).toFixed(2);const i=Object(a.h)(t);return"Income"===i?e>0?`-${s}${Math.abs(e)} ${s?"":n}`:`+${s}${Math.abs(e)} ${s?"":n}`:"Assets"===i?e>0?`+${s}${Math.abs(e)} ${s?"":n}`:`-${s}${Math.abs(e)} ${s?"":n}`:"Expenses"===i||"Liabilities"===i?e>0?`-${s}${Math.abs(e)} ${s?"":n}`:`+${s}${Math.abs(e)} ${s?"":n}`:String(e)}},216:function(t,e,s){"use strict";var a=s(225),n=s(72),i=s.n(n),c=s(0),o=s(91),l=s(5);class h extends c.Component{constructor(){super(...arguments),this.currentYear=i()().format("YYYY"),this.currentMonth=i()().format("YYYY-M"),this.state={loading:!1,years:[this.currentYear],months:[this.currentMonth]},this.queryMonthList=()=>{this.setState({loading:!0}),Object(o.d)("/api/auth/stats/months").then((t=>{let e=Array.from(new Set(t.map((t=>t.split("-")[0]))));this.setState({months:t,years:e})})).catch(console.error).finally((()=>{this.setState({loading:!1})}))}}componentDidMount(){this.queryMonthList()}render(){return Object(l.jsxs)(a.a,{size:"small",showSearch:!0,placeholder:"\u9009\u62e9\u6708\u4efd",style:{width:"120px"},...this.props,children:[!this.props.onlyShowMonth&&Object(l.jsx)(a.a.Option,{value:"",children:"\u4e0d\u9650"}),!this.props.onlyShowMonth&&this.state.years.reverse().map((t=>Object(l.jsx)(a.a.Option,{value:t,children:i()(t).format("YYYY\u5e74")},t))),this.state.months.reverse().map((t=>Object(l.jsx)(a.a.Option,{value:t,children:i()(t).format("YYYY\u5e74MM\u6708")},t)))]})}}e.a=h},244:function(t,e,s){"use strict";var a=s(445),n=(s(0),s(5));e.a=t=>t.hide?Object(n.jsx)(a.a,{...t,value:"***",prefix:t.hide?"":t.prefix}):Object(n.jsx)(a.a,{...t})},338:function(t,e,s){},464:function(t,e,s){"use strict";s.r(e);var a=s(329),n=s(255),i=s(61),c=s(333),o=s(334),l=s(441),h=s(0),r=s(217),d=s(467),u=s(210),p=s(91),j=s(5);const b=[{value:"Assets",label:p.a.Assets}];class m extends h.Component{constructor(){super(...arguments),this.state={loading:!1,balanceData:[],accountPrefix:Object(p.c)(this.props.selectedAccounts,b)[0].value},this.queryAccountBalance=t=>{let e,s;this.setState({loading:!0});const{accountPrefix:a}=this.state;if(t){const a=t.split("-").filter((t=>t));1===a.length?e=a[0]:2===a.length&&(e=a[0],s=a[1])}Object(p.d)(`/api/auth/stats/account/balance?prefix=${a}&year=${e||""}&month=${s||""}`).then((t=>{t&&t.length>0&&t.forEach((t=>{t.date=Object(p.f)(t.date)})),this.setState({balanceData:t})})).finally((()=>{this.setState({loading:!1})}))},this.handleChangeAccount=t=>{this.setState({accountPrefix:t},(()=>{this.queryAccountBalance(this.props.selectedMonth)}))}}componentDidMount(){this.queryAccountBalance(this.props.selectedMonth)}componentWillReceiveProps(t){t.selectedMonth!==this.props.selectedMonth&&this.queryAccountBalance(t.selectedMonth),t.selectedAccounts!==this.props.selectedAccounts&&this.setState({accountPrefix:Object(p.c)(t.selectedAccounts,b)[0].value})}render(){return this.props.chartLoading?Object(j.jsx)("div",{style:{height:480,display:"flex",alignItems:"center",justifyContent:"center"},children:Object(j.jsx)(r.a,{})}):Object(j.jsxs)("div",{children:[Object(j.jsx)("div",{style:{marginBottom:"1rem"},children:Object(j.jsx)(d.a,{options:Object(p.c)(this.props.selectedAccounts,b),value:this.state.accountPrefix,onChange:this.handleChangeAccount})}),Object(j.jsx)(r.a,{spinning:this.state.loading,children:Object(j.jsxs)(u.Chart,{appendPadding:[10,0,0,10],autoFit:!0,height:500,data:this.state.balanceData,scale:{amount:{alias:"\u5408\u8ba1",type