From 7c74ba1171fb95d4dacdc17ce5e19e446f58f10d Mon Sep 17 00:00:00 2001 From: wally <18603454788@163.com> Date: Sat, 13 Nov 2021 11:30:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=BE=E5=A4=87=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=A8=A1=E6=8B=9F=E8=8E=B7=E5=8F=96;?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=A6=82=E8=A7=88=E7=9B=B8=E5=85=B3=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 16 +++++- src/apis/index.js | 16 ++++++ .../overview/chart-device-count.vue | 55 ++++++++++++++----- src/components/overview/device-table.vue | 20 +++++-- src/routers/index.js | 2 +- src/store/device.js | 36 +++++++++++- src/store/index.js | 2 +- src/utils/overview.js | 30 ++++++++++ src/views/data-history.vue | 4 +- src/views/data-realtime.vue | 4 +- src/views/data-report.vue | 2 +- src/views/device-create.vue | 6 ++ src/views/device-list.vue | 3 +- src/views/overview.vue | 4 ++ 14 files changed, 169 insertions(+), 31 deletions(-) create mode 100644 src/utils/overview.js diff --git a/.eslintrc.js b/.eslintrc.js index 2b9b596..aca78d0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -13,6 +13,14 @@ module.exports = { 'import/no-unresolved': 0, 'import/extensions': 0, 'no-plusplus': 0, + 'no-use-before-define': [ + 'error', + { + functions: false, + classes: true, + variables: true, + }, + ], 'consistent-return': 0, 'vue/html-self-closing': 'off', 'no-unused-expressions': 'off', @@ -21,7 +29,13 @@ module.exports = { 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', 'no-param-reassign': 'off', - 'max-len': ['error', { code: 140, tabWidth: 2 }], + 'max-len': [ + 'error', + { + code: 140, + tabWidth: 2, + }, + ], 'object-curly-newline': ['error', { multiline: true }], 'arrow-parens': ['error', 'as-needed'], 'linebreak-style': 'off', diff --git a/src/apis/index.js b/src/apis/index.js index 3556198..3f460aa 100644 --- a/src/apis/index.js +++ b/src/apis/index.js @@ -12,6 +12,22 @@ export const getToken = userId => http.get(`${users}/userId`, { params: { userId // 获取设备列表 export const getDevices = () => http.get(`${corrosion}/devices`); +// 查设备概览 数据统计 +// export const getDevicesCount = () => http.get(`${corrosion}/devices/count`); +export const getDevicesCount = () => { + return new Promise(resolve => { + setTimeout(() => { + resolve({ + total: 100, + online: 10, + offline: 90, + fault: 10, + warning: 5, + }); + }, 100); + }); +}; + // 添加设备 export const createDevice = data => http.post(`${corrosion}/devices`, data); diff --git a/src/components/overview/chart-device-count.vue b/src/components/overview/chart-device-count.vue index 6900f55..8549d9d 100644 --- a/src/components/overview/chart-device-count.vue +++ b/src/components/overview/chart-device-count.vue @@ -3,18 +3,30 @@ diff --git a/src/components/overview/device-table.vue b/src/components/overview/device-table.vue index 49fc95f..b33cd4a 100644 --- a/src/components/overview/device-table.vue +++ b/src/components/overview/device-table.vue @@ -1,13 +1,21 @@