pnkx-admin-mongo/pnkx-app-apk/unpackage/cache/wgt/H5A8E5E14/static/js/chunk-74be3b77.1a364900.js
2024-01-13 13:29:20 +08:00

1 line
20 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-74be3b77"],{"5b61":function(t,e,a){"use strict";a("5ffc")},"5ffc":function(t,e,a){},"9e7c":function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"statistics"},[a("van-nav-bar",{attrs:{fixed:"","left-arrow":"","left-text":"返回",title:t.title},on:{"click-left":function(e){return t.$router.go(-1)}}}),a("div",{staticClass:"page"},[a("van-tabs",{attrs:{color:"#5A8DEE",animated:"",sticky:"",swipeable:""},model:{value:t.active,callback:function(e){t.active=e},expression:"active"}},[a("van-tab",{attrs:{title:"折线图"}},[a("van-row",[a("div",{staticClass:"month-total"},[t._v(" 本月总收入:"),a("span",[t._v(t._s(t.total.income))]),t._v("元;总支出:"),a("span",[t._v(t._s(t.total.expenditure))]),t._v("元 ")]),a("line-chart",{attrs:{"chart-data":t.lineChart}})],1),a("van-row",{staticClass:"pagination",attrs:{align:"center",justify:"space-between",type:"flex"}},[a("van-col",{on:{click:function(e){return t.getLineChart(0)}}},[t._v("上个月")]),a("van-col",[t._v(t._s(t.parseTime(new Date(t.queryParams.date),"{y}-{m}")))]),a("van-col",{on:{click:function(e){return t.getLineChart(1)}}},[t._v("下个月")])],1)],1),a("van-tab",{attrs:{title:"饼形图"}},[a("van-row",{staticClass:"dimension",attrs:{type:"flex",align:"center",justify:"center"},on:{click:function(e){t.showChangeDimension=!0}}},[a("van-col",[t._v(" "+t._s(t.dimensionName)+" ")]),a("van-col",[a("van-icon",{attrs:{name:"play"}})],1)],1),a("van-row",[t.dimensionData.length>0?a("pie-chart",{attrs:{title:this.dimensionName,data:t.dimensionData}}):a("van-empty",{staticStyle:{"min-height":"50vh"},attrs:{image:"error",description:"暂无数据"}})],1),"monthly"===t.queryParams.dimension.slice(0,7)?a("van-row",{staticClass:"pagination",attrs:{align:"center",justify:"space-between",type:"flex"}},[a("van-col",{on:{click:function(e){return t.handleChangeDate(2)}}},[t._v("上一年")]),a("van-col",[t._v(t._s(t.parseTime(new Date(t.queryParams.date),"{y}"))+"年")]),a("van-col",{on:{click:function(e){return t.handleChangeDate(3)}}},[t._v("下一年")])],1):a("van-row",{staticClass:"pagination",attrs:{align:"center",justify:"space-between",type:"flex"}},[a("van-col",{on:{click:function(e){return t.handleChangeDate(0)}}},[t._v("上个月")]),a("van-col",[t._v(t._s(t.parseTime(new Date(t.queryParams.date),"{y}-{m}")))]),a("van-col",{on:{click:function(e){return t.handleChangeDate(1)}}},[t._v("下个月")])],1)],1),a("van-tab",{attrs:{title:"条形图"}},[a("van-row",{staticClass:"dimension",attrs:{type:"flex",align:"center",justify:"center"},on:{click:function(e){t.showChangeDimension=!0}}},[a("van-col",[t._v(" "+t._s(t.dimensionName)+" ")]),a("van-col",[a("van-icon",{attrs:{name:"play"}})],1)],1),a("van-row",["monthlyContrast"!==t.queryParams.dimension&&t.dimensionData.length>0?a("div",{staticClass:"strip"},t._l(t.dimensionData,(function(e,n){return a("div",{key:e.name,staticClass:"one-strip d-flex flex-items-center"},[a("div",{staticClass:"left"},["monthly"===t.queryParams.dimension.slice(0,7)?a("div",{staticClass:"month"},[t._v(" "+t._s(e.name.slice(e.name.length-2))+" ")]):a("svg-icon",{attrs:{"icon-class":e.icon||""}})],1),a("div",{staticClass:"middle d-flex flex-column"},[a("div",{staticClass:"strip-name d-flex flex-items-center flex-justify-between"},[a("div",{staticClass:"name d-flex flex-items-end"},[a("span",[t._v(t._s(e.name))]),a("span",[t._v(t._s(t.calculationPercentage(0,e.value))+"%")])]),a("div",{staticClass:"value"},[t._v(t._s(e.value))])]),a("van-progress",{attrs:{"show-pivot":!1,color:t.colorArray[n%t.colorArray.length],percentage:t.calculationPercentage(0,e.value)}})],1),a("div",{staticClass:"right"},[a("van-icon",{attrs:{name:"arrow"}})],1)])})),0):t._e(),"monthlyContrast"===t.queryParams.dimension?a("div",{staticClass:"strip"},[a("van-row",{staticClass:"year",attrs:{type:"flex",justify:"space-between"}},[a("van-col",[a("div",{staticClass:"min-title"},[t._v("年收入")]),a("div",{staticClass:"number"},[t._v(t._s(t.arraySum(t.monthlyContrastData,"inflow")))])]),a("van-col",[a("div",{staticClass:"min-title"},[t._v("年支出")]),a("div",{staticClass:"number"},[t._v(t._s(t.arraySum(t.monthlyContrastData,"flowOut")))])])],1),t._l(t.monthlyContrastData,(function(e){return a("div",{key:e.name,staticClass:"monthly-contrast one-strip d-flex flex-items-center"},[a("div",{staticClass:"left"},[a("div",{staticClass:"month"},[t._v(" "+t._s(e.name.slice(e.name.length-2))+" ")])]),a("div",{staticClass:"middle d-flex flex-column"},[a("div",{staticClass:"value"},[t._v(t._s(e.inflow))]),a("van-progress",{attrs:{"show-pivot":!1,color:"#f1523a",percentage:t.calculationPercentage(1,e.inflow)}}),a("van-progress",{attrs:{"show-pivot":!1,color:"#14ba89",percentage:t.calculationPercentage(2,e.flowOut)}}),a("div",{staticClass:"value"},[t._v(t._s(e.flowOut))])],1)])}))],2):t._e(),0===t.dimensionData.length?a("van-empty",{staticStyle:{"min-height":"50vh"},attrs:{image:"error",description:"暂无数据"}}):t._e()],1),"monthly"===t.queryParams.dimension.slice(0,7)?a("van-row",{staticClass:"pagination",attrs:{align:"center",justify:"space-between",type:"flex"}},[a("van-col",{on:{click:function(e){return t.handleChangeDate(2)}}},[t._v("上一年")]),a("van-col",[t._v(t._s(t.parseTime(new Date(t.queryParams.date),"{y}"))+"年")]),a("van-col",{on:{click:function(e){return t.handleChangeDate(3)}}},[t._v("下一年")])],1):a("van-row",{staticClass:"pagination",attrs:{align:"center",justify:"space-between",type:"flex"}},[a("van-col",{on:{click:function(e){return t.handleChangeDate(0)}}},[t._v("上个月")]),a("van-col",[t._v(t._s(t.parseTime(new Date(t.queryParams.date),"{y}-{m}")))]),a("van-col",{on:{click:function(e){return t.handleChangeDate(1)}}},[t._v("下个月")])],1)],1)],1)],1),a("van-popup",{staticClass:"change-dimension",attrs:{position:"top",round:"",closeable:""},model:{value:t.showChangeDimension,callback:function(e){t.showChangeDimension=e},expression:"showChangeDimension"}},[a("van-row",{staticClass:"flow-out type-one",attrs:{type:"flex",align:"center"}},[a("van-col",{staticClass:"title"},[t._v("支"),a("br"),t._v("出"),a("br"),t._v("图"),a("br"),t._v("表")]),a("van-col",{staticClass:"one-type flex-1 d-flex flex-column flex-items-center flex-justify-center",class:{"one-type-active":"primaryFlowOut"===t.queryParams.dimension},on:{click:function(e){return t.handleChangeDimension("primaryFlowOut","分类支出")}}},[a("svg-icon",{attrs:{"icon-class":"分类支出"}}),a("div",{},[t._v("分类支出")])],1),a("van-col",{staticClass:"one-type flex-1 d-flex flex-column flex-items-center flex-justify-center",class:{"one-type-active":"secondaryFlowOut"===t.queryParams.dimension},on:{click:function(e){return t.handleChangeDimension("secondaryFlowOut","二级支出")}}},[a("svg-icon",{attrs:{"icon-class":"二级支出"}}),a("div",{},[t._v("二级支出")])],1),a("van-col",{staticClass:"one-type flex-1 d-flex flex-column flex-items-center flex-justify-center",class:{"one-type-active":"accountFlowOut"===t.queryParams.dimension},on:{click:function(e){return t.handleChangeDimension("accountFlowOut","账户支出")}}},[a("svg-icon",{attrs:{"icon-class":"账户支出"}}),a("div",{},[t._v("账户支出")])],1)],1),a("van-row",{staticClass:"inflow type-one",attrs:{type:"flex",align:"center"}},[a("van-col",{staticClass:"title"},[t._v("收"),a("br"),t._v("入"),a("br"),t._v("图"),a("br"),t._v("表")]),a("van-col",{staticClass:"one-type flex-1 d-flex flex-column flex-items-center flex-justify-center",class:{"one-type-active":"primaryInflow"===t.queryParams.dimension},on:{click:function(e){return t.handleChangeDimension("primaryInflow","分类收入")}}},[a("svg-icon",{attrs:{"icon-class":"分类收入"}}),a("div",{},[t._v("分类收入")])],1),a("van-col",{staticClass:"one-type flex-1 d-flex flex-column flex-items-center flex-justify-center",class:{"one-type-active":"secondaryInflow"===t.queryParams.dimension},on:{click:function(e){return t.handleChangeDimension("secondaryInflow","二级收入")}}},[a("svg-icon",{attrs:{"icon-class":"二级收入"}}),a("div",{},[t._v("二级收入")])],1),a("van-col",{staticClass:"one-type flex-1 d-flex flex-column flex-items-center flex-justify-center",class:{"one-type-active":"accountInflow"===t.queryParams.dimension},on:{click:function(e){return t.handleChangeDimension("accountInflow","账户收入")}}},[a("svg-icon",{attrs:{"icon-class":"账户收入"}}),a("div",{},[t._v("账户收入")])],1)],1),a("van-row",{staticClass:"gray type-one",attrs:{align:"center",type:"flex"}},[a("van-col",{staticClass:"title"},[t._v("资"),a("br"),t._v("产"),a("br"),t._v("图"),a("br"),t._v("表")]),a("van-col",{staticClass:"one-type flex-1 d-flex flex-column flex-items-center flex-justify-center",class:{"one-type-active":"assetsInfo"===t.queryParams.dimension},on:{click:function(e){return t.handleChangeDimension("assetsInfo","资产")}}},[a("svg-icon",{attrs:{"icon-class":"资产信息"}}),a("div",{},[t._v("资产")])],1),a("van-col",{staticClass:"one-type flex-1 d-flex flex-column flex-items-center flex-justify-center",class:{"one-type-active":"liabilitiesInfo"===t.queryParams.dimension},on:{click:function(e){return t.handleChangeDimension("liabilitiesInfo","负债")}}},[a("svg-icon",{attrs:{"icon-class":"负债情况"}}),a("div",{},[t._v("负债")])],1),a("van-col",{staticClass:"one-type flex-1 d-flex flex-column flex-items-center flex-justify-center"})],1),a("van-row",{staticClass:"gray type-one",attrs:{align:"center",type:"flex"}},[a("van-col",{staticClass:"title"},[t._v("月"),a("br"),t._v("度"),a("br"),t._v("图"),a("br"),t._v("表")]),a("van-col",{staticClass:"one-type flex-1 d-flex flex-column flex-items-center flex-justify-center",class:{"one-type-active":"monthlyInflow"===t.queryParams.dimension},on:{click:function(e){return t.handleChangeDimension("monthlyInflow","月度收入")}}},[a("svg-icon",{staticStyle:{"font-size":"1.6rem","margin-bottom":"0.4rem"},attrs:{"icon-class":"转入"}}),a("div",{},[t._v("月度收入")])],1),a("van-col",{staticClass:"one-type flex-1 d-flex flex-column flex-items-center flex-justify-center",class:{"one-type-active":"monthlyFlowOut"===t.queryParams.dimension},on:{click:function(e){return t.handleChangeDimension("monthlyFlowOut","月度支出")}}},[a("svg-icon",{staticStyle:{"font-size":"1.6rem","margin-bottom":"0.4rem"},attrs:{"icon-class":"转出"}}),a("div",{},[t._v("月度支出")])],1),2===t.active?a("van-col",{staticClass:"one-type flex-1 d-flex flex-column flex-items-center flex-justify-center",class:{"one-type-active":"monthlyContrast"===t.queryParams.dimension},on:{click:function(e){return t.handleChangeDimension("monthlyContrast","收支对比")}}},[a("svg-icon",{attrs:{"icon-class":"对比"}}),a("div",{},[t._v("收支对比")])],1):a("van-col",{staticClass:"one-type flex-1 d-flex flex-column flex-items-center flex-justify-center"})],1)],1)],1)},i=[],s=(a("b680"),a("4de4"),a("d3b7"),a("d81d"),a("159b"),a("7db0"),a("b0c0"),function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{class:t.className,style:{height:t.height,width:t.width}})}),r=[],o=a("313e"),l=a.n(o);a("53ca"),a("ac1f"),a("5319"),a("a15b"),a("b64b"),a("fb6a"),a("a630"),a("3ca3"),a("6062"),a("ddb0"),a("25f0"),a("466d"),a("4d63"),a("2c3e"),a("00b4"),a("7eeb");function c(t,e,a){var n,i,s,r,o,l=function l(){var c=+new Date-r;c<e&&c>0?n=setTimeout(l,e-c):(n=null,a||(o=t.apply(s,i),n||(s=i=null)))};return function(){for(var i=arguments.length,c=new Array(i),u=0;u<i;u++)c[u]=arguments[u];s=this,r=+new Date;var h=a&&!n;return n||(n=setTimeout(l,e)),h&&(o=t.apply(s,c),s=c=null),o}}var u={data:function(){return{$_sidebarElm:null,$_resizeHandler:null}},mounted:function(){this.initListener()},activated:function(){this.$_resizeHandler||this.initListener(),this.resize()},beforeDestroy:function(){this.destroyListener()},deactivated:function(){this.destroyListener()},methods:{$_sidebarResizeHandler:function(t){"width"===t.propertyName&&this.$_resizeHandler()},initListener:function(){var t=this;this.$_resizeHandler=c((function(){t.resize()}),100),window.addEventListener("resize",this.$_resizeHandler),this.$_sidebarElm=document.getElementsByClassName("sidebar-container")[0],this.$_sidebarElm&&this.$_sidebarElm.addEventListener("transitionend",this.$_sidebarResizeHandler)},destroyListener:function(){window.removeEventListener("resize",this.$_resizeHandler),this.$_resizeHandler=null,this.$_sidebarElm&&this.$_sidebarElm.removeEventListener("transitionend",this.$_sidebarResizeHandler)},resize:function(){var t=this.chart;t&&t.resize()}}};a("817d");var h={mixins:[u],props:{className:{type:String,default:"chart"},width:{type:String,default:"100%"},height:{type:String,default:"58vh"},autoResize:{type:Boolean,default:!0},chartData:{type:Object,required:!0}},data:function(){return{chart:null}},watch:{chartData:{deep:!0,handler:function(t){this.setOptions(t)}}},mounted:function(){var t=this;this.$nextTick((function(){t.initChart()}))},beforeDestroy:function(){this.chart&&(this.chart.dispose(),this.chart=null)},methods:{initChart:function(){this.chart=l.a.init(this.$el,"macarons"),this.setOptions(this.chartData)},setOptions:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.date,a=t.inflowMoney,n=t.flowOutMoney;this.chart.setOption({xAxis:{data:e,boundaryGap:!1,axisTick:{show:!1}},grid:{left:10,right:10,bottom:20,top:30,containLabel:!0},tooltip:{trigger:"axis",axisPointer:{type:"cross"},padding:[5,10]},yAxis:{axisTick:{show:!1}},legend:{data:["收入","支出"]},series:[{name:"收入",itemStyle:{normal:{color:"#f1523a",lineStyle:{color:"#f1523a",width:2}}},smooth:!1,type:"line",data:a,animationDuration:2800,animationEasing:"cubicInOut"},{name:"支出",smooth:!1,type:"line",itemStyle:{normal:{color:"#5A8DEE",lineStyle:{color:"#5A8DEE",width:2},areaStyle:{color:"#f3f8ff"}}},data:n,animationDuration:2800,animationEasing:"quadraticOut"}]})}}},m=h,d=a("2877"),f=Object(d["a"])(m,s,r,!1,null,null,null),y=f.exports,v=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{class:t.className,style:{height:t.height,width:t.width}})},p=[];a("817d");var g={mixins:[u],props:{data:{type:Array,default:[]},className:{type:String,default:"chart"},title:{type:String,default:"消费统计"},width:{type:String,default:"100%"},height:{type:String,default:"50vh"}},data:function(){return{chart:null}},watch:{data:function(){this.initChart()}},mounted:function(){var t=this;this.$nextTick((function(){t.initChart()}))},beforeDestroy:function(){this.chart&&(this.chart.dispose(),this.chart=null)},methods:{initChart:function(){this.chart=l.a.init(this.$el,"macarons"),this.chart.setOption({title:{show:!1,text:this.title,left:"left"},tooltip:{trigger:"item",formatter:"{a} <br/>{b} : {c} ({d}%)"},legend:{left:"center",bottom:"0",data:this.data.map((function(t){return t.name}))},series:[{name:this.title,type:"pie",roseType:"radius",radius:[15,95],center:["50%","50%"],data:this.data,animationEasing:"cubicInOut",animationDuration:2600}]})}}},w=g,C=Object(d["a"])(w,v,p,!1,null,null,null),x=C.exports,b=["#5A8DEE","#CD594B","#F8CE5E","#4B9E65"],_=a("b775");function D(t){return Object(_["a"])({url:"/bookkeeping/statistics/getLineChart",method:"post",data:t})}function P(t){return Object(_["a"])({url:"/bookkeeping/statistics/getPrimaryStatistics",method:"post",data:t})}function q(t){return Object(_["a"])({url:"/bookkeeping/statistics/getSecondaryStatistics",method:"post",data:t})}function k(t){return Object(_["a"])({url:"/bookkeeping/statistics/getAccountStatistics",method:"post",data:t})}function O(){return Object(_["a"])({url:"/bookkeeping/statistics/getAssetsStatistics",method:"post"})}function j(t){return Object(_["a"])({url:"/bookkeeping/statistics/getMonthlyStatistics",method:"post",data:t})}var E={name:"Statistics",components:{LineChart:y,PieChart:x},data:function(){return{dimensionName:"分类支出",showChangeDimension:!1,title:"图表统计",active:0,queryParams:{dimension:"primaryFlowOut",date:this.parseTime(new Date),typeDifference:"1"},lineChart:{date:[],inflowMoney:[],flowOutMoney:[]},dimensionData:[],monthlyContrastData:[],colorArray:b,total:{income:0,expenditure:0}}},watch:{active:{handler:function(t){switch(t){case 0:this.queryParams.date=this.parseTime(new Date),this.getLineChart();break;case 1:this.queryParams.date=this.parseTime(new Date),this.handleChangeDimension("primaryFlowOut","分类支出");break;case 2:this.queryParams.date=this.parseTime(new Date),this.handleChangeDimension("primaryFlowOut","分类支出");break}},deep:!0,immediate:!0}},methods:{calculationPercentage:function(t,e){var a;switch(t){case 0:a=this.arraySum(this.dimensionData,"value");break;case 1:a=this.arraySum(this.monthlyContrastData,"inflow");break;case 2:a=this.arraySum(this.monthlyContrastData,"flowOut");break}var n=parseFloat(e)/parseFloat(a);return n=(100*n).toFixed(2),"NaN"===n?0:n},handleChangeDate:function(t){switch(this.queryParams.date=new Date(this.queryParams.date),t){case 0:this.queryParams.date=this.queryParams.date.setMonth(this.queryParams.date.getMonth()-1);break;case 1:this.queryParams.date=this.queryParams.date.setMonth(this.queryParams.date.getMonth()+1);break;case 2:this.queryParams.date=this.queryParams.date.setFullYear(this.queryParams.date.getFullYear()-1);break;case 3:this.queryParams.date=this.queryParams.date.setFullYear(this.queryParams.date.getFullYear()+1);break}this.queryParams.date=this.parseTime(new Date(this.queryParams.date)),this.handleChangeDimension()},handleChangeDimension:function(t,e){var a=this;switch(e&&(this.dimensionName=e,this.queryParams.date=this.parseTime(new Date),this.queryParams.dimension=t),this.queryParams.dimension){case"primaryFlowOut":this.queryParams.typeDifference="1",P(this.queryParams).then((function(t){a.dimensionData=t.data}));break;case"secondaryFlowOut":this.queryParams.typeDifference="1",q(this.queryParams).then((function(t){a.dimensionData=t.data}));break;case"accountFlowOut":this.queryParams.typeDifference="1",k(this.queryParams).then((function(t){a.dimensionData=t.data}));break;case"primaryInflow":this.queryParams.typeDifference="0",P(this.queryParams).then((function(t){a.dimensionData=t.data}));break;case"secondaryInflow":this.queryParams.typeDifference="0",q(this.queryParams).then((function(t){a.dimensionData=t.data}));break;case"accountInflow":this.queryParams.typeDifference="0",k(this.queryParams).then((function(t){a.dimensionData=t.data}));break;case"assetsInfo":O().then((function(t){a.dimensionData=t.data.filter((function(t){return t.value>0}))}));break;case"liabilitiesInfo":O().then((function(t){a.dimensionData=t.data.filter((function(t){return t.value<0})).map((function(t){return t.value=-1*t.value,t}))}));break;case"monthlyInflow":this.queryParams.typeDifference="0",j(this.queryParams).then((function(t){a.dimensionData=t.data}));break;case"monthlyFlowOut":this.queryParams.typeDifference="1",j(this.queryParams).then((function(t){a.dimensionData=t.data}));break;case"monthlyContrast":this.monthlyContrastData=[];for(var n=0;n<12;n++)this.monthlyContrastData.push({name:this.parseTime(this.queryParams.date,"{y}")+"-"+(n+1<10?"0"+(n+1):n+1),inflow:0,flowOut:0});this.queryParams.typeDifference="0",j(this.queryParams).then((function(t){t.data.forEach((function(t){a.monthlyContrastData.find((function(e){return e.name===t.name})).inflow=t.value}))})),this.queryParams.typeDifference="1",j(this.queryParams).then((function(t){t.data.forEach((function(t){a.monthlyContrastData.find((function(e){return e.name===t.name})).flowOut=t.value}))}));break}this.showChangeDimension=!1},getLineChart:function(t){var e=this;0===t&&(this.queryParams.date=new Date(this.queryParams.date),this.queryParams.date=this.queryParams.date.setMonth(this.queryParams.date.getMonth()-1),this.queryParams.date=this.parseTime(new Date(this.queryParams.date))),1===t&&(this.queryParams.date=new Date(this.queryParams.date),this.queryParams.date=this.queryParams.date.setMonth(this.queryParams.date.getMonth()+1),this.queryParams.date=this.parseTime(new Date(this.queryParams.date))),D({payTime:this.queryParams.date}).then((function(t){e.lineChart={date:[],inflowMoney:[],flowOutMoney:[]},e.total={income:0,expenditure:0},t.data.forEach((function(t){e.lineChart.date.push(t.date),e.lineChart.inflowMoney.push(t.inflowMoney),e.lineChart.flowOutMoney.push(t.flowOutMoney),e.total.income+=t.inflowMoney,e.total.expenditure+=t.flowOutMoney}))}))}}},S=E,$=(a("5b61"),Object(d["a"])(S,n,i,!1,null,"4346a480",null));e["default"]=$.exports}}]);