401 lines
12 KiB
JavaScript
401 lines
12 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 {
|
|
profitabilityIndicatorIndex: 0,
|
|
profitIndicatorIndex: 0,
|
|
cashFlowIndicatorIndex: 0,
|
|
option1: {
|
|
legend: {
|
|
show: true,
|
|
data: ["货币资金", "同比(右)"]
|
|
},
|
|
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
|
|
}
|
|
]
|
|
},
|
|
option2: {
|
|
legend: {
|
|
show: true,
|
|
data: ["经营现金流", "同比(右)"]
|
|
},
|
|
grid: {
|
|
left: "2%",
|
|
right: "2%",
|
|
top: "5%",
|
|
bottom: "30%"
|
|
},
|
|
xAxis: {
|
|
type: "category",
|
|
data: [],
|
|
axisLabel: {
|
|
fontSize: 10,
|
|
rotate: 45
|
|
}
|
|
},
|
|
yAxis: [
|
|
{
|
|
type: "value",
|
|
name: "(亿)",
|
|
position: "left",
|
|
alignTicks: 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: {
|
|
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: "净利润",
|
|
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) {
|
|
let category = [];
|
|
let data = [];
|
|
for (let item of newValue) {
|
|
category.push(item.report_type);
|
|
if (item.assets.current_assets.cash) {
|
|
data.push(utils_util.accDiv(item.assets.current_assets.cash, 1e8).toFixed(2));
|
|
} else
|
|
data.push(0);
|
|
}
|
|
this.option1.xAxis.data = category;
|
|
this.option1.series[0].data = data;
|
|
this.profitabilityInit();
|
|
},
|
|
cashFlowList(newValue) {
|
|
let category = [];
|
|
let data = [];
|
|
for (let item of newValue) {
|
|
category.push(item.report_type);
|
|
if (item.operating_activities.net_flow) {
|
|
data.push(utils_util.accDiv(item.operating_activities.net_flow, 1e8).toFixed(2));
|
|
} else
|
|
data.push(0);
|
|
}
|
|
this.option2.xAxis.data = category;
|
|
this.option2.series[0].data = data;
|
|
this.cashFlowInit();
|
|
},
|
|
incomeStatementList(newValue) {
|
|
let category = [];
|
|
let data = [];
|
|
for (let item of newValue) {
|
|
category.push(item.report_type);
|
|
if (item.profit.net_profit) {
|
|
data.push(utils_util.accDiv(item.profit.net_profit, 1e9).toFixed(2));
|
|
} else
|
|
data1.push(0);
|
|
}
|
|
this.option3.xAxis.data = category;
|
|
this.option3.series[0].data = data;
|
|
this.incomeStatementInit();
|
|
}
|
|
},
|
|
methods: {
|
|
async profitabilityInit() {
|
|
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);
|
|
},
|
|
/**
|
|
* 计算经营性现金流增长率
|
|
*/
|
|
caculateOperatingFlowRatio() {
|
|
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);
|
|
},
|
|
/**
|
|
* 计算合计现金流增长率
|
|
*/
|
|
caculateNetIncreaseRatio() {
|
|
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);
|
|
},
|
|
/**
|
|
* 获取去年
|
|
*/
|
|
getLastYearPeriod(list) {
|
|
list[0].period.split("-")[0];
|
|
},
|
|
/**
|
|
* 点击切换现金流量表指标
|
|
* @param {Object} index
|
|
*/
|
|
clickCashFlowIndicatorItem(index) {
|
|
if (this.cashFlowIndicatorIndex != index) {
|
|
this.cashFlowIndicatorIndex = index;
|
|
let data = [];
|
|
if (index == 0) {
|
|
for (let item of this.cashFlowList) {
|
|
if (item.operating_activities.net_flow) {
|
|
data.push(utils_util.accDiv(item.operating_activities.net_flow, 1e8).toFixed(2));
|
|
} else
|
|
data.push(0);
|
|
}
|
|
} else if (index == 1) {
|
|
for (let item of this.cashFlowList) {
|
|
if (item.financing_activities.net_flow) {
|
|
data.push(utils_util.accDiv(item.financing_activities.net_flow, 1e8).toFixed(2));
|
|
} else
|
|
data.push(0);
|
|
}
|
|
} else if (index == 2) {
|
|
for (let item of this.cashFlowList) {
|
|
if (item.investment_activities.net_flow) {
|
|
data.push(utils_util.accDiv(item.investment_activities.net_flow, 1e8).toFixed(2));
|
|
} else
|
|
data.push(0);
|
|
}
|
|
}
|
|
this.option2.series[0].data = data;
|
|
this.cashFlowInit();
|
|
}
|
|
},
|
|
/**
|
|
* 点击切换利润表指标
|
|
* @param {Object} index
|
|
*/
|
|
clickProfitIndicatorItem(index) {
|
|
if (this.profitIndicatorIndex != index) {
|
|
this.profitIndicatorIndex = index;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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$8,
|
|
b: common_assets._imports_1$2,
|
|
c: 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_assets._imports_2$14,
|
|
e: common_assets._imports_3$13,
|
|
f: common_vendor.sr("chartRef1", "63ca7cac-0"),
|
|
g: $props.financialBalanceList.length > 0
|
|
}, $props.financialBalanceList.length > 0 ? {
|
|
h: common_vendor.t($data.getNumStr($props.financialBalanceList[0].assets.total)),
|
|
i: common_vendor.t($data.getNumStr($props.financialBalanceList[0].liabilities.total)),
|
|
j: common_vendor.t($data.getNumStr($props.financialBalanceList[0].equity.total)),
|
|
k: common_vendor.t($data.getNumStr($props.financialBalanceList[0].assets.current_assets.cash)),
|
|
l: common_vendor.t($data.getNumStr($props.financialBalanceList[0].equity.capital_reserve)),
|
|
m: common_vendor.t($data.getNumStr($props.financialBalanceList[0].equity.surplus_reserve)),
|
|
n: common_vendor.t($data.getNumStr($props.financialBalanceList[0].equity.undistributed_profit))
|
|
} : {}, {
|
|
o: common_assets._imports_0$8,
|
|
p: common_assets._imports_1$2,
|
|
q: 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)
|
|
};
|
|
}),
|
|
r: common_assets._imports_2$14,
|
|
s: common_assets._imports_3$13,
|
|
t: common_vendor.sr("chartRef2", "63ca7cac-1"),
|
|
v: $props.cashFlowList.length > 0
|
|
}, $props.cashFlowList.length > 0 ? {
|
|
w: common_vendor.t($data.getNumStr($props.cashFlowList[0].operating_activities.net_flow)),
|
|
x: common_vendor.t($options.caculateOperatingFlowRatio()),
|
|
y: common_vendor.t($data.getNumStr($props.cashFlowList[0].investment_activities.net_flow)),
|
|
z: common_vendor.t($data.getNumStr($props.cashFlowList[0].financing_activities.net_flow)),
|
|
A: common_vendor.t($data.getNumStr($props.cashFlowList[0].cash_changes.net_increase)),
|
|
B: common_vendor.t($options.caculateNetIncreaseRatio())
|
|
} : {}, {
|
|
C: common_assets._imports_0$8,
|
|
D: common_assets._imports_1$2,
|
|
E: 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)
|
|
};
|
|
}),
|
|
F: common_assets._imports_2$14,
|
|
G: common_assets._imports_3$13,
|
|
H: common_assets._imports_2$14,
|
|
I: common_assets._imports_3$13,
|
|
J: common_vendor.sr("chartRef3", "63ca7cac-2"),
|
|
K: $props.incomeStatementList.length > 0
|
|
}, $props.incomeStatementList.length > 0 ? {
|
|
L: common_vendor.t($data.getNumStr($props.incomeStatementList[0].comprehensive_income.total_comprehensive_income)),
|
|
M: common_vendor.t($data.getNumStr($props.incomeStatementList[0].revenue.total_operating_revenue)),
|
|
N: common_vendor.t($data.getNumStr($props.incomeStatementList[0].profit.operating_profit))
|
|
} : {});
|
|
}
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
wx.createComponent(Component);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/cwsj-view/cwsj-view.js.map
|