"use strict"; const common_vendor = require("../../common/vendor.js"); const common_assets = require("../../common/assets.js"); const echarts = require("../../uni_modules/lime-echart/static/echarts.min.js"); const _sfc_main = { name: "cwfx-view", data() { return { profitabilityIndicatorList: [ { title: "净资产收益率(ROE)%" }, { title: "净资产收益率(扣非)%" }, { title: "净资产收益率(加权)%" }, { title: "总资产报酬率(ROA)%" }, { title: "毛利率%" }, { title: "净利率%" }, { title: "营业利润率%" }, { title: "成本费用利润率%" } ], profitabilityIndicatorIndex: 0, perShareIndicatorList: [ { title: "每股收益(EPS)" }, { title: "基本每股收益" }, { title: "稀释每股收益" }, { title: "扣非每股收益" }, { title: "每股净资产" }, { title: "每股经营现金流" }, { title: "每股资本公积" }, { title: "每股未分配利润" } ], perShareIndicatorIndex: 0, option1: { legend: { show: true, data: ["ROE", "同比(右)"] }, 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: "ROE", data: [], yAxisIndex: 0 }, { type: "line", name: "同比", data: [], yAxisIndex: 1 } ] }, option2: { legend: { show: true, data: ["ROE", "同比(右)"] }, grid: { left: "2%", right: "2%", top: "5%", bottom: "30%" }, xAxis: { type: "category", data: [], axisLabel: { rotate: 45, fontSize: 10 } }, yAxis: [ { type: "value", name: "(%)", position: "left", alignTicks: true, axisLine: { onZero: false } }, { type: "value", name: "(%)", position: "right", alignTicks: true, axisLine: { onZero: false } } ], dataZoom: [{ type: "slider" }], series: [ { type: "bar", name: "ROE", data: [], yAxisIndex: 0 }, { type: "line", name: "同比", data: [], yAxisIndex: 1 } ] } }; }, props: { dataList: Array }, watch: { dataList(newValue) { let category = []; let data1 = []; let data2 = []; for (let item of newValue) { var type = item.report_type; type = type.replace("年三季报", "Q3"); type = type.replace("年一季报", "Q1"); type = type.replace("年中报", "中报"); type = type.replace("年年报", "年报"); category.push(type); if (item.profitability.roe) { data1.push(item.profitability.roe.toFixed(2)); } else data1.push(0); if (item.per_share_metrics.eps) { data2.push(item.per_share_metrics.eps.toFixed(2)); } else data2.push(0); } this.option1.xAxis.data = category; this.option1.series[0].data = data1; this.profitabilityInit(); this.option2.series[0].data = data2; this.perShareInit(); } }, methods: { async profitabilityInit() { const chart = await this.$refs.chartRef1.init(echarts); chart.setOption(this.option1); }, async perShareInit() { const chart = await this.$refs.chartRef2.init(echarts); chart.setOption(this.option2); }, /** * 切换盈利能力指标 * @param {Object} item */ clickProfitabilityIndicatorItem(index) { if (this.profitabilityIndicatorIndex != index) { this.profitabilityIndicatorIndex = index; let data = []; if (index == 0) { for (let item of this.dataList) { if (item.profitability.roe) { data.push(item.profitability.roe.toFixed(2)); } else data.push(0); } } else if (index == 1) { for (let item of this.dataList) { if (item.profitability.roe_deducted) { data.push(item.profitability.roe_deducted.toFixed(2)); } else data.push(0); } } else if (index == 2) { for (let item of this.dataList) { if (item.profitability.roe_deducted) { data.push(item.profitability.roe_deducted.toFixed(2)); } else data.push(0); } } else if (index == 3) { for (let item of this.dataList) { if (item.profitability.roa) { data.push(item.profitability.roa.toFixed(2)); } else data.push(0); } } else if (index == 4) { for (let item of this.dataList) { if (item.profitability.gross_margin) { data.push(item.profitability.gross_margin.toFixed(2)); } else data.push(0); } } else if (index == 5) { for (let item of this.dataList) { if (item.profitability.net_profit_margin) { data.push(item.profitability.net_profit_margin.toFixed(2)); } else data.push(0); } } else if (index == 6) { for (let item of this.dataList) { if (item.profitability.operating_profit_margin) { data.push(item.profitability.operating_profit_margin.toFixed(2)); } else data.push(0); } } else if (index == 7) { for (let item of this.dataList) { if (item.profitability.cost_profit_ratio) { data.push(item.profitability.cost_profit_ratio.toFixed(2)); } else data.push(0); } } this.option1.series[0].data = data; this.profitabilityInit(); } }, /** * 切换每股指标 * @param {Object} item */ clickPerShareIndicatorItem(index) { if (this.perShareIndicatorIndex != index) { this.perShareIndicatorIndex = index; let data = []; if (index == 0) { for (let item of this.dataList) { if (item.per_share_metrics.eps) { data.push(item.per_share_metrics.eps.toFixed(2)); } else data.push(0); } } else if (index == 1) { for (let item of this.dataList) { if (item.per_share_metrics.basic_eps) { data.push(item.per_share_metrics.basic_eps.toFixed(2)); } else data.push(0); } } else if (index == 2) { for (let item of this.dataList) { if (item.per_share_metrics.diluted_eps) { data.push(item.per_share_metrics.diluted_eps.toFixed(2)); } else data.push(0); } } else if (index == 3) { for (let item of this.dataList) { if (item.per_share_metrics.deducted_eps) { data.push(item.per_share_metrics.deducted_eps.toFixed(2)); } else data.push(0); } } else if (index == 4) { for (let item of this.dataList) { if (item.per_share_metrics.bvps) { data.push(item.per_share_metrics.bvps.toFixed(2)); } else data.push(0); } } else if (index == 5) { for (let item of this.dataList) { if (item.per_share_metrics.operating_cash_flow_ps) { data.push(item.per_share_metrics.operating_cash_flow_ps.toFixed(2)); } else data.push(0); } } else if (index == 6) { for (let item of this.dataList) { if (item.per_share_metrics.capital_reserve_ps) { data.push(item.per_share_metrics.capital_reserve_ps.toFixed(2)); } else data.push(0); } } else if (index == 7) { for (let item of this.dataList) { if (item.per_share_metrics.undistributed_profit_ps) { data.push(item.per_share_metrics.undistributed_profit_ps.toFixed(2)); } else data.push(0); } } this.option2.series[0].data = data; this.perShareInit(); } } } }; 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 { a: common_assets._imports_0$8, b: common_assets._imports_1$2, c: common_vendor.f($data.profitabilityIndicatorList, (item, index, i0) => { return { a: common_vendor.t(item.title), b: common_vendor.n("item flex " + ($data.profitabilityIndicatorIndex == index ? "select" : "")), c: index, d: common_vendor.o(($event) => $options.clickProfitabilityIndicatorItem(index), index) }; }), d: common_assets._imports_2$14, e: common_assets._imports_3$13, f: common_vendor.sr("chartRef1", "3746da36-0"), g: common_assets._imports_4$12, h: common_assets._imports_1$2, i: common_vendor.f($data.perShareIndicatorList, (item, index, i0) => { return { a: common_vendor.t(item.title), b: common_vendor.n("item flexCenter " + ($data.perShareIndicatorIndex == index ? "select" : "")), c: index, d: common_vendor.o(($event) => $options.clickPerShareIndicatorItem(index), index) }; }), j: common_assets._imports_2$14, k: common_assets._imports_3$13, l: common_vendor.sr("chartRef2", "3746da36-1") }; } const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]); wx.createComponent(Component); //# sourceMappingURL=../../../.sourcemap/mp-weixin/components/cwfx-view/cwfx-view.js.map