From 5f6abeedb7ce43853ad486731a5e99b340ec6392 Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期二, 17 九月 2024 18:55:39 +0800 Subject: [PATCH] 新大屏数据对接 --- src/views/screen/components/lineChart.vue | 49 ++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/views/screen/components/lineChart.vue b/src/views/screen/components/lineChart.vue index cc00d39..f2335f6 100644 --- a/src/views/screen/components/lineChart.vue +++ b/src/views/screen/components/lineChart.vue @@ -3,10 +3,23 @@ </template> <script> +import * as echarts from "echarts"; + export default { name: 'lineChart', + props: { + workOrderRegion: { + type: Array, + default: null, + }, + }, data () { return { + dataList: { + name: [], + data1: [], + data2: [], + }, // 閰嶇疆 option: { grid: { @@ -53,15 +66,7 @@ margin: 20, rotate: 30 }, - data: [ - '瀵岄『鍖�', - '澶у畨鍖�', - '鑷祦鏅尯', - '璐℃櫙鍖�', - '瀹瑰幙', - '楂樻柊鍖�', - '娌挎哗鍖�' - ] + data: this.dataList.name, }, // Y杞撮厤缃� yAxis: { @@ -87,7 +92,7 @@ { name: '宸插鐞嗗伐鍗曟暟', type: 'line', - data: [120, 200, 150, 80, 70, 110, 130], + data: this.dataList.data1, smooth: true, areaStyle: { color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [ @@ -108,7 +113,7 @@ { name: '鏈鐞嗗伐鍗曟暟', type: 'line', - data: [90, 140, 160, 55, 88, 99, 100], + data: this.dataList.data2, smooth: true, areaStyle: { color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [ @@ -144,6 +149,28 @@ } }, + watch: { + workOrderRegion: { + handler(newV, oldV) { + let name = []; + let data1 = []; + let data2 = []; + this.workOrderRegion.map((item) => { + name.push(item.area); + data1.push(item.doneNum); + data2.push(item.todoNum); + }) + console.log(this, "ddddd") + console.log(this.dataList, "ddddd") + this.dataList.name = name; + console.log(name) + this.dataList.data1 = data1; + this.dataList.data2 = data2; + this.initDrawLine() + }, + deep: true + } + }, mounted () { this.$nextTick(() => { setTimeout(() => { -- Gitblit v1.8.0