1 line
18 KiB
JavaScript
1 line
18 KiB
JavaScript
|
|
"use strict";(self.webpackChunkbeancount_web=self.webpackChunkbeancount_web||[]).push([[682],{7287:(e,t,s)=>{s.d(t,{A:()=>n});var i=s(4760);const n=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";t=Number(t).toFixed(2);const r=(0,i.b9)(e);return"Income"===r?t>0?`-${s}${Math.abs(t)} ${s?"":n}`:`+${s}${Math.abs(t)} ${s?"":n}`:"Assets"===r?t>0?`+${s}${Math.abs(t)} ${s?"":n}`:`-${s}${Math.abs(t)} ${s?"":n}`:"Expenses"===r||"Liabilities"===r?t>0?`-${s}${Math.abs(t)} ${s?"":n}`:`+${s}${Math.abs(t)} ${s?"":n}`:String(t)}},9470:(e,t,s)=>{s.d(t,{A:()=>n});s(9284);var i=s(712);const n=e=>{let{iconType:t,...s}=e;return(0,i.jsx)("img",{...s,src:`../../web/icons/${t}.png`,alt:"",width:32,height:32})}},1410:(e,t,s)=>{s.d(t,{A:()=>f});var i=s(5504),n=s(8405),r=s(1619),a=s(8037),o=s(6749),c=s(3981),l=s(9284),h=s(4760),d=s(7287),u=s(9470),m=s(1419),p=s(712);class y extends l.Component{constructor(){super(...arguments),this.state={transactions:[],selectedMonth:"",loading:!1},this.handleQueryAccountTransaction=e=>{if(!e)return;let t,s;if(this.setState({loading:!0}),this.state.selectedMonth){const e=this.state.selectedMonth.split("-").filter((e=>e));1===e.length?t=e[0]:2===e.length&&(t=e[0],s=e[1])}(0,h.hd)(`/api/auth/transaction?account=${e}&year=${t}&month=${s}`).then((e=>{this.setState({transactions:e})})).catch(console.error).finally((()=>{this.setState({loading:!1})}))},this.handleChangeMonth=e=>{this.setState({selectedMonth:e},(()=>{this.handleQueryAccountTransaction(this.props.account)}))}}componentDidMount(){this.props.account&&this.handleQueryAccountTransaction(this.props.account)}componentWillReceiveProps(e){e.visible&&this.handleQueryAccountTransaction(e.account)}render(){const e=this.props.account,{transactions:t,loading:s}=this.state;return(0,p.jsx)(r.A,{title:(0,p.jsxs)("div",{style:{fontSize:14},children:[(0,p.jsx)("div",{children:e}),(0,p.jsxs)("div",{children:["\u6700\u8fd1",t.length,"\u6761\u4ea4\u6613\u8bb0\u5f55"]})]}),placement:"bottom",closable:!0,className:"page-drawer",height:"90vh",bodyStyle:{display:"flex",justifyContent:"center"},...this.props,children:(0,p.jsxs)("div",{className:"page-form",children:[(0,p.jsx)(m.A,{size:"middle",value:this.state.selectedMonth,onChange:this.handleChangeMonth}),(0,p.jsx)(a.Ay,{itemLayout:"horizontal",loading:s,dataSource:t,renderItem:t=>{const s=t.costCurrency&&t.currency!==t.costCurrency,r=Boolean(t.price);let m,y;return s&&(m=(0,c.A)(t.costPrice).mul((0,c.A)(t.number).abs()),r&&(y=(0,c.A)(t.price).sub((0,c.A)(t.costPrice)).mul((0,c.A)(t.number).abs()))),(0,p.jsx)(a.Ay.Item,{actions:[(0,p.jsxs)("div",{style:{textAlign:"right"},children:[(0,p.jsx)("div",{children:t.number?(0,d.A)(e,t.number,t.currencySymbol,t.currency):""}),(0,p.jsx)("div",{style:{fontSize:"12px"},children:(0,h.vv)(t.balance,this.props.commodity)})]})],children:(0,p.jsx)(a.Ay.Item.Meta,{avatar:(0,p.jsx)(u.A,{iconType:(0,h.fe)(e)}),title:t.desc,description:(0,p.jsxs)("div",{children:[t.tags&&(0,p.jsx)("div",{children:t.tags.map((e=>(0,p.jsxs)("a",{style:{marginRight:"4px"},children:["#",e]})))}),(0,p.jsxs)("span",{children:[t.date,"\xa0",t.payee,"\xa0",t.commodity]}),s&&(0,p.jsx)("div",{style:{marginTop:"13px"},children:r?(0,p.jsxs)(l.Fragment,{children:[(0,p.jsxs)(o.A,{children:["\u6301\u4ed3\u6210\u672c: ",t.costPrice," (",t.costDate,")"]}),(0,p.jsxs)(o.A,{children:["\u786e\u8ba4\u51c0\u503c: ",t.price]}),y>=0?(0,p.jsxs)(l.Fragment,{children:[(0,p.jsxs)(o.A,{icon:(0,p.jsx)(i.A,{}),color:"#f50",children:[(100*Number(y)/Number(m)).toFixed(2),"%"]}),(0,p.jsxs)(o.A,{color:"#f50",children:["+",Math.abs(y).toFixed(2)]})]}):(0,p.jsxs)(l.Fragment,{children:[(0,p.jsxs)(o.A,{icon:(0,p.jsx)(n.A,{}),color:"#1DA57A",children:[(100*Number(y)/Number(m)).toFixed(2),"%"]}),(0,p.jsxs)(o.A,{color:"#1DA57A",children:["-",Math.abs(y).toFixed(2)]})]})]}):(0,p.jsx)(l.Fragment,{children:(0,p.jsxs)(o.A,{children:[t.isAnotherCurrency?"\u6c47\u7387":"\u8d2d\u5165\u51c0\u503c",": ",t.costPrice]})})})]})})})}})]})})}}const f=y},8415:(e,t,s)=>{s.d(t,{A:(
|