995 lines
32 KiB
JavaScript
995 lines
32 KiB
JavaScript
"use strict";
|
||
const common_vendor = require("../../../common/vendor.js");
|
||
const utils_util = require("../../../utils/util.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,
|
||
profitabilitySingleQuarterAllIndex: 0,
|
||
perShareIndicatorList: [
|
||
{
|
||
title: "每股收益(EPS)"
|
||
},
|
||
{
|
||
title: "基本每股收益"
|
||
},
|
||
{
|
||
title: "稀释每股收益"
|
||
},
|
||
{
|
||
title: "扣非每股收益"
|
||
},
|
||
{
|
||
title: "每股净资产"
|
||
},
|
||
{
|
||
title: "每股经营现金流"
|
||
},
|
||
{
|
||
title: "每股资本公积"
|
||
},
|
||
{
|
||
title: "每股未分配利润"
|
||
}
|
||
],
|
||
perShareIndicatorIndex: 0,
|
||
perShareSingleQuarterAllIndex: 0,
|
||
option1: {
|
||
legend: {
|
||
show: true,
|
||
data: ["ROE", "同比(右)"]
|
||
},
|
||
grid: {
|
||
left: "2%",
|
||
right: "2%",
|
||
top: "5%",
|
||
bottom: "30%"
|
||
},
|
||
xAxis: [
|
||
{
|
||
type: "category",
|
||
data: [],
|
||
axisLabel: {
|
||
fontSize: 10
|
||
}
|
||
},
|
||
{
|
||
type: "category",
|
||
data: [],
|
||
axisLine: {
|
||
show: false
|
||
},
|
||
axisTick: {
|
||
show: false
|
||
},
|
||
axisLabel: {
|
||
show: false
|
||
}
|
||
}
|
||
],
|
||
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
|
||
}
|
||
]
|
||
},
|
||
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
|
||
}
|
||
]
|
||
},
|
||
accDiv: utils_util.accDiv,
|
||
accSub: utils_util.accSub,
|
||
accMul: utils_util.accMul
|
||
};
|
||
},
|
||
props: {
|
||
dataList: Array
|
||
},
|
||
watch: {
|
||
dataList(newValue) {
|
||
if (this.profitabilitySingleQuarterAllIndex == 0) {
|
||
this.getROESingleQuarterData();
|
||
} else {
|
||
this.getROEAllData();
|
||
}
|
||
this.profitabilityInit();
|
||
}
|
||
},
|
||
methods: {
|
||
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) {
|
||
if (this.profitabilitySingleQuarterAllIndex == 0) {
|
||
this.getROESingleQuarterData();
|
||
} else {
|
||
this.getROEAllData();
|
||
}
|
||
} 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_weighted) {
|
||
data.push(item.profitability.roe_weighted.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();
|
||
}
|
||
},
|
||
/**
|
||
* 盈利能力切换单季度还是全部
|
||
*/
|
||
clickProfitabilitySingleQuarterOrAll(index) {
|
||
if (this.profitabilitySingleQuarterAllIndex != index) {
|
||
this.profitabilitySingleQuarterAllIndex = index;
|
||
if (index == 0) {
|
||
if (this.profitabilityIndicatorIndex == 0) {
|
||
this.getROESingleQuarterData();
|
||
} else if (this.profitabilityIndicatorIndex == 1) {
|
||
this.getOwnerEquitySingleQuarterData();
|
||
} else if (this.profitabilityIndicatorIndex == 2) {
|
||
this.getOwnerEquitySingleQuarterData();
|
||
}
|
||
} else {
|
||
if (this.profitabilityIndicatorIndex == 0) {
|
||
this.getROEAllData();
|
||
} else if (this.profitabilityIndicatorIndex == 1) {
|
||
this.getOwnerEquityAllData();
|
||
}
|
||
}
|
||
this.profitabilityInit();
|
||
}
|
||
},
|
||
/**
|
||
* 获取净资产收益率单季度数据
|
||
*/
|
||
getROESingleQuarterData() {
|
||
let category = [];
|
||
let currentYear = this.dataList[0].period.split("-")[0];
|
||
var currentYearCount = 0;
|
||
for (let item of this.dataList) {
|
||
let year = item.period.split("-")[0];
|
||
if (year == currentYear) {
|
||
currentYearCount++;
|
||
}
|
||
}
|
||
let years = (16 - currentYearCount) / 4;
|
||
let showDataCount = years * 4 + currentYearCount;
|
||
let showDataList = this.dataList.slice(0, showDataCount);
|
||
for (var i = 0; i <= years; i++) {
|
||
category.unshift(currentYear - i);
|
||
}
|
||
let data1 = [];
|
||
let data2 = [];
|
||
let data3 = [];
|
||
let data4 = [];
|
||
for (let item of showDataList) {
|
||
for (let item1 of category) {
|
||
let index = showDataList.indexOf(item);
|
||
let lastItem = showDataList[index + 1];
|
||
if (item1 + "年一季报" == item.report_type) {
|
||
if (item.profitability.roe) {
|
||
data1.unshift(item.profitability.roe.toFixed(2));
|
||
} else
|
||
data1.unshift(0);
|
||
}
|
||
if (item1 + "年中报" == item.report_type) {
|
||
if (item.profitability.roe) {
|
||
data2.unshift(utils_util.accSub(item.profitability.roe, lastItem.profitability.roe));
|
||
} else
|
||
data2.unshift(0);
|
||
}
|
||
if (item1 + "年三季报" == item.report_type) {
|
||
if (item.profitability.roe) {
|
||
data3.unshift(utils_util.accSub(item.profitability.roe, lastItem.profitability.roe));
|
||
} else
|
||
data3.unshift(0);
|
||
}
|
||
if (item1 + "年年报" == item.report_type) {
|
||
if (item.profitability.roe) {
|
||
data4.unshift(utils_util.accSub(item.profitability.roe, lastItem.profitability.roe));
|
||
} else
|
||
data4.unshift(0);
|
||
}
|
||
}
|
||
}
|
||
common_vendor.index.__f__("log", "at pagesStock/components/cwfx-view/cwfx-view.vue:476", data1, data2, data3, data4);
|
||
let sumData = [];
|
||
for (var i = 0; i < data1.length; i++) {
|
||
let sum = data1[i];
|
||
sum = utils_util.accAdd(sum, data2[i] ? data2[i] : 0);
|
||
sum = utils_util.accAdd(sum, data3[i] ? data3[i] : 0);
|
||
sum = utils_util.accAdd(sum, data4[i] ? data4[i] : 0).toFixed(2);
|
||
if (sum > 1e4) {
|
||
sumData.push((sum / 1e4).toFixed(2) + "万");
|
||
} else
|
||
sumData.push(sum);
|
||
}
|
||
this.option1.legend.data = ["第一季度", "第二季度", "第三季度", "第四季度"];
|
||
this.option1.xAxis[0].data = category;
|
||
this.option1.xAxis[1].data = category;
|
||
this.option1.series = [
|
||
{
|
||
type: "bar",
|
||
name: "第一季度",
|
||
barWidth: "15%",
|
||
data: data1,
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第二季度",
|
||
barWidth: "15%",
|
||
data: data2,
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第三季度",
|
||
barWidth: "15%",
|
||
data: data3,
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第四季度",
|
||
barWidth: "15%",
|
||
data: data4,
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "总值",
|
||
data: sumData,
|
||
barWidth: "70%",
|
||
xAxisIndex: 1,
|
||
yAxisIndex: 0,
|
||
itemStyle: {
|
||
color: "rgba(0,0,0,0.2)"
|
||
},
|
||
label: {
|
||
show: true,
|
||
position: "top"
|
||
}
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 获取净资产收益率全部数据
|
||
*/
|
||
getROEAllData() {
|
||
let showDataList = this.dataList.slice(0, 8);
|
||
let category = [];
|
||
let data1 = [];
|
||
let data2 = [];
|
||
let data3 = [];
|
||
let data4 = [];
|
||
for (let item of showDataList) {
|
||
let index = showDataList.indexOf(item);
|
||
if (index < showDataList.length - 3) {
|
||
let type = item.report_type;
|
||
type = type.replaceAll("三季报", "\n三季报");
|
||
type = type.replaceAll("年报", "\n年报");
|
||
type = type.replaceAll("中报", "\n中报");
|
||
type = type.replaceAll("一季报", "\n一季报");
|
||
category.unshift(type);
|
||
let lastItem1 = showDataList[index + 1];
|
||
let lastItem2 = showDataList[index + 2];
|
||
let lastItem3 = showDataList[index + 3];
|
||
if (item.report_type.indexOf("三季报") > -1) {
|
||
if (item.profitability.roe) {
|
||
data4.unshift(0);
|
||
data3.unshift(utils_util.accSub(item.profitability.roe, lastItem1.profitability.roe).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.profitability.roe, lastItem2.profitability.roe), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem2.profitability.roe, 1e8).toFixed(2));
|
||
} else {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(0);
|
||
}
|
||
} else if (item.report_type.indexOf("中报") > -1) {
|
||
if (item.profitability.roe) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.profitability.roe, lastItem1.profitability.roe), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem1.profitability.roe, 1e8).toFixed(2));
|
||
} else {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(0);
|
||
}
|
||
} else if (item.report_type.indexOf("一季报") > -1) {
|
||
if (item.profitability.roe) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(utils_util.accDiv(item.profitability.roe, 1e8).toFixed(2));
|
||
} else {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(0);
|
||
}
|
||
} else if (item.report_type.indexOf("年报") > -1) {
|
||
if (item.profitability.roe) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.profitability.roe, lastItem1.profitability.roe), 1e8).toFixed(2));
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.profitability.roe, lastItem2.profitability.roe), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem2.profitability.roe, lastItem3.profitability.roe), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem3.profitability.roe, 1e8).toFixed(2));
|
||
} else {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(0);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
let sumData = [];
|
||
for (var i = 0; i < data1.length; i++) {
|
||
let sum = data1[i];
|
||
sum = utils_util.accAdd(sum, data2[i]);
|
||
sum = utils_util.accAdd(sum, data3[i]);
|
||
sum = utils_util.accAdd(sum, data4[i]).toFixed(2);
|
||
if (sum > 1e4) {
|
||
sumData.push((sum / 1e4).toFixed(2) + "万");
|
||
} else
|
||
sumData.push(sum);
|
||
}
|
||
this.option1.xAxis[0].data = category;
|
||
let ratioList = [];
|
||
for (let item of showDataList) {
|
||
let index = showDataList.indexOf(item);
|
||
if (index < showDataList.length - 3) {
|
||
let lastItem = this.dataList[index + 4];
|
||
ratioList.unshift(utils_util.accMul(utils_util.accDiv(utils_util.accSub(item.profitability.roe, lastItem.profitability.roe), Math.abs(lastItem.profitability.roe)), 100).toFixed(2));
|
||
}
|
||
}
|
||
this.option1.tooltip = {
|
||
show: true,
|
||
confine: true,
|
||
formatter(params) {
|
||
let index = params.dataIndex;
|
||
let str = params.name + ":" + sumData[index];
|
||
if (data1[index] != 0) {
|
||
str += "\n第一季度:" + data1[index];
|
||
}
|
||
if (data2[index] != 0) {
|
||
str += "\n第二季度:" + data2[index];
|
||
}
|
||
if (data3[index] != 0) {
|
||
str += "\n第三季度:" + data3[index];
|
||
}
|
||
if (data4[index] != 0) {
|
||
str += "\n第四季度:" + data4[index];
|
||
}
|
||
str += "\n同比(右)" + ratioList[index];
|
||
return str;
|
||
}
|
||
};
|
||
this.option1.series = [
|
||
{
|
||
type: "bar",
|
||
name: "第一季度",
|
||
data: data1,
|
||
stack: "quarter",
|
||
yAxisIndex: 0,
|
||
label: {
|
||
show: true,
|
||
position: "top",
|
||
formatter(params) {
|
||
return sumData[params.dataIndex];
|
||
}
|
||
}
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第二季度",
|
||
data: data2,
|
||
stack: "quarter",
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第三季度",
|
||
data: data3,
|
||
yAxisIndex: 0,
|
||
stack: "quarter"
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第四季度",
|
||
data: data4,
|
||
yAxisIndex: 0,
|
||
stack: "quarter"
|
||
},
|
||
{
|
||
type: "line",
|
||
name: "同比(右)",
|
||
data: ratioList,
|
||
yAxisIndex: 1
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 切换每股指标
|
||
* @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();
|
||
}
|
||
},
|
||
/**
|
||
* 获取期间费用单季度数据
|
||
*/
|
||
getPeriodExpensesSingleQuarterData() {
|
||
let category = [];
|
||
let currentYear = this.incomeStatementList[0].period.split("-")[0];
|
||
var currentYearCount = 0;
|
||
for (let item of this.incomeStatementList) {
|
||
let year = item.period.split("-")[0];
|
||
if (year == currentYear) {
|
||
currentYearCount++;
|
||
}
|
||
}
|
||
let years = (16 - currentYearCount) / 4;
|
||
let showDataCount = years * 4 + currentYearCount;
|
||
let showDataList = this.incomeStatementList.slice(0, showDataCount);
|
||
for (var i = 0; i <= years; i++) {
|
||
category.unshift(currentYear - i);
|
||
}
|
||
let data1 = [];
|
||
let data2 = [];
|
||
let data3 = [];
|
||
let data4 = [];
|
||
for (let item of showDataList) {
|
||
for (let item1 of category) {
|
||
let index = showDataList.indexOf(item);
|
||
let lastItem = showDataList[index + 1];
|
||
let total1 = utils_util.accAdd(utils_util.accAdd(utils_util.accAdd(item.costs.selling_expenses, item.costs.admin_expenses), item.costs.rd_expenses), item.costs.financial_expenses);
|
||
let total2 = 0;
|
||
if (lastItem) {
|
||
total2 = utils_util.accAdd(utils_util.accAdd(utils_util.accAdd(lastItem.costs.selling_expenses, lastItem.costs.admin_expenses), lastItem.costs.rd_expenses), lastItem.costs.financial_expenses);
|
||
}
|
||
if (item1 + "年一季报" == item.report_type) {
|
||
if (total1) {
|
||
data1.unshift(utils_util.accDiv(total1, 1e8).toFixed(2));
|
||
} else
|
||
data1.unshift(0);
|
||
}
|
||
if (item1 + "年中报" == item.report_type) {
|
||
if (total1 && total2) {
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(total1, total2), 1e8).toFixed(2));
|
||
} else
|
||
data2.unshift(0);
|
||
}
|
||
if (item1 + "年三季报" == item.report_type) {
|
||
if (total1 && total2) {
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(total1, total2), 1e8).toFixed(2));
|
||
} else
|
||
data3.unshift(0);
|
||
}
|
||
if (item1 + "年年报" == item.report_type) {
|
||
if (total1 && total2) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(total1, total2), 1e8).toFixed(2));
|
||
} else
|
||
data4.unshift(0);
|
||
}
|
||
}
|
||
}
|
||
let sumData = [];
|
||
for (var i = 0; i < data1.length; i++) {
|
||
let sum = data1[i];
|
||
sum = utils_util.accAdd(sum, data2[i] ? data2[i] : 0);
|
||
sum = utils_util.accAdd(sum, data3[i] ? data3[i] : 0);
|
||
sum = utils_util.accAdd(sum, data4[i] ? data4[i] : 0).toFixed(2);
|
||
if (sum > 1e4) {
|
||
sumData.push((sum / 1e4).toFixed(2) + "万");
|
||
} else
|
||
sumData.push(sum);
|
||
}
|
||
this.option2.legend.data = ["第一季度", "第二季度", "第三季度", "第四季度"];
|
||
this.option3.xAxis[0].data = category;
|
||
this.option3.xAxis[1].data = category;
|
||
this.option3.series = [
|
||
{
|
||
type: "bar",
|
||
name: "第一季度",
|
||
barWidth: "15%",
|
||
data: data1,
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第二季度",
|
||
barWidth: "15%",
|
||
data: data2,
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第三季度",
|
||
barWidth: "15%",
|
||
data: data3,
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第四季度",
|
||
barWidth: "15%",
|
||
data: data4,
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "总值",
|
||
data: sumData,
|
||
barWidth: "70%",
|
||
xAxisIndex: 1,
|
||
yAxisIndex: 0,
|
||
itemStyle: {
|
||
color: "rgba(0,0,0,0.2)"
|
||
},
|
||
label: {
|
||
show: true,
|
||
position: "top"
|
||
}
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 获取期间费用全部数据
|
||
*/
|
||
getPeriodExpensesAllData() {
|
||
let showDataList = this.incomeStatementList.slice(0, 8);
|
||
let category = [];
|
||
let data1 = [];
|
||
let data2 = [];
|
||
let data3 = [];
|
||
let data4 = [];
|
||
for (let item of showDataList) {
|
||
let index = showDataList.indexOf(item);
|
||
if (index < showDataList.length - 3) {
|
||
let type = item.report_type;
|
||
type = type.replaceAll("三季报", "\n三季报");
|
||
type = type.replaceAll("年报", "\n年报");
|
||
type = type.replaceAll("中报", "\n中报");
|
||
type = type.replaceAll("一季报", "\n一季报");
|
||
category.unshift(type);
|
||
let lastItem1 = showDataList[index + 1];
|
||
let lastItem2 = showDataList[index + 2];
|
||
let lastItem3 = showDataList[index + 3];
|
||
let total1 = utils_util.accAdd(utils_util.accAdd(utils_util.accAdd(item.costs.selling_expenses, item.costs.admin_expenses), item.costs.rd_expenses), item.costs.financial_expenses);
|
||
let total2 = utils_util.accAdd(utils_util.accAdd(utils_util.accAdd(lastItem1.costs.selling_expenses, lastItem1.costs.admin_expenses), lastItem1.costs.rd_expenses), lastItem1.costs.financial_expenses);
|
||
let total3 = utils_util.accAdd(utils_util.accAdd(utils_util.accAdd(lastItem2.costs.selling_expenses, lastItem2.costs.admin_expenses), lastItem2.costs.rd_expenses), lastItem2.costs.financial_expenses);
|
||
let total4 = utils_util.accAdd(utils_util.accAdd(utils_util.accAdd(lastItem3.costs.selling_expenses, lastItem3.costs.admin_expenses), lastItem3.costs.rd_expenses), lastItem3.costs.financial_expenses);
|
||
if (item.report_type.indexOf("三季报") > -1) {
|
||
if (total1 && total2 && total3) {
|
||
data4.unshift(0);
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(total1, total2), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(total2, total3), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(total3, 1e8).toFixed(2));
|
||
} else {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(0);
|
||
}
|
||
} else if (item.report_type.indexOf("中报") > -1) {
|
||
if (total1 && total2) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(total1, total2), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(total2, 1e8).toFixed(2));
|
||
} else {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(0);
|
||
}
|
||
} else if (item.report_type.indexOf("一季报") > -1) {
|
||
if (total1) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(utils_util.accDiv(total1, 1e8).toFixed(2));
|
||
} else {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(0);
|
||
}
|
||
} else if (item.report_type.indexOf("年报") > -1) {
|
||
if (total1 && total2 && total3 && total4) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(total1, total2), 1e8).toFixed(2));
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(total2, total3), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(total3, total4), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(total4, 1e8).toFixed(2));
|
||
} else {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(0);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
let sumData = [];
|
||
for (var i = 0; i < data1.length; i++) {
|
||
let sum = data1[i];
|
||
sum = utils_util.accAdd(sum, data2[i]);
|
||
sum = utils_util.accAdd(sum, data3[i]);
|
||
sum = utils_util.accAdd(sum, data4[i]).toFixed(2);
|
||
if (sum > 1e4) {
|
||
sumData.push((sum / 1e4).toFixed(2) + "万");
|
||
} else
|
||
sumData.push(sum);
|
||
}
|
||
this.option3.xAxis[0].data = category;
|
||
let ratioList = [];
|
||
for (let item of showDataList) {
|
||
let index = showDataList.indexOf(item);
|
||
if (index < showDataList.length - 3) {
|
||
let lastItem = this.incomeStatementList[index + 4];
|
||
let total1 = utils_util.accAdd(utils_util.accAdd(utils_util.accAdd(item.costs.selling_expenses, item.costs.admin_expenses), item.costs.rd_expenses), item.costs.financial_expenses);
|
||
let total2 = utils_util.accAdd(utils_util.accAdd(utils_util.accAdd(lastItem.costs.selling_expenses, lastItem.costs.admin_expenses), lastItem.costs.rd_expenses), lastItem.costs.financial_expenses);
|
||
ratioList.unshift(utils_util.accMul(utils_util.accDiv(utils_util.accSub(total1, total2), Math.abs(total2)), 100).toFixed(2));
|
||
}
|
||
}
|
||
this.option3.tooltip = {
|
||
show: true,
|
||
confine: true,
|
||
formatter(params) {
|
||
let index = params.dataIndex;
|
||
let str = params.name + ":" + sumData[index];
|
||
if (data1[index] != 0) {
|
||
str += "\n第一季度:" + data1[index];
|
||
}
|
||
if (data2[index] != 0) {
|
||
str += "\n第二季度:" + data2[index];
|
||
}
|
||
if (data3[index] != 0) {
|
||
str += "\n第三季度:" + data3[index];
|
||
}
|
||
if (data4[index] != 0) {
|
||
str += "\n第四季度:" + data4[index];
|
||
}
|
||
str += "\n同比(右)" + ratioList[index];
|
||
return str;
|
||
}
|
||
};
|
||
this.option3.series = [
|
||
{
|
||
type: "bar",
|
||
name: "第一季度",
|
||
data: data1,
|
||
stack: "quarter",
|
||
yAxisIndex: 0,
|
||
label: {
|
||
show: true,
|
||
position: "top",
|
||
formatter(params) {
|
||
return sumData[params.dataIndex];
|
||
}
|
||
}
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第二季度",
|
||
data: data2,
|
||
stack: "quarter",
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第三季度",
|
||
data: data3,
|
||
yAxisIndex: 0,
|
||
stack: "quarter"
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第四季度",
|
||
data: data4,
|
||
yAxisIndex: 0,
|
||
stack: "quarter"
|
||
},
|
||
{
|
||
type: "line",
|
||
name: "同比(右)",
|
||
data: ratioList,
|
||
yAxisIndex: 1
|
||
}
|
||
];
|
||
}
|
||
}
|
||
};
|
||
if (!Array) {
|
||
const _easycom_l_echart2 = common_vendor.resolveComponent("l-echart");
|
||
_easycom_l_echart2();
|
||
}
|
||
const _easycom_l_echart = () => "../../../uni_modules/lime-echart/components/l-echart/l-echart.js";
|
||
if (!Math) {
|
||
_easycom_l_echart();
|
||
}
|
||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||
return common_vendor.e({
|
||
a: common_assets._imports_0$3,
|
||
b: common_assets._imports_2$3,
|
||
c: common_vendor.f($data.profitabilityIndicatorList, (item, index, i0) => {
|
||
return {
|
||
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_vendor.n("option " + ($data.profitabilitySingleQuarterAllIndex == 0 ? "select" : "")),
|
||
e: common_vendor.o(($event) => $options.clickProfitabilitySingleQuarterOrAll(0)),
|
||
f: $data.profitabilitySingleQuarterAllIndex == 1
|
||
}, $data.profitabilitySingleQuarterAllIndex == 1 ? {
|
||
g: common_assets._imports_2$12
|
||
} : {
|
||
h: common_assets._imports_3$11
|
||
}, {
|
||
i: $data.profitabilitySingleQuarterAllIndex == 1
|
||
}, $data.profitabilitySingleQuarterAllIndex == 1 ? {
|
||
j: common_assets._imports_4$10
|
||
} : {
|
||
k: common_assets._imports_5$7
|
||
}, {
|
||
l: common_vendor.n("flex option " + ($data.profitabilitySingleQuarterAllIndex == 1 ? "select" : "")),
|
||
m: common_vendor.o(($event) => $options.clickProfitabilitySingleQuarterOrAll(1)),
|
||
n: common_vendor.sr("chartRef1", "351c0d57-0"),
|
||
o: common_assets._imports_6$3,
|
||
p: common_assets._imports_2$3,
|
||
q: common_vendor.f($data.perShareIndicatorList, (item, index, i0) => {
|
||
return {
|
||
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)
|
||
};
|
||
}),
|
||
r: common_assets._imports_3$11,
|
||
s: common_assets._imports_5$7,
|
||
t: common_vendor.sr("chartRef2", "351c0d57-1")
|
||
});
|
||
}
|
||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||
wx.createPage(MiniProgramPage);
|
||
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pagesStock/components/cwfx-view/cwfx-view.js.map
|