From b722787575452df6f3fc8836bf54751843e42998 Mon Sep 17 00:00:00 2001 From: song Date: Thu, 28 Oct 2021 10:51:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=BB=9F=E8=AE=A1=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/index.js | 11 +-- src/components/data-search-bar.vue | 62 +++++++++++++++ src/components/history-data.vue | 115 +++++++++++++++++++++++++++ src/components/integral-electric.vue | 74 ++++++++--------- src/components/moist-time.vue | 53 ++++++++++++ src/components/realtime-data.vue | 115 +++++++++++++++++++++++++++ src/components/total-corrosion.vue | 52 ++++++++++++ src/routers/index.js | 12 +++ src/store/statistics.js | 40 +++++----- src/views/month-data.vue | 47 ++++++++++- src/views/statistical-history.vue | 41 ++++++++++ src/views/statistical-realtime.vue | 41 ++++++++++ 12 files changed, 596 insertions(+), 67 deletions(-) create mode 100644 src/components/data-search-bar.vue create mode 100644 src/components/history-data.vue create mode 100644 src/components/moist-time.vue create mode 100644 src/components/realtime-data.vue create mode 100644 src/components/total-corrosion.vue create mode 100644 src/views/statistical-history.vue create mode 100644 src/views/statistical-realtime.vue diff --git a/src/apis/index.js b/src/apis/index.js index ba262e5..12f8c9b 100644 --- a/src/apis/index.js +++ b/src/apis/index.js @@ -13,11 +13,8 @@ export const getDevices = () => http.get(`${corrosion}/devices`); // 获取设备列表 完整信息 export const getDevicesAll = () => http.get(`${corrosion}/devices/all`); -// 获取数据统计 积分电量 -export const getIntegralElectric = () => http.get(`${corrosion}/monthes/integralElectric`); +// 获取月累计数据分析 +export const getMonthesDate = params => http.get(`${corrosion}/statistics/monthes`, { params }); -// 获取数据统计 月累计腐蚀 -export const getTotalCorrosion = () => http.get(`${corrosion}/monthes/totalCorrosion`); - -// 获取数据统计 月累计湿润时间图 -export const getMoistTime = () => http.get(`${corrosion}/monthes/moistTime`); +// 获取实时数据统计 +export const getRealtimeData = params => http.get(`${corrosion}/statistics/realtime`, { params }); diff --git a/src/components/data-search-bar.vue b/src/components/data-search-bar.vue new file mode 100644 index 0000000..e9fbebe --- /dev/null +++ b/src/components/data-search-bar.vue @@ -0,0 +1,62 @@ + + + diff --git a/src/components/history-data.vue b/src/components/history-data.vue new file mode 100644 index 0000000..7bf4e1b --- /dev/null +++ b/src/components/history-data.vue @@ -0,0 +1,115 @@ + + + diff --git a/src/components/integral-electric.vue b/src/components/integral-electric.vue index be11f5c..6ffd492 100644 --- a/src/components/integral-electric.vue +++ b/src/components/integral-electric.vue @@ -1,51 +1,51 @@ diff --git a/src/components/moist-time.vue b/src/components/moist-time.vue new file mode 100644 index 0000000..a9e7e6a --- /dev/null +++ b/src/components/moist-time.vue @@ -0,0 +1,53 @@ + + + diff --git a/src/components/realtime-data.vue b/src/components/realtime-data.vue new file mode 100644 index 0000000..7bf4e1b --- /dev/null +++ b/src/components/realtime-data.vue @@ -0,0 +1,115 @@ + + + diff --git a/src/components/total-corrosion.vue b/src/components/total-corrosion.vue new file mode 100644 index 0000000..ba3ed64 --- /dev/null +++ b/src/components/total-corrosion.vue @@ -0,0 +1,52 @@ + + + diff --git a/src/routers/index.js b/src/routers/index.js index 6990027..000ada8 100644 --- a/src/routers/index.js +++ b/src/routers/index.js @@ -33,6 +33,18 @@ export const routes = [ meta: { title: '月累计数据分析' }, component: () => import('@/views/month-data.vue'), }, + { + path: '/statistical-realtime', + name: 'statistical-realtime', + meta: { title: '实时数据统计' }, + component: () => import('@/views/statistical-realtime.vue'), + }, + { + path: '/statistical-history', + name: 'statistical-history', + meta: { title: '历史数据统计' }, + component: () => import('@/views/statistical-history.vue'), + }, { path: '/test', name: 'test', diff --git a/src/store/statistics.js b/src/store/statistics.js index 3582071..54bead7 100644 --- a/src/store/statistics.js +++ b/src/store/statistics.js @@ -1,4 +1,4 @@ -import { getIntegralElectric, getTotalCorrosion, getMoistTime } from 'apis/index'; +import { getMonthesDate, getRealtimeData } from 'apis/index'; export default { namespaced: true, @@ -7,6 +7,7 @@ export default { electricData: null, corrosionData: null, moistTimeData: null, + realtimeData: null, }, getters: {}, @@ -18,7 +19,6 @@ export default { * @param {array} data */ setElectricData(state, data) { - console.log('data: ', data); state.electricData = data; }, @@ -39,36 +39,36 @@ export default { setMoistTimeData(state, data) { state.moistTimeData = data; }, + + /** + * 设置实时数据统计的数据 + * @param {*} state + * @param {*} data + */ + setRealtimeData(state, data) { + state.realtimeData = data; + }, }, actions: { // 获取积分电量数据 - async getElectricData({ commit }) { - try { - const data = await getIntegralElectric(); - commit('setElectricData', data || null); - return data; - } catch (error) { - throw new Error(error); - } - }, - - // 获取月累计腐蚀数据 - async getCorrosionData({ commit }) { + async getMonthesDate({ commit }, params) { try { - const data = await getTotalCorrosion(); - commit('setCorrosionData', data || null); + const data = await getMonthesDate(params); + commit('setElectricData', data.powers || null); + commit('setCorrosionData', data.corrosions || null); + commit('setMoistTimeData', data.humids || null); return data; } catch (error) { throw new Error(error); } }, - // 获取月累计湿润时间图数据 - async getMoistTimeData({ commit }) { + // 获取实时数据统计数据 + async getRealtimeData({ commit }, params) { try { - const data = await getMoistTime(); - commit('setMoistTimeData', data || null); + const data = await getRealtimeData(params); + commit('setRealtimeData', data || null); return data; } catch (error) { throw new Error(error); diff --git a/src/views/month-data.vue b/src/views/month-data.vue index a1e7dd1..18ce51e 100644 --- a/src/views/month-data.vue +++ b/src/views/month-data.vue @@ -1,9 +1,50 @@ diff --git a/src/views/statistical-history.vue b/src/views/statistical-history.vue new file mode 100644 index 0000000..3d73a60 --- /dev/null +++ b/src/views/statistical-history.vue @@ -0,0 +1,41 @@ + + + diff --git a/src/views/statistical-realtime.vue b/src/views/statistical-realtime.vue new file mode 100644 index 0000000..5011b4b --- /dev/null +++ b/src/views/statistical-realtime.vue @@ -0,0 +1,41 @@ + + +