From c9aaead65392b10b576f2f35c992a64bfb7ab08f Mon Sep 17 00:00:00 2001 From: ZhangXianQiang <1135831638@qq.com> Date: 星期三, 10 四月 2024 18:21:13 +0800 Subject: [PATCH] feat:工单数据 --- src/views/screen/components/screen-examine/components/examine-chart.vue | 4 src/views/screen/components/screen-data/index.vue | 45 ++++++++++- src/views/screen/components/screen-data/components/data-hola.vue | 137 ++++++++++++++++++++++++++++++++++ src/views/screen/components/screen-examine/components/examine-hola.vue | 2 4 files changed, 180 insertions(+), 8 deletions(-) diff --git a/src/views/screen/components/screen-data/components/data-hola.vue b/src/views/screen/components/screen-data/components/data-hola.vue new file mode 100644 index 0000000..da906ed --- /dev/null +++ b/src/views/screen/components/screen-data/components/data-hola.vue @@ -0,0 +1,137 @@ +<template> + <div class="hola-container"> + <div class="chart" id="dataChart" ref="chartRef"></div> + </div> +</template> + +<script> +import * as echarts from 'echarts'; +let myChart = null; +export default { + name: 'DataHola', + props: { + centerValue: { + type: [Number, String], + default: 0 + }, + holaColor: { + type: String, + default: '#4ea8ff' + }, + holaTitle: { + type: String, + default: '' + } + }, + data() { + return { + + } + }, + methods: { + initChart() { + const series= [ + { + type: 'gauge', // 浠〃鐩樼被鍨� + name: '绯诲垪鍚嶇О', // 鐢ㄤ簬tooltip鐨勬樉绀� + startAngle: 90, // 浠〃鐩樺紑濮嬭搴︼紙璁剧疆鑳屾櫙鍦嗙殑瑙掑害锛� + endAngle: -270, // 浠〃鐩樼粨鏉熻搴� + center: ['50%', '50%'], // 涓績鐐癸紙鍦嗗績鍧愭爣锛� + radius: '100%', // 鍦嗗ぇ灏忥紙浠〃鐩樺崐寰勶級 + clockwise: true, // 浠〃鐩樺埢搴︽槸鍚︽槸椤烘椂閽堝闀� + // 浠〃鐩樿酱绾跨浉鍏抽厤缃� + axisLine: { + show: true, + roundCap: false, // 涓ょ鏄剧ず鎴愬渾褰紙鑳屾櫙鐜級 + clip: false, // 鏄惁瑁佸壀瓒呭嚭閮ㄥ垎 + // 璁剧疆鑳屾櫙鍦嗙幆鏍峰紡 + lineStyle: { + width: 6, // 鍦嗙幆瀹藉害 + color: [[1, '#002865']] // 鍦嗙幆鑳屾櫙鑹� + } + }, + max: 5000, + // 浠〃鐩樻寚閽� + pointer: { + show: false + }, + // 杩涘害璁剧疆 + progress: { + show: true, + overlap: false, // 澶氱粍鏁版嵁鏃惰繘搴︽潯鏄惁閲嶅彔 + roundCap: true, // 鏄惁鍦ㄤ袱绔樉绀烘垚鍦嗗舰 + clip: false, // 鏄惁瑁佹帀瓒呭嚭閮ㄥ垎 + // 杩涘害鏉℃牱寮� + itemStyle: { + borderWidth: 0, + shadowColor: '', + color: this.holaColor + } + }, + // 浠〃鐩樺垎鍓茬嚎 + splitLine: { + show: false + }, + // 鍒诲害鏍峰紡 + axisTick: { + show: false + }, + // 鍒诲害鏍囩 + axisLabel: { + show: false + }, + title: { + show: false, + fontSize: 20 + }, + detail: { + // width: 50, + // height: 14, + fontSize: 20, + color: 'auto' + }, + data: [ + { + value: this.centerValue, + name: this.holaTitle, + title: { + show: true, + fontSize: 14, + color: '#fff', + offsetCenter: ['0%', '30%'], + }, + detail: { + fontSize: 18, + // 涓績title璁剧疆 + offsetCenter: ['0%', '-10%'], + color: '#fff', + formatter: '{value}' + + } + } + ], + } + ]; + myChart.setOption({ + series: series + }) + } + }, + mounted() { + myChart = echarts.init(this.$refs['chartRef']); + this.initChart(); + } +} +</script> + +<style lang="scss" scoped> +.hola-container { + width: 100%; + height: 100%; + + .chart { + width: 100%; + height: 100%; + } +} +</style> \ No newline at end of file diff --git a/src/views/screen/components/screen-data/index.vue b/src/views/screen/components/screen-data/index.vue index f6eba29..5518046 100644 --- a/src/views/screen/components/screen-data/index.vue +++ b/src/views/screen/components/screen-data/index.vue @@ -4,7 +4,25 @@ <div class="data-content"> <div class="data-panel"> - + <div class="panel-title"> + <div class="icon"> + <img src="@/assets/icons/arrow.png" alt=""> + </div> + <div class="title"> + 鏁翠綋宸ュ崟鏁� + </div> + </div> + <div class="panel-container"> + <div class="panel-item"> + <data-hola :holaTitle="`宸ュ崟鎬绘暟`" :centerValue="1111" :holaColor="`#4ea8ff`"></data-hola> + </div> + <div class="panel-item"> + <data-hola :holaTitle="`宸插鐞嗗伐鍗曟暟`" :centerValue="1111" :holaColor="`#4ea8ff`"></data-hola> + </div> + <div class="panel-item"> + <data-hola :holaTitle="`鏈鐞嗗伐鍗曟暟`" :centerValue="1111" :holaColor="`#4ea8ff`"></data-hola> + </div> + </div> </div> <div class="data-panel"> <div class="panel-title"> @@ -26,11 +44,13 @@ <script> import * as echarts from 'echarts'; import WrapperTitle from '../wrapper-title/index'; +import DataHola from './components/data-hola'; let chart = null; export default { name: 'ScreenData', components: { - WrapperTitle + WrapperTitle, + DataHola }, data() { return { @@ -45,7 +65,9 @@ initEchart() { const option = { grid: { + top: '10%', right: 0, + bottom: '15%', }, legend: { right: 0, @@ -102,7 +124,7 @@ <style lang="scss" scoped> .data-container { width: 100%; - height: 450px; + height: 470px; display: flex; flex-direction: column; @@ -110,14 +132,14 @@ flex: 1; background: rgba(67, 102, 155, 0.3); border: 1px solid rgba(47, 91, 157, 0.8); - padding: 20px; + padding: 10px; box-sizing: border-box; } } .echart-container { width: 100%; - height: 300px; + height: 260px; #barChart { width: 100%; @@ -129,13 +151,26 @@ color: #b9b9b9; display: flex; align-items: center; + .icon { width: 20px; margin-right: 5px; + img { width: 100%; display: block; } } } + +.panel-container { + width: 100%; + display: flex; + justify-content: space-around; + + .panel-item { + width: 100px; + height: 100px; + } +} </style> \ No newline at end of file diff --git a/src/views/screen/components/screen-examine/components/examine-chart.vue b/src/views/screen/components/screen-examine/components/examine-chart.vue index 553971d..36bf136 100644 --- a/src/views/screen/components/screen-examine/components/examine-chart.vue +++ b/src/views/screen/components/screen-examine/components/examine-chart.vue @@ -56,8 +56,8 @@ .hola-item { flex-shrink: 0; - width: 140px; - height: 140px; + width: 120px; + height: 120px; } } } diff --git a/src/views/screen/components/screen-examine/components/examine-hola.vue b/src/views/screen/components/screen-examine/components/examine-hola.vue index 0bcc4bd..e8e89d1 100644 --- a/src/views/screen/components/screen-examine/components/examine-hola.vue +++ b/src/views/screen/components/screen-examine/components/examine-hola.vue @@ -28,7 +28,7 @@ clip: false, // 鏄惁瑁佸壀瓒呭嚭閮ㄥ垎 // 璁剧疆鑳屾櫙鍦嗙幆鏍峰紡 lineStyle: { - width: 10, // 鍦嗙幆瀹藉害 + width: 6, // 鍦嗙幆瀹藉害 color: [[1, '#002865']] // 鍦嗙幆鑳屾櫙鑹� } }, -- Gitblit v1.8.0