已修改13个文件
已删除1个文件
已添加4个文件
已重命名2个文件
| | |
| | | params += startTime ? `&startTime=${startTime}` : ''; |
| | | params += endTime ? `&endTime=${endTime}` : ''; |
| | | return $http.get(`air/realtime/sec?${params}`).then((res) => res.data); |
| | | }, |
| | | |
| | | fetchNextData({ deviceCode, updateTime, perPage = 50 }) { |
| | | let params = `deviceCode=${deviceCode}&updateTime=${updateTime}&perPage=${perPage}`; |
| | | return $http.get(`air/realtime/sec/next?${params}`).then((res) => res.data); |
| | | } |
| | | }; |
| | |
| | | ElRadio: typeof import('element-plus/es')['ElRadio'] |
| | | ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] |
| | | ElRow: typeof import('element-plus/es')['ElRow'] |
| | | ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] |
| | | ElSelect: typeof import('element-plus/es')['ElSelect'] |
| | | ElSlider: typeof import('element-plus/es')['ElSlider'] |
| | | ElTable: typeof import('element-plus/es')['ElTable'] |
| | |
| | | FactorCheckbox: typeof import('./components/monitor/FactorCheckbox.vue')['default'] |
| | | FactorLegend: typeof import('./components/monitor/FactorLegend.vue')['default'] |
| | | FactorRadio: typeof import('./components/monitor/FactorRadio.vue')['default'] |
| | | GaugeChart: typeof import('./components/monitor/GaugeChart.vue')['default'] |
| | | FactorTrend: typeof import('./components/monitor/FactorTrend.vue')['default'] |
| | | GaugeChart: typeof import('./components/chart/GaugeChart.vue')['default'] |
| | | HistoricalTrajectory: typeof import('./components/animation/HistoricalTrajectory.vue')['default'] |
| | | LineChart: typeof import('./components/monitor/LineChart.vue')['default'] |
| | | LineChart: typeof import('./components/chart/LineChart.vue')['default'] |
| | | MapToolbox: typeof import('./components/map/MapToolbox.vue')['default'] |
| | | MIssionCreate: typeof import('./components/mission/MIssionCreate.vue')['default'] |
| | | MissionImport: typeof import('./components/mission/MissionImport.vue')['default'] |
| | |
| | | OptionMission: typeof import('./components/search/OptionMission.vue')['default'] |
| | | OptionTime: typeof import('./components/search/OptionTime.vue')['default'] |
| | | OptionType: typeof import('./components/search/OptionType.vue')['default'] |
| | | ProgressLineChart: typeof import('./components/chart/ProgressLineChart.vue')['default'] |
| | | RealTimeLineChart: typeof import('./components/chart/RealTimeLineChart.vue')['default'] |
| | | RouterLink: typeof import('vue-router')['RouterLink'] |
| | | RouterView: typeof import('vue-router')['RouterView'] |
| | | SearchBar: typeof import('./components/search/SearchBar.vue')['default'] |
ÎļþÃû´Ó src/components/monitor/GaugeChart.vue ÐÞ¸Ä |
| | |
| | | this.gaugeChart.setOption(this.option); |
| | | }, |
| | | refreshChart(e) { |
| | | this.option.data[0].value = e; |
| | | this.option.series[0].data[0].value = e; |
| | | this.gaugeChart.setOption(this.option); |
| | | } |
| | | }, |
ÎļþÃû´Ó src/components/monitor/LineChart.vue ÐÞ¸Ä |
| | |
| | | import { factorName } from '@/constant/factor-name'; |
| | | import { factorLineOption } from '@/utils/chart/chart-option'; |
| | | |
| | | // 另坿å¨è¿åº¦æ¡çæçº¿å¾ |
| | | export default { |
| | | props: { |
| | | loading: Boolean, |
| | |
| | | // ä¿®æ¹å¾è¡¨å±ç¤ºçæçº¿å¾ç±»å |
| | | changeChartSeries() { |
| | | this.option.series = this.getShowSeries(); |
| | | this.option.legend.data = this.getLegends(this.option.series); |
| | | this.lineChart.setOption(this.option, { notMerge: true }); |
| | | }, |
| | | changeChartRange() { |
| | | const { sIndex, eIndex, startPer, endPer } = this.getRange(); |
| | | const showSeries = this.getShowSeries(sIndex, eIndex); |
| | | const xAxis = this.getShowXAxis(sIndex, eIndex); |
| | | const legends = this.getLegends(showSeries); |
| | | if (!this.option) { |
| | | this.option = factorLineOption(xAxis, showSeries, legends); |
| | | this.option = factorLineOption(xAxis, showSeries); |
| | | } else { |
| | | this.option.xAxis.data = xAxis; |
| | | this.option.series = showSeries; |
| | | this.option.legend.data = legends; |
| | | } |
| | | // this.option.dataZoom[0].start = startPer; |
| | | // this.option.dataZoom[0].end = endPer; |
| | |
| | | const startPer = (sIndex / this.allXAxis.length) * 100; |
| | | const endPer = (eIndex / this.allXAxis.length) * 100; |
| | | return { sIndex, eIndex, startPer, endPer }; |
| | | }, |
| | | getLegends(series) { |
| | | return series.map((s) => { |
| | | return s.name; |
| | | }); |
| | | } |
| | | }, |
| | | beforeUnmount() { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="chart-wrap"> |
| | | <div ref="lineChart" class="line-chart"></div> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import * as echarts from 'echarts'; |
| | | import { smallLineOption } from '@/utils/chart/chart-option'; |
| | | |
| | | export default { |
| | | props: { |
| | | modelValue: { |
| | | type: Object |
| | | // default: () => { |
| | | // return { |
| | | // xAxis: [], |
| | | // series: [] |
| | | // }; |
| | | // } |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | option: null |
| | | }; |
| | | }, |
| | | watch: { |
| | | modelValue: { |
| | | handler() { |
| | | this.refreshChart(); |
| | | }, |
| | | deep: false, |
| | | immediate: true |
| | | } |
| | | }, |
| | | methods: { |
| | | refreshChart() { |
| | | const { xAxis, series } = this.modelValue; |
| | | if (!this.option) { |
| | | this.option = smallLineOption(xAxis, series); |
| | | } else { |
| | | this.option.xAxis[0].data = xAxis; |
| | | this.option.series = series; |
| | | } |
| | | if (this.lineChart) { |
| | | this.lineChart.setOption(this.option, { notMerge: true }); |
| | | } else { |
| | | this.onChartCreated = () => { |
| | | this.lineChart.setOption(this.option, { notMerge: true }); |
| | | }; |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.lineChart = echarts.init(this.$refs.lineChart); |
| | | if (typeof this.onChartCreated === 'function') { |
| | | this.onChartCreated(); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | <style scoped> |
| | | .chart-wrap { |
| | | /* width: 300px; */ |
| | | display: flex; |
| | | justify-content: center; |
| | | } |
| | | .line-chart { |
| | | width: 300px; |
| | | height: 140px; |
| | | /* border-bottom: 1px solid rgba(255, 255, 255, 0.329); */ |
| | | } |
| | | </style> |
| | |
| | | }, |
| | | selectFactorType: { |
| | | type: Array, |
| | | default: () => ['1', '2', '3'] |
| | | default: () => [] |
| | | }, |
| | | // å½åéä¸é«äº®çæ°æ®ç¹ç´¢å¼ |
| | | locateIndex: Number |
| | |
| | | |
| | | <script> |
| | | import { Legend } from '@/model/Legend'; |
| | | import { factorUnit } from '../../constant/factor-unit'; |
| | | import { factorUnit } from '@/constant/factor-unit'; |
| | | import { Factor } from '@/model/Factor'; |
| | | |
| | | export default { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <BaseCard size="medium" direction="left"> |
| | | <template #content> |
| | | <el-scrollbar height="calc(98vh - var(--bevel-length-2))"> |
| | | <!-- <div v-for="item in factorTypes" :key="item"> |
| | | <el-row> |
| | | <div>{{ allSeries.get(item.value).name }}</div> |
| | | <div>{{ allSeries.get(item.value).currentData }}</div> |
| | | <div>{{ allSeries.get(item.value).min }}</div> |
| | | <div>{{ allSeries.get(item.value).max }}</div> |
| | | <RealTimeLineChart |
| | | v-show="selectFactorType.includes(item.value)" |
| | | :model-value="series(item.value)" |
| | | ></RealTimeLineChart> |
| | | </el-row> |
| | | </div> --> |
| | | <div v-for="item in seriesList" :key="item.key"> |
| | | <el-row |
| | | v-show="selectFactorType.includes(item.series.key)" |
| | | justify="space-between" |
| | | class="wrap" |
| | | > |
| | | <div class="flex-col"> |
| | | <div class="factor-name">{{ item.series.name }}</div> |
| | | <div class="factor-value">{{ item.series.currentData }}</div> |
| | | <div class="factor-unit"> |
| | | {{ getUnit(item.series.label) }} |
| | | </div> |
| | | <!-- <div class="flex-col"> |
| | | <div>min:{{ item.series.min }}</div> |
| | | <div>max:{{ item.series.max }}</div> |
| | | </div> --> |
| | | </div> |
| | | <RealTimeLineChart :model-value="item"></RealTimeLineChart> |
| | | </el-row> |
| | | </div> |
| | | </el-scrollbar> |
| | | </template> |
| | | </BaseCard> |
| | | </template> |
| | | <script> |
| | | import { FactorDatas } from '@/model/FactorDatas'; |
| | | import { TYPE0 } from '@/constant/device-type'; |
| | | import { checkboxOptions } from '@/constant/checkbox-options'; |
| | | import { factorName } from '@/constant/factor-name'; |
| | | import { factorUnit } from '@/constant/factor-unit'; |
| | | |
| | | export default { |
| | | props: { |
| | | loading: Boolean, |
| | | factorDatas: FactorDatas, |
| | | deviceType: { |
| | | type: String, |
| | | // type0: è½¦è½½ææ äººæº; type1:æ äººè¹ |
| | | default: TYPE0 |
| | | }, |
| | | selectFactorType: { |
| | | type: Array, |
| | | default: () => ['1', '2', '3'] |
| | | }, |
| | | // æçº¿å¾æ¾ç¤ºçææ°æ®é |
| | | maxCount: { |
| | | type: Number, |
| | | default: 75 |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | xAxis: [], |
| | | allSeries: new Map(), |
| | | seriesList: [] |
| | | }; |
| | | }, |
| | | computed: { |
| | | factorTypes() { |
| | | return checkboxOptions(this.deviceType); |
| | | } |
| | | // seriesList() { |
| | | // const list = []; |
| | | // for (const iterator of this.allSeries) { |
| | | // list.push({ |
| | | // xAxis: this.xAxis, |
| | | // series: iterator[1] |
| | | // }); |
| | | // } |
| | | // return list; |
| | | // } |
| | | }, |
| | | watch: { |
| | | factorDatas: { |
| | | handler() { |
| | | this.refreshData(); |
| | | }, |
| | | deep: false |
| | | } |
| | | }, |
| | | methods: { |
| | | refreshData() { |
| | | this.refreshX(); |
| | | this.refreshY(); |
| | | }, |
| | | refreshX() { |
| | | const newTimes = this.factorDatas.times |
| | | .lastCount(this.maxCount) |
| | | .map((v) => { |
| | | return v.split(' ')[1]; |
| | | }); |
| | | this.xAxis = this.xAxis.concat(newTimes).lastCount(this.maxCount); |
| | | }, |
| | | refreshY() { |
| | | for (const key in this.factorDatas.factor) { |
| | | if (Object.hasOwnProperty.call(this.factorDatas.factor, key)) { |
| | | const e = this.factorDatas.factor[key]; |
| | | if (!this.allSeries.has(key)) { |
| | | this.allSeries.set(key, { |
| | | key: key, |
| | | name: factorName[e.factorName], |
| | | label: e.factorName, |
| | | type: 'line', |
| | | data: [], |
| | | showAllSymbol: true, |
| | | animationDelay: function (idx) { |
| | | return idx * 10; |
| | | } |
| | | }); |
| | | } |
| | | if (e.datas.length == 0) { |
| | | continue; |
| | | } |
| | | const series = this.allSeries.get(key); |
| | | // æå
¥æ°æ°æ® |
| | | const newSeries = e.datas.map((v) => v.factorData); |
| | | series.data = series.data.concat(newSeries).lastCount(this.maxCount); |
| | | // è®¡ç®æ°æ®èå´ |
| | | const { min, max } = this.dataRange(series.data); |
| | | series.min = min; |
| | | series.max = max; |
| | | // è®°å½ææ°æ°æ® |
| | | series.currentData = |
| | | Math.round(series.data[series.data.length - 1] * 10) / 10; |
| | | } |
| | | } |
| | | this.toList(); |
| | | }, |
| | | series(key) { |
| | | return { |
| | | xAxis: this.xAxis, |
| | | // series: this.allSeries.get(key) |
| | | series: key |
| | | }; |
| | | }, |
| | | dataRange(dataList) { |
| | | let min, max; |
| | | dataList.forEach((e) => { |
| | | if (!min || min > e) { |
| | | min = e; |
| | | } |
| | | if (!max || max < e) { |
| | | max = e; |
| | | } |
| | | }); |
| | | return { min, max }; |
| | | }, |
| | | toList() { |
| | | const list = []; |
| | | for (const iterator of this.allSeries) { |
| | | list.push({ |
| | | xAxis: this.xAxis, |
| | | series: iterator[1] |
| | | }); |
| | | } |
| | | this.seriesList = list; |
| | | }, |
| | | getUnit(label) { |
| | | return factorUnit[label]; |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | <style scoped> |
| | | .wrap { |
| | | border-bottom: 1px solid rgba(255, 255, 255, 0.329); |
| | | } |
| | | |
| | | .flex-col { |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
| | | |
| | | .factor-value { |
| | | font-weight: 600; |
| | | font-size: 20px; |
| | | } |
| | | |
| | | .factor-name { |
| | | color: var(--el-color-warning); |
| | | } |
| | | |
| | | .factor-unit { |
| | | /* font-size: ; */ |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <el-row class="wrap"> |
| | | <el-form :inline="true"> |
| | | <el-row justify="center" class="wrap"> |
| | | <!-- <el-form :inline="true"> |
| | | <el-form-item label="车éï¼" class="tag-2"> |
| | | {{ speed }} |
| | | {{ speed }}km/h |
| | | </el-form-item> |
| | | </el-form> |
| | | <GaugeChart name="车é" :speed="speed"></GaugeChart> |
| | | </el-form> --> |
| | | <GaugeChart name="车é" :value="speed"></GaugeChart> |
| | | </el-row> |
| | | </template> |
| | | <script> |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | speed: '--km/h' |
| | | speed: 0 |
| | | }; |
| | | }, |
| | | watch: { |
| | | factorDatas: { |
| | | handler(nV) { |
| | | this.speed = this.lastOne(nV, '14') + 'km/h'; |
| | | this.speed = this.lastOne(nV, '14'); |
| | | }, |
| | | deep: true |
| | | } |
| | |
| | | const lastIndex = f.datas.length - 1; |
| | | return factorDatas.factor[key].datas[lastIndex].factorData; |
| | | } else { |
| | | return '--'; |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | <style scoped> |
| | | .wrap { |
| | | /* flex-direction: column; */ |
| | | /* background-color: antiquewhite; */ |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <el-row class="wrap"> |
| | | <el-form :inline="true"> |
| | | <el-form-item label="温度ï¼" class="tag-2"> |
| | | <el-form :inline="true" class="form"> |
| | | <el-form-item label="温度ï¼" class="w-tag"> |
| | | {{ temprature }} |
| | | </el-form-item> |
| | | <el-form-item label="湿度ï¼" class="tag-2"> |
| | | <el-form-item label="湿度ï¼" class="w-tag"> |
| | | {{ humidity }} |
| | | </el-form-item> |
| | | </el-form> |
| | | <!-- <div class="tag-2">{{ temprature }}</div> |
| | | <div class="tag-2">{{ humidity }}</div> --> |
| | | <!-- <div class="w-tag">{{ temprature }}</div> |
| | | <div class="w-tag">{{ humidity }}</div> --> |
| | | </el-row> |
| | | <el-row class="wrap"> |
| | | <el-form :inline="true"> |
| | | <el-form-item label="é£åï¼" class="tag-2"> |
| | | <el-form :inline="true" class="form"> |
| | | <el-form-item label="é£åï¼" class="w-tag"> |
| | | {{ windDirection }} |
| | | </el-form-item> |
| | | <el-form-item label="é£éï¼" class="tag-2"> |
| | | <el-form-item label="é£éï¼" class="w-tag"> |
| | | {{ windSpeed }} |
| | | </el-form-item> |
| | | </el-form> |
| | | <!-- <div class="tag-2">{{ windDirection }}</div> |
| | | <div class="tag-2">{{ windSpeed }}</div> --> |
| | | <!-- <div class="w-tag">{{ windDirection }}</div> |
| | | <div class="w-tag">{{ windSpeed }}</div> --> |
| | | </el-row> |
| | | </template> |
| | | <script> |
| | |
| | | deep: true |
| | | } |
| | | }, |
| | | // computed: { |
| | | // temprature() { |
| | | // return `${this.lastOne('TEMPERATURE')}â`; |
| | | // }, |
| | | // humidity() { |
| | | // return `${this.lastOne('HUMIDITY')}%`; |
| | | // }, |
| | | // windDirection() { |
| | | // return `${this.lastOne('WIND_DIRECTION')}`; |
| | | // }, |
| | | // windSpeed() { |
| | | // return `${this.lastOne('WIND_SPEED')}m/s`; |
| | | // } |
| | | // }, |
| | | methods: { |
| | | lastOne(factorDatas, key) { |
| | | const f = factorDatas.factor[key]; |
| | |
| | | } |
| | | }; |
| | | </script> |
| | | <style scoped> |
| | | .w-tag { |
| | | padding: 2px 4px; |
| | | /* background-color: green; */ |
| | | border: 1px solid white; |
| | | border-radius: 2px; |
| | | -moz-border-radius: 25px; |
| | | width: 130px; |
| | | /* Old Firefox */ |
| | | } |
| | | |
| | | .form { |
| | | display: flex; |
| | | gap: 4px; |
| | | } |
| | | |
| | | .el-form-item { |
| | | margin-bottom: 4px; |
| | | margin-right: 0px !important; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // çæµå åå¤éæ¡é»è®¤é项 |
| | | import { defineProps, ref, watch } from 'vue'; |
| | | import { checkboxOptions } from '@/constant/checkbox-options'; |
| | | import { TYPE0 } from '@/constant/device-type'; |
| | | |
| | | export function useDefaultFactorType() { |
| | | const props = defineProps({ |
| | | deviceType: { |
| | | type: String, |
| | | // type0: è½¦è½½ææ äººæº; type1:æ äººè¹ |
| | | default: TYPE0 |
| | | } |
| | | }); |
| | | |
| | | // æ ¹æ®å½åæ°æ®å¯¹åºç设å¤ç±»å, è·åé»è®¤éä¸ççæµå åidéå |
| | | function defaultFactorTypes() { |
| | | const list = checkboxOptions(props.deviceType); |
| | | if (list.length > 3) { |
| | | return list.slice(0, 3).map((v) => v.value); |
| | | } else { |
| | | return list.map((v) => v.value); |
| | | } |
| | | } |
| | | |
| | | const selectFactorType = ref(defaultFactorTypes()); |
| | | |
| | | watch(props.deviceType, (nV, oV) => { |
| | | if (nV != oV) { |
| | | selectFactorType.value = defaultFactorTypes(); |
| | | } |
| | | }); |
| | | |
| | | return { selectFactorType, props }; |
| | | } |
| | |
| | | /** |
| | | * çæµå åç±» |
| | | * å卿ä¸ç±»åççæµå åæ°æ®ï¼æä¾3då°å¾ç»å¶é«åº¦æ¢ç®ï¼ç»å¾èå´è®¾å®çåè½ |
| | | * ç¨äº3då°å¾ç»å¶ |
| | | */ |
| | | function Factor(options) { |
| | | /** |
| | |
| | | |
| | | .el-form-item { |
| | | margin-bottom: 0px; |
| | | margin-right: 8px !important; |
| | | } |
| | | |
| | | .el-form-item__label { |
| | |
| | | } |
| | | |
| | | // æçº¿å¾ |
| | | function factorLineOption(_xAxis, _series, legends) { |
| | | function factorLineOption(_xAxis, _series) { |
| | | var fontSize = fGetChartFontSize(); |
| | | return { |
| | | animationEasing: 'elasticOut', |
| | |
| | | }, |
| | | legend: { |
| | | type: 'scroll', |
| | | data: legends, |
| | | // data: legends, |
| | | left: 0, |
| | | textStyle: { |
| | | fontSize: fontSize, |
| | |
| | | }, |
| | | minInterval: 1 |
| | | }, |
| | | series: _series, |
| | | dataZoom: [ |
| | | { |
| | | type: 'inside', |
| | | start: 0, |
| | | end: 100 |
| | | series: _series |
| | | }; |
| | | } |
| | | |
| | | // æçº¿å¾ |
| | | function smallLineOption(_xAxis, _series) { |
| | | var fontSize = fGetChartFontSize(); |
| | | return { |
| | | animationEasing: 'elasticOut', |
| | | animationDelayUpdate: function (idx) { |
| | | return idx * 5; |
| | | }, |
| | | tooltip: { |
| | | textStyle: { |
| | | fontSize: fontSize |
| | | } |
| | | ] |
| | | }, |
| | | grid: { |
| | | left: '11%', |
| | | right: '2%', |
| | | top: '7%', |
| | | bottom: '20%' |
| | | }, |
| | | legend: { |
| | | show: false |
| | | }, |
| | | xAxis: [ |
| | | { |
| | | show: true, |
| | | // name: 'æ¶é´', |
| | | // type: 'time', |
| | | data: _xAxis, |
| | | axisLabel: { |
| | | textStyle: { |
| | | fontSize: fontSize |
| | | }, |
| | | color: '#ffffff', |
| | | textBorderColor: '#fff' |
| | | }, |
| | | axisTick: { |
| | | lineStyle: { |
| | | color: 'white' |
| | | }, |
| | | intervel: 0, |
| | | inside: false |
| | | }, |
| | | |
| | | nameTextStyle: { |
| | | color: '#ffffff' |
| | | }, |
| | | axisLine: { |
| | | lineStyle: { |
| | | color: '#ffffff' |
| | | } |
| | | } |
| | | }, |
| | | { show: true } |
| | | ], |
| | | yAxis: [ |
| | | { |
| | | // name: 'æµåº¦(μg/m³)', |
| | | // type: 'time', |
| | | axisLabel: { |
| | | textStyle: { |
| | | fontSize: fontSize |
| | | } |
| | | }, |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color: 'white' |
| | | } |
| | | }, |
| | | axisTick: { |
| | | show: false, |
| | | lineStyle: { |
| | | color: 'white' |
| | | } |
| | | }, |
| | | splitLine: { |
| | | show: false |
| | | }, |
| | | minInterval: 1, |
| | | intervel: 1, |
| | | min: function (value) { |
| | | return Math.floor(value.min); |
| | | }, |
| | | max: function (value) { |
| | | return Math.ceil(value.max); |
| | | } |
| | | }, |
| | | { |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color: 'white' |
| | | } |
| | | } |
| | | } |
| | | ], |
| | | series: _series |
| | | }; |
| | | } |
| | | |
| | | // 仪表ç |
| | | function gaugeOption(name, value) { |
| | | var fontSize = fGetChartFontSize(); |
| | | // var fontSize = fGetChartFontSize(); |
| | | var option = { |
| | | title: { |
| | | text: name, |
| | | textStyle: { |
| | | color: 'white', |
| | | fontSize: fontSize |
| | | }, |
| | | left: 'center' |
| | | }, |
| | | // title: { |
| | | // text: name, |
| | | // textStyle: { |
| | | // color: 'white', |
| | | // fontSize: fontSize |
| | | // }, |
| | | // left: 'center' |
| | | // }, |
| | | textStyle: { |
| | | color: '#ffffff', |
| | | fontSize: 10 |
| | | }, |
| | | tooltip: { |
| | | formatter: '{a} <br/>{b} : {c}%' |
| | | formatter: '{a} : {c}km/h' |
| | | }, |
| | | toolbox: { |
| | | // feature: { |
| | |
| | | { |
| | | name: name, |
| | | type: 'gauge', |
| | | title: { |
| | | color: 'white', |
| | | offsetCenter: [0, '50%'] |
| | | }, |
| | | detail: { |
| | | color: 'white', |
| | | formatter: '{value}', |
| | | formatter: '{value}km/h', |
| | | textStyle: { |
| | | fontSize: fontSize |
| | | } |
| | | fontSize: 18 |
| | | }, |
| | | offsetCenter: [0, '80%'] |
| | | }, |
| | | splitLine: { |
| | | lineStyle: { |
| | |
| | | fontSize: 10 |
| | | }, |
| | | axisLine: { |
| | | lineStyle: { |
| | | color: [ |
| | | [0.2, '#2afd2a'], |
| | | [0.8, '#f1e74d'], |
| | | [1, '#c23531'] |
| | | ] |
| | | } |
| | | // lineStyle: { |
| | | // color: [ |
| | | // [0.2, '#2afd2a'], |
| | | // [0.8, '#f1e74d'], |
| | | // [1, '#c23531'] |
| | | // ] |
| | | // } |
| | | }, |
| | | itemStyle: { |
| | | color: 'white' |
| | |
| | | data: [ |
| | | { |
| | | value: value, |
| | | name: '' |
| | | name: '车é' |
| | | } |
| | | ], |
| | | min: 0, |
| | |
| | | return option; |
| | | } |
| | | |
| | | export { factorLineOption, gaugeOption }; |
| | | export { factorLineOption, smallLineOption, gaugeOption }; |
| | |
| | | } |
| | | return fmt; |
| | | }; |
| | | |
| | | Array.prototype.lastCount = function (size) { |
| | | const l = this.length; |
| | | const s = size > this.length ? 0 : this.length - size; |
| | | return this.slice(s, l); |
| | | }; |
| | |
| | | </el-row> |
| | | </template> |
| | | <script> |
| | | // import { toRefs } from 'vue'; |
| | | import { TYPE0 } from '@/constant/device-type'; |
| | | import { checkboxOptions } from '@/constant/checkbox-options'; |
| | | import { FactorDatas } from '@/model/FactorDatas'; |
| | | // import { useDefaultFactorType } from "../../../composables/defaultFactorType"; |
| | | |
| | | export default { |
| | | // setup(){ |
| | | // const {selectFactorType, props} = useDefaultFactorType() |
| | | // return {selectFactorType, ...toRefs(props)} |
| | | // }, |
| | | props: { |
| | | loading: Boolean, |
| | | factorDatas: FactorDatas, |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | selectFactorType: ['1', '2', '3'], |
| | | selectFactorType: this.defaultFactorTypes(), |
| | | show: false |
| | | }; |
| | | }, |
| | | emits: ['tableClick'], |
| | | watch: { |
| | | deviceType(nV, oV) { |
| | | if (nV != oV) { |
| | | this.selectFactorType = this.defaultFactorTypes(); |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | handleTableClick(index) { |
| | | this.$emit('tableClick', index); |
| | | }, |
| | | defaultFactorTypes() { |
| | | const list = checkboxOptions(this.deviceType); |
| | | if (list.length > 3) { |
| | | return list.slice(0, 3).map((v) => v.value); |
| | | } else { |
| | | return list.map((v) => v.value); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | |
| | | v-model="selectFactorType" |
| | | :device-type="deviceType" |
| | | ></FactorCheckbox> |
| | | <LineChart |
| | | <ProgressLineChart |
| | | :locate-index="locateIndex" |
| | | @chart-click="handleChartClick" |
| | | :factor-datas="factorDatas" |
| | | :select-factor-type="selectFactorType" |
| | | ></LineChart> |
| | | ></ProgressLineChart> |
| | | </el-col> |
| | | </Transition> |
| | | <el-col span="2"> |
| | |
| | | <el-row class="m-t-2" justify="start"> |
| | | <DashBoard :factor-datas="factorDatas"></DashBoard> |
| | | </el-row> |
| | | <RealTimeTrend |
| | | class="real-time-trend" |
| | | :factor-datas="factorDatas" |
| | | :device-type="deviceType" |
| | | ></RealTimeTrend> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import { FactorDatas } from '@/model/FactorDatas'; |
| | | import monitorDataApi from '@/api/monitorDataApi'; |
| | | import DashBoard from './component/DashBoard.vue'; |
| | | import RealTimeTrend from './component/RealTimeTrend.vue'; |
| | | import { MapAnimation } from '@/utils/map/animation'; |
| | | |
| | | const mapAnimation = new MapAnimation(); |
| | | |
| | | export default { |
| | | components: { DashBoard }, |
| | | components: { DashBoard, RealTimeTrend }, |
| | | setup() { |
| | | const { loading, fetchData } = useFetchData(10000); |
| | | return { loading, fetchData }; |
| | |
| | | return { |
| | | // çæµè®¾å¤ç±»å |
| | | deviceType: TYPE0, |
| | | deviceCode: '0a0000000001', |
| | | // çæµå åçç±»åç¼å· |
| | | factorType: '1', |
| | | // çæµæ°æ® |
| | | factorDatas: new FactorDatas() |
| | | // æ°è·åççæµæ°æ® |
| | | factorDatas: new FactorDatas(), |
| | | // å
¨é¨çæµæ°æ® |
| | | allFactorDatas: new FactorDatas() |
| | | }; |
| | | }, |
| | | computed: { |
| | | latestTime() { |
| | | if (this.factorDatas.times.length == 0) { |
| | | return '----/--/-- --:--:--'; |
| | | } else { |
| | | return this.factorDatas.times[this.factorDatas.times.length - 1]; |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | onFetchData(type, data) { |
| | | onFetchData(data) { |
| | | // todo æ ¹æ®è®¾å¤ç±»å忢å°å¾çæµå åå±ç¤ºåéæ¡ãæçº¿å¾å¤éæ¡ãæ°æ®è¡¨æ ¼å¤éæ¡çå åç±»å |
| | | this.deviceType = type; |
| | | this.factorDatas.setData(data, this.drawMode, () => { |
| | | this.factorDatas.refreshHeight(this.factorType); |
| | | // this.deviceType = type; |
| | | const fDatas = new FactorDatas(); |
| | | fDatas.setData(data, this.drawMode, () => { |
| | | fDatas.refreshHeight(this.factorType); |
| | | // this.draw(); |
| | | this.factorDatas = fDatas; |
| | | }); |
| | | }, |
| | | fetchRealTimeData() { |
| | |
| | | this.fetchData((page) => { |
| | | return monitorDataApi |
| | | .fetchHistroyData({ |
| | | deviceCode: '0a0000000001', |
| | | deviceCode: this.deviceCode, |
| | | startTime: '2021-11-04 09:53:35', |
| | | page, |
| | | perPage: 100 |
| | | }) |
| | | .then((res) => { |
| | | this.onFetchData(TYPE0, res.data); |
| | | this.onFetchData(res.data); |
| | | this.onMapData(res.data); |
| | | this.fetchNextData(); |
| | | }); |
| | | }); |
| | | }, |
| | | clearFetchingTask() { |
| | | if (this.fetchingTask) { |
| | | clearInterval(this.fetchingTask); |
| | | } |
| | | }, |
| | | fetchNextData() { |
| | | this.clearFetchingTask(); |
| | | this.fetchingTask = setInterval(() => { |
| | | if (this.isFetching) { |
| | | return; |
| | | } |
| | | |
| | | this.isFetching = true; |
| | | this.fetchData(() => { |
| | | return monitorDataApi |
| | | .fetchNextData({ |
| | | deviceCode: this.deviceCode, |
| | | updateTime: this.latestTime, |
| | | perPage: 2 |
| | | }) |
| | | .then((res) => { |
| | | this.onFetchData(res.data); |
| | | this.onMapData(res.data); |
| | | }) |
| | | .finally(() => (this.isFetching = false)); |
| | | }); |
| | | }, 10000); |
| | | }, |
| | | onMapData(dataList) { |
| | | let startIndex = this.allFactorDatas.length() - 1; |
| | | if (!this.notFirstFetch) { |
| | | startIndex = dataList.length - 2; |
| | | this.notFirstFetch = true; |
| | | } |
| | | startIndex = startIndex < 0 ? 0 : startIndex; |
| | | this.allFactorDatas.addData(dataList, this.drawMode, () => { |
| | | mapAnimation.moveAnimation( |
| | | this.allFactorDatas, |
| | | this.factorType, |
| | | startIndex |
| | | ); |
| | | }); |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.fetchRealTimeData(); |
| | | }, |
| | | unmounted() { |
| | | this.clearFetchingTask(); |
| | | mapAnimation.stop(); |
| | | } |
| | | }; |
| | | </script> |
| | | <style scoped> |
| | | .real-time-trend { |
| | | position: absolute; |
| | | right: 0; |
| | | top: 0; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-row class="wrap"> |
| | | <el-col span="" class="flex-col"> |
| | | <el-row justify="end"> |
| | | <CardButton |
| | | name="宿¶è¶å¿" |
| | | direction="left" |
| | | @click="() => (show = !show)" |
| | | ></CardButton> |
| | | </el-row> |
| | | <FactorCheckbox |
| | | v-show="show" |
| | | direction="right" |
| | | vertical |
| | | borderless-direction="r" |
| | | v-model="selectFactorType" |
| | | :device-type="deviceType" |
| | | ></FactorCheckbox> |
| | | </el-col> |
| | | <el-col v-show="show" span=""> |
| | | <el-row align="bottom"> |
| | | <FactorTrend |
| | | :factor-datas="factorDatas" |
| | | :device-type="deviceType" |
| | | :select-factor-type="selectFactorType" |
| | | ></FactorTrend> |
| | | </el-row> |
| | | </el-col> |
| | | </el-row> |
| | | </template> |
| | | <script> |
| | | import { TYPE0 } from '@/constant/device-type'; |
| | | import { FactorDatas } from '@/model/FactorDatas'; |
| | | |
| | | export default { |
| | | props: { |
| | | loading: Boolean, |
| | | factorDatas: FactorDatas, |
| | | deviceType: { |
| | | type: String, |
| | | // type0: è½¦è½½ææ äººæº; type1:æ äººè¹ |
| | | default: TYPE0 |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | selectFactorType: ['1', '2', '3'], |
| | | show: true |
| | | }; |
| | | } |
| | | }; |
| | | </script> |
| | | <style scoped> |
| | | .flex-col { |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-between; |
| | | } |
| | | </style> |