From 1e18f0bcee0358e13c0e2cb750d17cd7ef5bf4d6 Mon Sep 17 00:00:00 2001 From: zmc <zmc_li@foxmail.com> Date: 星期一, 07 八月 2023 17:55:21 +0800 Subject: [PATCH] 油烟检测系统 --- src/test/TestNoData.vue | 165 ++++++++---------------------------------------------- 1 files changed, 25 insertions(+), 140 deletions(-) diff --git a/src/test/TestNoData.vue b/src/test/TestNoData.vue index f2d4534..b641644 100644 --- a/src/test/TestNoData.vue +++ b/src/test/TestNoData.vue @@ -1,149 +1,34 @@ +<script > +import {store} from '../utils/status.js' +import {useCount} from '../utils/status1.js' + export default { + data() { + return{ + store, -<template> - <div> - <div style="margin: 5px;"> - <span style="color: #b1b3b8;" >瀹炴椂鏁版嵁</span> - </div> - - <hr style="margin-top: 10px;"/> - <div v-loading="loading"> - <el-row :gutter="20"> - <el-col :span="8" v-for="device in devices" :key="device.id"> - <div class="dashboard"> - <div class="dashboard-title">璁惧缂栧彿涓猴細{{ device.mnCode }}</div> - <div ref="charts" class="echarts"></div> - <div> - <div class="data">褰撳墠鏁板�硷細{{ device.value }}</div> - <div class="data">浜х敓鏃堕棿锛歿{ device.time }}</div> - <div class="status" :class="{'exceed': device.value > 1}"> {{ device.value >= 1 ? '瓒呮爣' : '' }}</div> - <div class="status1" :class="{'exceed1': device.value < 1}"> {{ device.value < 1 ? '鏈秴鏍�' : '' }}</div> - </div> - </div> - - - </el-col> - </el-row> - 鍔犺浇 - </div> - </div> -</template> - -<script> - -import * as echarts from 'echarts' -import axios from 'axios' - -export default { - data() { - return { - devices: [], - loading:false, //鍔犺浇涓� - } - }, - methods: { - fetchData() { - const params = { - params: { - page: 1, - per_page: 10 - } + localCount:0 } - axios.get('https://fyami.com.cn/device/min/value/real_time', params) - .then(response => { - this.devices = response.data.data - }) - .catch(error => { - console.error(error) - }) }, - updateCharts() { - for (let i = 0; i < this.devices.length; i++) { - const device = this.devices[i] - const chart = echarts.init(this.$refs.charts[i]) - - const option = { - title: { - // text: '瀹炴椂鏁版嵁' - }, - tooltip: { - formatter: '{a} <br/>{b} : {c}' - }, - series: [ - { - name: '瀹炴椂鏁版嵁', - type: 'gauge', - detail: { formatter: '{value}' }, - data: [{ - value: device.value, - name: '娌圭儫娴撳害' , - itemStyle: { - color:device.value >= 1?'red' :'green' - } - }], - max:2 - } - ] - } - - chart.setOption(option) - } - console.log('璋冪敤浜嗭紒'); - } - }, - mounted() { - this.fetchData() - this.loading = true - setInterval(() => { - this.updateCharts() - }, 30000) //姣忓垎閽燂紙30绉掞級璋冪敤涓�娆� - this.loading = false - }, - created() { - // 鐩戝惉绐楀彛澶у皬鍙樺寲锛屽姩鎬佽皟鏁翠华琛ㄧ洏甯冨眬 - window.addEventListener('resize', this.updateCharts) - }, - beforeUnmount() { - // 绉婚櫎绐楀彛澶у皬鍙樺寲鐨勭洃鍚� - window.removeEventListener('resize', this.updateCharts) - } + mounted(){ + this.localCount = useCount() + }, + methods: { + + } } </script> -<style scoped> -.dashboard { - margin-bottom: 20px; -} +<template> + <div> + <el-button @click="store.increment()">澧炲姞</el-button> + <div>count:{{ store.count }}</div> -.dashboard-title { - font-size: 20px; - text-align: center; - padding: 10px 0; - background-color: #f5f7fa; -} + <!-- <div>{{ globalCount.value }}</div> --> + <div>{{ localCount.localCount }}</div> -.echarts { - height: 300px; -} + </div> +</template> -/* 瓒呮爣 鏂囧瓧鏁堟灉*/ -.status { - font-size: 18px; - color: #FF4D4F; - font-weight: bold; - } - - .exceed { - color: #FF4D4F; - } - -/* 鏈秴鏍� */ - .status1 { - font-size: 18px; - color: #1de01d; - font-weight: bold; - } - - .exceed1 { - color: #1de01d; - } -</style> +<style lang="scss" scoped> + +</style> \ No newline at end of file -- Gitblit v1.9.3