1.29 财务分析模块完善
This commit is contained in:
@@ -1,10 +1,65 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_assets = require("../../common/assets.js");
|
||||
const echarts = require("../../uni_modules/lime-echart/static/echarts.min.js");
|
||||
const _sfc_main = {
|
||||
name: "cwfx-view",
|
||||
data() {
|
||||
return {
|
||||
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: true,
|
||||
@@ -20,7 +75,8 @@ const _sfc_main = {
|
||||
type: "category",
|
||||
data: [],
|
||||
axisLabel: {
|
||||
// interval:0
|
||||
fontSize: 10,
|
||||
rotate: 45
|
||||
}
|
||||
},
|
||||
yAxis: [
|
||||
@@ -49,13 +105,70 @@ const _sfc_main = {
|
||||
series: [
|
||||
{
|
||||
type: "bar",
|
||||
name: "营业收入",
|
||||
name: "ROE",
|
||||
data: [],
|
||||
yAxisIndex: 0
|
||||
},
|
||||
{
|
||||
type: "line",
|
||||
name: "净利润",
|
||||
name: "同比",
|
||||
data: [],
|
||||
yAxisIndex: 1
|
||||
}
|
||||
]
|
||||
},
|
||||
option2: {
|
||||
legend: {
|
||||
show: true,
|
||||
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: true,
|
||||
axisLine: {
|
||||
onZero: false
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "value",
|
||||
name: "(%)",
|
||||
position: "right",
|
||||
alignTicks: true,
|
||||
axisLine: {
|
||||
onZero: false
|
||||
}
|
||||
}
|
||||
],
|
||||
dataZoom: [{
|
||||
type: "slider"
|
||||
}],
|
||||
series: [
|
||||
{
|
||||
type: "bar",
|
||||
name: "ROE",
|
||||
data: [],
|
||||
yAxisIndex: 0
|
||||
},
|
||||
{
|
||||
type: "line",
|
||||
name: "同比",
|
||||
data: [],
|
||||
yAxisIndex: 1
|
||||
}
|
||||
@@ -64,15 +177,182 @@ const _sfc_main = {
|
||||
};
|
||||
},
|
||||
props: {
|
||||
barCategoryList1: Array,
|
||||
barList1: Array,
|
||||
lineList: Array,
|
||||
//折线图数据
|
||||
barCategoryList1: Array,
|
||||
barList1: Array
|
||||
dataList: Array
|
||||
},
|
||||
watch: {
|
||||
dataList(newValue) {
|
||||
let category = [];
|
||||
let data1 = [];
|
||||
let data2 = [];
|
||||
for (let item of newValue) {
|
||||
var type = item.report_type;
|
||||
type = type.replace("年三季报", "Q3");
|
||||
type = type.replace("年一季报", "Q1");
|
||||
type = type.replace("年中报", "中报");
|
||||
type = type.replace("年年报", "年报");
|
||||
category.push(type);
|
||||
if (item.profitability.roe) {
|
||||
data1.push(item.profitability.roe.toFixed(2));
|
||||
} else
|
||||
data1.push(0);
|
||||
if (item.per_share_metrics.eps) {
|
||||
data2.push(item.per_share_metrics.eps.toFixed(2));
|
||||
} else
|
||||
data2.push(0);
|
||||
}
|
||||
this.option1.xAxis.data = category;
|
||||
this.option1.series[0].data = data1;
|
||||
this.profitabilityInit();
|
||||
this.option2.series[0].data = data2;
|
||||
this.perShareInit();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickProfitabilityIndicators(item) {
|
||||
async profitabilityInit() {
|
||||
const chart = await this.$refs.chartRef1.init(echarts);
|
||||
chart.setOption(this.option1);
|
||||
},
|
||||
async perShareInit() {
|
||||
const chart = await this.$refs.chartRef2.init(echarts);
|
||||
chart.setOption(this.option2);
|
||||
},
|
||||
/**
|
||||
* 切换盈利能力指标
|
||||
* @param {Object} item
|
||||
*/
|
||||
clickProfitabilityIndicatorItem(index) {
|
||||
if (this.profitabilityIndicatorIndex != index) {
|
||||
this.profitabilityIndicatorIndex = index;
|
||||
let data = [];
|
||||
if (index == 0) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.profitability.roe) {
|
||||
data.push(item.profitability.roe.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
} else if (index == 1) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.profitability.roe_deducted) {
|
||||
data.push(item.profitability.roe_deducted.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
} else if (index == 2) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.profitability.roe_deducted) {
|
||||
data.push(item.profitability.roe_deducted.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
} else if (index == 3) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.profitability.roa) {
|
||||
data.push(item.profitability.roa.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
} else if (index == 4) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.profitability.gross_margin) {
|
||||
data.push(item.profitability.gross_margin.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
} else if (index == 5) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.profitability.net_profit_margin) {
|
||||
data.push(item.profitability.net_profit_margin.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
} else if (index == 6) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.profitability.operating_profit_margin) {
|
||||
data.push(item.profitability.operating_profit_margin.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
} else if (index == 7) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.profitability.cost_profit_ratio) {
|
||||
data.push(item.profitability.cost_profit_ratio.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
}
|
||||
this.option1.series[0].data = data;
|
||||
this.profitabilityInit();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 切换每股指标
|
||||
* @param {Object} item
|
||||
*/
|
||||
clickPerShareIndicatorItem(index) {
|
||||
if (this.perShareIndicatorIndex != index) {
|
||||
this.perShareIndicatorIndex = index;
|
||||
let data = [];
|
||||
if (index == 0) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.per_share_metrics.eps) {
|
||||
data.push(item.per_share_metrics.eps.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
} else if (index == 1) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.per_share_metrics.basic_eps) {
|
||||
data.push(item.per_share_metrics.basic_eps.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
} else if (index == 2) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.per_share_metrics.diluted_eps) {
|
||||
data.push(item.per_share_metrics.diluted_eps.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
} else if (index == 3) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.per_share_metrics.deducted_eps) {
|
||||
data.push(item.per_share_metrics.deducted_eps.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
} else if (index == 4) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.per_share_metrics.bvps) {
|
||||
data.push(item.per_share_metrics.bvps.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
} else if (index == 5) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.per_share_metrics.operating_cash_flow_ps) {
|
||||
data.push(item.per_share_metrics.operating_cash_flow_ps.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
} else if (index == 6) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.per_share_metrics.capital_reserve_ps) {
|
||||
data.push(item.per_share_metrics.capital_reserve_ps.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
} else if (index == 7) {
|
||||
for (let item of this.dataList) {
|
||||
if (item.per_share_metrics.undistributed_profit_ps) {
|
||||
data.push(item.per_share_metrics.undistributed_profit_ps.toFixed(2));
|
||||
} else
|
||||
data.push(0);
|
||||
}
|
||||
}
|
||||
this.option2.series[0].data = data;
|
||||
this.perShareInit();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -88,13 +368,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_assets._imports_0$8,
|
||||
b: common_assets._imports_1$2,
|
||||
c: common_vendor.f(["净资产收益率(ROE)%", "净资产收益率(扣非)%", "净资产收益率(加权)%", "总资产报酬率(ROA)%", "毛利率%", "净利率%", "营业利润率%", "成本费用利润率%"], (item, index, i0) => {
|
||||
c: common_vendor.f($data.profitabilityIndicatorList, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item),
|
||||
b: index == 0 ? "#BB8520" : "#999999",
|
||||
c: `1rpx solid ${index == 0 ? "#F2C369" : "#D2D2D2"}`,
|
||||
d: index == 0 ? "#FFFAF1" : "#FFFFFF",
|
||||
e: index
|
||||
a: common_vendor.t(item.title),
|
||||
b: common_vendor.n("item flex " + ($data.profitabilityIndicatorIndex == index ? "select" : "")),
|
||||
c: index,
|
||||
d: common_vendor.o(($event) => $options.clickProfitabilityIndicatorItem(index), index)
|
||||
};
|
||||
}),
|
||||
d: common_assets._imports_2$14,
|
||||
@@ -102,13 +381,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
f: common_vendor.sr("chartRef1", "3746da36-0"),
|
||||
g: common_assets._imports_4$12,
|
||||
h: common_assets._imports_1$2,
|
||||
i: common_vendor.f(["每股收益(EPS)", "基本每股收益", "稀释每股收益", "扣非每股收益", "每股净资产", "每股经营现金流", "每股资本公积", "每股未分配利润"], (item, index, i0) => {
|
||||
i: common_vendor.f($data.perShareIndicatorList, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item),
|
||||
b: index == 0 ? "#BB8520" : "#999999",
|
||||
c: `1rpx solid ${index == 0 ? "#F2C369" : "#D2D2D2"}`,
|
||||
d: index == 0 ? "#FFFAF1" : "#FFFFFF",
|
||||
e: index
|
||||
a: common_vendor.t(item.title),
|
||||
b: common_vendor.n("item flexCenter " + ($data.perShareIndicatorIndex == index ? "select" : "")),
|
||||
c: index,
|
||||
d: common_vendor.o(($event) => $options.clickPerShareIndicatorItem(index), index)
|
||||
};
|
||||
}),
|
||||
j: common_assets._imports_2$14,
|
||||
|
||||
Reference in New Issue
Block a user