2 lines
5.5 KiB
JavaScript
2 lines
5.5 KiB
JavaScript
"use strict";const t=require("../../common/vendor.js"),i=require("../../common/assets.js"),e=require("../../uni_modules/lime-echart/static/echarts.min.js"),s={name:"cwfx-view",data:()=>({profitabilityIndicatorList:[{title:"净资产收益率(ROE)%"},{title:"净资产收益率(扣非)%"},{title:"净资产收益率(加权)%"},{title:"总资产报酬率(ROA)%"},{title:"毛利率%"},{title:"净利率%"},{title:"营业利润率%"},{title:"成本费用利润率%"}],profitabilityIndicatorIndex:0,perShareIndicatorList:[{title:"每股收益(EPS)"},{title:"基本每股收益"},{title:"稀释每股收益"},{title:"扣非每股收益"},{title:"每股净资产"},{title:"每股经营现金流"},{title:"每股资本公积"},{title:"每股未分配利润"}],perShareIndicatorIndex:0,option1:{legend:{show:!0,data:["ROE","同比(右)"]},grid:{left:"2%",right:"2%",top:"5%",bottom:"30%"},xAxis:{type:"category",data:[],axisLabel:{fontSize:10,rotate:45}},yAxis:[{type:"value",name:"(%)",position:"left",alignTicks:!0,axisLine:{onZero:!1}},{type:"value",name:"(%)",position:"right",alignTicks:!0,axisLine:{onZero:!1}}],dataZoom:[{type:"slider"}],series:[{type:"bar",name:"ROE",data:[],yAxisIndex:0},{type:"line",name:"同比",data:[],yAxisIndex:1}]},option2:{legend:{show:!0,data:["ROE","同比(右)"]},grid:{left:"2%",right:"2%",top:"5%",bottom:"30%"},xAxis:{type:"category",data:[],axisLabel:{rotate:45,fontSize:10}},yAxis:[{type:"value",name:"(%)",position:"left",alignTicks:!0,axisLine:{onZero:!1}},{type:"value",name:"(%)",position:"right",alignTicks:!0,axisLine:{onZero:!1}}],dataZoom:[{type:"slider"}],series:[{type:"bar",name:"ROE",data:[],yAxisIndex:0},{type:"line",name:"同比",data:[],yAxisIndex:1}]}}),props:{dataList:Array},watch:{dataList(t){let i=[],e=[],s=[];for(let a of t){var r=a.report_type;r=(r=(r=(r=r.replace("年三季报","Q3")).replace("年一季报","Q1")).replace("年中报","中报")).replace("年年报","年报"),i.push(r),a.profitability.roe?e.push(a.profitability.roe.toFixed(2)):e.push(0),a.per_share_metrics.eps?s.push(a.per_share_metrics.eps.toFixed(2)):s.push(0)}this.option1.xAxis.data=i,this.option1.series[0].data=e,this.profitabilityInit(),this.option2.xAxis.data=i,this.option2.series[0].data=s,this.perShareInit()}},methods:{async profitabilityInit(){(await this.$refs.chartRef1.init(e)).setOption(this.option1)},async perShareInit(){(await this.$refs.chartRef2.init(e)).setOption(this.option2)},clickProfitabilityIndicatorItem(t){if(this.profitabilityIndicatorIndex!=t){this.profitabilityIndicatorIndex=t;let i=[];if(0==t)for(let t of this.dataList)t.profitability.roe?i.push(t.profitability.roe.toFixed(2)):i.push(0);else if(1==t)for(let t of this.dataList)t.profitability.roe_deducted?i.push(t.profitability.roe_deducted.toFixed(2)):i.push(0);else if(2==t)for(let t of this.dataList)t.profitability.roe_deducted?i.push(t.profitability.roe_deducted.toFixed(2)):i.push(0);else if(3==t)for(let t of this.dataList)t.profitability.roa?i.push(t.profitability.roa.toFixed(2)):i.push(0);else if(4==t)for(let t of this.dataList)t.profitability.gross_margin?i.push(t.profitability.gross_margin.toFixed(2)):i.push(0);else if(5==t)for(let t of this.dataList)t.profitability.net_profit_margin?i.push(t.profitability.net_profit_margin.toFixed(2)):i.push(0);else if(6==t)for(let t of this.dataList)t.profitability.operating_profit_margin?i.push(t.profitability.operating_profit_margin.toFixed(2)):i.push(0);else if(7==t)for(let t of this.dataList)t.profitability.cost_profit_ratio?i.push(t.profitability.cost_profit_ratio.toFixed(2)):i.push(0);this.option1.series[0].data=i,this.profitabilityInit()}},clickPerShareIndicatorItem(t){if(this.perShareIndicatorIndex!=t){this.perShareIndicatorIndex=t;let i=[];if(0==t)for(let t of this.dataList)t.per_share_metrics.eps?i.push(t.per_share_metrics.eps.toFixed(2)):i.push(0);else if(1==t)for(let t of this.dataList)t.per_share_metrics.basic_eps?i.push(t.per_share_metrics.basic_eps.toFixed(2)):i.push(0);else if(2==t)for(let t of this.dataList)t.per_share_metrics.diluted_eps?i.push(t.per_share_metrics.diluted_eps.toFixed(2)):i.push(0);else if(3==t)for(let t of this.dataList)t.per_share_metrics.deducted_eps?i.push(t.per_share_metrics.deducted_eps.toFixed(2)):i.push(0);else if(4==t)for(let t of this.dataList)t.per_share_metrics.bvps?i.push(t.per_share_metrics.bvps.toFixed(2)):i.push(0);else if(5==t)for(let t of this.dataList)t.per_share_metrics.operating_cash_flow_ps?i.push(t.per_share_metrics.operating_cash_flow_ps.toFixed(2)):i.push(0);else if(6==t)for(let t of this.dataList)t.per_share_metrics.capital_reserve_ps?i.push(t.per_share_metrics.capital_reserve_ps.toFixed(2)):i.push(0);else if(7==t)for(let t of this.dataList)t.per_share_metrics.undistributed_profit_ps?i.push(t.per_share_metrics.undistributed_profit_ps.toFixed(2)):i.push(0);this.option2.series[0].data=i,this.perShareInit()}}}};if(!Array){t.resolveComponent("l-echart")()}Math;const r=t._export_sfc(s,[["render",function(e,s,r,a,o,p){return{a:i._imports_0$8,b:i._imports_1$2,c:t.f(o.profitabilityIndicatorList,((i,e,s)=>({a:t.t(i.title),b:t.n("item flex "+(o.profitabilityIndicatorIndex==e?"select":"")),c:e,d:t.o((t=>p.clickProfitabilityIndicatorItem(e)),e)}))),d:i._imports_2$14,e:i._imports_3$13,f:t.sr("chartRef1","3746da36-0"),g:i._imports_4$12,h:i._imports_1$2,i:t.f(o.perShareIndicatorList,((i,e,s)=>({a:t.t(i.title),b:t.n("item flexCenter "+(o.perShareIndicatorIndex==e?"select":"")),c:e,d:t.o((t=>p.clickPerShareIndicatorItem(e)),e)}))),j:i._imports_2$14,k:i._imports_3$13,l:t.sr("chartRef2","3746da36-1")}}]]);wx.createComponent(r);
|