From d62407de20b8063a07a5560db31b73e56cf4ccf2 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期三, 24 四月 2024 23:42:49 +0800
Subject: [PATCH] zancun
---
src/views/mdc/processParam/index.vue | 212 +++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 197 insertions(+), 15 deletions(-)
diff --git a/src/views/mdc/processParam/index.vue b/src/views/mdc/processParam/index.vue
index b25fc1d..344ed62 100644
--- a/src/views/mdc/processParam/index.vue
+++ b/src/views/mdc/processParam/index.vue
@@ -1,7 +1,7 @@
<!--
* @Date: 2024-04-09 22:11:21
* @LastEditors: Sneed
- * @LastEditTime: 2024-04-24 21:11:17
+ * @LastEditTime: 2024-04-24 23:41:35
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/processParam/index.vue
瀹炴椂鐪嬫澘
-->
@@ -39,20 +39,21 @@
<div>
<el-button>鏌ョ湅鏁版嵁</el-button>
</div>
- <scEcharts v-show="!isShowTable" style="width:100%" height="300px"
- :option="item.dayCharts">
+ <scEcharts style="width:100%" height="300px" :option="dayCharts">
</scEcharts>
- <scTable v-show="isShowTable" ref="table0" row-key="id" border :apiObj="item.apiObj"
+ <!-- <scTable v-show="isShowTable" ref="table0" row-key="id" border :apiObj="item.apiObj"
stripe>
<el-table-column prop="alarmCode" label="鎶ヨ浠g爜" />
<el-table-column prop="alarmMsg" label="鎶ヨ淇℃伅" />
<el-table-column prop="count" label="鎶ヨ娆℃暟" />
- </scTable>
+ </scTable> -->
</el-collapse-item>
</el-collapse>
</el-main>
<el-main v-show="list.length == 0">
- <el-empty description="鏆傛棤鏁版嵁" />
+ <!-- <el-empty description="鏆傛棤鏁版嵁" /> -->
+ <scEcharts style="width:100%" height="300px" :option="dayCharts">
+ </scEcharts>
</el-main>
</el-container>
</el-container>
@@ -62,12 +63,102 @@
<script>
import moment from 'moment'
+import scEcharts from '@/components/scEcharts';
import TimeLine from './TimeLine.vue'
import MYTree from '../MYTree.vue'
+const rawData = [
+ [100],
+ [320],
+ [220],
+ [150],
+ [820]
+]
+const totalData = [];
+for (let i = 0; i < rawData[0].length; ++i) {
+ let sum = 0;
+ for (let j = 0; j < rawData.length; ++j) {
+ sum += rawData[j][i];
+ }
+ totalData.push(sum);
+}
+const series = [
+ '杩愯',
+ '杩愯',
+ '杩愯',
+ '寰呮満',
+ '杩愯'
+].map((name, sid) => {
+ return {
+ name,
+ type: 'bar',
+ stack: 'total',
+ barWidth: '20px',
+ label: {
+ show: true,
+ formatter: (params) => Math.round(params.value * 1000) / 10 + '%'
+ },
+ data: rawData[sid].map((d, did) =>
+ totalData[did] <= 0 ? 0 : d / totalData[did]
+ )
+ };
+});
+// let data = {
+// "collectItem": "璁惧鐘舵��",
+// "collectRealItem": "DeviceStatus",
+// "data": [
+// {
+// "time": "2024-04-24 10:00:00",
+// "name": "杩愯",
+// "color": "#73D13D",
+// "value": "2"
+// },
+// {
+// "time": "2024-04-24 10:30:00",
+// "name": "杩愯",
+// "color": "#73D13D",
+// "value": "2"
+// },
+// {
+// "time": "2024-04-24 11:00:00",
+// "name": "杩愯",
+// "color": "#73D13D",
+// "value": "2"
+// },
+// {
+// "time": "2024-04-24 11:30:00",
+// "name": "寰呮満",
+// "color": "#FFC53D",
+// "value": "3"
+// },
+// {
+// "time": "2024-04-24 12:00:00",
+// "name": "寰呮満",
+// "color": "#FFC53D",
+// "value": "3"
+// }
+// ]
+// }
+// const series = data.data.map(item => ({
+// name: item.name,
+// label: {
+// show: true,
+// },
+// barWidth: '20px',
+// type: 'bar',
+// stack: 'duration',
+// itemStyle: {
+// color: item.color,
+// borderColor: item.color,
+// },
+// zlevel: -1,
+// data: [item.time]
+// }))
+console.log('>>>>>>>>????', series)
export default {
components: {
TimeLine,
- MYTree
+ MYTree,
+ scEcharts
},
watch: {
treeChecked() {
@@ -84,7 +175,7 @@
return {
isShowTable: false,
list: [],
- activeList: [],
+ activeList: [0],
timeRange: '',
treeChecked: [],
timeStart: moment().format('YYYY-MM-DD'),
@@ -93,10 +184,37 @@
let max = moment(this.timeStart, 'YYYY-MM-DD').add(3, 'd').format('YYYY-MM-DD')
let min = moment(this.timeStart, 'YYYY-MM-DD').subtract(3, 'd').format('YYYY-MM-DD')
return !moment(Date).isBetween(min, max);
+ },
+ dayCharts: {
+ legend: [
+ ],
+ title: {
+ text: '璁惧鐘舵�佺粺璁″浘',
+ subtext: '',
+ },
+ yAxis: {
+ type: 'category',
+ data: ['']
+ },
+ xAxis: {
+ type: 'value',
+ },
+ series
}
}
},
+ created() {
+ console.log('---------')
+ console.log(series)
+ },
methods: {
+ init() {
+ this.$HTTP.get('/api/blade-mdc/process-parameter').then(res => {
+ if (res.code === 200) {
+ this.legend = res.data
+ }
+ })
+ },
query() {
this.$refs?.timeLine?.init({
dates: this.time,
@@ -105,17 +223,81 @@
this.$HTTP.get('/api/blade-mdc/process-parameter/param', { workstationId: this.treeChecked.toString() }).then(res => {
if (res.code === 200) {
this.list = res.data
+ // this.queryChart(res.data[0])
}
})
},
queryChart(dmpDTO) {
- this.$HTTP.post('/api/blade-mdc/process-parameter/chart/dmp-item', {
- methodEnum: "HOUR",
- startTime: this.timeRange.startTime,
- endTime: this.timeRange.endTime,
- workstationId: this.treeChecked.toString(),
- dmpDTO
- })
+ // this.$HTTP.post('/api/blade-mdc/process-parameter/chart/dmp-item', {
+ // methodEnum: "HOUR",
+ // startTime: this.timeRange.startTime,
+ // endTime: this.timeRange.endTime,
+ // workstationId: this.treeChecked.toString(),
+ // dmpDTO
+ // })
+ let data = {
+ "collectItem": "璁惧鐘舵��",
+ "collectRealItem": "DeviceStatus",
+ "data": [
+ {
+ "time": "2024-04-24 10:00:00",
+ "name": "杩愯",
+ "color": "#73D13D",
+ "value": "2"
+ },
+ {
+ "time": "2024-04-24 10:30:00",
+ "name": "杩愯",
+ "color": "#73D13D",
+ "value": "2"
+ },
+ {
+ "time": "2024-04-24 11:30:00",
+ "name": "杩愯",
+ "color": "#73D13D",
+ "value": "2"
+ },
+ {
+ "time": "2024-04-24 11:40:00",
+ "name": "寰呮満",
+ "color": "#FFC53D",
+ "value": "3"
+ },
+ {
+ "time": "2024-04-24 12:00:00",
+ "name": "寰呮満",
+ "color": "#FFC53D",
+ "value": "3"
+ },
+ {
+ "time": "2024-04-24 12:00:00",
+ "name": "杩愯",
+ "color": "#73D13D",
+ "value": "2"
+ }
+ ]
+ }
+ // {
+ // name: '杩愯',
+ // type: 'bar',
+ // stack: 'duration',
+ // itemStyle: {
+ // color: '#007acc',
+ // borderColor: '#fff',
+ // borderWidth: 1
+ // },
+ // zlevel: -1,
+ // data: ['2024-04-24 10:00:00'] // 缁撴潫鏃堕棿
+ // }
+ // this.dayCharts.series = [...data.data.map(item => ({
+ // name: item.name,
+ // stack: 'duration',
+ // itemStyle: {
+ // color: item.color,
+ // },
+ // zlevel: -1,
+ // data: [item.time]
+ // }))]
},
change(e) {
this.timeStart = e[0] || moment().format('YYYY-MM-DD')
--
Gitblit v1.9.3