zmc
2023-12-08 9c1d136e4f5ed9b5bce100147edbb52486da985a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<script>
import getHistoryApi from '@/api/py/getHistoryApi.js'
import { ElMessage } from 'element-plus'
import exceptionApi from '@/api/exceptionApi.js'
export default {
  data() {
    return {
      async: '未完成....',
      normal: '未变化....',
      count:0
    }
  },
  mounted() {
    // this.query()
    // this.getAnalysisData()
  },
  methods: {
    getData() {
      getHistoryApi.fetchDustHistoryData().then((res) => {
        print(res)
      })
      setTimeout(() => {
        ElMessage.success('数据获取中')
      }, 600)
    },
    // async query() {
    // await  exceptionApi.analysisdata('','2023-08-01','2023-10-01', 'day').then((response) => {
    //     const chartData = response.data.data
    //     this.async = '完成'
    //   })
    //   this.normal= '变化'
    // },
    //  query() {
    //   exceptionApi.analysisdata('','2023-08-01','2023-10-01', 'day').then((response) => {
    //     const chartData = response.data.data
    //     this.async = '完成'
    //   })
    //   this.normal= '变化'
    // },
 
    //    query() {
    //   exceptionApi.analysisdata('','2023-08-01','2023-10-01', 'day')
    //   .then((response) => {
    //     return response.data.data
    //   }).then((res)=>{
    //     a = exceptionApi.analysisdataByType('2023-09-01','month')
 
    //   })
    // },
 
    // getd1(){
    //   return exceptionApi.analysisdataByType('2023-09-01','month')
    // },
    // async query() {
    //  const  analysis =   await  exceptionApi.analysisdata('','2023-08-01','2023-10-01', 'day')
    //  console.log('分析数据为:',analysis);
    //  const exception = await exceptionApi.analysisdataByType('2023-09-01','month')
    //  console.log('异常数据为:',exception);
    // }
    getAnalysisData() {
      const analysis = exceptionApi.analysisdata(
        this.form.name,
        this.form.beginTime,
        this.form.endTime,
        'day'
      )
      const exception = exceptionApi.exceptiondata1({
        siteName: this.form.name,
        beginTime: this.form.beginTime,
        endTime: this.form.endTime
      })
      this.loading = true
      this.queryButton = true
      Promise.all([analysis, exception]).then((res) => {
        this.chartData = res[0].data.data
        let exceptionData = res[1].data.data
        // console.log('分析数据:',analysisData);
        // console.log('异常数据:',exceptionData);
        // 得到有效数据的起始时间
        this.begin = this.chartData[0].lst
        this.end = this.chartData[this.chartData.length - 1].lst
        // 移除空数据状态
        this.isNoData = false
        // 生成折线图数据配置
        this.setChart()
 
        //  日统计数据
        let temp = index.calBillData(this.chartData, this.begin, this.end)
        // 异常数据
        let obj = index.calRecur(exceptionData)
 
        this.bill.min = temp['min']
        this.bill.max = temp['max']
        this.bill.avg = temp['avg']
        this.bill.online = temp['online']
        this.bill.valid = temp['valid']
        this.bill.exceeding = temp['exceeding']
 
        this.bill.exceptionRecurrence = obj['exceptionRecurrence']
        this.bill.exceptionTypeAggregation = obj['exceptionTypeAggregation']
      })
    },
 
 
 increment(){
    this.count++
    console.log(document.getElementById('but').textContent)
    nextTick(()=>{
      console.log('abc',document.getElementById('but').textContent)
    })
    
  }
  }
}
</script>
 
<template>
  <el-button id="but" @click="increment" >{{count}} </el-button>
  <div>
    <!-- 点击"获取数据"后,每隔一个小时执行一次 -->
  </div>
 
  <el-descriptions title="数据获取详情" direction="vertical" :column="4" :size="size" border>
    <el-descriptions-item label="数据来源">扬尘</el-descriptions-item>
    <el-descriptions-item label="数据获取频率">1小时</el-descriptions-item>
    <el-descriptions-item label="自动异常分析" :span="2"
      ><el-tag size="small">是</el-tag></el-descriptions-item
    >
    <el-descriptions-item label="站点基本信息数据">
      <el-tag size="small">是</el-tag>
    </el-descriptions-item>
    <el-descriptions-item label="浓度数据"><el-tag size="small">是</el-tag> </el-descriptions-item>
  </el-descriptions>
 
  <el-button type="primary" @click="getData"> 自动获取 </el-button>
  <div>异步函数:{{ async }}</div>
  <div style="margin-bottom: 20px"></div>
  <div>后面: {{ normal }}</div>
</template>
 
<style scoped>
.el-descriptions,
.el-button {
  margin: 20px;
}
</style>