Files
JiaZhiQianYan/unpackage/dist/dev/mp-weixin/pagesStock/components/cyl-view/cyl-view.js
2026-02-04 17:43:41 +08:00

195 lines
6.1 KiB
JavaScript

"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: "cyl-view",
data() {
return {
isShow: false,
center_index: 0,
types: [
{
title: "上游供应链",
count: 0,
desc: "原材料与供应商",
type: "upstream"
},
{
title: "核心企业",
count: 0,
desc: "公司主体与产品",
type: "core"
},
{
title: "下游客户",
count: 0,
desc: "客户与终端市场",
type: "downstream"
}
],
typeIndex: 0,
option: {
legend: {
show: false
},
grid: {
left: "2%",
right: "2%",
top: "5%",
bottom: "30%"
},
series: [
{
type: "sankey",
name: "经营现金流",
data: [],
links: []
}
]
}
};
},
props: {
valueChainAnalysisInfo: Object,
upstreamList: Array,
//上游供应链
coreEnterpriseList: Array,
//核心企业
downstreamList: Array,
//下游客户
totalNodes: Number,
//总节点数
valueChainFlowsList: Array
//产业链流向数据
},
watch: {
valueChainAnalysisInfo(newValue) {
this.types[0].count = newValue.upstream_nodes;
this.types[1].count = newValue.company_nodes;
this.types[2].count = newValue.downstream_nodes;
},
valueChainFlowsList(newValue) {
let data = [];
let links = [];
let name = [];
for (let item of newValue) {
if (name.indexOf(item.source.node_name) == -1) {
name.push(item.source.node_name);
data.push({ name: item.source.node_name });
}
links.push({ source: item.source.node_name, target: item.target.node_name, value: item.flow_metrics.flow_ratio });
}
this.option.series[0].data = data;
this.option.series[0].links = links;
}
},
methods: {
async init() {
const chart = await this.$refs.chartRef.init(echarts);
common_vendor.index.__f__("log", "at pagesStock/components/cyl-view/cyl-view.vue:183", chart);
common_vendor.index.__f__("log", "at pagesStock/components/cyl-view/cyl-view.vue:184", this.option);
chart.setOption(this.option);
},
changeCenterIndex(index) {
if (this.center_index != index) {
this.center_index = index;
if (index == 1) {
let that = this;
setTimeout(function() {
that.init();
}, 500);
}
}
},
clickAction(item) {
this.$emit("detail", item);
}
}
};
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_vendor.t($props.totalNodes),
b: $data.center_index == 0 ? 1 : "",
c: common_vendor.o(($event) => $options.changeCenterIndex(0)),
d: $data.center_index == 1 ? 1 : "",
e: common_vendor.o(($event) => $options.changeCenterIndex(1)),
f: $data.center_index == 0
}, $data.center_index == 0 ? common_vendor.e({
g: common_vendor.f($data.types, (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item.title),
b: common_vendor.t(item.count),
c: common_vendor.n("num " + ($data.typeIndex == index ? item.type : "")),
d: common_vendor.t(item.desc),
e: common_vendor.n("contentC flexColumnCenter flex1 " + ($data.typeIndex == index ? item.type : "")),
f: common_vendor.o(($event) => $data.typeIndex = index, index),
g: index != $data.types.length - 1
}, index != $data.types.length - 1 ? {
h: common_assets._imports_0$4
} : {}, {
i: index
});
}),
h: $data.typeIndex == 0
}, $data.typeIndex == 0 ? {
i: common_vendor.f($props.upstreamList, (item, index, i0) => {
return {
a: common_vendor.t(item.node_name),
b: common_vendor.t(item.node_description),
c: common_vendor.t(item.node_type),
d: common_vendor.t(item.market_share),
e: `${item.importance_score}%`,
f: common_vendor.t(item.importance_score),
g: index,
h: common_vendor.o(($event) => $options.clickAction(item), index)
};
})
} : {}, {
j: $data.typeIndex == 1
}, $data.typeIndex == 1 ? {
k: common_vendor.f($props.coreEnterpriseList, (item, index, i0) => {
return {
a: common_vendor.t(item.node_name),
b: common_vendor.t(item.node_description),
c: common_vendor.t(item.node_type),
d: common_vendor.t(item.market_share),
e: `${item.importance_score}%`,
f: common_vendor.t(item.importance_score),
g: index,
h: common_vendor.o(($event) => $options.clickAction(item), index)
};
})
} : {}, {
l: $data.typeIndex == 2
}, $data.typeIndex == 2 ? {
m: common_vendor.f($props.downstreamList, (item, index, i0) => {
return {
a: common_vendor.t(item.node_name),
b: common_vendor.t(item.node_description),
c: common_vendor.t(item.node_type),
d: common_vendor.t(item.market_share),
e: `${item.importance_score}%`,
f: common_vendor.t(item.importance_score),
g: index,
h: common_vendor.o(($event) => $options.clickAction(item), index)
};
})
} : {}) : {}, {
n: $data.center_index == 1
}, $data.center_index == 1 ? {
o: common_vendor.sr("chartRef", "4ade4b3d-0")
} : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pagesStock/components/cyl-view/cyl-view.js.map