|
@@ -1,10 +1,6 @@
|
|
|
<template>
|
|
|
<div class="pageBox">
|
|
|
- <simple-line-chart :height="'100px'" />
|
|
|
- <simple-line-chart :height="'100px'" :color="'yellow'" :title="'发电机'" />
|
|
|
- <simple-line-chart :height="'100px'" :color="'purple'" :title="'变桨系统'" />
|
|
|
- <simple-line-chart :height="'100px'" :color="'blue'" :title="'主控系统'" />
|
|
|
- <simple-line-chart :height="'100px'" :color="'orange'" :title="'齿轮箱'" />
|
|
|
+ <simple-line-chart :height="'100px'" v-for="(item, index) in chartData" :key="index" :title="item.title" :data="item.data" :color="item.color" :lineTitle="item.lineTitle" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -14,15 +10,46 @@ export default {
|
|
|
setup() {},
|
|
|
components: { SimpleLineChart },
|
|
|
data() {
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ chartData:[]
|
|
|
+ };
|
|
|
},
|
|
|
|
|
|
created() {
|
|
|
this.wtId = this.$route.params.wtId;
|
|
|
+ this.requestData();
|
|
|
},
|
|
|
|
|
|
methods:{
|
|
|
-
|
|
|
+ requestData(){
|
|
|
+ let that=this;
|
|
|
+ that.API.requestData({
|
|
|
+ method: "POST",
|
|
|
+ subUrl: "healthsub/hsFjValueIndex",
|
|
|
+ data:{
|
|
|
+ wtId: that.wtId
|
|
|
+ },
|
|
|
+ success(res) {
|
|
|
+
|
|
|
+ const color=["green","yellow","purple","blue","orange"];
|
|
|
+ let chartData=[];
|
|
|
+ let lineTitle=[];
|
|
|
+
|
|
|
+ res.data.xData.forEach(ele=>{
|
|
|
+ lineTitle.push(new Date(ele).formatDate("hh:mm"));
|
|
|
+ });
|
|
|
+
|
|
|
+ res.data.datasets.forEach((ele,index)=>{
|
|
|
+ chartData.push({
|
|
|
+ title:ele.name,
|
|
|
+ data:ele.data,
|
|
|
+ color:color[index],
|
|
|
+ lineTitle
|
|
|
+ });
|
|
|
+ });
|
|
|
+ that.chartData=chartData;
|
|
|
+ },
|
|
|
+ });}
|
|
|
}
|
|
|
};
|
|
|
</script>
|