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 @@