From 234409bb4a612c5b69b78b1e844492f0a7122521 Mon Sep 17 00:00:00 2001 From: TreeWish <1131093754@qq.com> Date: 星期二, 28 二月 2023 19:15:32 +0800 Subject: [PATCH] 工程&管线接口对接 --- src/components/chart/BaseLineChart.vue | 46 +++++++++++++++++++++++++++++++++++----------- 1 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/components/chart/BaseLineChart.vue b/src/components/chart/BaseLineChart.vue index f78d2e8..fb37072 100644 --- a/src/components/chart/BaseLineChart.vue +++ b/src/components/chart/BaseLineChart.vue @@ -8,6 +8,10 @@ countCountryDimension, countProvinceDimension, GetServicesVisitsCount, + countZhPipeMapLength, + countLargeCategories, + countProjectType, + countProjectDown } from "@/api/screen.js" export default { props: { @@ -34,6 +38,18 @@ project: { type: String, default: "鍏ㄥ浗椤圭洰", + }, + params: { + type: Object, + default: () => null, + }, + project: { + type: String, + default: "鍏ㄥ浗椤圭洰", + }, + title: { + type: String, + default: "", }, }, data() { @@ -66,10 +82,10 @@ }, grid: { right: "5%", - top: '10%', + top: "10%", left: "5%", bottom: "17%", - containLabel: true + containLabel: true, }, xAxis: { @@ -77,9 +93,9 @@ boundaryGap: true, axisLine: { lineStyle: { - color: "#fff" + color: "#fff", }, - show: false + show: false, }, nameRotate: 45, axisTick: { @@ -116,7 +132,7 @@ }, series: [ { - name: "鏈嶅姟璁块棶娆℃暟", + name: this.title, type: "line", showAllSymbol: false, lineStyle: { @@ -143,17 +159,25 @@ }, project: { deep: true, + immediate: true, handler(newVal) { let requsetFn = null switch (newVal) { case "鍏ㄧ悆椤圭洰": - requsetFn = countCountryDimension + requsetFn = countLargeCategories break case "鍏ㄥ浗椤圭洰": - requsetFn = countProvinceDimension + requsetFn = countLargeCategories break - + case "鍏ㄧ悆绠$綉鍥�": + requsetFn = countZhPipeMapLength + break + case "鍏ㄥ浗绠$綉鍥�": + requsetFn = countZhPipeMapLength + break default: + requsetFn = GetServicesVisitsCount + break } requsetFn && this.initData(requsetFn) @@ -163,7 +187,7 @@ }, }, mounted() { - this.initData() + // this.initData() this.initChart() if (this.autoResize) { window.addEventListener("resize", this.resizeHandler) @@ -181,7 +205,7 @@ }, methods: { resizeHandler() { - this.chart.resize() + this.chart && this.chart.resize() }, initChart() { this.chart = echarts.init(this.$refs.chart, "", { @@ -207,7 +231,7 @@ this.chart && this.chart.clear() }, async initData(requsetFn = GetServicesVisitsCount) { - const res = await requsetFn() + const res = await requsetFn(this.params) if (res.code == 200) { this.dataList = res.result console.log("requsetFn", res) -- Gitblit v1.9.3