1.28 完善主营业务模块表格,柱状图,饼状图

This commit is contained in:
尚政杰
2026-01-28 17:52:32 +08:00
parent da90511b86
commit 4f211dcd5f
15 changed files with 486 additions and 161 deletions

View File

@@ -1,14 +1,28 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const utils_util = require("../../utils/util.js");
const echarts = require("../../uni_modules/lime-echart/static/echarts.min.js");
const _sfc_main = {
name: "zysj-view",
data() {
return {
option1: {
legend: {
show: true,
data: ["营业收入", "净利润"]
},
grid: {
left: "2%",
right: "2%",
top: "5%",
bottom: "30%"
},
xAxis: {
type: "category",
data: []
data: [],
axisLabel: {
// interval:0
}
},
yAxis: [
{
@@ -30,48 +44,67 @@ const _sfc_main = {
}
}
],
dataZoom: [{
type: "slider"
}],
series: [
{
type: "bar",
name: "营业收入",
data: [],
yAxisIndex: 0
},
{
type: "line",
name: "净利润",
data: [],
yAxisIndex: 1
}
]
},
option2: {
xAxis: {
type: "category",
data: []
title: {
text: "",
textStyle: {
fontSize: 12
}
},
yAxis: {
type: "value"
legend: {
show: true
},
grid: {
left: 0,
right: 0,
top: "5%",
bottom: "5%"
},
series: [
{
data: [120, 200, 150, 80, 70, 110, 130],
data: [],
type: "pie",
showBackground: true,
backgroundStyle: {
color: "rgba(180, 180, 180, 0.2)"
center: ["50%", "50%"],
label: {
formatter: "{d}%"
}
}
]
}
},
getChgRateStr: utils_util.getChgRateStr,
getNumStr: utils_util.getNumStr
};
},
props: {
// 0 主营数据 1 财务分析 2 财务数据
type: Number,
stockInfo: Object,
barCategoryList: Array,
barList: Array,
lineList: Array
lineList: Array,
//折线图数据
productClassificationList: Array
},
watch: {
barCategoryList(newValue) {
this.option1.xAxis.data = newValue;
},
barList(newValue) {
this.option1.series[0].data = newValue;
this.barLineInit();
@@ -79,6 +112,19 @@ const _sfc_main = {
lineList(newValue) {
this.option1.series[1].data = newValue;
this.barLineInit();
},
productClassificationList(newValue) {
let data = newValue[0].products;
this.option2.title.text = "主营业务构成(" + newValue[0].report_type + "";
let pieList = [];
for (let item of data) {
pieList.push({
name: item.content,
value: item.revenue_ratio.toFixed(2)
});
}
this.option2.series[0].data = pieList;
this.pieInit();
}
},
methods: {
@@ -118,10 +164,18 @@ if (!Math) {
_easycom_l_echart();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.sr("chartRef1", "cf18d1d4-0"),
b: common_vendor.sr("chartRef2", "cf18d1d4-1"),
c: common_vendor.f(["业务", "毛利率", "利润", "营收", "营收"], (item, index, i0) => {
return common_vendor.e({
a: $props.stockInfo
}, $props.stockInfo ? {
b: common_vendor.t($data.getChgRateStr($props.stockInfo.growth_rates.profit_growth)),
c: common_vendor.t($data.getChgRateStr($props.stockInfo.growth_rates.revenue_growth)),
d: common_vendor.t($data.getChgRateStr($props.stockInfo.key_metrics.roe)),
e: common_vendor.t($data.getChgRateStr($props.stockInfo.key_metrics.net_margin)),
f: common_vendor.t($data.getChgRateStr($props.stockInfo.key_metrics.gross_margin))
} : {}, {
g: common_vendor.sr("chartRef1", "cf18d1d4-0"),
h: common_vendor.sr("chartRef2", "cf18d1d4-1"),
i: common_vendor.f(["业务", "毛利率", "利润", "营收", "营收"], (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item),
b: ["", "(2025年中报)", "(2025年中报)", "(2025年中报)", "(2024年年报)"][index].length > 0
@@ -133,18 +187,20 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
f: index == 0 ? "flex-start" : "center"
});
}),
d: common_vendor.f(["零售金融业务", "批发金融业务", "其他业务"], (item, index, i0) => {
j: $props.productClassificationList.length > 0
}, $props.productClassificationList.length > 0 ? {
k: common_vendor.f($props.productClassificationList[0].products, (item, index, i0) => {
return {
a: common_vendor.f([item, "64.53%", "200.57亿", "310.81亿", "712.55亿"], (item2, index2, i1) => {
return {
a: common_vendor.t(item2),
b: index2 == 0 ? "left" : "center"
};
}),
b: index % 2 == 0 ? "#FFFFFF" : "#FAFAFC"
a: common_vendor.t(item.content),
b: common_vendor.t(item.profit_margin.toFixed(2)),
c: common_vendor.t($data.getNumStr(item.profit)),
d: common_vendor.t($data.getNumStr(item.revenue)),
e: common_vendor.t(item.content),
f: index,
g: index % 2 == 0 ? "#FFFFFF" : "#FAFAFC"
};
})
};
} : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createComponent(Component);