2779 lines
97 KiB
JavaScript
2779 lines
97 KiB
JavaScript
"use strict";
|
||
const utils_util = require("../../../utils/util.js");
|
||
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: "cwsj-view",
|
||
data() {
|
||
return {
|
||
balanceIndicatorIndex: 0,
|
||
cashFlowIndicatorIndex: 0,
|
||
profitIndicatorIndex: 0,
|
||
balanceSingleQuarterAllIndex: 0,
|
||
//资产负债表单季度还是全部
|
||
cashFlowSingleQuarterAllIndex: 0,
|
||
//现金流量表单季度还是全部
|
||
profitSingleQuarterAllIndex: 0,
|
||
//利润表单季度还是全部
|
||
option1: {
|
||
legend: {
|
||
show: true,
|
||
itemWidth: 10,
|
||
itemHeight: 10,
|
||
data: ["货币资金", "同比(右)"]
|
||
},
|
||
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: ["经营现金流", "同比(右)"]
|
||
},
|
||
tooltip: {
|
||
show: true
|
||
},
|
||
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: "经营现金流",
|
||
data: [],
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "line",
|
||
name: "同比",
|
||
data: [],
|
||
yAxisIndex: 1
|
||
}
|
||
]
|
||
},
|
||
option3: {
|
||
legend: {
|
||
show: true,
|
||
data: ["净利润", "同比(右)"]
|
||
},
|
||
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: "净利润",
|
||
data: [],
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "line",
|
||
name: "同比",
|
||
data: [],
|
||
yAxisIndex: 1
|
||
}
|
||
]
|
||
},
|
||
getNumStr: utils_util.getNumStr,
|
||
accDiv: utils_util.accDiv,
|
||
accSub: utils_util.accSub,
|
||
accMul: utils_util.accMul
|
||
};
|
||
},
|
||
props: {
|
||
financialBalanceList: Array,
|
||
//资产负债表
|
||
cashFlowList: Array,
|
||
//现金流量表
|
||
incomeStatementList: Array
|
||
//利润表
|
||
},
|
||
watch: {
|
||
financialBalanceList(newValue) {
|
||
this.getMoneyFundSingleQuarterData();
|
||
this.balanceInit();
|
||
},
|
||
cashFlowList(newValue) {
|
||
this.getOperatingCashFlowSingleQuarterData();
|
||
this.cashFlowInit();
|
||
},
|
||
incomeStatementList(newValue) {
|
||
this.getNetProfitSingleQuarterData();
|
||
this.incomeStatementInit();
|
||
}
|
||
},
|
||
methods: {
|
||
async balanceInit() {
|
||
const chart = await this.$refs.chartRef1.init(echarts);
|
||
chart.setOption(this.option1);
|
||
},
|
||
async cashFlowInit() {
|
||
const chart = await this.$refs.chartRef2.init(echarts);
|
||
chart.setOption(this.option2);
|
||
},
|
||
async incomeStatementInit() {
|
||
const chart = await this.$refs.chartRef3.init(echarts);
|
||
chart.setOption(this.option3);
|
||
},
|
||
/**
|
||
* 点击切换资产负债表指标
|
||
* @param {Object} index
|
||
*/
|
||
clickBalanceIndicatorItem(index) {
|
||
if (this.balanceIndicatorIndex != index) {
|
||
this.balanceIndicatorIndex = index;
|
||
if (index == 0) {
|
||
if (this.balanceSingleQuarterAllIndex == 0) {
|
||
this.getMoneyFundSingleQuarterData();
|
||
} else {
|
||
this.getMoneyFundAllData();
|
||
}
|
||
} else if (index == 1) {
|
||
if (this.balanceSingleQuarterAllIndex == 0) {
|
||
this.getOwnerEquitySingleQuarterData();
|
||
} else {
|
||
this.getOwnerEquityAllData();
|
||
}
|
||
} else
|
||
;
|
||
this.balanceInit();
|
||
}
|
||
},
|
||
/**
|
||
* 资产负债表切换单季度还是全部
|
||
*/
|
||
clickBalanceSingleQuarterOrAll(index) {
|
||
if (this.balanceSingleQuarterAllIndex != index) {
|
||
this.balanceSingleQuarterAllIndex = index;
|
||
if (index == 0) {
|
||
if (this.balanceIndicatorIndex == 0) {
|
||
this.getMoneyFundSingleQuarterData();
|
||
} else if (this.balanceIndicatorIndex == 1) {
|
||
this.getOwnerEquitySingleQuarterData();
|
||
}
|
||
} else {
|
||
if (this.balanceIndicatorIndex == 0) {
|
||
this.getMoneyFundAllData();
|
||
} else if (this.balanceIndicatorIndex == 1) {
|
||
this.getOwnerEquityAllData();
|
||
}
|
||
}
|
||
this.balanceInit();
|
||
}
|
||
},
|
||
/**
|
||
* 获取货币基金单季度数据
|
||
*/
|
||
getMoneyFundSingleQuarterData() {
|
||
let category = [];
|
||
let currentYear = this.financialBalanceList[0].period.split("-")[0];
|
||
var currentYearCount = 0;
|
||
for (let item of this.financialBalanceList) {
|
||
let year = item.period.split("-")[0];
|
||
if (year == currentYear) {
|
||
currentYearCount++;
|
||
}
|
||
}
|
||
let years = (16 - currentYearCount) / 4;
|
||
let showDataCount = years * 4 + currentYearCount;
|
||
let showDataList = this.financialBalanceList.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 = this.financialBalanceList[index + 1];
|
||
if (item1 + "年一季报" == item.report_type) {
|
||
if (item.assets.current_assets.cash) {
|
||
data1.unshift(utils_util.accDiv(item.assets.current_assets.cash, 1e8).toFixed(2));
|
||
} else
|
||
data1.unshift(0);
|
||
}
|
||
if (item1 + "年中报" == item.report_type) {
|
||
if (item.assets.current_assets.cash) {
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.assets.current_assets.cash, lastItem.assets.current_assets.cash), 1e8).toFixed(2));
|
||
} else
|
||
data2.unshift(0);
|
||
}
|
||
if (item1 + "年三季报" == item.report_type) {
|
||
if (item.assets.current_assets.cash) {
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(item.assets.current_assets.cash, lastItem.assets.current_assets.cash), 1e8).toFixed(2));
|
||
} else
|
||
data3.unshift(0);
|
||
}
|
||
if (item1 + "年年报" == item.report_type) {
|
||
if (item.assets.current_assets.cash) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.assets.current_assets.cash, lastItem.assets.current_assets.cash), 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.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"
|
||
}
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 获取货币基金全部数据
|
||
*/
|
||
getMoneyFundAllData() {
|
||
let showDataList = this.financialBalanceList.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.assets.current_assets.cash) {
|
||
data4.unshift(0);
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(item.assets.current_assets.cash, lastItem1.assets.current_assets.cash), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.assets.current_assets.cash, lastItem2.assets.current_assets.cash), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem2.assets.current_assets.cash, 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.assets.current_assets.cash) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.assets.current_assets.cash, lastItem1.assets.current_assets.cash), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem1.assets.current_assets.cash, 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.assets.current_assets.cash) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(utils_util.accDiv(item.assets.current_assets.cash, 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.assets.current_assets.cash) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.assets.current_assets.cash, lastItem1.assets.current_assets.cash), 1e8).toFixed(2));
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.assets.current_assets.cash, lastItem2.assets.current_assets.cash), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem2.assets.current_assets.cash, lastItem3.assets.current_assets.cash), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem3.assets.current_assets.cash, 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.legend.data = ["货币基金", "同比(右)"];
|
||
this.option1.xAxis[0].data = category;
|
||
this.option1.xAxis[1].data = category;
|
||
let ratioList = [];
|
||
for (let item of showDataList) {
|
||
let index = showDataList.indexOf(item);
|
||
if (index < showDataList.length - 3) {
|
||
let lastItem = this.financialBalanceList[index + 4];
|
||
ratioList.unshift(utils_util.accMul(utils_util.accDiv(utils_util.accSub(item.assets.current_assets.cash, lastItem.assets.current_assets.cash), lastItem.assets.current_assets.cash), 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
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 获取所有者权益单季度数据
|
||
*/
|
||
getOwnerEquitySingleQuarterData() {
|
||
let category = [];
|
||
let currentYear = this.financialBalanceList[0].period.split("-")[0];
|
||
var currentYearCount = 0;
|
||
for (let item of this.financialBalanceList) {
|
||
let year = item.period.split("-")[0];
|
||
if (year == currentYear) {
|
||
currentYearCount++;
|
||
}
|
||
}
|
||
let years = (16 - currentYearCount) / 4;
|
||
let showDataCount = years * 4 + currentYearCount;
|
||
let showDataList = this.financialBalanceList.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.equity.total) {
|
||
data1.unshift(utils_util.accDiv(item.equity.total, 1e8).toFixed(2));
|
||
} else
|
||
data1.unshift(0);
|
||
}
|
||
if (item1 + "年中报" == item.report_type) {
|
||
if (item.equity.total) {
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.equity.total, lastItem.equity.total), 1e8).toFixed(2));
|
||
} else
|
||
data2.unshift(0);
|
||
}
|
||
if (item1 + "年三季报" == item.report_type) {
|
||
if (item.equity.total) {
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(item.equity.total, lastItem.equity.total), 1e8).toFixed(2));
|
||
} else
|
||
data3.unshift(0);
|
||
}
|
||
if (item1 + "年年报" == item.report_type) {
|
||
if (item.equity.total) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.equity.total, lastItem.equity.total), 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.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"
|
||
}
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 获取所有者权益全部数据
|
||
*/
|
||
getOwnerEquityAllData() {
|
||
let showDataList = this.financialBalanceList.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.equity.total) {
|
||
data4.unshift(0);
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(item.equity.total, lastItem1.equity.total), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.equity.total, lastItem2.equity.total), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem2.equity.total, 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.equity.total) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.equity.total, lastItem1.equity.total), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem1.equity.total, 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.equity.total) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(utils_util.accDiv(item.equity.total, 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.equity.total) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.equity.total, lastItem1.equity.total), 1e8).toFixed(2));
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.equity.total, lastItem2.equity.total), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem2.equity.total, lastItem3.equity.total), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem3.equity.total, 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.legend.data = ["所有者权益", "同比(右)"];
|
||
this.option1.xAxis[0].data = category;
|
||
this.option1.xAxis[1].data = category;
|
||
let ratioList = [];
|
||
for (let item of showDataList) {
|
||
let index = showDataList.indexOf(item);
|
||
if (index < showDataList.length - 3) {
|
||
let lastItem = this.financialBalanceList[index + 4];
|
||
ratioList.unshift(utils_util.accMul(utils_util.accDiv(utils_util.accSub(item.equity.total, lastItem.equity.total), lastItem.equity.total), 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
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 计算经营性现金流增长率
|
||
*/
|
||
caculateOperatingCashFlowGrowthRate() {
|
||
let flow1 = this.cashFlowList[0].operating_activities.net_flow;
|
||
let flow2 = this.cashFlowList[4].operating_activities.net_flow;
|
||
return utils_util.accMul(utils_util.accDiv(utils_util.accSub(flow1, flow2), flow2), 100).toFixed(2);
|
||
},
|
||
/**
|
||
* 计算合计现金流增长率
|
||
*/
|
||
caculateTotalCashFlowGrowthRate() {
|
||
let flow1 = this.cashFlowList[0].cash_changes.net_increase;
|
||
let flow2 = this.cashFlowList[4].cash_changes.net_increase;
|
||
return utils_util.accMul(utils_util.accDiv(utils_util.accSub(flow1, flow2), flow2), 100).toFixed(2);
|
||
},
|
||
/**
|
||
* 点击切换现金流量表指标
|
||
* @param {Object} index
|
||
*/
|
||
clickCashFlowIndicatorItem(index) {
|
||
if (this.cashFlowIndicatorIndex != index) {
|
||
this.cashFlowIndicatorIndex = index;
|
||
if (index == 0) {
|
||
if (this.cashFlowSingleQuarterAllIndex == 0) {
|
||
this.getOperatingCashFlowSingleQuarterData();
|
||
} else
|
||
this.getOperatingCashFlowAllData();
|
||
} else if (index == 1) {
|
||
if (this.cashFlowSingleQuarterAllIndex == 0) {
|
||
this.getFinancingCashFlowSingleQuarterData();
|
||
} else
|
||
this.getFinancingCashFlowAllData();
|
||
} else if (index == 2) {
|
||
if (this.cashFlowSingleQuarterAllIndex == 0) {
|
||
this.getInvestmentCashFlowSingleQuarterData();
|
||
} else
|
||
this.getInvestmentCashFlowAllData();
|
||
}
|
||
this.cashFlowInit();
|
||
}
|
||
},
|
||
/**
|
||
* 现金流量表切换单季度还是全部
|
||
*/
|
||
clickCashFlowSingleQuarterOrAll(index) {
|
||
if (this.cashFlowSingleQuarterAllIndex != index) {
|
||
this.cashFlowSingleQuarterAllIndex = index;
|
||
if (index == 0) {
|
||
if (this.cashFlowIndicatorIndex == 0) {
|
||
this.getOperatingCashFlowSingleQuarterData();
|
||
} else if (this.cashFlowIndicatorIndex == 1) {
|
||
this.getFinancingCashFlowSingleQuarterData();
|
||
} else {
|
||
this.getInvestmentCashFlowSingleQuarterData();
|
||
}
|
||
} else {
|
||
if (this.cashFlowIndicatorIndex == 0) {
|
||
this.getOperatingCashFlowAllData();
|
||
} else if (this.cashFlowIndicatorIndex == 1) {
|
||
this.getFinancingCashFlowAllData();
|
||
} else {
|
||
this.getInvestmentCashFlowAllData();
|
||
}
|
||
}
|
||
this.cashFlowInit();
|
||
}
|
||
},
|
||
/**
|
||
* 获取经营现金流单季度数据
|
||
*/
|
||
getOperatingCashFlowSingleQuarterData() {
|
||
let category = [];
|
||
let currentYear = this.cashFlowList[0].period.split("-")[0];
|
||
var currentYearCount = 0;
|
||
for (let item of this.cashFlowList) {
|
||
let year = item.period.split("-")[0];
|
||
if (year == currentYear) {
|
||
currentYearCount++;
|
||
}
|
||
}
|
||
let years = (16 - currentYearCount) / 4;
|
||
let showDataCount = years * 4 + currentYearCount;
|
||
let showDataList = this.cashFlowList.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.operating_activities.net_flow) {
|
||
data1.unshift(utils_util.accDiv(item.operating_activities.net_flow, 1e8).toFixed(2));
|
||
} else
|
||
data1.unshift(0);
|
||
}
|
||
if (item1 + "年中报" == item.report_type) {
|
||
if (item.operating_activities.net_flow) {
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.operating_activities.net_flow, lastItem.operating_activities.net_flow), 1e8).toFixed(2));
|
||
} else
|
||
data2.unshift(0);
|
||
}
|
||
if (item1 + "年三季报" == item.report_type) {
|
||
if (item.operating_activities.net_flow) {
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(item.operating_activities.net_flow, lastItem.operating_activities.net_flow), 1e8).toFixed(2));
|
||
} else
|
||
data3.unshift(0);
|
||
}
|
||
if (item1 + "年年报" == item.report_type) {
|
||
if (item.operating_activities.net_flow) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.operating_activities.net_flow, lastItem.operating_activities.net_flow), 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.option2.xAxis[0].data = category;
|
||
this.option2.xAxis[1].data = category;
|
||
this.option2.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"
|
||
}
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 获取经营现金流全部数据
|
||
*/
|
||
getOperatingCashFlowAllData() {
|
||
let showDataList = this.cashFlowList.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.operating_activities.net_flow) {
|
||
data4.unshift(0);
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(item.operating_activities.net_flow, lastItem1.operating_activities.net_flow), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.operating_activities.net_flow, lastItem2.operating_activities.net_flow), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem2.operating_activities.net_flow, 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.operating_activities.net_flow) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.operating_activities.net_flow, lastItem1.operating_activities.net_flow), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem1.operating_activities.net_flow, 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.operating_activities.net_flow) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(utils_util.accDiv(item.operating_activities.net_flow, 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.operating_activities.net_flow) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.operating_activities.net_flow, lastItem1.operating_activities.net_flow), 1e8).toFixed(2));
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.operating_activities.net_flow, lastItem2.operating_activities.net_flow), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem2.operating_activities.net_flow, lastItem3.operating_activities.net_flow), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem3.operating_activities.net_flow, 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.option2.legend.data = ["经营现金流", "同比(右)"];
|
||
this.option2.xAxis[0].data = category;
|
||
let ratioList = [];
|
||
for (let item of showDataList) {
|
||
let index = showDataList.indexOf(item);
|
||
if (index < showDataList.length - 3) {
|
||
let lastItem = this.cashFlowList[index + 4];
|
||
ratioList.unshift(utils_util.accMul(utils_util.accDiv(utils_util.accSub(item.operating_activities.net_flow, lastItem.operating_activities.net_flow), Math.abs(lastItem.operating_activities.net_flow)), 100).toFixed(2));
|
||
}
|
||
}
|
||
this.option2.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.option2.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
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 获取筹资现金流单季度数据
|
||
*/
|
||
getFinancingCashFlowSingleQuarterData() {
|
||
let category = [];
|
||
let currentYear = this.cashFlowList[0].period.split("-")[0];
|
||
var currentYearCount = 0;
|
||
for (let item of this.financialBalanceList) {
|
||
let year = item.period.split("-")[0];
|
||
if (year == currentYear) {
|
||
currentYearCount++;
|
||
}
|
||
}
|
||
let years = (16 - currentYearCount) / 4;
|
||
let showDataCount = years * 4 + currentYearCount;
|
||
let showDataList = this.cashFlowList.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.financing_activities.net_flow) {
|
||
data1.unshift(utils_util.accDiv(item.financing_activities.net_flow, 1e8).toFixed(2));
|
||
} else
|
||
data1.unshift(0);
|
||
}
|
||
if (item1 + "年中报" == item.report_type) {
|
||
if (item.financing_activities.net_flow) {
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.financing_activities.net_flow, lastItem.financing_activities.net_flow), 1e8).toFixed(2));
|
||
} else
|
||
data2.unshift(0);
|
||
}
|
||
if (item1 + "年三季报" == item.report_type) {
|
||
if (item.financing_activities.net_flow) {
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(item.financing_activities.net_flow, lastItem.financing_activities.net_flow), 1e8).toFixed(2));
|
||
} else
|
||
data3.unshift(0);
|
||
}
|
||
if (item1 + "年年报" == item.report_type) {
|
||
if (item.financing_activities.net_flow) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.financing_activities.net_flow, lastItem.financing_activities.net_flow), 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.option2.xAxis[0].data = category;
|
||
this.option2.xAxis[1].data = category;
|
||
this.option2.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"
|
||
}
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 获取筹资现金流全部数据
|
||
*/
|
||
getFinancingCashFlowAllData() {
|
||
let showDataList = this.cashFlowList.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.financing_activities.net_flow) {
|
||
data4.unshift(0);
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(item.financing_activities.net_flow, lastItem1.financing_activities.net_flow), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.financing_activities.net_flow, lastItem2.financing_activities.net_flow), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem2.financing_activities.net_flow, 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.financing_activities.net_flow) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.financing_activities.net_flow, lastItem1.financing_activities.net_flow), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem1.financing_activities.net_flow, 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.financing_activities.net_flow) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(utils_util.accDiv(item.financing_activities.net_flow, 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.financing_activities.net_flow) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.financing_activities.net_flow, lastItem1.financing_activities.net_flow), 1e8).toFixed(2));
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.financing_activities.net_flow, lastItem2.financing_activities.net_flow), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem2.financing_activities.net_flow, lastItem3.financing_activities.net_flow), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem3.financing_activities.net_flow, 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.option2.xAxis[0].data = category;
|
||
let ratioList = [];
|
||
for (let item of showDataList) {
|
||
let index = showDataList.indexOf(item);
|
||
if (index < showDataList.length - 3) {
|
||
let lastItem = this.cashFlowList[index + 4];
|
||
ratioList.unshift(utils_util.accMul(utils_util.accDiv(utils_util.accSub(item.financing_activities.net_flow, lastItem.financing_activities.net_flow), Math.abs(lastItem.financing_activities.net_flow)), 100).toFixed(2));
|
||
}
|
||
}
|
||
this.option2.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.option2.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
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 获取投资现金流单季度数据
|
||
*/
|
||
getInvestmentCashFlowSingleQuarterData() {
|
||
let category = [];
|
||
let currentYear = this.cashFlowList[0].period.split("-")[0];
|
||
var currentYearCount = 0;
|
||
for (let item of this.cashFlowList) {
|
||
let year = item.period.split("-")[0];
|
||
if (year == currentYear) {
|
||
currentYearCount++;
|
||
}
|
||
}
|
||
let years = (16 - currentYearCount) / 4;
|
||
let showDataCount = years * 4 + currentYearCount;
|
||
let showDataList = this.cashFlowList.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.investment_activities.net_flow) {
|
||
data1.unshift(utils_util.accDiv(item.investment_activities.net_flow, 1e8).toFixed(2));
|
||
} else
|
||
data1.unshift(0);
|
||
}
|
||
if (item1 + "年中报" == item.report_type) {
|
||
if (item.investment_activities.net_flow) {
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.investment_activities.net_flow, lastItem.investment_activities.net_flow), 1e8).toFixed(2));
|
||
} else
|
||
data2.unshift(0);
|
||
}
|
||
if (item1 + "年三季报" == item.report_type) {
|
||
if (item.investment_activities.net_flow) {
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(item.investment_activities.net_flow, lastItem.investment_activities.net_flow), 1e8).toFixed(2));
|
||
} else
|
||
data3.unshift(0);
|
||
}
|
||
if (item1 + "年年报" == item.report_type) {
|
||
if (item.investment_activities.net_flow) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.investment_activities.net_flow, lastItem.investment_activities.net_flow), 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.option2.xAxis[0].data = category;
|
||
this.option2.xAxis[1].data = category;
|
||
this.option2.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"
|
||
}
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 获取投资现金流全部数据
|
||
*/
|
||
getInvestmentCashFlowAllData() {
|
||
let showDataList = this.cashFlowList.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.investment_activities.net_flow) {
|
||
data4.unshift(0);
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(item.investment_activities.net_flow, lastItem1.investment_activities.net_flow), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.investment_activities.net_flow, lastItem2.investment_activities.net_flow), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem2.investment_activities.net_flow, 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.investment_activities.net_flow) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.investment_activities.net_flow, lastItem1.investment_activities.net_flow), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem1.investment_activities.net_flow, 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.investment_activities.net_flow) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(utils_util.accDiv(item.investment_activities.net_flow, 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.investment_activities.net_flow) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.investment_activities.net_flow, lastItem1.investment_activities.net_flow), 1e8).toFixed(2));
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.investment_activities.net_flow, lastItem2.investment_activities.net_flow), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem2.investment_activities.net_flow, lastItem3.investment_activities.net_flow), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem3.investment_activities.net_flow, 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.option2.xAxis[0].data = category;
|
||
let ratioList = [];
|
||
for (let item of showDataList) {
|
||
let index = showDataList.indexOf(item);
|
||
if (index < showDataList.length - 3) {
|
||
let lastItem = this.cashFlowList[index + 4];
|
||
ratioList.unshift(utils_util.accMul(utils_util.accDiv(utils_util.accSub(item.investment_activities.net_flow, lastItem.investment_activities.net_flow), Math.abs(lastItem.investment_activities.net_flow)), 100).toFixed(2));
|
||
}
|
||
}
|
||
this.option2.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.option2.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} index
|
||
*/
|
||
clickProfitIndicatorItem(index) {
|
||
if (this.profitIndicatorIndex != index) {
|
||
this.profitIndicatorIndex = index;
|
||
if (index == 0) {
|
||
if (this.profitSingleQuarterAllIndex == 0) {
|
||
this.getNetProfitSingleQuarterData();
|
||
} else
|
||
this.getNetProfitAllData();
|
||
} else if (index == 1) {
|
||
if (this.profitSingleQuarterAllIndex == 0) {
|
||
this.getOperatingRevenueSingleQuarterData();
|
||
} else
|
||
this.getOperatingRevenueAllData();
|
||
} else if (index == 2) {
|
||
if (this.profitSingleQuarterAllIndex == 0) {
|
||
this.getPeriodExpensesSingleQuarterData();
|
||
} else
|
||
this.getPeriodExpensesAllData();
|
||
}
|
||
this.incomeStatementInit();
|
||
}
|
||
},
|
||
/**
|
||
* 利润表切换单季度还是全部
|
||
*/
|
||
clickProfitSingleQuarterOrAll(index) {
|
||
if (this.profitSingleQuarterAllIndex != index) {
|
||
this.profitSingleQuarterAllIndex = index;
|
||
if (index == 0) {
|
||
if (this.profitIndicatorIndex == 0) {
|
||
this.getNetProfitSingleQuarterData();
|
||
} else if (this.profitIndicatorIndex == 1) {
|
||
this.getOperatingRevenueSingleQuarterData();
|
||
} else
|
||
this.getPeriodExpensesSingleQuarterData();
|
||
} else {
|
||
if (this.profitIndicatorIndex == 0) {
|
||
this.getNetProfitAllData();
|
||
} else if (this.profitIndicatorIndex == 1) {
|
||
this.getOperatingRevenueAllData();
|
||
} else
|
||
this.getPeriodExpensesAllData();
|
||
}
|
||
this.incomeStatementInit();
|
||
}
|
||
},
|
||
/**
|
||
* 获取净利润单季度数据
|
||
*/
|
||
getNetProfitSingleQuarterData() {
|
||
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];
|
||
if (item1 + "年一季报" == item.report_type) {
|
||
if (item.profit.net_profit) {
|
||
data1.unshift(utils_util.accDiv(item.profit.net_profit, 1e8).toFixed(2));
|
||
} else
|
||
data1.unshift(0);
|
||
}
|
||
if (item1 + "年中报" == item.report_type) {
|
||
if (item.profit.net_profit) {
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.profit.net_profit, lastItem.profit.net_profit), 1e8).toFixed(2));
|
||
} else
|
||
data2.unshift(0);
|
||
}
|
||
if (item1 + "年三季报" == item.report_type) {
|
||
if (item.profit.net_profit) {
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(item.profit.net_profit, lastItem.profit.net_profit), 1e8).toFixed(2));
|
||
} else
|
||
data3.unshift(0);
|
||
}
|
||
if (item1 + "年年报" == item.report_type) {
|
||
if (item.profit.net_profit) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.profit.net_profit, lastItem.profit.net_profit), 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: "第一季度",
|
||
data: data1,
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第二季度",
|
||
data: data2,
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第三季度",
|
||
data: data3,
|
||
yAxisIndex: 0
|
||
},
|
||
{
|
||
type: "bar",
|
||
name: "第四季度",
|
||
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"
|
||
}
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 获取投资现金流全部数据
|
||
*/
|
||
getNetProfitAllData() {
|
||
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];
|
||
if (item.report_type.indexOf("三季报") > -1) {
|
||
if (item.profit.net_profit) {
|
||
data4.unshift(0);
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(item.profit.net_profit, lastItem1.profit.net_profit), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.profit.net_profit, lastItem2.profit.net_profit), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem2.profit.net_profit, 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.profit.net_profit) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.profit.net_profit, lastItem1.profit.net_profit), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem1.profit.net_profit, 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.profit.net_profit) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(utils_util.accDiv(item.profit.net_profit, 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.profit.net_profit) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.profit.net_profit, lastItem1.profit.net_profit), 1e8).toFixed(2));
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.profit.net_profit, lastItem2.profit.net_profit), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem2.profit.net_profit, lastItem3.profit.net_profit), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem3.profit.net_profit, 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];
|
||
ratioList.unshift(utils_util.accMul(utils_util.accDiv(utils_util.accSub(item.profit.net_profit, lastItem.profit.net_profit), Math.abs(lastItem.profit.net_profit)), 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
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 获取营业收入单季度数据
|
||
*/
|
||
getOperatingRevenueSingleQuarterData() {
|
||
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];
|
||
if (item1 + "年一季报" == item.report_type) {
|
||
if (item.revenue.total_operating_revenue) {
|
||
data1.unshift(utils_util.accDiv(item.revenue.total_operating_revenue, 1e8).toFixed(2));
|
||
} else
|
||
data1.unshift(0);
|
||
}
|
||
if (item1 + "年中报" == item.report_type) {
|
||
if (item.revenue.total_operating_revenue) {
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.revenue.total_operating_revenue, lastItem.revenue.total_operating_revenue), 1e8).toFixed(2));
|
||
} else
|
||
data2.unshift(0);
|
||
}
|
||
if (item1 + "年三季报" == item.report_type) {
|
||
if (item.revenue.total_operating_revenue) {
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(item.revenue.total_operating_revenue, lastItem.revenue.total_operating_revenue), 1e8).toFixed(2));
|
||
} else
|
||
data3.unshift(0);
|
||
}
|
||
if (item1 + "年年报" == item.report_type) {
|
||
if (item.revenue.total_operating_revenue) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.revenue.total_operating_revenue, lastItem.revenue.total_operating_revenue), 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"
|
||
}
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 获取营业收入全部数据
|
||
*/
|
||
getOperatingRevenueAllData() {
|
||
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];
|
||
if (item.report_type.indexOf("三季报") > -1) {
|
||
if (item.revenue.total_operating_revenue) {
|
||
data4.unshift(0);
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(item.revenue.total_operating_revenue, lastItem1.revenue.total_operating_revenue), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.revenue.total_operating_revenue, lastItem2.revenue.total_operating_revenue), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem2.revenue.total_operating_revenue, 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.revenue.total_operating_revenue) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(item.revenue.total_operating_revenue, lastItem1.revenue.total_operating_revenue), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem1.revenue.total_operating_revenue, 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.revenue.total_operating_revenue) {
|
||
data4.unshift(0);
|
||
data3.unshift(0);
|
||
data2.unshift(0);
|
||
data1.unshift(utils_util.accDiv(item.revenue.total_operating_revenue, 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.revenue.total_operating_revenue) {
|
||
data4.unshift(utils_util.accDiv(utils_util.accSub(item.revenue.total_operating_revenue, lastItem1.revenue.total_operating_revenue), 1e8).toFixed(2));
|
||
data3.unshift(utils_util.accDiv(utils_util.accSub(lastItem1.revenue.total_operating_revenue, lastItem2.revenue.total_operating_revenue), 1e8).toFixed(2));
|
||
data2.unshift(utils_util.accDiv(utils_util.accSub(lastItem2.revenue.total_operating_revenue, lastItem3.revenue.total_operating_revenue), 1e8).toFixed(2));
|
||
data1.unshift(utils_util.accDiv(lastItem3.revenue.total_operating_revenue, 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];
|
||
ratioList.unshift(utils_util.accMul(utils_util.accDiv(utils_util.accSub(item.revenue.total_operating_revenue, lastItem.revenue.total_operating_revenue), Math.abs(lastItem.revenue.total_operating_revenue)), 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
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 获取期间费用单季度数据
|
||
*/
|
||
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
|
||
}
|
||
];
|
||
},
|
||
/**
|
||
* 计算净利润增长率
|
||
*/
|
||
caculateNetProfitGrowthRate() {
|
||
let flow1 = this.incomeStatementList[0].profit.net_profit;
|
||
let flow2 = this.incomeStatementList[4].profit.net_profit;
|
||
return utils_util.accMul(utils_util.accDiv(utils_util.accSub(flow1, flow2), Math.abs(flow2)), 100).toFixed(2);
|
||
},
|
||
/**
|
||
* 计算营业总收入增长率
|
||
*/
|
||
caculateRevenueGrowthRate() {
|
||
let flow1 = this.incomeStatementList[0].revenue.total_operating_revenue;
|
||
let flow2 = this.incomeStatementList[4].revenue.total_operating_revenue;
|
||
return utils_util.accMul(utils_util.accDiv(utils_util.accSub(flow1, flow2), Math.abs(flow2)), 100).toFixed(2);
|
||
},
|
||
/**
|
||
* 计算营业利润增长率
|
||
*/
|
||
caculateRevenueProfitGrowthRate() {
|
||
let flow1 = this.incomeStatementList[0].profit.operating_profit;
|
||
let flow2 = this.incomeStatementList[4].profit.operating_profit;
|
||
return utils_util.accMul(utils_util.accDiv(utils_util.accSub(flow1, flow2), Math.abs(flow2)), 100).toFixed(2);
|
||
}
|
||
}
|
||
};
|
||
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(["货币资金", "所有者权益", "关键指标"], (item, index, i0) => {
|
||
return {
|
||
a: common_vendor.t(item),
|
||
b: common_vendor.n("item flexCenter " + ($data.balanceIndicatorIndex == index ? "select" : "")),
|
||
c: index,
|
||
d: common_vendor.o(($event) => $options.clickBalanceIndicatorItem(index), index)
|
||
};
|
||
}),
|
||
d: common_vendor.n("option " + ($data.balanceSingleQuarterAllIndex == 0 ? "select" : "")),
|
||
e: common_vendor.o(($event) => $options.clickBalanceSingleQuarterOrAll(0)),
|
||
f: $data.balanceSingleQuarterAllIndex == 1
|
||
}, $data.balanceSingleQuarterAllIndex == 1 ? {
|
||
g: common_assets._imports_2$13
|
||
} : {
|
||
h: common_assets._imports_3$12
|
||
}, {
|
||
i: $data.balanceSingleQuarterAllIndex == 1
|
||
}, $data.balanceSingleQuarterAllIndex == 1 ? {
|
||
j: common_assets._imports_4$10
|
||
} : {
|
||
k: common_assets._imports_5$7
|
||
}, {
|
||
l: common_vendor.n("flex option " + ($data.balanceSingleQuarterAllIndex == 1 ? "select" : "")),
|
||
m: common_vendor.o(($event) => $options.clickBalanceSingleQuarterOrAll(1)),
|
||
n: common_vendor.sr("chartRef1", "619fafcd-0"),
|
||
o: $props.financialBalanceList.length > 0
|
||
}, $props.financialBalanceList.length > 0 ? {
|
||
p: common_vendor.t($data.getNumStr($props.financialBalanceList[0].assets.total)),
|
||
q: common_vendor.t($data.getNumStr($props.financialBalanceList[0].liabilities.total)),
|
||
r: common_vendor.t($data.getNumStr($props.financialBalanceList[0].equity.total)),
|
||
s: common_vendor.t($data.getNumStr($props.financialBalanceList[0].assets.current_assets.cash)),
|
||
t: common_vendor.t($data.getNumStr($props.financialBalanceList[0].equity.capital_reserve)),
|
||
v: common_vendor.t($data.getNumStr($props.financialBalanceList[0].equity.surplus_reserve)),
|
||
w: common_vendor.t($data.getNumStr($props.financialBalanceList[0].equity.undistributed_profit))
|
||
} : {}, {
|
||
x: common_assets._imports_0$3,
|
||
y: common_assets._imports_2$3,
|
||
z: common_vendor.f(["经营现金流", "筹资现金流", "投资现金流"], (item, index, i0) => {
|
||
return {
|
||
a: common_vendor.t(item),
|
||
b: common_vendor.n("item flexCenter " + ($data.cashFlowIndicatorIndex == index ? "select" : "")),
|
||
c: index,
|
||
d: common_vendor.o(($event) => $options.clickCashFlowIndicatorItem(index), index)
|
||
};
|
||
}),
|
||
A: common_vendor.n("option " + ($data.cashFlowSingleQuarterAllIndex == 0 ? "select" : "")),
|
||
B: common_vendor.o(($event) => $options.clickCashFlowSingleQuarterOrAll(0)),
|
||
C: $data.cashFlowSingleQuarterAllIndex == 1
|
||
}, $data.cashFlowSingleQuarterAllIndex == 1 ? {
|
||
D: common_assets._imports_2$13
|
||
} : {
|
||
E: common_assets._imports_3$12
|
||
}, {
|
||
F: $data.cashFlowSingleQuarterAllIndex == 1
|
||
}, $data.cashFlowSingleQuarterAllIndex == 1 ? {
|
||
G: common_assets._imports_4$10
|
||
} : {
|
||
H: common_assets._imports_5$7
|
||
}, {
|
||
I: common_vendor.n("flex option " + ($data.cashFlowSingleQuarterAllIndex == 1 ? "select" : "")),
|
||
J: common_vendor.o(($event) => $options.clickCashFlowSingleQuarterOrAll(1)),
|
||
K: common_vendor.sr("chartRef2", "619fafcd-1"),
|
||
L: $props.cashFlowList.length > 0
|
||
}, $props.cashFlowList.length > 0 ? {
|
||
M: common_vendor.t($data.getNumStr($props.cashFlowList[0].operating_activities.net_flow)),
|
||
N: common_vendor.t($options.caculateOperatingCashFlowGrowthRate()),
|
||
O: common_vendor.t($data.getNumStr($props.cashFlowList[0].investment_activities.net_flow)),
|
||
P: common_vendor.t($data.getNumStr($props.cashFlowList[0].financing_activities.net_flow)),
|
||
Q: common_vendor.t($data.getNumStr($props.cashFlowList[0].cash_changes.net_increase)),
|
||
R: common_vendor.t($options.caculateTotalCashFlowGrowthRate())
|
||
} : {}, {
|
||
S: common_assets._imports_0$3,
|
||
T: common_assets._imports_2$3,
|
||
U: common_vendor.f(["净利润", "营业收入", "期间费用"], (item, index, i0) => {
|
||
return {
|
||
a: common_vendor.t(item),
|
||
b: common_vendor.n("item flexCenter " + ($data.profitIndicatorIndex == index ? "select" : "")),
|
||
c: index,
|
||
d: common_vendor.o(($event) => $options.clickProfitIndicatorItem(index), index)
|
||
};
|
||
}),
|
||
V: common_vendor.n("option " + ($data.profitSingleQuarterAllIndex == 0 ? "select" : "")),
|
||
W: common_vendor.o(($event) => $options.clickProfitSingleQuarterOrAll(0)),
|
||
X: $data.profitSingleQuarterAllIndex == 1
|
||
}, $data.profitSingleQuarterAllIndex == 1 ? {
|
||
Y: common_assets._imports_2$13
|
||
} : {
|
||
Z: common_assets._imports_3$12
|
||
}, {
|
||
aa: $data.profitSingleQuarterAllIndex == 1
|
||
}, $data.profitSingleQuarterAllIndex == 1 ? {
|
||
ab: common_assets._imports_4$10
|
||
} : {
|
||
ac: common_assets._imports_5$7
|
||
}, {
|
||
ad: common_vendor.n("flex option " + ($data.profitSingleQuarterAllIndex == 1 ? "select" : "")),
|
||
ae: common_vendor.o(($event) => $options.clickProfitSingleQuarterOrAll(1)),
|
||
af: common_vendor.sr("chartRef3", "619fafcd-2"),
|
||
ag: $props.incomeStatementList.length > 0
|
||
}, $props.incomeStatementList.length > 0 ? {
|
||
ah: common_vendor.t($data.getNumStr($props.incomeStatementList[0].profit.net_profit)),
|
||
ai: common_vendor.t($options.caculateNetProfitGrowthRate()),
|
||
aj: common_vendor.t($data.getNumStr($props.incomeStatementList[0].revenue.total_operating_revenue)),
|
||
ak: common_vendor.t($options.caculateRevenueGrowthRate()),
|
||
al: common_vendor.t($data.getNumStr($props.incomeStatementList[0].profit.operating_profit)),
|
||
am: common_vendor.t($options.caculateRevenueProfitGrowthRate())
|
||
} : {});
|
||
}
|
||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||
wx.createPage(MiniProgramPage);
|
||
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pagesStock/components/cwsj-view/cwsj-view.js.map
|