diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2c2b0ce..1b0e44b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,12 +44,16 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } + console.log(tmp) + const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + console.log(tmp.path + '->' + tmp.children[0].path) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -61,10 +65,22 @@ return res } +function filterRedirect(routes) { + console.log('filterRedirect') + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + console.log(sys.path + ':' + firstmenu.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, addRouters: [], + systems: [], // 子系统 menus: [], // 菜单 btns: [] // 按钮 }, @@ -73,6 +89,9 @@ state.addRouters = routers state.routers = constantRouterMap.concat(routers) }, + SET_SYSTEMS: (state, systems) => { + state.systems = Array.from(systems) + }, SET_MENUS: (state, menus) => { state.menus = Array.from(menus) }, @@ -81,17 +100,49 @@ } }, actions: { - // 获取用户权限 - GetMenus({ commit, state }) { + // 获取用户子系统权限 + GetSystems({ commit, state }) { return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + const params = { + resourceType: '02' + } + getMenus(params).then(response => { // 处理返回值 + const data = response.data + const systems = [] // 子系统 + if (data.menus && data.menus.length > 0) { + commit('SET_SYSTEMS', data.menus) + for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 + const menu_tmp = {} + menu_tmp.id = menu.id + menu_tmp.url = menu.url + menu_tmp.icon = menu.icon + menu_tmp.name = menu.name + systems.push(menu_tmp) + } + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 获取用户权限 + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + return new Promise((resolve, reject) => { + // const params = { + // parentCode: currentSystem.code + // } + getMenus().then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -103,11 +154,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2c2b0ce..1b0e44b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,12 +44,16 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } + console.log(tmp) + const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + console.log(tmp.path + '->' + tmp.children[0].path) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -61,10 +65,22 @@ return res } +function filterRedirect(routes) { + console.log('filterRedirect') + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + console.log(sys.path + ':' + firstmenu.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, addRouters: [], + systems: [], // 子系统 menus: [], // 菜单 btns: [] // 按钮 }, @@ -73,6 +89,9 @@ state.addRouters = routers state.routers = constantRouterMap.concat(routers) }, + SET_SYSTEMS: (state, systems) => { + state.systems = Array.from(systems) + }, SET_MENUS: (state, menus) => { state.menus = Array.from(menus) }, @@ -81,17 +100,49 @@ } }, actions: { - // 获取用户权限 - GetMenus({ commit, state }) { + // 获取用户子系统权限 + GetSystems({ commit, state }) { return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + const params = { + resourceType: '02' + } + getMenus(params).then(response => { // 处理返回值 + const data = response.data + const systems = [] // 子系统 + if (data.menus && data.menus.length > 0) { + commit('SET_SYSTEMS', data.menus) + for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 + const menu_tmp = {} + menu_tmp.id = menu.id + menu_tmp.url = menu.url + menu_tmp.icon = menu.icon + menu_tmp.name = menu.name + systems.push(menu_tmp) + } + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 获取用户权限 + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + return new Promise((resolve, reject) => { + // const params = { + // parentCode: currentSystem.code + // } + getMenus().then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -103,11 +154,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index b7e3be9..f5d3918 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -20,19 +20,23 @@ }, DEL_VISITED_VIEW: (state, view) => { - for (const [i, v] of state.visitedViews.entries()) { - if (v.path === view.path) { - state.visitedViews.splice(i, 1) - break + if (!(state.visitedViews.length === 1 && state.visitedViews[0] === view)) { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } } } }, DEL_CACHED_VIEW: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews.splice(index, 1) - break + if (!state.cachedViews.length === 1 && state.cachedViews[0] === view) { + for (const i of state.cachedViews) { + if (i === view.name) { + const index = state.cachedViews.indexOf(i) + state.cachedViews.splice(index, 1) + break + } } } }, @@ -52,13 +56,32 @@ } }, - DEL_ALL_VISITED_VIEWS: state => { - // keep affix tags - const affixTags = state.visitedViews.filter(tag => tag.meta.affix) - state.visitedViews = affixTags + DEL_ALL_VISITED_VIEWS: (state, delAll) => { + if (delAll) { + state.visitedViews = [] + } else { + // keep affix tags + const affixTags = state.visitedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.visitedViews = affixTags + } }, - DEL_ALL_CACHED_VIEWS: state => { - state.cachedViews = [] + DEL_ALL_CACHED_VIEWS: (state, delAll) => { + // state.cachedViews = [] + // keep affix tags + if (delAll) { + state.cachedViews = [] + } else { + const affixTags = state.cachedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.cachedViews = affixTags + } }, UPDATE_VISITED_VIEW: (state, view) => { @@ -128,26 +151,26 @@ resolve([...state.cachedViews]) }) }, - - delAllViews({ dispatch, state }, view) { + // 关闭全部 + delAllViews({ dispatch, state }, delAll = false) { return new Promise(resolve => { - dispatch('delAllVisitedViews', view) - dispatch('delAllCachedViews', view) + dispatch('delAllVisitedViews', delAll) + dispatch('delAllCachedViews', delAll) resolve({ visitedViews: [...state.visitedViews], cachedViews: [...state.cachedViews] }) }) }, - delAllVisitedViews({ commit, state }) { + delAllVisitedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_VISITED_VIEWS') + commit('DEL_ALL_VISITED_VIEWS', delAll) resolve([...state.visitedViews]) }) }, - delAllCachedViews({ commit, state }) { + delAllCachedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_CACHED_VIEWS') + commit('DEL_ALL_CACHED_VIEWS', delAll) resolve([...state.cachedViews]) }) }, diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2c2b0ce..1b0e44b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,12 +44,16 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } + console.log(tmp) + const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + console.log(tmp.path + '->' + tmp.children[0].path) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -61,10 +65,22 @@ return res } +function filterRedirect(routes) { + console.log('filterRedirect') + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + console.log(sys.path + ':' + firstmenu.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, addRouters: [], + systems: [], // 子系统 menus: [], // 菜单 btns: [] // 按钮 }, @@ -73,6 +89,9 @@ state.addRouters = routers state.routers = constantRouterMap.concat(routers) }, + SET_SYSTEMS: (state, systems) => { + state.systems = Array.from(systems) + }, SET_MENUS: (state, menus) => { state.menus = Array.from(menus) }, @@ -81,17 +100,49 @@ } }, actions: { - // 获取用户权限 - GetMenus({ commit, state }) { + // 获取用户子系统权限 + GetSystems({ commit, state }) { return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + const params = { + resourceType: '02' + } + getMenus(params).then(response => { // 处理返回值 + const data = response.data + const systems = [] // 子系统 + if (data.menus && data.menus.length > 0) { + commit('SET_SYSTEMS', data.menus) + for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 + const menu_tmp = {} + menu_tmp.id = menu.id + menu_tmp.url = menu.url + menu_tmp.icon = menu.icon + menu_tmp.name = menu.name + systems.push(menu_tmp) + } + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 获取用户权限 + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + return new Promise((resolve, reject) => { + // const params = { + // parentCode: currentSystem.code + // } + getMenus().then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -103,11 +154,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index b7e3be9..f5d3918 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -20,19 +20,23 @@ }, DEL_VISITED_VIEW: (state, view) => { - for (const [i, v] of state.visitedViews.entries()) { - if (v.path === view.path) { - state.visitedViews.splice(i, 1) - break + if (!(state.visitedViews.length === 1 && state.visitedViews[0] === view)) { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } } } }, DEL_CACHED_VIEW: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews.splice(index, 1) - break + if (!state.cachedViews.length === 1 && state.cachedViews[0] === view) { + for (const i of state.cachedViews) { + if (i === view.name) { + const index = state.cachedViews.indexOf(i) + state.cachedViews.splice(index, 1) + break + } } } }, @@ -52,13 +56,32 @@ } }, - DEL_ALL_VISITED_VIEWS: state => { - // keep affix tags - const affixTags = state.visitedViews.filter(tag => tag.meta.affix) - state.visitedViews = affixTags + DEL_ALL_VISITED_VIEWS: (state, delAll) => { + if (delAll) { + state.visitedViews = [] + } else { + // keep affix tags + const affixTags = state.visitedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.visitedViews = affixTags + } }, - DEL_ALL_CACHED_VIEWS: state => { - state.cachedViews = [] + DEL_ALL_CACHED_VIEWS: (state, delAll) => { + // state.cachedViews = [] + // keep affix tags + if (delAll) { + state.cachedViews = [] + } else { + const affixTags = state.cachedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.cachedViews = affixTags + } }, UPDATE_VISITED_VIEW: (state, view) => { @@ -128,26 +151,26 @@ resolve([...state.cachedViews]) }) }, - - delAllViews({ dispatch, state }, view) { + // 关闭全部 + delAllViews({ dispatch, state }, delAll = false) { return new Promise(resolve => { - dispatch('delAllVisitedViews', view) - dispatch('delAllCachedViews', view) + dispatch('delAllVisitedViews', delAll) + dispatch('delAllCachedViews', delAll) resolve({ visitedViews: [...state.visitedViews], cachedViews: [...state.cachedViews] }) }) }, - delAllVisitedViews({ commit, state }) { + delAllVisitedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_VISITED_VIEWS') + commit('DEL_ALL_VISITED_VIEWS', delAll) resolve([...state.visitedViews]) }) }, - delAllCachedViews({ commit, state }) { + delAllCachedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_CACHED_VIEWS') + commit('DEL_ALL_CACHED_VIEWS', delAll) resolve([...state.cachedViews]) }) }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a7a5abc..28149ed 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,5 @@ -import { login, logout, getInfo } from '@/api/login' -import { getToken, setToken, removeToken } from '@/utils/auth' +import { login, logout, getInfo, getBizPerm } from '@/api/login' +import { getToken, setToken, removeToken, removeCurrentSys } from '@/utils/auth' const user = { state: { @@ -10,22 +10,14 @@ roleList: [], // 角色编号集合 roleNames: [], // 角色名称集合 roleTips: [], // 角色标签集合 - sexList: [], // 性别字典列表 - nationList: [], // 民族字典列表 - nationalityList: [], // 国籍字典列表 - cardTypeList: [], // 证件类型列表 + wellTypes: [], // 支持闸井类型 + deviceTypes: [], // 支持设备类型 + communications: [], // 支持通讯方式 area: '' // 默认地区 }, mutations: { SET_TOKEN: (state, token) => { state.token = token - setToken(token) - }, - SET_ID: (state, id) => { - state.id = id - }, - SET_ACCOUNT: (state, account) => { - state.account = account }, SET_NAME: (state, name) => { state.name = name @@ -45,17 +37,14 @@ SET_DEPTNAME: (state, deptName) => { state.deptName = deptName }, - SET_SEXLIST: (state, sexList) => { - state.sexList = sexList + SET_WELLTYPES: (state, wellTypes) => { + state.wellTypes = wellTypes }, - SET_NATIONLIST: (state, nationList) => { - state.nationList = nationList + SET_DEVICETYPES: (state, deviceTypes) => { + state.deviceTypes = deviceTypes }, - SET_NATIONALITYLIST: (state, nationalityList) => { - state.nationalityList = nationalityList - }, - SET_CARDTYPELIST: (state, cardTypeList) => { - state.cardTypeList = cardTypeList + SET_COMMUNICATIONS: (state, communications) => { + state.communications = communications }, SET_AREA: (state, area) => { state.area = area @@ -69,6 +58,7 @@ login(userInfo).then(response => { if (response.code === 200) { const data = response.data + setToken(data.token) commit('SET_TOKEN', data.token) resolve() } else { @@ -98,13 +88,60 @@ } else { reject('该用户无组织机构') } - commit('SET_ID', data.id) - commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) resolve(response) }).catch(error => { reject(error) }) + // getBizPerm().then(response => { + // const data = response.data + // if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + // commit('SET_WELLTYPES', data.wellTypes) + // } else { + // reject('该用户不支持任何闸井类型') + // } + // if (data.deviceTypes && data.deviceTypes.length > 0) { + // commit('SET_DEVICETYPES', data.deviceTypes) + // } else { + // reject('该用户不支持任何设备类型') + // } + // if (data.communications && data.communications.length > 0) { + // commit('SET_COMMUNICATIONS', data.communications) + // } else { + // reject('该用户不支持任何通讯方式') + // } + // commit('SET_AREA', data.area) + // resolve(response) + // }).catch(error => { + // reject(error) + // }) + }) + }, + // 获取用户业务权限 + GetBizPerm({ commit, state }) { + return new Promise((resolve, reject) => { + getBizPerm(state.token).then(response => { + const data = response.data + if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + commit('SET_WELLTYPES', data.wellTypes) + } else { + reject('该用户不支持任何闸井类型') + } + if (data.deviceTypes && data.deviceTypes.length > 0) { + commit('SET_DEVICETYPES', data.deviceTypes) + } else { + reject('该用户不支持任何设备类型') + } + if (data.communications && data.communications.length > 0) { + commit('SET_COMMUNICATIONS', data.communications) + } else { + reject('该用户不支持任何通讯方式') + } + commit('SET_AREA', data.area) + resolve(response) + }).catch(error => { + reject(error) + }) }) }, @@ -115,6 +152,7 @@ commit('SET_TOKEN', '') commit('SET_ROLES', []) removeToken() + removeCurrentSys() resolve() }).catch(error => { reject(error) @@ -127,6 +165,7 @@ return new Promise(resolve => { commit('SET_TOKEN', '') removeToken() + removeCurrentSys() resolve() }) } diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2c2b0ce..1b0e44b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,12 +44,16 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } + console.log(tmp) + const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + console.log(tmp.path + '->' + tmp.children[0].path) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -61,10 +65,22 @@ return res } +function filterRedirect(routes) { + console.log('filterRedirect') + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + console.log(sys.path + ':' + firstmenu.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, addRouters: [], + systems: [], // 子系统 menus: [], // 菜单 btns: [] // 按钮 }, @@ -73,6 +89,9 @@ state.addRouters = routers state.routers = constantRouterMap.concat(routers) }, + SET_SYSTEMS: (state, systems) => { + state.systems = Array.from(systems) + }, SET_MENUS: (state, menus) => { state.menus = Array.from(menus) }, @@ -81,17 +100,49 @@ } }, actions: { - // 获取用户权限 - GetMenus({ commit, state }) { + // 获取用户子系统权限 + GetSystems({ commit, state }) { return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + const params = { + resourceType: '02' + } + getMenus(params).then(response => { // 处理返回值 + const data = response.data + const systems = [] // 子系统 + if (data.menus && data.menus.length > 0) { + commit('SET_SYSTEMS', data.menus) + for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 + const menu_tmp = {} + menu_tmp.id = menu.id + menu_tmp.url = menu.url + menu_tmp.icon = menu.icon + menu_tmp.name = menu.name + systems.push(menu_tmp) + } + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 获取用户权限 + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + return new Promise((resolve, reject) => { + // const params = { + // parentCode: currentSystem.code + // } + getMenus().then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -103,11 +154,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index b7e3be9..f5d3918 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -20,19 +20,23 @@ }, DEL_VISITED_VIEW: (state, view) => { - for (const [i, v] of state.visitedViews.entries()) { - if (v.path === view.path) { - state.visitedViews.splice(i, 1) - break + if (!(state.visitedViews.length === 1 && state.visitedViews[0] === view)) { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } } } }, DEL_CACHED_VIEW: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews.splice(index, 1) - break + if (!state.cachedViews.length === 1 && state.cachedViews[0] === view) { + for (const i of state.cachedViews) { + if (i === view.name) { + const index = state.cachedViews.indexOf(i) + state.cachedViews.splice(index, 1) + break + } } } }, @@ -52,13 +56,32 @@ } }, - DEL_ALL_VISITED_VIEWS: state => { - // keep affix tags - const affixTags = state.visitedViews.filter(tag => tag.meta.affix) - state.visitedViews = affixTags + DEL_ALL_VISITED_VIEWS: (state, delAll) => { + if (delAll) { + state.visitedViews = [] + } else { + // keep affix tags + const affixTags = state.visitedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.visitedViews = affixTags + } }, - DEL_ALL_CACHED_VIEWS: state => { - state.cachedViews = [] + DEL_ALL_CACHED_VIEWS: (state, delAll) => { + // state.cachedViews = [] + // keep affix tags + if (delAll) { + state.cachedViews = [] + } else { + const affixTags = state.cachedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.cachedViews = affixTags + } }, UPDATE_VISITED_VIEW: (state, view) => { @@ -128,26 +151,26 @@ resolve([...state.cachedViews]) }) }, - - delAllViews({ dispatch, state }, view) { + // 关闭全部 + delAllViews({ dispatch, state }, delAll = false) { return new Promise(resolve => { - dispatch('delAllVisitedViews', view) - dispatch('delAllCachedViews', view) + dispatch('delAllVisitedViews', delAll) + dispatch('delAllCachedViews', delAll) resolve({ visitedViews: [...state.visitedViews], cachedViews: [...state.cachedViews] }) }) }, - delAllVisitedViews({ commit, state }) { + delAllVisitedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_VISITED_VIEWS') + commit('DEL_ALL_VISITED_VIEWS', delAll) resolve([...state.visitedViews]) }) }, - delAllCachedViews({ commit, state }) { + delAllCachedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_CACHED_VIEWS') + commit('DEL_ALL_CACHED_VIEWS', delAll) resolve([...state.cachedViews]) }) }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a7a5abc..28149ed 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,5 @@ -import { login, logout, getInfo } from '@/api/login' -import { getToken, setToken, removeToken } from '@/utils/auth' +import { login, logout, getInfo, getBizPerm } from '@/api/login' +import { getToken, setToken, removeToken, removeCurrentSys } from '@/utils/auth' const user = { state: { @@ -10,22 +10,14 @@ roleList: [], // 角色编号集合 roleNames: [], // 角色名称集合 roleTips: [], // 角色标签集合 - sexList: [], // 性别字典列表 - nationList: [], // 民族字典列表 - nationalityList: [], // 国籍字典列表 - cardTypeList: [], // 证件类型列表 + wellTypes: [], // 支持闸井类型 + deviceTypes: [], // 支持设备类型 + communications: [], // 支持通讯方式 area: '' // 默认地区 }, mutations: { SET_TOKEN: (state, token) => { state.token = token - setToken(token) - }, - SET_ID: (state, id) => { - state.id = id - }, - SET_ACCOUNT: (state, account) => { - state.account = account }, SET_NAME: (state, name) => { state.name = name @@ -45,17 +37,14 @@ SET_DEPTNAME: (state, deptName) => { state.deptName = deptName }, - SET_SEXLIST: (state, sexList) => { - state.sexList = sexList + SET_WELLTYPES: (state, wellTypes) => { + state.wellTypes = wellTypes }, - SET_NATIONLIST: (state, nationList) => { - state.nationList = nationList + SET_DEVICETYPES: (state, deviceTypes) => { + state.deviceTypes = deviceTypes }, - SET_NATIONALITYLIST: (state, nationalityList) => { - state.nationalityList = nationalityList - }, - SET_CARDTYPELIST: (state, cardTypeList) => { - state.cardTypeList = cardTypeList + SET_COMMUNICATIONS: (state, communications) => { + state.communications = communications }, SET_AREA: (state, area) => { state.area = area @@ -69,6 +58,7 @@ login(userInfo).then(response => { if (response.code === 200) { const data = response.data + setToken(data.token) commit('SET_TOKEN', data.token) resolve() } else { @@ -98,13 +88,60 @@ } else { reject('该用户无组织机构') } - commit('SET_ID', data.id) - commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) resolve(response) }).catch(error => { reject(error) }) + // getBizPerm().then(response => { + // const data = response.data + // if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + // commit('SET_WELLTYPES', data.wellTypes) + // } else { + // reject('该用户不支持任何闸井类型') + // } + // if (data.deviceTypes && data.deviceTypes.length > 0) { + // commit('SET_DEVICETYPES', data.deviceTypes) + // } else { + // reject('该用户不支持任何设备类型') + // } + // if (data.communications && data.communications.length > 0) { + // commit('SET_COMMUNICATIONS', data.communications) + // } else { + // reject('该用户不支持任何通讯方式') + // } + // commit('SET_AREA', data.area) + // resolve(response) + // }).catch(error => { + // reject(error) + // }) + }) + }, + // 获取用户业务权限 + GetBizPerm({ commit, state }) { + return new Promise((resolve, reject) => { + getBizPerm(state.token).then(response => { + const data = response.data + if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + commit('SET_WELLTYPES', data.wellTypes) + } else { + reject('该用户不支持任何闸井类型') + } + if (data.deviceTypes && data.deviceTypes.length > 0) { + commit('SET_DEVICETYPES', data.deviceTypes) + } else { + reject('该用户不支持任何设备类型') + } + if (data.communications && data.communications.length > 0) { + commit('SET_COMMUNICATIONS', data.communications) + } else { + reject('该用户不支持任何通讯方式') + } + commit('SET_AREA', data.area) + resolve(response) + }).catch(error => { + reject(error) + }) }) }, @@ -115,6 +152,7 @@ commit('SET_TOKEN', '') commit('SET_ROLES', []) removeToken() + removeCurrentSys() resolve() }).catch(error => { reject(error) @@ -127,6 +165,7 @@ return new Promise(resolve => { commit('SET_TOKEN', '') removeToken() + removeCurrentSys() resolve() }) } diff --git a/src/utils/auth.js b/src/utils/auth.js index 213f5e6..44af377 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -2,6 +2,7 @@ const TokenKey = 'token' const PublicKey = 'public_key' +const CurrentSystem = 'current_system' export function getToken() { return Cookies.get(TokenKey) @@ -27,3 +28,24 @@ return window.localStorage.removeItem(PublicKey) } +export function getCurrentSys() { + let currentSystem = window.localStorage.getItem(CurrentSystem) + if (typeof (currentSystem) === 'undefined') { + return undefined + } else { + currentSystem = JSON.parse(currentSystem) + return currentSystem + } +} + +export function setCurrentSys(currentSystem) { + console.log('in auth setCurrentSys') + console.log(currentSystem) + const currentSys = JSON.stringify(currentSystem) + return window.localStorage.setItem(CurrentSystem, currentSys) +} + +export function removeCurrentSys() { + return window.localStorage.removeItem(CurrentSystem) +} + diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2c2b0ce..1b0e44b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,12 +44,16 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } + console.log(tmp) + const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + console.log(tmp.path + '->' + tmp.children[0].path) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -61,10 +65,22 @@ return res } +function filterRedirect(routes) { + console.log('filterRedirect') + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + console.log(sys.path + ':' + firstmenu.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, addRouters: [], + systems: [], // 子系统 menus: [], // 菜单 btns: [] // 按钮 }, @@ -73,6 +89,9 @@ state.addRouters = routers state.routers = constantRouterMap.concat(routers) }, + SET_SYSTEMS: (state, systems) => { + state.systems = Array.from(systems) + }, SET_MENUS: (state, menus) => { state.menus = Array.from(menus) }, @@ -81,17 +100,49 @@ } }, actions: { - // 获取用户权限 - GetMenus({ commit, state }) { + // 获取用户子系统权限 + GetSystems({ commit, state }) { return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + const params = { + resourceType: '02' + } + getMenus(params).then(response => { // 处理返回值 + const data = response.data + const systems = [] // 子系统 + if (data.menus && data.menus.length > 0) { + commit('SET_SYSTEMS', data.menus) + for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 + const menu_tmp = {} + menu_tmp.id = menu.id + menu_tmp.url = menu.url + menu_tmp.icon = menu.icon + menu_tmp.name = menu.name + systems.push(menu_tmp) + } + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 获取用户权限 + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + return new Promise((resolve, reject) => { + // const params = { + // parentCode: currentSystem.code + // } + getMenus().then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -103,11 +154,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index b7e3be9..f5d3918 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -20,19 +20,23 @@ }, DEL_VISITED_VIEW: (state, view) => { - for (const [i, v] of state.visitedViews.entries()) { - if (v.path === view.path) { - state.visitedViews.splice(i, 1) - break + if (!(state.visitedViews.length === 1 && state.visitedViews[0] === view)) { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } } } }, DEL_CACHED_VIEW: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews.splice(index, 1) - break + if (!state.cachedViews.length === 1 && state.cachedViews[0] === view) { + for (const i of state.cachedViews) { + if (i === view.name) { + const index = state.cachedViews.indexOf(i) + state.cachedViews.splice(index, 1) + break + } } } }, @@ -52,13 +56,32 @@ } }, - DEL_ALL_VISITED_VIEWS: state => { - // keep affix tags - const affixTags = state.visitedViews.filter(tag => tag.meta.affix) - state.visitedViews = affixTags + DEL_ALL_VISITED_VIEWS: (state, delAll) => { + if (delAll) { + state.visitedViews = [] + } else { + // keep affix tags + const affixTags = state.visitedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.visitedViews = affixTags + } }, - DEL_ALL_CACHED_VIEWS: state => { - state.cachedViews = [] + DEL_ALL_CACHED_VIEWS: (state, delAll) => { + // state.cachedViews = [] + // keep affix tags + if (delAll) { + state.cachedViews = [] + } else { + const affixTags = state.cachedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.cachedViews = affixTags + } }, UPDATE_VISITED_VIEW: (state, view) => { @@ -128,26 +151,26 @@ resolve([...state.cachedViews]) }) }, - - delAllViews({ dispatch, state }, view) { + // 关闭全部 + delAllViews({ dispatch, state }, delAll = false) { return new Promise(resolve => { - dispatch('delAllVisitedViews', view) - dispatch('delAllCachedViews', view) + dispatch('delAllVisitedViews', delAll) + dispatch('delAllCachedViews', delAll) resolve({ visitedViews: [...state.visitedViews], cachedViews: [...state.cachedViews] }) }) }, - delAllVisitedViews({ commit, state }) { + delAllVisitedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_VISITED_VIEWS') + commit('DEL_ALL_VISITED_VIEWS', delAll) resolve([...state.visitedViews]) }) }, - delAllCachedViews({ commit, state }) { + delAllCachedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_CACHED_VIEWS') + commit('DEL_ALL_CACHED_VIEWS', delAll) resolve([...state.cachedViews]) }) }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a7a5abc..28149ed 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,5 @@ -import { login, logout, getInfo } from '@/api/login' -import { getToken, setToken, removeToken } from '@/utils/auth' +import { login, logout, getInfo, getBizPerm } from '@/api/login' +import { getToken, setToken, removeToken, removeCurrentSys } from '@/utils/auth' const user = { state: { @@ -10,22 +10,14 @@ roleList: [], // 角色编号集合 roleNames: [], // 角色名称集合 roleTips: [], // 角色标签集合 - sexList: [], // 性别字典列表 - nationList: [], // 民族字典列表 - nationalityList: [], // 国籍字典列表 - cardTypeList: [], // 证件类型列表 + wellTypes: [], // 支持闸井类型 + deviceTypes: [], // 支持设备类型 + communications: [], // 支持通讯方式 area: '' // 默认地区 }, mutations: { SET_TOKEN: (state, token) => { state.token = token - setToken(token) - }, - SET_ID: (state, id) => { - state.id = id - }, - SET_ACCOUNT: (state, account) => { - state.account = account }, SET_NAME: (state, name) => { state.name = name @@ -45,17 +37,14 @@ SET_DEPTNAME: (state, deptName) => { state.deptName = deptName }, - SET_SEXLIST: (state, sexList) => { - state.sexList = sexList + SET_WELLTYPES: (state, wellTypes) => { + state.wellTypes = wellTypes }, - SET_NATIONLIST: (state, nationList) => { - state.nationList = nationList + SET_DEVICETYPES: (state, deviceTypes) => { + state.deviceTypes = deviceTypes }, - SET_NATIONALITYLIST: (state, nationalityList) => { - state.nationalityList = nationalityList - }, - SET_CARDTYPELIST: (state, cardTypeList) => { - state.cardTypeList = cardTypeList + SET_COMMUNICATIONS: (state, communications) => { + state.communications = communications }, SET_AREA: (state, area) => { state.area = area @@ -69,6 +58,7 @@ login(userInfo).then(response => { if (response.code === 200) { const data = response.data + setToken(data.token) commit('SET_TOKEN', data.token) resolve() } else { @@ -98,13 +88,60 @@ } else { reject('该用户无组织机构') } - commit('SET_ID', data.id) - commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) resolve(response) }).catch(error => { reject(error) }) + // getBizPerm().then(response => { + // const data = response.data + // if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + // commit('SET_WELLTYPES', data.wellTypes) + // } else { + // reject('该用户不支持任何闸井类型') + // } + // if (data.deviceTypes && data.deviceTypes.length > 0) { + // commit('SET_DEVICETYPES', data.deviceTypes) + // } else { + // reject('该用户不支持任何设备类型') + // } + // if (data.communications && data.communications.length > 0) { + // commit('SET_COMMUNICATIONS', data.communications) + // } else { + // reject('该用户不支持任何通讯方式') + // } + // commit('SET_AREA', data.area) + // resolve(response) + // }).catch(error => { + // reject(error) + // }) + }) + }, + // 获取用户业务权限 + GetBizPerm({ commit, state }) { + return new Promise((resolve, reject) => { + getBizPerm(state.token).then(response => { + const data = response.data + if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + commit('SET_WELLTYPES', data.wellTypes) + } else { + reject('该用户不支持任何闸井类型') + } + if (data.deviceTypes && data.deviceTypes.length > 0) { + commit('SET_DEVICETYPES', data.deviceTypes) + } else { + reject('该用户不支持任何设备类型') + } + if (data.communications && data.communications.length > 0) { + commit('SET_COMMUNICATIONS', data.communications) + } else { + reject('该用户不支持任何通讯方式') + } + commit('SET_AREA', data.area) + resolve(response) + }).catch(error => { + reject(error) + }) }) }, @@ -115,6 +152,7 @@ commit('SET_TOKEN', '') commit('SET_ROLES', []) removeToken() + removeCurrentSys() resolve() }).catch(error => { reject(error) @@ -127,6 +165,7 @@ return new Promise(resolve => { commit('SET_TOKEN', '') removeToken() + removeCurrentSys() resolve() }) } diff --git a/src/utils/auth.js b/src/utils/auth.js index 213f5e6..44af377 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -2,6 +2,7 @@ const TokenKey = 'token' const PublicKey = 'public_key' +const CurrentSystem = 'current_system' export function getToken() { return Cookies.get(TokenKey) @@ -27,3 +28,24 @@ return window.localStorage.removeItem(PublicKey) } +export function getCurrentSys() { + let currentSystem = window.localStorage.getItem(CurrentSystem) + if (typeof (currentSystem) === 'undefined') { + return undefined + } else { + currentSystem = JSON.parse(currentSystem) + return currentSystem + } +} + +export function setCurrentSys(currentSystem) { + console.log('in auth setCurrentSys') + console.log(currentSystem) + const currentSys = JSON.stringify(currentSystem) + return window.localStorage.setItem(CurrentSystem, currentSys) +} + +export function removeCurrentSys() { + return window.localStorage.removeItem(CurrentSystem) +} + diff --git a/src/utils/permission.js b/src/utils/permission.js index 8fee27f..f5e6c09 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -10,7 +10,7 @@ } // 根据用户权限判断是否要显示井类型下拉框 export function showWellType() { - console.log('是否显示井类型下拉') + // console.log('是否显示井类型下拉') const wellTypes = store.getters.wellTypes if (wellTypes.length > 1) return true else return false diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2c2b0ce..1b0e44b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,12 +44,16 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } + console.log(tmp) + const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + console.log(tmp.path + '->' + tmp.children[0].path) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -61,10 +65,22 @@ return res } +function filterRedirect(routes) { + console.log('filterRedirect') + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + console.log(sys.path + ':' + firstmenu.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, addRouters: [], + systems: [], // 子系统 menus: [], // 菜单 btns: [] // 按钮 }, @@ -73,6 +89,9 @@ state.addRouters = routers state.routers = constantRouterMap.concat(routers) }, + SET_SYSTEMS: (state, systems) => { + state.systems = Array.from(systems) + }, SET_MENUS: (state, menus) => { state.menus = Array.from(menus) }, @@ -81,17 +100,49 @@ } }, actions: { - // 获取用户权限 - GetMenus({ commit, state }) { + // 获取用户子系统权限 + GetSystems({ commit, state }) { return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + const params = { + resourceType: '02' + } + getMenus(params).then(response => { // 处理返回值 + const data = response.data + const systems = [] // 子系统 + if (data.menus && data.menus.length > 0) { + commit('SET_SYSTEMS', data.menus) + for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 + const menu_tmp = {} + menu_tmp.id = menu.id + menu_tmp.url = menu.url + menu_tmp.icon = menu.icon + menu_tmp.name = menu.name + systems.push(menu_tmp) + } + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 获取用户权限 + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + return new Promise((resolve, reject) => { + // const params = { + // parentCode: currentSystem.code + // } + getMenus().then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -103,11 +154,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index b7e3be9..f5d3918 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -20,19 +20,23 @@ }, DEL_VISITED_VIEW: (state, view) => { - for (const [i, v] of state.visitedViews.entries()) { - if (v.path === view.path) { - state.visitedViews.splice(i, 1) - break + if (!(state.visitedViews.length === 1 && state.visitedViews[0] === view)) { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } } } }, DEL_CACHED_VIEW: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews.splice(index, 1) - break + if (!state.cachedViews.length === 1 && state.cachedViews[0] === view) { + for (const i of state.cachedViews) { + if (i === view.name) { + const index = state.cachedViews.indexOf(i) + state.cachedViews.splice(index, 1) + break + } } } }, @@ -52,13 +56,32 @@ } }, - DEL_ALL_VISITED_VIEWS: state => { - // keep affix tags - const affixTags = state.visitedViews.filter(tag => tag.meta.affix) - state.visitedViews = affixTags + DEL_ALL_VISITED_VIEWS: (state, delAll) => { + if (delAll) { + state.visitedViews = [] + } else { + // keep affix tags + const affixTags = state.visitedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.visitedViews = affixTags + } }, - DEL_ALL_CACHED_VIEWS: state => { - state.cachedViews = [] + DEL_ALL_CACHED_VIEWS: (state, delAll) => { + // state.cachedViews = [] + // keep affix tags + if (delAll) { + state.cachedViews = [] + } else { + const affixTags = state.cachedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.cachedViews = affixTags + } }, UPDATE_VISITED_VIEW: (state, view) => { @@ -128,26 +151,26 @@ resolve([...state.cachedViews]) }) }, - - delAllViews({ dispatch, state }, view) { + // 关闭全部 + delAllViews({ dispatch, state }, delAll = false) { return new Promise(resolve => { - dispatch('delAllVisitedViews', view) - dispatch('delAllCachedViews', view) + dispatch('delAllVisitedViews', delAll) + dispatch('delAllCachedViews', delAll) resolve({ visitedViews: [...state.visitedViews], cachedViews: [...state.cachedViews] }) }) }, - delAllVisitedViews({ commit, state }) { + delAllVisitedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_VISITED_VIEWS') + commit('DEL_ALL_VISITED_VIEWS', delAll) resolve([...state.visitedViews]) }) }, - delAllCachedViews({ commit, state }) { + delAllCachedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_CACHED_VIEWS') + commit('DEL_ALL_CACHED_VIEWS', delAll) resolve([...state.cachedViews]) }) }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a7a5abc..28149ed 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,5 @@ -import { login, logout, getInfo } from '@/api/login' -import { getToken, setToken, removeToken } from '@/utils/auth' +import { login, logout, getInfo, getBizPerm } from '@/api/login' +import { getToken, setToken, removeToken, removeCurrentSys } from '@/utils/auth' const user = { state: { @@ -10,22 +10,14 @@ roleList: [], // 角色编号集合 roleNames: [], // 角色名称集合 roleTips: [], // 角色标签集合 - sexList: [], // 性别字典列表 - nationList: [], // 民族字典列表 - nationalityList: [], // 国籍字典列表 - cardTypeList: [], // 证件类型列表 + wellTypes: [], // 支持闸井类型 + deviceTypes: [], // 支持设备类型 + communications: [], // 支持通讯方式 area: '' // 默认地区 }, mutations: { SET_TOKEN: (state, token) => { state.token = token - setToken(token) - }, - SET_ID: (state, id) => { - state.id = id - }, - SET_ACCOUNT: (state, account) => { - state.account = account }, SET_NAME: (state, name) => { state.name = name @@ -45,17 +37,14 @@ SET_DEPTNAME: (state, deptName) => { state.deptName = deptName }, - SET_SEXLIST: (state, sexList) => { - state.sexList = sexList + SET_WELLTYPES: (state, wellTypes) => { + state.wellTypes = wellTypes }, - SET_NATIONLIST: (state, nationList) => { - state.nationList = nationList + SET_DEVICETYPES: (state, deviceTypes) => { + state.deviceTypes = deviceTypes }, - SET_NATIONALITYLIST: (state, nationalityList) => { - state.nationalityList = nationalityList - }, - SET_CARDTYPELIST: (state, cardTypeList) => { - state.cardTypeList = cardTypeList + SET_COMMUNICATIONS: (state, communications) => { + state.communications = communications }, SET_AREA: (state, area) => { state.area = area @@ -69,6 +58,7 @@ login(userInfo).then(response => { if (response.code === 200) { const data = response.data + setToken(data.token) commit('SET_TOKEN', data.token) resolve() } else { @@ -98,13 +88,60 @@ } else { reject('该用户无组织机构') } - commit('SET_ID', data.id) - commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) resolve(response) }).catch(error => { reject(error) }) + // getBizPerm().then(response => { + // const data = response.data + // if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + // commit('SET_WELLTYPES', data.wellTypes) + // } else { + // reject('该用户不支持任何闸井类型') + // } + // if (data.deviceTypes && data.deviceTypes.length > 0) { + // commit('SET_DEVICETYPES', data.deviceTypes) + // } else { + // reject('该用户不支持任何设备类型') + // } + // if (data.communications && data.communications.length > 0) { + // commit('SET_COMMUNICATIONS', data.communications) + // } else { + // reject('该用户不支持任何通讯方式') + // } + // commit('SET_AREA', data.area) + // resolve(response) + // }).catch(error => { + // reject(error) + // }) + }) + }, + // 获取用户业务权限 + GetBizPerm({ commit, state }) { + return new Promise((resolve, reject) => { + getBizPerm(state.token).then(response => { + const data = response.data + if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + commit('SET_WELLTYPES', data.wellTypes) + } else { + reject('该用户不支持任何闸井类型') + } + if (data.deviceTypes && data.deviceTypes.length > 0) { + commit('SET_DEVICETYPES', data.deviceTypes) + } else { + reject('该用户不支持任何设备类型') + } + if (data.communications && data.communications.length > 0) { + commit('SET_COMMUNICATIONS', data.communications) + } else { + reject('该用户不支持任何通讯方式') + } + commit('SET_AREA', data.area) + resolve(response) + }).catch(error => { + reject(error) + }) }) }, @@ -115,6 +152,7 @@ commit('SET_TOKEN', '') commit('SET_ROLES', []) removeToken() + removeCurrentSys() resolve() }).catch(error => { reject(error) @@ -127,6 +165,7 @@ return new Promise(resolve => { commit('SET_TOKEN', '') removeToken() + removeCurrentSys() resolve() }) } diff --git a/src/utils/auth.js b/src/utils/auth.js index 213f5e6..44af377 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -2,6 +2,7 @@ const TokenKey = 'token' const PublicKey = 'public_key' +const CurrentSystem = 'current_system' export function getToken() { return Cookies.get(TokenKey) @@ -27,3 +28,24 @@ return window.localStorage.removeItem(PublicKey) } +export function getCurrentSys() { + let currentSystem = window.localStorage.getItem(CurrentSystem) + if (typeof (currentSystem) === 'undefined') { + return undefined + } else { + currentSystem = JSON.parse(currentSystem) + return currentSystem + } +} + +export function setCurrentSys(currentSystem) { + console.log('in auth setCurrentSys') + console.log(currentSystem) + const currentSys = JSON.stringify(currentSystem) + return window.localStorage.setItem(CurrentSystem, currentSys) +} + +export function removeCurrentSys() { + return window.localStorage.removeItem(CurrentSystem) +} + diff --git a/src/utils/permission.js b/src/utils/permission.js index 8fee27f..f5e6c09 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -10,7 +10,7 @@ } // 根据用户权限判断是否要显示井类型下拉框 export function showWellType() { - console.log('是否显示井类型下拉') + // console.log('是否显示井类型下拉') const wellTypes = store.getters.wellTypes if (wellTypes.length > 1) return true else return false diff --git a/src/views/dashboard/portal.vue b/src/views/dashboard/portal.vue index c199a38..b517742 100644 --- a/src/views/dashboard/portal.vue +++ b/src/views/dashboard/portal.vue @@ -33,11 +33,20 @@ -
- 天津园区 +
+ +
+
+ 天津滨海园区 +
+
+ 综合安防集成管理平台 +
+
-
- 综合安防集成管理平台 + +
+
@@ -45,9 +54,38 @@ - - - - diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2c2b0ce..1b0e44b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,12 +44,16 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } + console.log(tmp) + const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + console.log(tmp.path + '->' + tmp.children[0].path) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -61,10 +65,22 @@ return res } +function filterRedirect(routes) { + console.log('filterRedirect') + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + console.log(sys.path + ':' + firstmenu.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, addRouters: [], + systems: [], // 子系统 menus: [], // 菜单 btns: [] // 按钮 }, @@ -73,6 +89,9 @@ state.addRouters = routers state.routers = constantRouterMap.concat(routers) }, + SET_SYSTEMS: (state, systems) => { + state.systems = Array.from(systems) + }, SET_MENUS: (state, menus) => { state.menus = Array.from(menus) }, @@ -81,17 +100,49 @@ } }, actions: { - // 获取用户权限 - GetMenus({ commit, state }) { + // 获取用户子系统权限 + GetSystems({ commit, state }) { return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + const params = { + resourceType: '02' + } + getMenus(params).then(response => { // 处理返回值 + const data = response.data + const systems = [] // 子系统 + if (data.menus && data.menus.length > 0) { + commit('SET_SYSTEMS', data.menus) + for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 + const menu_tmp = {} + menu_tmp.id = menu.id + menu_tmp.url = menu.url + menu_tmp.icon = menu.icon + menu_tmp.name = menu.name + systems.push(menu_tmp) + } + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 获取用户权限 + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + return new Promise((resolve, reject) => { + // const params = { + // parentCode: currentSystem.code + // } + getMenus().then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -103,11 +154,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index b7e3be9..f5d3918 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -20,19 +20,23 @@ }, DEL_VISITED_VIEW: (state, view) => { - for (const [i, v] of state.visitedViews.entries()) { - if (v.path === view.path) { - state.visitedViews.splice(i, 1) - break + if (!(state.visitedViews.length === 1 && state.visitedViews[0] === view)) { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } } } }, DEL_CACHED_VIEW: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews.splice(index, 1) - break + if (!state.cachedViews.length === 1 && state.cachedViews[0] === view) { + for (const i of state.cachedViews) { + if (i === view.name) { + const index = state.cachedViews.indexOf(i) + state.cachedViews.splice(index, 1) + break + } } } }, @@ -52,13 +56,32 @@ } }, - DEL_ALL_VISITED_VIEWS: state => { - // keep affix tags - const affixTags = state.visitedViews.filter(tag => tag.meta.affix) - state.visitedViews = affixTags + DEL_ALL_VISITED_VIEWS: (state, delAll) => { + if (delAll) { + state.visitedViews = [] + } else { + // keep affix tags + const affixTags = state.visitedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.visitedViews = affixTags + } }, - DEL_ALL_CACHED_VIEWS: state => { - state.cachedViews = [] + DEL_ALL_CACHED_VIEWS: (state, delAll) => { + // state.cachedViews = [] + // keep affix tags + if (delAll) { + state.cachedViews = [] + } else { + const affixTags = state.cachedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.cachedViews = affixTags + } }, UPDATE_VISITED_VIEW: (state, view) => { @@ -128,26 +151,26 @@ resolve([...state.cachedViews]) }) }, - - delAllViews({ dispatch, state }, view) { + // 关闭全部 + delAllViews({ dispatch, state }, delAll = false) { return new Promise(resolve => { - dispatch('delAllVisitedViews', view) - dispatch('delAllCachedViews', view) + dispatch('delAllVisitedViews', delAll) + dispatch('delAllCachedViews', delAll) resolve({ visitedViews: [...state.visitedViews], cachedViews: [...state.cachedViews] }) }) }, - delAllVisitedViews({ commit, state }) { + delAllVisitedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_VISITED_VIEWS') + commit('DEL_ALL_VISITED_VIEWS', delAll) resolve([...state.visitedViews]) }) }, - delAllCachedViews({ commit, state }) { + delAllCachedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_CACHED_VIEWS') + commit('DEL_ALL_CACHED_VIEWS', delAll) resolve([...state.cachedViews]) }) }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a7a5abc..28149ed 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,5 @@ -import { login, logout, getInfo } from '@/api/login' -import { getToken, setToken, removeToken } from '@/utils/auth' +import { login, logout, getInfo, getBizPerm } from '@/api/login' +import { getToken, setToken, removeToken, removeCurrentSys } from '@/utils/auth' const user = { state: { @@ -10,22 +10,14 @@ roleList: [], // 角色编号集合 roleNames: [], // 角色名称集合 roleTips: [], // 角色标签集合 - sexList: [], // 性别字典列表 - nationList: [], // 民族字典列表 - nationalityList: [], // 国籍字典列表 - cardTypeList: [], // 证件类型列表 + wellTypes: [], // 支持闸井类型 + deviceTypes: [], // 支持设备类型 + communications: [], // 支持通讯方式 area: '' // 默认地区 }, mutations: { SET_TOKEN: (state, token) => { state.token = token - setToken(token) - }, - SET_ID: (state, id) => { - state.id = id - }, - SET_ACCOUNT: (state, account) => { - state.account = account }, SET_NAME: (state, name) => { state.name = name @@ -45,17 +37,14 @@ SET_DEPTNAME: (state, deptName) => { state.deptName = deptName }, - SET_SEXLIST: (state, sexList) => { - state.sexList = sexList + SET_WELLTYPES: (state, wellTypes) => { + state.wellTypes = wellTypes }, - SET_NATIONLIST: (state, nationList) => { - state.nationList = nationList + SET_DEVICETYPES: (state, deviceTypes) => { + state.deviceTypes = deviceTypes }, - SET_NATIONALITYLIST: (state, nationalityList) => { - state.nationalityList = nationalityList - }, - SET_CARDTYPELIST: (state, cardTypeList) => { - state.cardTypeList = cardTypeList + SET_COMMUNICATIONS: (state, communications) => { + state.communications = communications }, SET_AREA: (state, area) => { state.area = area @@ -69,6 +58,7 @@ login(userInfo).then(response => { if (response.code === 200) { const data = response.data + setToken(data.token) commit('SET_TOKEN', data.token) resolve() } else { @@ -98,13 +88,60 @@ } else { reject('该用户无组织机构') } - commit('SET_ID', data.id) - commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) resolve(response) }).catch(error => { reject(error) }) + // getBizPerm().then(response => { + // const data = response.data + // if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + // commit('SET_WELLTYPES', data.wellTypes) + // } else { + // reject('该用户不支持任何闸井类型') + // } + // if (data.deviceTypes && data.deviceTypes.length > 0) { + // commit('SET_DEVICETYPES', data.deviceTypes) + // } else { + // reject('该用户不支持任何设备类型') + // } + // if (data.communications && data.communications.length > 0) { + // commit('SET_COMMUNICATIONS', data.communications) + // } else { + // reject('该用户不支持任何通讯方式') + // } + // commit('SET_AREA', data.area) + // resolve(response) + // }).catch(error => { + // reject(error) + // }) + }) + }, + // 获取用户业务权限 + GetBizPerm({ commit, state }) { + return new Promise((resolve, reject) => { + getBizPerm(state.token).then(response => { + const data = response.data + if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + commit('SET_WELLTYPES', data.wellTypes) + } else { + reject('该用户不支持任何闸井类型') + } + if (data.deviceTypes && data.deviceTypes.length > 0) { + commit('SET_DEVICETYPES', data.deviceTypes) + } else { + reject('该用户不支持任何设备类型') + } + if (data.communications && data.communications.length > 0) { + commit('SET_COMMUNICATIONS', data.communications) + } else { + reject('该用户不支持任何通讯方式') + } + commit('SET_AREA', data.area) + resolve(response) + }).catch(error => { + reject(error) + }) }) }, @@ -115,6 +152,7 @@ commit('SET_TOKEN', '') commit('SET_ROLES', []) removeToken() + removeCurrentSys() resolve() }).catch(error => { reject(error) @@ -127,6 +165,7 @@ return new Promise(resolve => { commit('SET_TOKEN', '') removeToken() + removeCurrentSys() resolve() }) } diff --git a/src/utils/auth.js b/src/utils/auth.js index 213f5e6..44af377 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -2,6 +2,7 @@ const TokenKey = 'token' const PublicKey = 'public_key' +const CurrentSystem = 'current_system' export function getToken() { return Cookies.get(TokenKey) @@ -27,3 +28,24 @@ return window.localStorage.removeItem(PublicKey) } +export function getCurrentSys() { + let currentSystem = window.localStorage.getItem(CurrentSystem) + if (typeof (currentSystem) === 'undefined') { + return undefined + } else { + currentSystem = JSON.parse(currentSystem) + return currentSystem + } +} + +export function setCurrentSys(currentSystem) { + console.log('in auth setCurrentSys') + console.log(currentSystem) + const currentSys = JSON.stringify(currentSystem) + return window.localStorage.setItem(CurrentSystem, currentSys) +} + +export function removeCurrentSys() { + return window.localStorage.removeItem(CurrentSystem) +} + diff --git a/src/utils/permission.js b/src/utils/permission.js index 8fee27f..f5e6c09 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -10,7 +10,7 @@ } // 根据用户权限判断是否要显示井类型下拉框 export function showWellType() { - console.log('是否显示井类型下拉') + // console.log('是否显示井类型下拉') const wellTypes = store.getters.wellTypes if (wellTypes.length > 1) return true else return false diff --git a/src/views/dashboard/portal.vue b/src/views/dashboard/portal.vue index c199a38..b517742 100644 --- a/src/views/dashboard/portal.vue +++ b/src/views/dashboard/portal.vue @@ -33,11 +33,20 @@ -
- 天津园区 +
+ +
+
+ 天津滨海园区 +
+
+ 综合安防集成管理平台 +
+
-
- 综合安防集成管理平台 + +
+
@@ -45,9 +54,38 @@ - - - - diff --git a/src/views/layout/SupLayout.vue b/src/views/layout/SupLayout.vue index 47cdbc6..5ada200 100644 --- a/src/views/layout/SupLayout.vue +++ b/src/views/layout/SupLayout.vue @@ -15,6 +15,7 @@ \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2c2b0ce..1b0e44b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,12 +44,16 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } + console.log(tmp) + const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + console.log(tmp.path + '->' + tmp.children[0].path) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -61,10 +65,22 @@ return res } +function filterRedirect(routes) { + console.log('filterRedirect') + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + console.log(sys.path + ':' + firstmenu.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, addRouters: [], + systems: [], // 子系统 menus: [], // 菜单 btns: [] // 按钮 }, @@ -73,6 +89,9 @@ state.addRouters = routers state.routers = constantRouterMap.concat(routers) }, + SET_SYSTEMS: (state, systems) => { + state.systems = Array.from(systems) + }, SET_MENUS: (state, menus) => { state.menus = Array.from(menus) }, @@ -81,17 +100,49 @@ } }, actions: { - // 获取用户权限 - GetMenus({ commit, state }) { + // 获取用户子系统权限 + GetSystems({ commit, state }) { return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + const params = { + resourceType: '02' + } + getMenus(params).then(response => { // 处理返回值 + const data = response.data + const systems = [] // 子系统 + if (data.menus && data.menus.length > 0) { + commit('SET_SYSTEMS', data.menus) + for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 + const menu_tmp = {} + menu_tmp.id = menu.id + menu_tmp.url = menu.url + menu_tmp.icon = menu.icon + menu_tmp.name = menu.name + systems.push(menu_tmp) + } + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 获取用户权限 + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + return new Promise((resolve, reject) => { + // const params = { + // parentCode: currentSystem.code + // } + getMenus().then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -103,11 +154,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index b7e3be9..f5d3918 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -20,19 +20,23 @@ }, DEL_VISITED_VIEW: (state, view) => { - for (const [i, v] of state.visitedViews.entries()) { - if (v.path === view.path) { - state.visitedViews.splice(i, 1) - break + if (!(state.visitedViews.length === 1 && state.visitedViews[0] === view)) { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } } } }, DEL_CACHED_VIEW: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews.splice(index, 1) - break + if (!state.cachedViews.length === 1 && state.cachedViews[0] === view) { + for (const i of state.cachedViews) { + if (i === view.name) { + const index = state.cachedViews.indexOf(i) + state.cachedViews.splice(index, 1) + break + } } } }, @@ -52,13 +56,32 @@ } }, - DEL_ALL_VISITED_VIEWS: state => { - // keep affix tags - const affixTags = state.visitedViews.filter(tag => tag.meta.affix) - state.visitedViews = affixTags + DEL_ALL_VISITED_VIEWS: (state, delAll) => { + if (delAll) { + state.visitedViews = [] + } else { + // keep affix tags + const affixTags = state.visitedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.visitedViews = affixTags + } }, - DEL_ALL_CACHED_VIEWS: state => { - state.cachedViews = [] + DEL_ALL_CACHED_VIEWS: (state, delAll) => { + // state.cachedViews = [] + // keep affix tags + if (delAll) { + state.cachedViews = [] + } else { + const affixTags = state.cachedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.cachedViews = affixTags + } }, UPDATE_VISITED_VIEW: (state, view) => { @@ -128,26 +151,26 @@ resolve([...state.cachedViews]) }) }, - - delAllViews({ dispatch, state }, view) { + // 关闭全部 + delAllViews({ dispatch, state }, delAll = false) { return new Promise(resolve => { - dispatch('delAllVisitedViews', view) - dispatch('delAllCachedViews', view) + dispatch('delAllVisitedViews', delAll) + dispatch('delAllCachedViews', delAll) resolve({ visitedViews: [...state.visitedViews], cachedViews: [...state.cachedViews] }) }) }, - delAllVisitedViews({ commit, state }) { + delAllVisitedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_VISITED_VIEWS') + commit('DEL_ALL_VISITED_VIEWS', delAll) resolve([...state.visitedViews]) }) }, - delAllCachedViews({ commit, state }) { + delAllCachedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_CACHED_VIEWS') + commit('DEL_ALL_CACHED_VIEWS', delAll) resolve([...state.cachedViews]) }) }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a7a5abc..28149ed 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,5 @@ -import { login, logout, getInfo } from '@/api/login' -import { getToken, setToken, removeToken } from '@/utils/auth' +import { login, logout, getInfo, getBizPerm } from '@/api/login' +import { getToken, setToken, removeToken, removeCurrentSys } from '@/utils/auth' const user = { state: { @@ -10,22 +10,14 @@ roleList: [], // 角色编号集合 roleNames: [], // 角色名称集合 roleTips: [], // 角色标签集合 - sexList: [], // 性别字典列表 - nationList: [], // 民族字典列表 - nationalityList: [], // 国籍字典列表 - cardTypeList: [], // 证件类型列表 + wellTypes: [], // 支持闸井类型 + deviceTypes: [], // 支持设备类型 + communications: [], // 支持通讯方式 area: '' // 默认地区 }, mutations: { SET_TOKEN: (state, token) => { state.token = token - setToken(token) - }, - SET_ID: (state, id) => { - state.id = id - }, - SET_ACCOUNT: (state, account) => { - state.account = account }, SET_NAME: (state, name) => { state.name = name @@ -45,17 +37,14 @@ SET_DEPTNAME: (state, deptName) => { state.deptName = deptName }, - SET_SEXLIST: (state, sexList) => { - state.sexList = sexList + SET_WELLTYPES: (state, wellTypes) => { + state.wellTypes = wellTypes }, - SET_NATIONLIST: (state, nationList) => { - state.nationList = nationList + SET_DEVICETYPES: (state, deviceTypes) => { + state.deviceTypes = deviceTypes }, - SET_NATIONALITYLIST: (state, nationalityList) => { - state.nationalityList = nationalityList - }, - SET_CARDTYPELIST: (state, cardTypeList) => { - state.cardTypeList = cardTypeList + SET_COMMUNICATIONS: (state, communications) => { + state.communications = communications }, SET_AREA: (state, area) => { state.area = area @@ -69,6 +58,7 @@ login(userInfo).then(response => { if (response.code === 200) { const data = response.data + setToken(data.token) commit('SET_TOKEN', data.token) resolve() } else { @@ -98,13 +88,60 @@ } else { reject('该用户无组织机构') } - commit('SET_ID', data.id) - commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) resolve(response) }).catch(error => { reject(error) }) + // getBizPerm().then(response => { + // const data = response.data + // if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + // commit('SET_WELLTYPES', data.wellTypes) + // } else { + // reject('该用户不支持任何闸井类型') + // } + // if (data.deviceTypes && data.deviceTypes.length > 0) { + // commit('SET_DEVICETYPES', data.deviceTypes) + // } else { + // reject('该用户不支持任何设备类型') + // } + // if (data.communications && data.communications.length > 0) { + // commit('SET_COMMUNICATIONS', data.communications) + // } else { + // reject('该用户不支持任何通讯方式') + // } + // commit('SET_AREA', data.area) + // resolve(response) + // }).catch(error => { + // reject(error) + // }) + }) + }, + // 获取用户业务权限 + GetBizPerm({ commit, state }) { + return new Promise((resolve, reject) => { + getBizPerm(state.token).then(response => { + const data = response.data + if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + commit('SET_WELLTYPES', data.wellTypes) + } else { + reject('该用户不支持任何闸井类型') + } + if (data.deviceTypes && data.deviceTypes.length > 0) { + commit('SET_DEVICETYPES', data.deviceTypes) + } else { + reject('该用户不支持任何设备类型') + } + if (data.communications && data.communications.length > 0) { + commit('SET_COMMUNICATIONS', data.communications) + } else { + reject('该用户不支持任何通讯方式') + } + commit('SET_AREA', data.area) + resolve(response) + }).catch(error => { + reject(error) + }) }) }, @@ -115,6 +152,7 @@ commit('SET_TOKEN', '') commit('SET_ROLES', []) removeToken() + removeCurrentSys() resolve() }).catch(error => { reject(error) @@ -127,6 +165,7 @@ return new Promise(resolve => { commit('SET_TOKEN', '') removeToken() + removeCurrentSys() resolve() }) } diff --git a/src/utils/auth.js b/src/utils/auth.js index 213f5e6..44af377 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -2,6 +2,7 @@ const TokenKey = 'token' const PublicKey = 'public_key' +const CurrentSystem = 'current_system' export function getToken() { return Cookies.get(TokenKey) @@ -27,3 +28,24 @@ return window.localStorage.removeItem(PublicKey) } +export function getCurrentSys() { + let currentSystem = window.localStorage.getItem(CurrentSystem) + if (typeof (currentSystem) === 'undefined') { + return undefined + } else { + currentSystem = JSON.parse(currentSystem) + return currentSystem + } +} + +export function setCurrentSys(currentSystem) { + console.log('in auth setCurrentSys') + console.log(currentSystem) + const currentSys = JSON.stringify(currentSystem) + return window.localStorage.setItem(CurrentSystem, currentSys) +} + +export function removeCurrentSys() { + return window.localStorage.removeItem(CurrentSystem) +} + diff --git a/src/utils/permission.js b/src/utils/permission.js index 8fee27f..f5e6c09 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -10,7 +10,7 @@ } // 根据用户权限判断是否要显示井类型下拉框 export function showWellType() { - console.log('是否显示井类型下拉') + // console.log('是否显示井类型下拉') const wellTypes = store.getters.wellTypes if (wellTypes.length > 1) return true else return false diff --git a/src/views/dashboard/portal.vue b/src/views/dashboard/portal.vue index c199a38..b517742 100644 --- a/src/views/dashboard/portal.vue +++ b/src/views/dashboard/portal.vue @@ -33,11 +33,20 @@ -
- 天津园区 +
+ +
+
+ 天津滨海园区 +
+
+ 综合安防集成管理平台 +
+
-
- 综合安防集成管理平台 + +
+
@@ -45,9 +54,38 @@ - - - - diff --git a/src/views/layout/SupLayout.vue b/src/views/layout/SupLayout.vue index 47cdbc6..5ada200 100644 --- a/src/views/layout/SupLayout.vue +++ b/src/views/layout/SupLayout.vue @@ -15,6 +15,7 @@ diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2c2b0ce..1b0e44b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,12 +44,16 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } + console.log(tmp) + const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + console.log(tmp.path + '->' + tmp.children[0].path) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -61,10 +65,22 @@ return res } +function filterRedirect(routes) { + console.log('filterRedirect') + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + console.log(sys.path + ':' + firstmenu.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, addRouters: [], + systems: [], // 子系统 menus: [], // 菜单 btns: [] // 按钮 }, @@ -73,6 +89,9 @@ state.addRouters = routers state.routers = constantRouterMap.concat(routers) }, + SET_SYSTEMS: (state, systems) => { + state.systems = Array.from(systems) + }, SET_MENUS: (state, menus) => { state.menus = Array.from(menus) }, @@ -81,17 +100,49 @@ } }, actions: { - // 获取用户权限 - GetMenus({ commit, state }) { + // 获取用户子系统权限 + GetSystems({ commit, state }) { return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + const params = { + resourceType: '02' + } + getMenus(params).then(response => { // 处理返回值 + const data = response.data + const systems = [] // 子系统 + if (data.menus && data.menus.length > 0) { + commit('SET_SYSTEMS', data.menus) + for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 + const menu_tmp = {} + menu_tmp.id = menu.id + menu_tmp.url = menu.url + menu_tmp.icon = menu.icon + menu_tmp.name = menu.name + systems.push(menu_tmp) + } + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 获取用户权限 + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + return new Promise((resolve, reject) => { + // const params = { + // parentCode: currentSystem.code + // } + getMenus().then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -103,11 +154,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index b7e3be9..f5d3918 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -20,19 +20,23 @@ }, DEL_VISITED_VIEW: (state, view) => { - for (const [i, v] of state.visitedViews.entries()) { - if (v.path === view.path) { - state.visitedViews.splice(i, 1) - break + if (!(state.visitedViews.length === 1 && state.visitedViews[0] === view)) { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } } } }, DEL_CACHED_VIEW: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews.splice(index, 1) - break + if (!state.cachedViews.length === 1 && state.cachedViews[0] === view) { + for (const i of state.cachedViews) { + if (i === view.name) { + const index = state.cachedViews.indexOf(i) + state.cachedViews.splice(index, 1) + break + } } } }, @@ -52,13 +56,32 @@ } }, - DEL_ALL_VISITED_VIEWS: state => { - // keep affix tags - const affixTags = state.visitedViews.filter(tag => tag.meta.affix) - state.visitedViews = affixTags + DEL_ALL_VISITED_VIEWS: (state, delAll) => { + if (delAll) { + state.visitedViews = [] + } else { + // keep affix tags + const affixTags = state.visitedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.visitedViews = affixTags + } }, - DEL_ALL_CACHED_VIEWS: state => { - state.cachedViews = [] + DEL_ALL_CACHED_VIEWS: (state, delAll) => { + // state.cachedViews = [] + // keep affix tags + if (delAll) { + state.cachedViews = [] + } else { + const affixTags = state.cachedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.cachedViews = affixTags + } }, UPDATE_VISITED_VIEW: (state, view) => { @@ -128,26 +151,26 @@ resolve([...state.cachedViews]) }) }, - - delAllViews({ dispatch, state }, view) { + // 关闭全部 + delAllViews({ dispatch, state }, delAll = false) { return new Promise(resolve => { - dispatch('delAllVisitedViews', view) - dispatch('delAllCachedViews', view) + dispatch('delAllVisitedViews', delAll) + dispatch('delAllCachedViews', delAll) resolve({ visitedViews: [...state.visitedViews], cachedViews: [...state.cachedViews] }) }) }, - delAllVisitedViews({ commit, state }) { + delAllVisitedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_VISITED_VIEWS') + commit('DEL_ALL_VISITED_VIEWS', delAll) resolve([...state.visitedViews]) }) }, - delAllCachedViews({ commit, state }) { + delAllCachedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_CACHED_VIEWS') + commit('DEL_ALL_CACHED_VIEWS', delAll) resolve([...state.cachedViews]) }) }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a7a5abc..28149ed 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,5 @@ -import { login, logout, getInfo } from '@/api/login' -import { getToken, setToken, removeToken } from '@/utils/auth' +import { login, logout, getInfo, getBizPerm } from '@/api/login' +import { getToken, setToken, removeToken, removeCurrentSys } from '@/utils/auth' const user = { state: { @@ -10,22 +10,14 @@ roleList: [], // 角色编号集合 roleNames: [], // 角色名称集合 roleTips: [], // 角色标签集合 - sexList: [], // 性别字典列表 - nationList: [], // 民族字典列表 - nationalityList: [], // 国籍字典列表 - cardTypeList: [], // 证件类型列表 + wellTypes: [], // 支持闸井类型 + deviceTypes: [], // 支持设备类型 + communications: [], // 支持通讯方式 area: '' // 默认地区 }, mutations: { SET_TOKEN: (state, token) => { state.token = token - setToken(token) - }, - SET_ID: (state, id) => { - state.id = id - }, - SET_ACCOUNT: (state, account) => { - state.account = account }, SET_NAME: (state, name) => { state.name = name @@ -45,17 +37,14 @@ SET_DEPTNAME: (state, deptName) => { state.deptName = deptName }, - SET_SEXLIST: (state, sexList) => { - state.sexList = sexList + SET_WELLTYPES: (state, wellTypes) => { + state.wellTypes = wellTypes }, - SET_NATIONLIST: (state, nationList) => { - state.nationList = nationList + SET_DEVICETYPES: (state, deviceTypes) => { + state.deviceTypes = deviceTypes }, - SET_NATIONALITYLIST: (state, nationalityList) => { - state.nationalityList = nationalityList - }, - SET_CARDTYPELIST: (state, cardTypeList) => { - state.cardTypeList = cardTypeList + SET_COMMUNICATIONS: (state, communications) => { + state.communications = communications }, SET_AREA: (state, area) => { state.area = area @@ -69,6 +58,7 @@ login(userInfo).then(response => { if (response.code === 200) { const data = response.data + setToken(data.token) commit('SET_TOKEN', data.token) resolve() } else { @@ -98,13 +88,60 @@ } else { reject('该用户无组织机构') } - commit('SET_ID', data.id) - commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) resolve(response) }).catch(error => { reject(error) }) + // getBizPerm().then(response => { + // const data = response.data + // if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + // commit('SET_WELLTYPES', data.wellTypes) + // } else { + // reject('该用户不支持任何闸井类型') + // } + // if (data.deviceTypes && data.deviceTypes.length > 0) { + // commit('SET_DEVICETYPES', data.deviceTypes) + // } else { + // reject('该用户不支持任何设备类型') + // } + // if (data.communications && data.communications.length > 0) { + // commit('SET_COMMUNICATIONS', data.communications) + // } else { + // reject('该用户不支持任何通讯方式') + // } + // commit('SET_AREA', data.area) + // resolve(response) + // }).catch(error => { + // reject(error) + // }) + }) + }, + // 获取用户业务权限 + GetBizPerm({ commit, state }) { + return new Promise((resolve, reject) => { + getBizPerm(state.token).then(response => { + const data = response.data + if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + commit('SET_WELLTYPES', data.wellTypes) + } else { + reject('该用户不支持任何闸井类型') + } + if (data.deviceTypes && data.deviceTypes.length > 0) { + commit('SET_DEVICETYPES', data.deviceTypes) + } else { + reject('该用户不支持任何设备类型') + } + if (data.communications && data.communications.length > 0) { + commit('SET_COMMUNICATIONS', data.communications) + } else { + reject('该用户不支持任何通讯方式') + } + commit('SET_AREA', data.area) + resolve(response) + }).catch(error => { + reject(error) + }) }) }, @@ -115,6 +152,7 @@ commit('SET_TOKEN', '') commit('SET_ROLES', []) removeToken() + removeCurrentSys() resolve() }).catch(error => { reject(error) @@ -127,6 +165,7 @@ return new Promise(resolve => { commit('SET_TOKEN', '') removeToken() + removeCurrentSys() resolve() }) } diff --git a/src/utils/auth.js b/src/utils/auth.js index 213f5e6..44af377 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -2,6 +2,7 @@ const TokenKey = 'token' const PublicKey = 'public_key' +const CurrentSystem = 'current_system' export function getToken() { return Cookies.get(TokenKey) @@ -27,3 +28,24 @@ return window.localStorage.removeItem(PublicKey) } +export function getCurrentSys() { + let currentSystem = window.localStorage.getItem(CurrentSystem) + if (typeof (currentSystem) === 'undefined') { + return undefined + } else { + currentSystem = JSON.parse(currentSystem) + return currentSystem + } +} + +export function setCurrentSys(currentSystem) { + console.log('in auth setCurrentSys') + console.log(currentSystem) + const currentSys = JSON.stringify(currentSystem) + return window.localStorage.setItem(CurrentSystem, currentSys) +} + +export function removeCurrentSys() { + return window.localStorage.removeItem(CurrentSystem) +} + diff --git a/src/utils/permission.js b/src/utils/permission.js index 8fee27f..f5e6c09 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -10,7 +10,7 @@ } // 根据用户权限判断是否要显示井类型下拉框 export function showWellType() { - console.log('是否显示井类型下拉') + // console.log('是否显示井类型下拉') const wellTypes = store.getters.wellTypes if (wellTypes.length > 1) return true else return false diff --git a/src/views/dashboard/portal.vue b/src/views/dashboard/portal.vue index c199a38..b517742 100644 --- a/src/views/dashboard/portal.vue +++ b/src/views/dashboard/portal.vue @@ -33,11 +33,20 @@ -
- 天津园区 +
+ +
+
+ 天津滨海园区 +
+
+ 综合安防集成管理平台 +
+
-
- 综合安防集成管理平台 + +
+
@@ -45,9 +54,38 @@ - - - - diff --git a/src/views/layout/SupLayout.vue b/src/views/layout/SupLayout.vue index 47cdbc6..5ada200 100644 --- a/src/views/layout/SupLayout.vue +++ b/src/views/layout/SupLayout.vue @@ -15,6 +15,7 @@ diff --git a/src/views/layout/components/AppMain.vue b/src/views/layout/components/AppMain.vue index 2ea268e..0693fbb 100644 --- a/src/views/layout/components/AppMain.vue +++ b/src/views/layout/components/AppMain.vue @@ -4,10 +4,9 @@
- - + + -
@@ -17,22 +16,26 @@ export default { name: 'AppMain', computed: { + cachedViews() { + return this.$store.state.tagsView.catchedViews + }, key() { - if (this.$route.meta.keepAlive) { - return this.$route.name !== undefined ? this.$route.name : this.$route - } else { - return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() - } + // if (this.$route.meta.keepAlive) { + // return this.$route.name !== undefined ? this.$route.name : this.$route + // } else { + // return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() + // } + return this.$route.fullPath } } } diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2c2b0ce..1b0e44b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,12 +44,16 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } + console.log(tmp) + const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + console.log(tmp.path + '->' + tmp.children[0].path) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -61,10 +65,22 @@ return res } +function filterRedirect(routes) { + console.log('filterRedirect') + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + console.log(sys.path + ':' + firstmenu.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, addRouters: [], + systems: [], // 子系统 menus: [], // 菜单 btns: [] // 按钮 }, @@ -73,6 +89,9 @@ state.addRouters = routers state.routers = constantRouterMap.concat(routers) }, + SET_SYSTEMS: (state, systems) => { + state.systems = Array.from(systems) + }, SET_MENUS: (state, menus) => { state.menus = Array.from(menus) }, @@ -81,17 +100,49 @@ } }, actions: { - // 获取用户权限 - GetMenus({ commit, state }) { + // 获取用户子系统权限 + GetSystems({ commit, state }) { return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + const params = { + resourceType: '02' + } + getMenus(params).then(response => { // 处理返回值 + const data = response.data + const systems = [] // 子系统 + if (data.menus && data.menus.length > 0) { + commit('SET_SYSTEMS', data.menus) + for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 + const menu_tmp = {} + menu_tmp.id = menu.id + menu_tmp.url = menu.url + menu_tmp.icon = menu.icon + menu_tmp.name = menu.name + systems.push(menu_tmp) + } + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 获取用户权限 + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + return new Promise((resolve, reject) => { + // const params = { + // parentCode: currentSystem.code + // } + getMenus().then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -103,11 +154,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index b7e3be9..f5d3918 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -20,19 +20,23 @@ }, DEL_VISITED_VIEW: (state, view) => { - for (const [i, v] of state.visitedViews.entries()) { - if (v.path === view.path) { - state.visitedViews.splice(i, 1) - break + if (!(state.visitedViews.length === 1 && state.visitedViews[0] === view)) { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } } } }, DEL_CACHED_VIEW: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews.splice(index, 1) - break + if (!state.cachedViews.length === 1 && state.cachedViews[0] === view) { + for (const i of state.cachedViews) { + if (i === view.name) { + const index = state.cachedViews.indexOf(i) + state.cachedViews.splice(index, 1) + break + } } } }, @@ -52,13 +56,32 @@ } }, - DEL_ALL_VISITED_VIEWS: state => { - // keep affix tags - const affixTags = state.visitedViews.filter(tag => tag.meta.affix) - state.visitedViews = affixTags + DEL_ALL_VISITED_VIEWS: (state, delAll) => { + if (delAll) { + state.visitedViews = [] + } else { + // keep affix tags + const affixTags = state.visitedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.visitedViews = affixTags + } }, - DEL_ALL_CACHED_VIEWS: state => { - state.cachedViews = [] + DEL_ALL_CACHED_VIEWS: (state, delAll) => { + // state.cachedViews = [] + // keep affix tags + if (delAll) { + state.cachedViews = [] + } else { + const affixTags = state.cachedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.cachedViews = affixTags + } }, UPDATE_VISITED_VIEW: (state, view) => { @@ -128,26 +151,26 @@ resolve([...state.cachedViews]) }) }, - - delAllViews({ dispatch, state }, view) { + // 关闭全部 + delAllViews({ dispatch, state }, delAll = false) { return new Promise(resolve => { - dispatch('delAllVisitedViews', view) - dispatch('delAllCachedViews', view) + dispatch('delAllVisitedViews', delAll) + dispatch('delAllCachedViews', delAll) resolve({ visitedViews: [...state.visitedViews], cachedViews: [...state.cachedViews] }) }) }, - delAllVisitedViews({ commit, state }) { + delAllVisitedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_VISITED_VIEWS') + commit('DEL_ALL_VISITED_VIEWS', delAll) resolve([...state.visitedViews]) }) }, - delAllCachedViews({ commit, state }) { + delAllCachedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_CACHED_VIEWS') + commit('DEL_ALL_CACHED_VIEWS', delAll) resolve([...state.cachedViews]) }) }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a7a5abc..28149ed 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,5 @@ -import { login, logout, getInfo } from '@/api/login' -import { getToken, setToken, removeToken } from '@/utils/auth' +import { login, logout, getInfo, getBizPerm } from '@/api/login' +import { getToken, setToken, removeToken, removeCurrentSys } from '@/utils/auth' const user = { state: { @@ -10,22 +10,14 @@ roleList: [], // 角色编号集合 roleNames: [], // 角色名称集合 roleTips: [], // 角色标签集合 - sexList: [], // 性别字典列表 - nationList: [], // 民族字典列表 - nationalityList: [], // 国籍字典列表 - cardTypeList: [], // 证件类型列表 + wellTypes: [], // 支持闸井类型 + deviceTypes: [], // 支持设备类型 + communications: [], // 支持通讯方式 area: '' // 默认地区 }, mutations: { SET_TOKEN: (state, token) => { state.token = token - setToken(token) - }, - SET_ID: (state, id) => { - state.id = id - }, - SET_ACCOUNT: (state, account) => { - state.account = account }, SET_NAME: (state, name) => { state.name = name @@ -45,17 +37,14 @@ SET_DEPTNAME: (state, deptName) => { state.deptName = deptName }, - SET_SEXLIST: (state, sexList) => { - state.sexList = sexList + SET_WELLTYPES: (state, wellTypes) => { + state.wellTypes = wellTypes }, - SET_NATIONLIST: (state, nationList) => { - state.nationList = nationList + SET_DEVICETYPES: (state, deviceTypes) => { + state.deviceTypes = deviceTypes }, - SET_NATIONALITYLIST: (state, nationalityList) => { - state.nationalityList = nationalityList - }, - SET_CARDTYPELIST: (state, cardTypeList) => { - state.cardTypeList = cardTypeList + SET_COMMUNICATIONS: (state, communications) => { + state.communications = communications }, SET_AREA: (state, area) => { state.area = area @@ -69,6 +58,7 @@ login(userInfo).then(response => { if (response.code === 200) { const data = response.data + setToken(data.token) commit('SET_TOKEN', data.token) resolve() } else { @@ -98,13 +88,60 @@ } else { reject('该用户无组织机构') } - commit('SET_ID', data.id) - commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) resolve(response) }).catch(error => { reject(error) }) + // getBizPerm().then(response => { + // const data = response.data + // if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + // commit('SET_WELLTYPES', data.wellTypes) + // } else { + // reject('该用户不支持任何闸井类型') + // } + // if (data.deviceTypes && data.deviceTypes.length > 0) { + // commit('SET_DEVICETYPES', data.deviceTypes) + // } else { + // reject('该用户不支持任何设备类型') + // } + // if (data.communications && data.communications.length > 0) { + // commit('SET_COMMUNICATIONS', data.communications) + // } else { + // reject('该用户不支持任何通讯方式') + // } + // commit('SET_AREA', data.area) + // resolve(response) + // }).catch(error => { + // reject(error) + // }) + }) + }, + // 获取用户业务权限 + GetBizPerm({ commit, state }) { + return new Promise((resolve, reject) => { + getBizPerm(state.token).then(response => { + const data = response.data + if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + commit('SET_WELLTYPES', data.wellTypes) + } else { + reject('该用户不支持任何闸井类型') + } + if (data.deviceTypes && data.deviceTypes.length > 0) { + commit('SET_DEVICETYPES', data.deviceTypes) + } else { + reject('该用户不支持任何设备类型') + } + if (data.communications && data.communications.length > 0) { + commit('SET_COMMUNICATIONS', data.communications) + } else { + reject('该用户不支持任何通讯方式') + } + commit('SET_AREA', data.area) + resolve(response) + }).catch(error => { + reject(error) + }) }) }, @@ -115,6 +152,7 @@ commit('SET_TOKEN', '') commit('SET_ROLES', []) removeToken() + removeCurrentSys() resolve() }).catch(error => { reject(error) @@ -127,6 +165,7 @@ return new Promise(resolve => { commit('SET_TOKEN', '') removeToken() + removeCurrentSys() resolve() }) } diff --git a/src/utils/auth.js b/src/utils/auth.js index 213f5e6..44af377 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -2,6 +2,7 @@ const TokenKey = 'token' const PublicKey = 'public_key' +const CurrentSystem = 'current_system' export function getToken() { return Cookies.get(TokenKey) @@ -27,3 +28,24 @@ return window.localStorage.removeItem(PublicKey) } +export function getCurrentSys() { + let currentSystem = window.localStorage.getItem(CurrentSystem) + if (typeof (currentSystem) === 'undefined') { + return undefined + } else { + currentSystem = JSON.parse(currentSystem) + return currentSystem + } +} + +export function setCurrentSys(currentSystem) { + console.log('in auth setCurrentSys') + console.log(currentSystem) + const currentSys = JSON.stringify(currentSystem) + return window.localStorage.setItem(CurrentSystem, currentSys) +} + +export function removeCurrentSys() { + return window.localStorage.removeItem(CurrentSystem) +} + diff --git a/src/utils/permission.js b/src/utils/permission.js index 8fee27f..f5e6c09 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -10,7 +10,7 @@ } // 根据用户权限判断是否要显示井类型下拉框 export function showWellType() { - console.log('是否显示井类型下拉') + // console.log('是否显示井类型下拉') const wellTypes = store.getters.wellTypes if (wellTypes.length > 1) return true else return false diff --git a/src/views/dashboard/portal.vue b/src/views/dashboard/portal.vue index c199a38..b517742 100644 --- a/src/views/dashboard/portal.vue +++ b/src/views/dashboard/portal.vue @@ -33,11 +33,20 @@ -
- 天津园区 +
+ +
+
+ 天津滨海园区 +
+
+ 综合安防集成管理平台 +
+
-
- 综合安防集成管理平台 + +
+
@@ -45,9 +54,38 @@ - - - - diff --git a/src/views/layout/SupLayout.vue b/src/views/layout/SupLayout.vue index 47cdbc6..5ada200 100644 --- a/src/views/layout/SupLayout.vue +++ b/src/views/layout/SupLayout.vue @@ -15,6 +15,7 @@ diff --git a/src/views/layout/components/AppMain.vue b/src/views/layout/components/AppMain.vue index 2ea268e..0693fbb 100644 --- a/src/views/layout/components/AppMain.vue +++ b/src/views/layout/components/AppMain.vue @@ -4,10 +4,9 @@
- - + + -
@@ -17,22 +16,26 @@ export default { name: 'AppMain', computed: { + cachedViews() { + return this.$store.state.tagsView.catchedViews + }, key() { - if (this.$route.meta.keepAlive) { - return this.$route.name !== undefined ? this.$route.name : this.$route - } else { - return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() - } + // if (this.$route.meta.keepAlive) { + // return this.$route.name !== undefined ? this.$route.name : this.$route + // } else { + // return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() + // } + return this.$route.fullPath } } } diff --git a/src/views/layout/components/Sidebar/Item.vue b/src/views/layout/components/Sidebar/Item.vue index b515f61..e4066f1 100644 --- a/src/views/layout/components/Sidebar/Item.vue +++ b/src/views/layout/components/Sidebar/Item.vue @@ -1,7 +1,14 @@ + diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2c2b0ce..1b0e44b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,12 +44,16 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } + console.log(tmp) + const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + console.log(tmp.path + '->' + tmp.children[0].path) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -61,10 +65,22 @@ return res } +function filterRedirect(routes) { + console.log('filterRedirect') + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + console.log(sys.path + ':' + firstmenu.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, addRouters: [], + systems: [], // 子系统 menus: [], // 菜单 btns: [] // 按钮 }, @@ -73,6 +89,9 @@ state.addRouters = routers state.routers = constantRouterMap.concat(routers) }, + SET_SYSTEMS: (state, systems) => { + state.systems = Array.from(systems) + }, SET_MENUS: (state, menus) => { state.menus = Array.from(menus) }, @@ -81,17 +100,49 @@ } }, actions: { - // 获取用户权限 - GetMenus({ commit, state }) { + // 获取用户子系统权限 + GetSystems({ commit, state }) { return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + const params = { + resourceType: '02' + } + getMenus(params).then(response => { // 处理返回值 + const data = response.data + const systems = [] // 子系统 + if (data.menus && data.menus.length > 0) { + commit('SET_SYSTEMS', data.menus) + for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 + const menu_tmp = {} + menu_tmp.id = menu.id + menu_tmp.url = menu.url + menu_tmp.icon = menu.icon + menu_tmp.name = menu.name + systems.push(menu_tmp) + } + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 获取用户权限 + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + return new Promise((resolve, reject) => { + // const params = { + // parentCode: currentSystem.code + // } + getMenus().then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -103,11 +154,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index b7e3be9..f5d3918 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -20,19 +20,23 @@ }, DEL_VISITED_VIEW: (state, view) => { - for (const [i, v] of state.visitedViews.entries()) { - if (v.path === view.path) { - state.visitedViews.splice(i, 1) - break + if (!(state.visitedViews.length === 1 && state.visitedViews[0] === view)) { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } } } }, DEL_CACHED_VIEW: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews.splice(index, 1) - break + if (!state.cachedViews.length === 1 && state.cachedViews[0] === view) { + for (const i of state.cachedViews) { + if (i === view.name) { + const index = state.cachedViews.indexOf(i) + state.cachedViews.splice(index, 1) + break + } } } }, @@ -52,13 +56,32 @@ } }, - DEL_ALL_VISITED_VIEWS: state => { - // keep affix tags - const affixTags = state.visitedViews.filter(tag => tag.meta.affix) - state.visitedViews = affixTags + DEL_ALL_VISITED_VIEWS: (state, delAll) => { + if (delAll) { + state.visitedViews = [] + } else { + // keep affix tags + const affixTags = state.visitedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.visitedViews = affixTags + } }, - DEL_ALL_CACHED_VIEWS: state => { - state.cachedViews = [] + DEL_ALL_CACHED_VIEWS: (state, delAll) => { + // state.cachedViews = [] + // keep affix tags + if (delAll) { + state.cachedViews = [] + } else { + const affixTags = state.cachedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.cachedViews = affixTags + } }, UPDATE_VISITED_VIEW: (state, view) => { @@ -128,26 +151,26 @@ resolve([...state.cachedViews]) }) }, - - delAllViews({ dispatch, state }, view) { + // 关闭全部 + delAllViews({ dispatch, state }, delAll = false) { return new Promise(resolve => { - dispatch('delAllVisitedViews', view) - dispatch('delAllCachedViews', view) + dispatch('delAllVisitedViews', delAll) + dispatch('delAllCachedViews', delAll) resolve({ visitedViews: [...state.visitedViews], cachedViews: [...state.cachedViews] }) }) }, - delAllVisitedViews({ commit, state }) { + delAllVisitedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_VISITED_VIEWS') + commit('DEL_ALL_VISITED_VIEWS', delAll) resolve([...state.visitedViews]) }) }, - delAllCachedViews({ commit, state }) { + delAllCachedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_CACHED_VIEWS') + commit('DEL_ALL_CACHED_VIEWS', delAll) resolve([...state.cachedViews]) }) }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a7a5abc..28149ed 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,5 @@ -import { login, logout, getInfo } from '@/api/login' -import { getToken, setToken, removeToken } from '@/utils/auth' +import { login, logout, getInfo, getBizPerm } from '@/api/login' +import { getToken, setToken, removeToken, removeCurrentSys } from '@/utils/auth' const user = { state: { @@ -10,22 +10,14 @@ roleList: [], // 角色编号集合 roleNames: [], // 角色名称集合 roleTips: [], // 角色标签集合 - sexList: [], // 性别字典列表 - nationList: [], // 民族字典列表 - nationalityList: [], // 国籍字典列表 - cardTypeList: [], // 证件类型列表 + wellTypes: [], // 支持闸井类型 + deviceTypes: [], // 支持设备类型 + communications: [], // 支持通讯方式 area: '' // 默认地区 }, mutations: { SET_TOKEN: (state, token) => { state.token = token - setToken(token) - }, - SET_ID: (state, id) => { - state.id = id - }, - SET_ACCOUNT: (state, account) => { - state.account = account }, SET_NAME: (state, name) => { state.name = name @@ -45,17 +37,14 @@ SET_DEPTNAME: (state, deptName) => { state.deptName = deptName }, - SET_SEXLIST: (state, sexList) => { - state.sexList = sexList + SET_WELLTYPES: (state, wellTypes) => { + state.wellTypes = wellTypes }, - SET_NATIONLIST: (state, nationList) => { - state.nationList = nationList + SET_DEVICETYPES: (state, deviceTypes) => { + state.deviceTypes = deviceTypes }, - SET_NATIONALITYLIST: (state, nationalityList) => { - state.nationalityList = nationalityList - }, - SET_CARDTYPELIST: (state, cardTypeList) => { - state.cardTypeList = cardTypeList + SET_COMMUNICATIONS: (state, communications) => { + state.communications = communications }, SET_AREA: (state, area) => { state.area = area @@ -69,6 +58,7 @@ login(userInfo).then(response => { if (response.code === 200) { const data = response.data + setToken(data.token) commit('SET_TOKEN', data.token) resolve() } else { @@ -98,13 +88,60 @@ } else { reject('该用户无组织机构') } - commit('SET_ID', data.id) - commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) resolve(response) }).catch(error => { reject(error) }) + // getBizPerm().then(response => { + // const data = response.data + // if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + // commit('SET_WELLTYPES', data.wellTypes) + // } else { + // reject('该用户不支持任何闸井类型') + // } + // if (data.deviceTypes && data.deviceTypes.length > 0) { + // commit('SET_DEVICETYPES', data.deviceTypes) + // } else { + // reject('该用户不支持任何设备类型') + // } + // if (data.communications && data.communications.length > 0) { + // commit('SET_COMMUNICATIONS', data.communications) + // } else { + // reject('该用户不支持任何通讯方式') + // } + // commit('SET_AREA', data.area) + // resolve(response) + // }).catch(error => { + // reject(error) + // }) + }) + }, + // 获取用户业务权限 + GetBizPerm({ commit, state }) { + return new Promise((resolve, reject) => { + getBizPerm(state.token).then(response => { + const data = response.data + if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + commit('SET_WELLTYPES', data.wellTypes) + } else { + reject('该用户不支持任何闸井类型') + } + if (data.deviceTypes && data.deviceTypes.length > 0) { + commit('SET_DEVICETYPES', data.deviceTypes) + } else { + reject('该用户不支持任何设备类型') + } + if (data.communications && data.communications.length > 0) { + commit('SET_COMMUNICATIONS', data.communications) + } else { + reject('该用户不支持任何通讯方式') + } + commit('SET_AREA', data.area) + resolve(response) + }).catch(error => { + reject(error) + }) }) }, @@ -115,6 +152,7 @@ commit('SET_TOKEN', '') commit('SET_ROLES', []) removeToken() + removeCurrentSys() resolve() }).catch(error => { reject(error) @@ -127,6 +165,7 @@ return new Promise(resolve => { commit('SET_TOKEN', '') removeToken() + removeCurrentSys() resolve() }) } diff --git a/src/utils/auth.js b/src/utils/auth.js index 213f5e6..44af377 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -2,6 +2,7 @@ const TokenKey = 'token' const PublicKey = 'public_key' +const CurrentSystem = 'current_system' export function getToken() { return Cookies.get(TokenKey) @@ -27,3 +28,24 @@ return window.localStorage.removeItem(PublicKey) } +export function getCurrentSys() { + let currentSystem = window.localStorage.getItem(CurrentSystem) + if (typeof (currentSystem) === 'undefined') { + return undefined + } else { + currentSystem = JSON.parse(currentSystem) + return currentSystem + } +} + +export function setCurrentSys(currentSystem) { + console.log('in auth setCurrentSys') + console.log(currentSystem) + const currentSys = JSON.stringify(currentSystem) + return window.localStorage.setItem(CurrentSystem, currentSys) +} + +export function removeCurrentSys() { + return window.localStorage.removeItem(CurrentSystem) +} + diff --git a/src/utils/permission.js b/src/utils/permission.js index 8fee27f..f5e6c09 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -10,7 +10,7 @@ } // 根据用户权限判断是否要显示井类型下拉框 export function showWellType() { - console.log('是否显示井类型下拉') + // console.log('是否显示井类型下拉') const wellTypes = store.getters.wellTypes if (wellTypes.length > 1) return true else return false diff --git a/src/views/dashboard/portal.vue b/src/views/dashboard/portal.vue index c199a38..b517742 100644 --- a/src/views/dashboard/portal.vue +++ b/src/views/dashboard/portal.vue @@ -33,11 +33,20 @@ -
- 天津园区 +
+ +
+
+ 天津滨海园区 +
+
+ 综合安防集成管理平台 +
+
-
- 综合安防集成管理平台 + +
+
@@ -45,9 +54,38 @@ - - - - diff --git a/src/views/layout/SupLayout.vue b/src/views/layout/SupLayout.vue index 47cdbc6..5ada200 100644 --- a/src/views/layout/SupLayout.vue +++ b/src/views/layout/SupLayout.vue @@ -15,6 +15,7 @@ diff --git a/src/views/layout/components/AppMain.vue b/src/views/layout/components/AppMain.vue index 2ea268e..0693fbb 100644 --- a/src/views/layout/components/AppMain.vue +++ b/src/views/layout/components/AppMain.vue @@ -4,10 +4,9 @@
- - + + -
@@ -17,22 +16,26 @@ export default { name: 'AppMain', computed: { + cachedViews() { + return this.$store.state.tagsView.catchedViews + }, key() { - if (this.$route.meta.keepAlive) { - return this.$route.name !== undefined ? this.$route.name : this.$route - } else { - return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() - } + // if (this.$route.meta.keepAlive) { + // return this.$route.name !== undefined ? this.$route.name : this.$route + // } else { + // return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() + // } + return this.$route.fullPath } } } diff --git a/src/views/layout/components/Sidebar/Item.vue b/src/views/layout/components/Sidebar/Item.vue index b515f61..e4066f1 100644 --- a/src/views/layout/components/Sidebar/Item.vue +++ b/src/views/layout/components/Sidebar/Item.vue @@ -1,7 +1,14 @@ + diff --git a/src/views/layout/components/Sidebar/SidebarItem.vue b/src/views/layout/components/Sidebar/SidebarItem.vue index 988d662..6c2d5ad 100644 --- a/src/views/layout/components/Sidebar/SidebarItem.vue +++ b/src/views/layout/components/Sidebar/SidebarItem.vue @@ -26,7 +26,7 @@ - + @@ -56,6 +56,16 @@ basePath: { type: String, default: '' + }, + tempData: { + type: Object, + default() { + return { + // '/supWork': 5, + // '/supToRegister': 2, + // '/toAdjust': 1 + } + } } }, data() { @@ -105,3 +115,22 @@ } } + + diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2c2b0ce..1b0e44b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,12 +44,16 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } + console.log(tmp) + const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + console.log(tmp.path + '->' + tmp.children[0].path) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -61,10 +65,22 @@ return res } +function filterRedirect(routes) { + console.log('filterRedirect') + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + console.log(sys.path + ':' + firstmenu.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, addRouters: [], + systems: [], // 子系统 menus: [], // 菜单 btns: [] // 按钮 }, @@ -73,6 +89,9 @@ state.addRouters = routers state.routers = constantRouterMap.concat(routers) }, + SET_SYSTEMS: (state, systems) => { + state.systems = Array.from(systems) + }, SET_MENUS: (state, menus) => { state.menus = Array.from(menus) }, @@ -81,17 +100,49 @@ } }, actions: { - // 获取用户权限 - GetMenus({ commit, state }) { + // 获取用户子系统权限 + GetSystems({ commit, state }) { return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + const params = { + resourceType: '02' + } + getMenus(params).then(response => { // 处理返回值 + const data = response.data + const systems = [] // 子系统 + if (data.menus && data.menus.length > 0) { + commit('SET_SYSTEMS', data.menus) + for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 + const menu_tmp = {} + menu_tmp.id = menu.id + menu_tmp.url = menu.url + menu_tmp.icon = menu.icon + menu_tmp.name = menu.name + systems.push(menu_tmp) + } + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 获取用户权限 + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + return new Promise((resolve, reject) => { + // const params = { + // parentCode: currentSystem.code + // } + getMenus().then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -103,11 +154,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index b7e3be9..f5d3918 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -20,19 +20,23 @@ }, DEL_VISITED_VIEW: (state, view) => { - for (const [i, v] of state.visitedViews.entries()) { - if (v.path === view.path) { - state.visitedViews.splice(i, 1) - break + if (!(state.visitedViews.length === 1 && state.visitedViews[0] === view)) { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } } } }, DEL_CACHED_VIEW: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews.splice(index, 1) - break + if (!state.cachedViews.length === 1 && state.cachedViews[0] === view) { + for (const i of state.cachedViews) { + if (i === view.name) { + const index = state.cachedViews.indexOf(i) + state.cachedViews.splice(index, 1) + break + } } } }, @@ -52,13 +56,32 @@ } }, - DEL_ALL_VISITED_VIEWS: state => { - // keep affix tags - const affixTags = state.visitedViews.filter(tag => tag.meta.affix) - state.visitedViews = affixTags + DEL_ALL_VISITED_VIEWS: (state, delAll) => { + if (delAll) { + state.visitedViews = [] + } else { + // keep affix tags + const affixTags = state.visitedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.visitedViews = affixTags + } }, - DEL_ALL_CACHED_VIEWS: state => { - state.cachedViews = [] + DEL_ALL_CACHED_VIEWS: (state, delAll) => { + // state.cachedViews = [] + // keep affix tags + if (delAll) { + state.cachedViews = [] + } else { + const affixTags = state.cachedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.cachedViews = affixTags + } }, UPDATE_VISITED_VIEW: (state, view) => { @@ -128,26 +151,26 @@ resolve([...state.cachedViews]) }) }, - - delAllViews({ dispatch, state }, view) { + // 关闭全部 + delAllViews({ dispatch, state }, delAll = false) { return new Promise(resolve => { - dispatch('delAllVisitedViews', view) - dispatch('delAllCachedViews', view) + dispatch('delAllVisitedViews', delAll) + dispatch('delAllCachedViews', delAll) resolve({ visitedViews: [...state.visitedViews], cachedViews: [...state.cachedViews] }) }) }, - delAllVisitedViews({ commit, state }) { + delAllVisitedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_VISITED_VIEWS') + commit('DEL_ALL_VISITED_VIEWS', delAll) resolve([...state.visitedViews]) }) }, - delAllCachedViews({ commit, state }) { + delAllCachedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_CACHED_VIEWS') + commit('DEL_ALL_CACHED_VIEWS', delAll) resolve([...state.cachedViews]) }) }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a7a5abc..28149ed 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,5 @@ -import { login, logout, getInfo } from '@/api/login' -import { getToken, setToken, removeToken } from '@/utils/auth' +import { login, logout, getInfo, getBizPerm } from '@/api/login' +import { getToken, setToken, removeToken, removeCurrentSys } from '@/utils/auth' const user = { state: { @@ -10,22 +10,14 @@ roleList: [], // 角色编号集合 roleNames: [], // 角色名称集合 roleTips: [], // 角色标签集合 - sexList: [], // 性别字典列表 - nationList: [], // 民族字典列表 - nationalityList: [], // 国籍字典列表 - cardTypeList: [], // 证件类型列表 + wellTypes: [], // 支持闸井类型 + deviceTypes: [], // 支持设备类型 + communications: [], // 支持通讯方式 area: '' // 默认地区 }, mutations: { SET_TOKEN: (state, token) => { state.token = token - setToken(token) - }, - SET_ID: (state, id) => { - state.id = id - }, - SET_ACCOUNT: (state, account) => { - state.account = account }, SET_NAME: (state, name) => { state.name = name @@ -45,17 +37,14 @@ SET_DEPTNAME: (state, deptName) => { state.deptName = deptName }, - SET_SEXLIST: (state, sexList) => { - state.sexList = sexList + SET_WELLTYPES: (state, wellTypes) => { + state.wellTypes = wellTypes }, - SET_NATIONLIST: (state, nationList) => { - state.nationList = nationList + SET_DEVICETYPES: (state, deviceTypes) => { + state.deviceTypes = deviceTypes }, - SET_NATIONALITYLIST: (state, nationalityList) => { - state.nationalityList = nationalityList - }, - SET_CARDTYPELIST: (state, cardTypeList) => { - state.cardTypeList = cardTypeList + SET_COMMUNICATIONS: (state, communications) => { + state.communications = communications }, SET_AREA: (state, area) => { state.area = area @@ -69,6 +58,7 @@ login(userInfo).then(response => { if (response.code === 200) { const data = response.data + setToken(data.token) commit('SET_TOKEN', data.token) resolve() } else { @@ -98,13 +88,60 @@ } else { reject('该用户无组织机构') } - commit('SET_ID', data.id) - commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) resolve(response) }).catch(error => { reject(error) }) + // getBizPerm().then(response => { + // const data = response.data + // if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + // commit('SET_WELLTYPES', data.wellTypes) + // } else { + // reject('该用户不支持任何闸井类型') + // } + // if (data.deviceTypes && data.deviceTypes.length > 0) { + // commit('SET_DEVICETYPES', data.deviceTypes) + // } else { + // reject('该用户不支持任何设备类型') + // } + // if (data.communications && data.communications.length > 0) { + // commit('SET_COMMUNICATIONS', data.communications) + // } else { + // reject('该用户不支持任何通讯方式') + // } + // commit('SET_AREA', data.area) + // resolve(response) + // }).catch(error => { + // reject(error) + // }) + }) + }, + // 获取用户业务权限 + GetBizPerm({ commit, state }) { + return new Promise((resolve, reject) => { + getBizPerm(state.token).then(response => { + const data = response.data + if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + commit('SET_WELLTYPES', data.wellTypes) + } else { + reject('该用户不支持任何闸井类型') + } + if (data.deviceTypes && data.deviceTypes.length > 0) { + commit('SET_DEVICETYPES', data.deviceTypes) + } else { + reject('该用户不支持任何设备类型') + } + if (data.communications && data.communications.length > 0) { + commit('SET_COMMUNICATIONS', data.communications) + } else { + reject('该用户不支持任何通讯方式') + } + commit('SET_AREA', data.area) + resolve(response) + }).catch(error => { + reject(error) + }) }) }, @@ -115,6 +152,7 @@ commit('SET_TOKEN', '') commit('SET_ROLES', []) removeToken() + removeCurrentSys() resolve() }).catch(error => { reject(error) @@ -127,6 +165,7 @@ return new Promise(resolve => { commit('SET_TOKEN', '') removeToken() + removeCurrentSys() resolve() }) } diff --git a/src/utils/auth.js b/src/utils/auth.js index 213f5e6..44af377 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -2,6 +2,7 @@ const TokenKey = 'token' const PublicKey = 'public_key' +const CurrentSystem = 'current_system' export function getToken() { return Cookies.get(TokenKey) @@ -27,3 +28,24 @@ return window.localStorage.removeItem(PublicKey) } +export function getCurrentSys() { + let currentSystem = window.localStorage.getItem(CurrentSystem) + if (typeof (currentSystem) === 'undefined') { + return undefined + } else { + currentSystem = JSON.parse(currentSystem) + return currentSystem + } +} + +export function setCurrentSys(currentSystem) { + console.log('in auth setCurrentSys') + console.log(currentSystem) + const currentSys = JSON.stringify(currentSystem) + return window.localStorage.setItem(CurrentSystem, currentSys) +} + +export function removeCurrentSys() { + return window.localStorage.removeItem(CurrentSystem) +} + diff --git a/src/utils/permission.js b/src/utils/permission.js index 8fee27f..f5e6c09 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -10,7 +10,7 @@ } // 根据用户权限判断是否要显示井类型下拉框 export function showWellType() { - console.log('是否显示井类型下拉') + // console.log('是否显示井类型下拉') const wellTypes = store.getters.wellTypes if (wellTypes.length > 1) return true else return false diff --git a/src/views/dashboard/portal.vue b/src/views/dashboard/portal.vue index c199a38..b517742 100644 --- a/src/views/dashboard/portal.vue +++ b/src/views/dashboard/portal.vue @@ -33,11 +33,20 @@ -
- 天津园区 +
+ +
+
+ 天津滨海园区 +
+
+ 综合安防集成管理平台 +
+
-
- 综合安防集成管理平台 + +
+
@@ -45,9 +54,38 @@ - - - - diff --git a/src/views/layout/SupLayout.vue b/src/views/layout/SupLayout.vue index 47cdbc6..5ada200 100644 --- a/src/views/layout/SupLayout.vue +++ b/src/views/layout/SupLayout.vue @@ -15,6 +15,7 @@ diff --git a/src/views/layout/components/AppMain.vue b/src/views/layout/components/AppMain.vue index 2ea268e..0693fbb 100644 --- a/src/views/layout/components/AppMain.vue +++ b/src/views/layout/components/AppMain.vue @@ -4,10 +4,9 @@
- - + + -
@@ -17,22 +16,26 @@ export default { name: 'AppMain', computed: { + cachedViews() { + return this.$store.state.tagsView.catchedViews + }, key() { - if (this.$route.meta.keepAlive) { - return this.$route.name !== undefined ? this.$route.name : this.$route - } else { - return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() - } + // if (this.$route.meta.keepAlive) { + // return this.$route.name !== undefined ? this.$route.name : this.$route + // } else { + // return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() + // } + return this.$route.fullPath } } } diff --git a/src/views/layout/components/Sidebar/Item.vue b/src/views/layout/components/Sidebar/Item.vue index b515f61..e4066f1 100644 --- a/src/views/layout/components/Sidebar/Item.vue +++ b/src/views/layout/components/Sidebar/Item.vue @@ -1,7 +1,14 @@ + diff --git a/src/views/layout/components/Sidebar/SidebarItem.vue b/src/views/layout/components/Sidebar/SidebarItem.vue index 988d662..6c2d5ad 100644 --- a/src/views/layout/components/Sidebar/SidebarItem.vue +++ b/src/views/layout/components/Sidebar/SidebarItem.vue @@ -26,7 +26,7 @@ - + @@ -56,6 +56,16 @@ basePath: { type: String, default: '' + }, + tempData: { + type: Object, + default() { + return { + // '/supWork': 5, + // '/supToRegister': 2, + // '/toAdjust': 1 + } + } } }, data() { @@ -105,3 +115,22 @@ } } + + diff --git a/src/views/layout/components/Sidebar/index.vue b/src/views/layout/components/Sidebar/index.vue index f0315ae..861d9e4 100644 --- a/src/views/layout/components/Sidebar/index.vue +++ b/src/views/layout/components/Sidebar/index.vue @@ -5,7 +5,7 @@ :default-active="$route.path" :collapse="isCollapse" mode="vertical" - background-color="#304156" + background-color="#2f3856" text-color="#bfcbd9" active-text-color="#1bb1a5" > @@ -21,8 +21,18 @@ export default { components: { SidebarItem }, computed: { + permission_routers() { + let permission_routers = this.$store.getters.permission_routers + const currentSystem = this.$store.getters.currentSystem + permission_routers = permission_routers.filter(item => { + if (item.meta && item.meta.sys && item.meta.sys === currentSystem.url) { + return true + } + }) + return permission_routers + }, ...mapGetters([ - 'permission_routers', + // 'permission_routers', 'sidebar' ]), isCollapse() { diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2c2b0ce..1b0e44b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,12 +44,16 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } + console.log(tmp) + const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + console.log(tmp.path + '->' + tmp.children[0].path) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -61,10 +65,22 @@ return res } +function filterRedirect(routes) { + console.log('filterRedirect') + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + console.log(sys.path + ':' + firstmenu.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, addRouters: [], + systems: [], // 子系统 menus: [], // 菜单 btns: [] // 按钮 }, @@ -73,6 +89,9 @@ state.addRouters = routers state.routers = constantRouterMap.concat(routers) }, + SET_SYSTEMS: (state, systems) => { + state.systems = Array.from(systems) + }, SET_MENUS: (state, menus) => { state.menus = Array.from(menus) }, @@ -81,17 +100,49 @@ } }, actions: { - // 获取用户权限 - GetMenus({ commit, state }) { + // 获取用户子系统权限 + GetSystems({ commit, state }) { return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + const params = { + resourceType: '02' + } + getMenus(params).then(response => { // 处理返回值 + const data = response.data + const systems = [] // 子系统 + if (data.menus && data.menus.length > 0) { + commit('SET_SYSTEMS', data.menus) + for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 + const menu_tmp = {} + menu_tmp.id = menu.id + menu_tmp.url = menu.url + menu_tmp.icon = menu.icon + menu_tmp.name = menu.name + systems.push(menu_tmp) + } + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 获取用户权限 + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + return new Promise((resolve, reject) => { + // const params = { + // parentCode: currentSystem.code + // } + getMenus().then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -103,11 +154,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index b7e3be9..f5d3918 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -20,19 +20,23 @@ }, DEL_VISITED_VIEW: (state, view) => { - for (const [i, v] of state.visitedViews.entries()) { - if (v.path === view.path) { - state.visitedViews.splice(i, 1) - break + if (!(state.visitedViews.length === 1 && state.visitedViews[0] === view)) { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } } } }, DEL_CACHED_VIEW: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews.splice(index, 1) - break + if (!state.cachedViews.length === 1 && state.cachedViews[0] === view) { + for (const i of state.cachedViews) { + if (i === view.name) { + const index = state.cachedViews.indexOf(i) + state.cachedViews.splice(index, 1) + break + } } } }, @@ -52,13 +56,32 @@ } }, - DEL_ALL_VISITED_VIEWS: state => { - // keep affix tags - const affixTags = state.visitedViews.filter(tag => tag.meta.affix) - state.visitedViews = affixTags + DEL_ALL_VISITED_VIEWS: (state, delAll) => { + if (delAll) { + state.visitedViews = [] + } else { + // keep affix tags + const affixTags = state.visitedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.visitedViews = affixTags + } }, - DEL_ALL_CACHED_VIEWS: state => { - state.cachedViews = [] + DEL_ALL_CACHED_VIEWS: (state, delAll) => { + // state.cachedViews = [] + // keep affix tags + if (delAll) { + state.cachedViews = [] + } else { + const affixTags = state.cachedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.cachedViews = affixTags + } }, UPDATE_VISITED_VIEW: (state, view) => { @@ -128,26 +151,26 @@ resolve([...state.cachedViews]) }) }, - - delAllViews({ dispatch, state }, view) { + // 关闭全部 + delAllViews({ dispatch, state }, delAll = false) { return new Promise(resolve => { - dispatch('delAllVisitedViews', view) - dispatch('delAllCachedViews', view) + dispatch('delAllVisitedViews', delAll) + dispatch('delAllCachedViews', delAll) resolve({ visitedViews: [...state.visitedViews], cachedViews: [...state.cachedViews] }) }) }, - delAllVisitedViews({ commit, state }) { + delAllVisitedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_VISITED_VIEWS') + commit('DEL_ALL_VISITED_VIEWS', delAll) resolve([...state.visitedViews]) }) }, - delAllCachedViews({ commit, state }) { + delAllCachedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_CACHED_VIEWS') + commit('DEL_ALL_CACHED_VIEWS', delAll) resolve([...state.cachedViews]) }) }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a7a5abc..28149ed 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,5 @@ -import { login, logout, getInfo } from '@/api/login' -import { getToken, setToken, removeToken } from '@/utils/auth' +import { login, logout, getInfo, getBizPerm } from '@/api/login' +import { getToken, setToken, removeToken, removeCurrentSys } from '@/utils/auth' const user = { state: { @@ -10,22 +10,14 @@ roleList: [], // 角色编号集合 roleNames: [], // 角色名称集合 roleTips: [], // 角色标签集合 - sexList: [], // 性别字典列表 - nationList: [], // 民族字典列表 - nationalityList: [], // 国籍字典列表 - cardTypeList: [], // 证件类型列表 + wellTypes: [], // 支持闸井类型 + deviceTypes: [], // 支持设备类型 + communications: [], // 支持通讯方式 area: '' // 默认地区 }, mutations: { SET_TOKEN: (state, token) => { state.token = token - setToken(token) - }, - SET_ID: (state, id) => { - state.id = id - }, - SET_ACCOUNT: (state, account) => { - state.account = account }, SET_NAME: (state, name) => { state.name = name @@ -45,17 +37,14 @@ SET_DEPTNAME: (state, deptName) => { state.deptName = deptName }, - SET_SEXLIST: (state, sexList) => { - state.sexList = sexList + SET_WELLTYPES: (state, wellTypes) => { + state.wellTypes = wellTypes }, - SET_NATIONLIST: (state, nationList) => { - state.nationList = nationList + SET_DEVICETYPES: (state, deviceTypes) => { + state.deviceTypes = deviceTypes }, - SET_NATIONALITYLIST: (state, nationalityList) => { - state.nationalityList = nationalityList - }, - SET_CARDTYPELIST: (state, cardTypeList) => { - state.cardTypeList = cardTypeList + SET_COMMUNICATIONS: (state, communications) => { + state.communications = communications }, SET_AREA: (state, area) => { state.area = area @@ -69,6 +58,7 @@ login(userInfo).then(response => { if (response.code === 200) { const data = response.data + setToken(data.token) commit('SET_TOKEN', data.token) resolve() } else { @@ -98,13 +88,60 @@ } else { reject('该用户无组织机构') } - commit('SET_ID', data.id) - commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) resolve(response) }).catch(error => { reject(error) }) + // getBizPerm().then(response => { + // const data = response.data + // if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + // commit('SET_WELLTYPES', data.wellTypes) + // } else { + // reject('该用户不支持任何闸井类型') + // } + // if (data.deviceTypes && data.deviceTypes.length > 0) { + // commit('SET_DEVICETYPES', data.deviceTypes) + // } else { + // reject('该用户不支持任何设备类型') + // } + // if (data.communications && data.communications.length > 0) { + // commit('SET_COMMUNICATIONS', data.communications) + // } else { + // reject('该用户不支持任何通讯方式') + // } + // commit('SET_AREA', data.area) + // resolve(response) + // }).catch(error => { + // reject(error) + // }) + }) + }, + // 获取用户业务权限 + GetBizPerm({ commit, state }) { + return new Promise((resolve, reject) => { + getBizPerm(state.token).then(response => { + const data = response.data + if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + commit('SET_WELLTYPES', data.wellTypes) + } else { + reject('该用户不支持任何闸井类型') + } + if (data.deviceTypes && data.deviceTypes.length > 0) { + commit('SET_DEVICETYPES', data.deviceTypes) + } else { + reject('该用户不支持任何设备类型') + } + if (data.communications && data.communications.length > 0) { + commit('SET_COMMUNICATIONS', data.communications) + } else { + reject('该用户不支持任何通讯方式') + } + commit('SET_AREA', data.area) + resolve(response) + }).catch(error => { + reject(error) + }) }) }, @@ -115,6 +152,7 @@ commit('SET_TOKEN', '') commit('SET_ROLES', []) removeToken() + removeCurrentSys() resolve() }).catch(error => { reject(error) @@ -127,6 +165,7 @@ return new Promise(resolve => { commit('SET_TOKEN', '') removeToken() + removeCurrentSys() resolve() }) } diff --git a/src/utils/auth.js b/src/utils/auth.js index 213f5e6..44af377 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -2,6 +2,7 @@ const TokenKey = 'token' const PublicKey = 'public_key' +const CurrentSystem = 'current_system' export function getToken() { return Cookies.get(TokenKey) @@ -27,3 +28,24 @@ return window.localStorage.removeItem(PublicKey) } +export function getCurrentSys() { + let currentSystem = window.localStorage.getItem(CurrentSystem) + if (typeof (currentSystem) === 'undefined') { + return undefined + } else { + currentSystem = JSON.parse(currentSystem) + return currentSystem + } +} + +export function setCurrentSys(currentSystem) { + console.log('in auth setCurrentSys') + console.log(currentSystem) + const currentSys = JSON.stringify(currentSystem) + return window.localStorage.setItem(CurrentSystem, currentSys) +} + +export function removeCurrentSys() { + return window.localStorage.removeItem(CurrentSystem) +} + diff --git a/src/utils/permission.js b/src/utils/permission.js index 8fee27f..f5e6c09 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -10,7 +10,7 @@ } // 根据用户权限判断是否要显示井类型下拉框 export function showWellType() { - console.log('是否显示井类型下拉') + // console.log('是否显示井类型下拉') const wellTypes = store.getters.wellTypes if (wellTypes.length > 1) return true else return false diff --git a/src/views/dashboard/portal.vue b/src/views/dashboard/portal.vue index c199a38..b517742 100644 --- a/src/views/dashboard/portal.vue +++ b/src/views/dashboard/portal.vue @@ -33,11 +33,20 @@ -
- 天津园区 +
+ +
+
+ 天津滨海园区 +
+
+ 综合安防集成管理平台 +
+
-
- 综合安防集成管理平台 + +
+
@@ -45,9 +54,38 @@ - - - - diff --git a/src/views/layout/SupLayout.vue b/src/views/layout/SupLayout.vue index 47cdbc6..5ada200 100644 --- a/src/views/layout/SupLayout.vue +++ b/src/views/layout/SupLayout.vue @@ -15,6 +15,7 @@ diff --git a/src/views/layout/components/AppMain.vue b/src/views/layout/components/AppMain.vue index 2ea268e..0693fbb 100644 --- a/src/views/layout/components/AppMain.vue +++ b/src/views/layout/components/AppMain.vue @@ -4,10 +4,9 @@
- - + + -
@@ -17,22 +16,26 @@ export default { name: 'AppMain', computed: { + cachedViews() { + return this.$store.state.tagsView.catchedViews + }, key() { - if (this.$route.meta.keepAlive) { - return this.$route.name !== undefined ? this.$route.name : this.$route - } else { - return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() - } + // if (this.$route.meta.keepAlive) { + // return this.$route.name !== undefined ? this.$route.name : this.$route + // } else { + // return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() + // } + return this.$route.fullPath } } } diff --git a/src/views/layout/components/Sidebar/Item.vue b/src/views/layout/components/Sidebar/Item.vue index b515f61..e4066f1 100644 --- a/src/views/layout/components/Sidebar/Item.vue +++ b/src/views/layout/components/Sidebar/Item.vue @@ -1,7 +1,14 @@ + diff --git a/src/views/layout/components/Sidebar/SidebarItem.vue b/src/views/layout/components/Sidebar/SidebarItem.vue index 988d662..6c2d5ad 100644 --- a/src/views/layout/components/Sidebar/SidebarItem.vue +++ b/src/views/layout/components/Sidebar/SidebarItem.vue @@ -26,7 +26,7 @@ - + @@ -56,6 +56,16 @@ basePath: { type: String, default: '' + }, + tempData: { + type: Object, + default() { + return { + // '/supWork': 5, + // '/supToRegister': 2, + // '/toAdjust': 1 + } + } } }, data() { @@ -105,3 +115,22 @@ } } + + diff --git a/src/views/layout/components/Sidebar/index.vue b/src/views/layout/components/Sidebar/index.vue index f0315ae..861d9e4 100644 --- a/src/views/layout/components/Sidebar/index.vue +++ b/src/views/layout/components/Sidebar/index.vue @@ -5,7 +5,7 @@ :default-active="$route.path" :collapse="isCollapse" mode="vertical" - background-color="#304156" + background-color="#2f3856" text-color="#bfcbd9" active-text-color="#1bb1a5" > @@ -21,8 +21,18 @@ export default { components: { SidebarItem }, computed: { + permission_routers() { + let permission_routers = this.$store.getters.permission_routers + const currentSystem = this.$store.getters.currentSystem + permission_routers = permission_routers.filter(item => { + if (item.meta && item.meta.sys && item.meta.sys === currentSystem.url) { + return true + } + }) + return permission_routers + }, ...mapGetters([ - 'permission_routers', + // 'permission_routers', 'sidebar' ]), isCollapse() { diff --git a/src/views/layout/components/TagsView/index.vue b/src/views/layout/components/TagsView/index.vue index 325c815..3796293 100644 --- a/src/views/layout/components/TagsView/index.vue +++ b/src/views/layout/components/TagsView/index.vue @@ -2,7 +2,7 @@
{{ tag.title }} - +
    @@ -48,6 +48,14 @@ routes() { return this.$store.state.permission.routers } + // showClose(tag, index) { + // if (tag.meta.affix) { + // return false + // } else if (index === 0) { + // return false + // } + // return true + // } }, watch: { $route() { @@ -67,6 +75,16 @@ this.addTags() }, methods: { + showClose(tag, index) { + if (tag.meta.affix) { + return false + // } else if (index === 0) { + // return false + } else if (this.visitedViews.length === 1) { + return false + } + return true + }, isActive(route) { return route.path === this.$route.path }, @@ -122,6 +140,7 @@ } }) }, + // 刷新页面 refreshSelectedTag(view) { this.$store.dispatch('tagsView/delCachedView', view).then(() => { const { fullPath } = view @@ -132,6 +151,7 @@ }) }) }, + // 关闭当前 closeSelectedTag(view) { this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => { if (this.isActive(view)) { @@ -139,12 +159,14 @@ } }) }, + // 关闭其他 closeOthersTags() { this.$router.push(this.selectedTag) this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => { this.moveToCurrentTag() }) }, + // 关闭全部 closeAllTags(view) { this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => { if (this.affixTags.some(tag => tag.path === view.path)) { diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 08fdca3..7b22cce 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -57,7 +57,7 @@ template: 'index.html', inject: true, favicon: resolve('favicon.ico'), - title: '智能闸井监测管理系统' + title: '综合安防集中管理平台' }) ] }) diff --git a/config/dev.env.js b/config/dev.env.js index d01a748..3495d13 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -7,5 +7,5 @@ module.exports = merge(prodEnv, { NODE_ENV: '"development"', BASE_API: '"http://192.168.0.212:20220"' - // BASE_API: '"http://192.168.8.225:8093"' + // BASE_API: '"http://192.168.0.102:20220"' }) diff --git a/config/index.js b/config/index.js index 38a5030..bbef312 100644 --- a/config/index.js +++ b/config/index.js @@ -52,7 +52,7 @@ // Paths assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', + assetsSubDirectory: './static', /** * You can set by youself according to actual condition @@ -61,7 +61,7 @@ * then assetsPublicPath should be set to "/bar/". * In most cases please use '/' !!! */ - assetsPublicPath: '/iris_check/', + assetsPublicPath: '/security/', /** * Source Maps diff --git a/src/api/login.js b/src/api/login.js index 5d69126..1e7ac52 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -14,11 +14,13 @@ method: 'get' }) } + // 获取用户权限(菜单、按钮) -export function getMenus() { +export function getMenus(params) { return request({ url: '/user/permission', - method: 'get' + method: 'get', + params }) } // 登出 diff --git a/src/api/statistics.js b/src/api/statistics.js deleted file mode 100644 index a5dfba9..0000000 --- a/src/api/statistics.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 数据查询接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 采集统计 -export function collectStatics(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysis', - method: 'get', - params - }) -} -// 采集对比 -export function collectStaticsContrast(params) { - return request({ - url: 'irisAnalysis/dataLogAnalysisContrast', - method: 'get', - params - }) -} - -// 识别统计 -export function recognitionStatics(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysis', - method: 'get', - params - }) -} -// 识别统计对比 -export function recognitionStaticsContrast(params) { - return request({ - url: '/irisAnalysis/recRecordAnalysisContrast', - method: 'get', - params - }) -} -// 导出采集统计结果 -export function exportCollectStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出采集统计比对结果 -export function exportCollectStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计结果 -export function exportRecognitionStatics(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - -// 导出识别统计比对结果 -export function exportRecognitionStaticsContrast(params, config) { - return request({ - url: 'well/batchExport', - method: 'get', - timeout: 120000, - params, - ...config, - responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob - }) -} - diff --git a/src/api/verify.js b/src/api/verify.js deleted file mode 100644 index f43d4b3..0000000 --- a/src/api/verify.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 虹膜采集相关接口 - */ -import request from '@/utils/request' -// import qs from 'qs' - -// 人证核验 -export function verify(data) { - return request({ - url: '/recognition/verify', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addCollectLog(data) { - return request({ - url: 'irisDataLog/add', - method: 'post', - data - }) -} - -// 新增采集日志基础信息(第一步提交) -export function addIrisData(data) { - return request({ - url: 'irisData/add', - method: 'post', - data - }) -} diff --git a/src/assets/global_images/example_photo.jpg b/src/assets/global_images/example_photo.jpg deleted file mode 100644 index b03c7d8..0000000 --- a/src/assets/global_images/example_photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/global_images/photo.jpg b/src/assets/global_images/photo.jpg deleted file mode 100644 index d367169..0000000 --- a/src/assets/global_images/photo.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/left1.jpg b/src/assets/login_images/left1.jpg deleted file mode 100644 index 8ef0a24..0000000 --- a/src/assets/login_images/left1.jpg +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/background.png b/src/assets/login_images/theme1/background.png deleted file mode 100644 index 9e7de75..0000000 --- a/src/assets/login_images/theme1/background.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/leftImg.png b/src/assets/login_images/theme1/leftImg.png deleted file mode 100644 index ae7d911..0000000 --- a/src/assets/login_images/theme1/leftImg.png +++ /dev/null Binary files differ diff --git a/src/assets/login_images/theme1/logo.png b/src/assets/login_images/theme1/logo.png deleted file mode 100644 index 46e3614..0000000 --- a/src/assets/login_images/theme1/logo.png +++ /dev/null Binary files differ diff --git a/src/icons/svg/failure.svg b/src/icons/svg/failure.svg deleted file mode 100644 index 6c63092..0000000 --- a/src/icons/svg/failure.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-door.svg b/src/icons/svg/icon-door.svg deleted file mode 100644 index 20ac655..0000000 --- a/src/icons/svg/icon-door.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-key.svg b/src/icons/svg/icon-key.svg deleted file mode 100644 index 0c6188d..0000000 --- a/src/icons/svg/icon-key.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-lock.svg b/src/icons/svg/icon-lock.svg deleted file mode 100644 index 3165195..0000000 --- a/src/icons/svg/icon-lock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-smart.svg b/src/icons/svg/icon-smart.svg deleted file mode 100644 index 58ea91c..0000000 --- a/src/icons/svg/icon-smart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-staff.svg b/src/icons/svg/icon-step-staff.svg deleted file mode 100644 index c2ebbd7..0000000 --- a/src/icons/svg/icon-step-staff.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-step-visitor.svg b/src/icons/svg/icon-step-visitor.svg deleted file mode 100644 index a7e1f39..0000000 --- a/src/icons/svg/icon-step-visitor.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-strategy.svg b/src/icons/svg/icon-strategy.svg deleted file mode 100644 index 192e8bc..0000000 --- a/src/icons/svg/icon-strategy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/icon-tag.svg b/src/icons/svg/icon-tag.svg deleted file mode 100644 index a383db6..0000000 --- a/src/icons/svg/icon-tag.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/success.svg b/src/icons/svg/success.svg deleted file mode 100644 index a9ccf6b..0000000 --- a/src/icons/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index 75c7e4a..c673350 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,6 +4,7 @@ import 'nprogress/nprogress.css' // progress bar style 进度条样式 import { Message } from 'element-ui' import { getToken } from '@/utils/auth' // getToken from cookie +import { getCurrentSys } from './utils/auth' NProgress.configure({ showSpinner: false })// NProgress configuration @@ -13,19 +14,31 @@ NProgress.start() // 加载进度条 // 如果有token if (getToken()) { + console.log('to Path:' + to.path) // 登录后进入登录页 if (to.path === '/login') { - next({ path: '/' }) + next({ path: '/login' }) + NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it + } else if (to.path === '/dashboard') { + next() NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it } else { - // 当进入非登陆页时 + // 当进入非登陆页或非主页时 if (store.getters.roleList.length === 0) { // 判断当前用户是否已拉取完user_info信息 store.dispatch('GetInfo').then(res => { // 拉取用户信息 - // 远程访问获取权限列表(菜单&按钮) - store.dispatch('GetMenus').then(() => { - router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 - next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record - }) + // 如果已有当前可进入的子系统,刷新子系统菜单 + const currentSys = getCurrentSys() + if (currentSys) { + // 远程访问获取权限列表(菜单&按钮) + store.dispatch('GetMenus', currentSys).then(() => { + store.commit('SET_CHANGEFLAG', '0') + router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 + // TODO: 判断路由是否被允许,不允许则重定向 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record + }) + } else { // 没有当前子系统信息,跳转到选择子系统页面 + next({ path: '/dashboard' }) + } }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message.error(err || '权限验证失败,请重新登录系统') @@ -33,6 +46,7 @@ }) }) } else { + // TODO: 判断路由是否被允许,不允许则重定向 next() } } @@ -40,7 +54,8 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { - next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + // next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 + next('/login') // 否则全部重定向到登录页 NProgress.done() } } diff --git a/src/router/index.js b/src/router/index.js index ff091f5..9435997 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,27 +7,23 @@ Vue.use(Router) /* Layout */ -import Layout from '@/views/layout/Layout' -import SinglePageLayout from '@/views/layout/SinglePageLayout' +import Layout from '../views/layout/Layout' import { systemRouters } from './modules/system' -import { deviceRouters } from './modules/device' -import { staffRouters } from './modules/staff' -import { carRouters } from './modules/car' -import { visitorRouters } from './modules/visitor' -import { areaRouters } from './modules/area' +import { doorSysRouters } from './modules/doorSys' + /** - * hidden: true if `hidden:true` will not show in the sidebar(default is false) - * alwaysShow: true if set true, will always show the root menu, whatever its child routes length - * if not set alwaysShow, only more than one route under the children - * it will becomes nested mode, otherwise not show the root menu - * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb - * name:'router-name' the name is used by (must set!!!) - * meta : { +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* alwaysShow: true if set true, will always show the root menu, whatever its child routes length +* if not set alwaysShow, only more than one route under the children +* it will becomes nested mode, otherwise not show the root menu +* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb +* name:'router-name' the name is used by (must set!!!) +* meta : { title: 'title' the name show in subMenu and breadcrumb (recommend set) icon: 'svg-name' the icon show in the sidebar breadcrumb: false if false, the item will hidden in breadcrumb(default is true) } - **/ +**/ /** * 静态路由 */ @@ -52,18 +48,34 @@ // 主页 { path: '/', - component: SinglePageLayout, - redirect: 'portal', - name: 'Portal1', - // hidden: true, - children: [{ - path: 'portal', - name: 'Portal', - component: () => import('@/views/dashboard/portal'), - meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } - }] - } + redirect: '/dashboard', + name: 'Dashboard', + hidden: true + }, + // 九宫格 + { path: '/dashboard', component: () => import('@/views/dashboard/portal'), hidden: true } + // 协同办公子系统 + // { + // path: '/cooperate', + // name: 'cooperate', + // redirect: '/coorBusiness', + // hidden: true + // }, + // // 应用维护子系统 + // { + // path: '/sys', + // name: 'sys', + // redirect: '/system', + // hidden: true + // } ] + +export const createRouter = () => { + return new Router({ + routes: constantRouterMap + }) +} + // 实例化vue的时候直挂载constantRouter export default new Router({ // mode: 'history', //后端支持可开 @@ -74,11 +86,7 @@ // 异步挂载路由 // 动态需要根据权限加载的路由表 export const asyncRouterMap = [ - ...deviceRouters, - ...staffRouters, - ...carRouters, - ...visitorRouters, - ...areaRouters, ...systemRouters, - { path: '*', redirect: '/404', hidden: true } + ...doorSysRouters, + { path: '*', redirect: '/404', hidden: true, meta: {}} ] diff --git a/src/router/modules/area.js b/src/router/modules/area.js deleted file mode 100644 index 7b02617..0000000 --- a/src/router/modules/area.js +++ /dev/null @@ -1,32 +0,0 @@ -// 区域管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const areaRouters = [ - { - path: 'area', - component: Layout, - redirect: '/area', - name: 'Area', - alwaysShow: true, - meta: { - title: '区域管理', - icon: 'icon-area', // 图标 - permission: ['/area']// 权限名称 - }, - children: [ - { - path: '/area/list', - name: 'AreaList', - component: () => import('@/views/area/areaList'), - meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } - }, - { - path: '/area/defenceList', - name: 'DefenceList', - component: () => import('@/views/area/defenceList'), - meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/car.js b/src/router/modules/car.js deleted file mode 100644 index e8dc920..0000000 --- a/src/router/modules/car.js +++ /dev/null @@ -1,33 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const carRouters = [ - { - path: 'car', - component: Layout, - redirect: '/car', - name: 'Car', - alwaysShow: true, - meta: { - title: '车辆管理', - icon: 'icon-car', // 图标 - permission: ['/car']// 权限名称 - }, - children: [ - { - path: '/car/list', - name: 'CarList', - component: () => import('@/views/car/carList'), - meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } - }, - { - path: '/car/add', - name: 'CarAdd', - hidden: true, - component: () => import('@/views/car/carAdd'), - meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/doorSys.js b/src/router/modules/doorSys.js new file mode 100644 index 0000000..605b851 --- /dev/null +++ b/src/router/modules/doorSys.js @@ -0,0 +1,170 @@ +/* Layout */ +import Layout from '../../views/layout/Layout' +export const doorSysRouters = [ + { + path: '/door', + name: 'door', + redirect: '/visitor', + hidden: true, + meta: { + title: '营门管理子系统', + permission: ['/door'], + isSys: true + } + }, + { + path: '/visitor', + component: Layout, + redirect: '/visitor/add', + name: 'Visitor', + alwaysShow: true, + meta: { + title: '访客管理', + icon: 'icon-visitor', // 图标 + permission: ['/visitor'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/visitor/add', + name: 'VisitorAdd', + component: () => import('@/views/visitor/visitorAdd'), + meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } + }, + { + path: '/visitor/addCar', + name: 'VisitorAddCar', + component: () => import('@/views/visitor/visitorAddCar'), + meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } + }, + { + path: '/visitor/today', + name: 'VisitorToday', + component: () => import('@/views/visitor/visitorTodayList'), + meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } + }, + { + path: '/visitor/carToday', + name: 'VisitorCarToday', + component: () => import('@/views/visitor/visitorCarTodayList'), + meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } + }, + { + path: '/visitor/list', + name: 'VisitorList', + component: () => import('@/views/visitor/visitorList'), + meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } + } + ] + }, + { + path: '/staff', + component: Layout, + redirect: '/staff', + name: 'Staff', + alwaysShow: true, + meta: { + title: '人员管理', + icon: 'icon-person', // 图标 + permission: ['/staff'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/staff/add', + name: 'StaffAdd', + component: () => import('@/views/staff/staffAdd'), + meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } + }, + { + path: '/staff/list', + name: 'StaffList', + component: () => import('@/views/staff/staffList'), + meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } + }, + { + path: '/staff/edit', + name: 'StaffEdit', + component: () => import('@/views/staff/staffEdit'), + hidden: true, + meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } + } + ] + }, + { + path: '/device', + component: Layout, + redirect: '/device', + name: 'Device', + alwaysShow: true, + meta: { + title: '设备管理', + icon: 'icon-device', // 图标 + permission: ['/device'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/device/list', + name: 'DeviceList', + component: () => import('@/views/deviceManage/deviceList'), + meta: { title: '设备列表', icon: '', permission: ['/device/list'], keepAlive: true } + } + ] + }, + { + path: '/car', + component: Layout, + redirect: '/car', + name: 'Car', + alwaysShow: true, + meta: { + title: '车辆管理', + icon: 'icon-car', // 图标 + permission: ['/car'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/car/list', + name: 'CarList', + component: () => import('@/views/car/carList'), + meta: { title: '车辆列表', icon: '', permission: ['/car/list'], keepAlive: true } + }, + { + path: '/car/add', + name: 'CarAdd', + hidden: true, + component: () => import('@/views/car/carAdd'), + meta: { title: '车辆登记', icon: '', permission: ['/car/add'], keepAlive: true } + } + ] + }, + { + path: '/area', + component: Layout, + redirect: '/area', + name: 'Area', + alwaysShow: true, + meta: { + title: '区域管理', + icon: 'icon-area', // 图标 + permission: ['/area'], // 权限名称 + sys: '/door' + }, + children: [ + { + path: '/area/list', + name: 'AreaList', + component: () => import('@/views/area/areaList'), + meta: { title: '区域列表', icon: '', permission: ['/area/list'], keepAlive: true } + }, + { + path: '/area/defenceList', + name: 'DefenceList', + component: () => import('@/views/area/defenceList'), + meta: { title: '车辆登记', icon: '', permission: ['/area/defenceList'], keepAlive: true } + } + ] + } +] diff --git a/src/router/modules/staff.js b/src/router/modules/staff.js deleted file mode 100644 index e25e841..0000000 --- a/src/router/modules/staff.js +++ /dev/null @@ -1,39 +0,0 @@ -// 路灯设备管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const staffRouters = [ - { - path: 'staff', - component: Layout, - redirect: '/staff', - name: 'Staff', - alwaysShow: true, - meta: { - title: '人员管理', - icon: 'icon-person', // 图标 - permission: ['/staff']// 权限名称 - }, - children: [ - { - path: '/staff/add', - name: 'StaffAdd', - component: () => import('@/views/staff/staffAdd'), - meta: { title: '人员登记', icon: '', permission: ['/staff/add'], keepAlive: true } - }, - { - path: '/staff/list', - name: 'StaffList', - component: () => import('@/views/staff/staffList'), - meta: { title: '人员列表', icon: '', permission: ['/staff/list'], keepAlive: true } - }, - { - path: '/staff/edit', - name: 'StaffEdit', - component: () => import('@/views/staff/staffEdit'), - hidden: true, - meta: { title: '人员编辑', icon: '', permission: ['/staff/edit'], keepAlive: true } - } - ] - } -] diff --git a/src/router/modules/system.js b/src/router/modules/system.js index b020020..05f97c3 100644 --- a/src/router/modules/system.js +++ b/src/router/modules/system.js @@ -1,66 +1,78 @@ /* Layout */ import Layout from '../../views/layout/Layout' - -export const systemRouters = [{ - path: 'system', - component: Layout, - redirect: '/resource', - name: 'System', - alwaysShow: true, - meta: { - title: '系统管理', - icon: 'icon-config', // 图标 - permission: ['/system']// 权限名称 - }, - children: [ - { - path: '/resource', - name: 'Resource', - component: () => import('@/views/system/resource/listResource'), - meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } - }, - { - path: '/dict', - name: 'Dict', - component: () => import('@/views/system/dict/listDict'), - meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } - }, - { - path: '/area', - name: 'Area', - component: () => import('@/views/system/area/listArea'), - meta: { title: '区域管理', icon: 'function', permission: ['/area'] } - }, - { - path: '/dept', - name: 'Dept', - component: () => import('@/views/system/dept/listDept'), - meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } - }, - { - path: '/role', - component: () => import('@/views/system/role/listRole'), // Parent router-view - name: 'Role', - meta: { title: '角色管理', permission: ['/role'] } - }, - { - path: '/user', - component: () => import('@/views/system/user/listUser'), // Parent router-view - name: 'User', - meta: { title: '用户管理', permission: ['/mgr'] } - }, - { - path: '/log', - component: () => import('@/views/system/log/listLog'), // Parent router-view - name: 'Log', - meta: { title: '日志管理', permission: ['/log'] } - }, - { - path: '/loginLog', - component: () => import('@/views/system/log/loginLog'), // Parent router-view - name: 'LoginLog', - meta: { title: '登录日志', permission: ['/loginLog'] } +export const systemRouters = [ + { + path: '/sys', + name: 'sys', + redirect: '/busAdmin', + hidden: true, + meta: { + title: '系统管理子系统', + permission: ['/sys'], + isSys: true } - ] -} + }, + { + path: '/system', + component: Layout, + redirect: '/resource', + name: 'System', + alwaysShow: true, + meta: { + title: '系统管理', + icon: 'icon-config', // 图标 + permission: ['/system'], // 权限名称 + sys: '/sys' + }, + children: [ + { + path: '/resource', + name: 'Resource', + component: () => import('@/views/system/resource/listResource'), + meta: { title: '资源管理', icon: 'function', permission: ['/resource'] } + }, + { + path: '/dict', + name: 'Dict', + component: () => import('@/views/system/dict/listDict'), + meta: { title: '字典管理', icon: 'function', permission: ['/dict'] } + }, + { + path: '/area', + name: 'Area', + component: () => import('@/views/system/area/listArea'), + meta: { title: '区域管理', icon: 'function', permission: ['/area'] } + }, + { + path: '/dept', + name: 'Dept', + component: () => import('@/views/system/dept/listDept'), + meta: { title: '组织管理', icon: 'tree', permission: ['/dept'] } + }, + { + path: '/role', + component: () => import('@/views/system/role/listRole'), // Parent router-view + name: 'Role', + meta: { title: '角色管理', permission: ['/role'] } + }, + { + path: '/user', + component: () => import('@/views/system/user/listUser'), // Parent router-view + name: 'User', + meta: { title: '用户管理', permission: ['/mgr'] } + }, + { + path: '/log', + component: () => import('@/views/system/log/listLog'), // Parent router-view + name: 'Log', + meta: { title: '日志管理', permission: ['/log'] } + }, + { + path: '/loginLog', + component: () => import('@/views/system/log/loginLog'), // Parent router-view + name: 'LoginLog', + meta: { title: '登录日志', permission: ['/loginLog'] } + } + ] + } ] diff --git a/src/router/modules/visitor.js b/src/router/modules/visitor.js deleted file mode 100644 index 869c3b7..0000000 --- a/src/router/modules/visitor.js +++ /dev/null @@ -1,50 +0,0 @@ -// 车辆管理部分路由 -/* Layout */ -import Layout from '../../views/layout/Layout' - -export const visitorRouters = [ - { - path: 'visitor', - component: Layout, - redirect: '/visitor', - name: 'Visitor', - alwaysShow: true, - meta: { - title: '访客管理', - icon: 'icon-visitor', // 图标 - permission: ['/visitor']// 权限名称 - }, - children: [ - { - path: '/visitor/add', - name: 'VisitorAdd', - component: () => import('@/views/visitor/visitorAdd'), - meta: { title: '访客登记', icon: '', permission: ['/visitor/add'], keepAlive: true } - }, - { - path: '/visitor/addCar', - name: 'VisitorAddCar', - component: () => import('@/views/visitor/visitorAddCar'), - meta: { title: '访客车辆登记', icon: '', permission: ['/visitor/addCar'], keepAlive: true } - }, - { - path: '/visitor/today', - name: 'VisitorToday', - component: () => import('@/views/visitor/visitorTodayList'), - meta: { title: '当日来访人员', icon: '', permission: ['/visitor/today'], keepAlive: true } - }, - { - path: '/visitor/carToday', - name: 'VisitorCarToday', - component: () => import('@/views/visitor/visitorCarTodayList'), - meta: { title: '当日来访车辆', icon: '', permission: ['/visitor/carToday'], keepAlive: true } - }, - { - path: '/visitor/list', - name: 'VisitorList', - component: () => import('@/views/visitor/visitorList'), - meta: { title: '来访记录', icon: '', permission: ['/visitor/list'], keepAlive: true } - } - ] - } -] diff --git a/src/store/getters.js b/src/store/getters.js index 80b80fb..c33a49d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -1,14 +1,14 @@ const getters = { - sidebar: state => state.app.sidebar, // 侧边栏 - device: state => state.app.device, // 设备 visitedViews: state => state.tagsView.visitedViews, cachedViews: state => state.tagsView.cachedViews, + sidebar: state => state.app.sidebar, // 侧边栏 + device: state => state.app.device, // 设备 kaptcha: state => state.app.kaptcha, // 验证码 publicKey: state => state.app.publicKey, // 公钥 sid: state => state.app.sid, // 用户标识 + currentSystem: state => state.app.currentSystem, // 用户标识 + changeFlag: state => state.app.changeFlag, // 切换子系统标志 token: state => state.user.token, // token - id: state => state.user.id, // id - account: state => state.user.account, // 账户 name: state => state.user.name, // 姓名 roleList: state => state.user.roleList, // 角色列表 roleNames: state => state.user.roleNames, // 角色名称列表 @@ -16,6 +16,7 @@ deptId: state => state.user.deptId, // 权属单位 deptName: state => state.user.deptName, // 权属单位名称 menus: state => state.permission.menus, // 菜单 + systems: state => state.permission.systems, // 子系统 permission_routers: state => state.permission.routers, // 用户有权限的路由 addRouters: state => state.permission.addRouters, // 添加的路由 btns: state => state.permission.btns, // 用户所有的按钮权限 diff --git a/src/store/modules/app.js b/src/store/modules/app.js index c592ba0..b259731 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -1,6 +1,7 @@ import Cookies from 'js-cookie' import { getConfig } from '@/api/login' import { getPublicKey, setPublicKey } from '../../utils/auth' +import { getCurrentSys, setCurrentSys } from '@/utils/auth' const app = { state: { @@ -9,9 +10,11 @@ withoutAnimation: false }, device: 'desktop', - kaptcha: '', - publicKey: getPublicKey(), - sid: '' + kaptcha: '', // 验证码 + publicKey: getPublicKey(), // 公钥 + sid: '', + currentSystem: getCurrentSys(), // 当前子系统 + changeFlag: '0' // 更换子系统标志,1为更换 0为未更换 }, mutations: { TOGGLE_SIDEBAR: state => { @@ -36,7 +39,15 @@ state.publicKey = config.publicKey state.sid = config.sid setPublicKey(config.publicKey) + }, + SET_SYSTEM: (state, system) => { + state.currentSystem = system + setCurrentSys(system) + }, + SET_CHANGEFLAG: (state, changeFlag) => { + state.changeFlag = changeFlag } + }, actions: { ToggleSideBar: ({ commit }) => { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2c2b0ce..1b0e44b 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -44,12 +44,16 @@ // 遍历每一个路由,判断是否有权限 routes.forEach(route => { const tmp = { ...route } + console.log(tmp) + const menu = getMenu(menus, tmp) if (menu) { // 如果有权限,添加该路由,并根据url的icon更新图标 tmp.meta.icon = menu.icon // 给route更新icon tmp.meta.title = menu.name // 给route更新名称 if (tmp.children) { tmp.children = filterAsyncRouter(tmp.children, menus) + console.log(tmp.path + '->' + tmp.children[0].path) + tmp.redirect = tmp.children[0].path } res.push(tmp) } else { @@ -61,10 +65,22 @@ return res } +function filterRedirect(routes) { + console.log('filterRedirect') + const sysroutes = routes.filter(route => route.meta.isSys) + const menuroutes = routes.filter(route => !route.meta.isSys) + for (const sys of sysroutes) { + const firstmenu = menuroutes.find(route => route.meta.sys === sys.path) + console.log(sys.path + ':' + firstmenu.path) + sys.redirect = firstmenu.path + } + return [...sysroutes, ...menuroutes] +} const permission = { state: { routers: constantRouterMap, addRouters: [], + systems: [], // 子系统 menus: [], // 菜单 btns: [] // 按钮 }, @@ -73,6 +89,9 @@ state.addRouters = routers state.routers = constantRouterMap.concat(routers) }, + SET_SYSTEMS: (state, systems) => { + state.systems = Array.from(systems) + }, SET_MENUS: (state, menus) => { state.menus = Array.from(menus) }, @@ -81,17 +100,49 @@ } }, actions: { - // 获取用户权限 - GetMenus({ commit, state }) { + // 获取用户子系统权限 + GetSystems({ commit, state }) { return new Promise((resolve, reject) => { - getMenus(state.token).then(response => { // 处理返回值 + const params = { + resourceType: '02' + } + getMenus(params).then(response => { // 处理返回值 + const data = response.data + const systems = [] // 子系统 + if (data.menus && data.menus.length > 0) { + commit('SET_SYSTEMS', data.menus) + for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 + const menu_tmp = {} + menu_tmp.id = menu.id + menu_tmp.url = menu.url + menu_tmp.icon = menu.icon + menu_tmp.name = menu.name + systems.push(menu_tmp) + } + } + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + // 获取用户权限 + GetMenus({ commit, state }, currentSystem) { + // console.log('in store.permission.js:GetMenus:') + console.log('获取' + currentSystem.name + '的菜单') + return new Promise((resolve, reject) => { + // const params = { + // parentCode: currentSystem.code + // } + getMenus().then(response => { // 处理返回值 const data = response.data const menus = [] // 仅菜单 const btns = [] // 非菜单 if (data.menus && data.menus.length > 0) { - commit('SET_MENUS', data.menus) - for (const menu of data.menus) { // 遍历菜单,获取所有的权限项 - if (menu.ismenu === '1') { // 将是菜单的放入menus + const allmenus = [...data.menus] + commit('SET_MENUS', allmenus) + for (const menu of allmenus) { // 遍历菜单,获取所有的权限项 + if (menu.resourceType === '02' || menu.resourceType === '03') { // 将是菜单的放入menus const menu_tmp = {} menu_tmp.url = menu.url menu_tmp.icon = menu.icon @@ -103,11 +154,11 @@ btn_tmp.name = menu.name btn_tmp.icon = menu.icon btns.push(btn_tmp) - // console.log(menu.url) } } // 过滤路由表 - const accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + let accessedRouters = filterAsyncRouter(asyncRouterMap, menus) + accessedRouters = filterRedirect(accessedRouters) commit('SET_BTNS', btns) commit('SET_ROUTERS', accessedRouters) resolve(response) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index b7e3be9..f5d3918 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -20,19 +20,23 @@ }, DEL_VISITED_VIEW: (state, view) => { - for (const [i, v] of state.visitedViews.entries()) { - if (v.path === view.path) { - state.visitedViews.splice(i, 1) - break + if (!(state.visitedViews.length === 1 && state.visitedViews[0] === view)) { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } } } }, DEL_CACHED_VIEW: (state, view) => { - for (const i of state.cachedViews) { - if (i === view.name) { - const index = state.cachedViews.indexOf(i) - state.cachedViews.splice(index, 1) - break + if (!state.cachedViews.length === 1 && state.cachedViews[0] === view) { + for (const i of state.cachedViews) { + if (i === view.name) { + const index = state.cachedViews.indexOf(i) + state.cachedViews.splice(index, 1) + break + } } } }, @@ -52,13 +56,32 @@ } }, - DEL_ALL_VISITED_VIEWS: state => { - // keep affix tags - const affixTags = state.visitedViews.filter(tag => tag.meta.affix) - state.visitedViews = affixTags + DEL_ALL_VISITED_VIEWS: (state, delAll) => { + if (delAll) { + state.visitedViews = [] + } else { + // keep affix tags + const affixTags = state.visitedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.visitedViews = affixTags + } }, - DEL_ALL_CACHED_VIEWS: state => { - state.cachedViews = [] + DEL_ALL_CACHED_VIEWS: (state, delAll) => { + // state.cachedViews = [] + // keep affix tags + if (delAll) { + state.cachedViews = [] + } else { + const affixTags = state.cachedViews.filter((tag, index) => { + if (tag.meta.affix || index === 0) { + return true + } + }) + state.cachedViews = affixTags + } }, UPDATE_VISITED_VIEW: (state, view) => { @@ -128,26 +151,26 @@ resolve([...state.cachedViews]) }) }, - - delAllViews({ dispatch, state }, view) { + // 关闭全部 + delAllViews({ dispatch, state }, delAll = false) { return new Promise(resolve => { - dispatch('delAllVisitedViews', view) - dispatch('delAllCachedViews', view) + dispatch('delAllVisitedViews', delAll) + dispatch('delAllCachedViews', delAll) resolve({ visitedViews: [...state.visitedViews], cachedViews: [...state.cachedViews] }) }) }, - delAllVisitedViews({ commit, state }) { + delAllVisitedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_VISITED_VIEWS') + commit('DEL_ALL_VISITED_VIEWS', delAll) resolve([...state.visitedViews]) }) }, - delAllCachedViews({ commit, state }) { + delAllCachedViews({ commit, state }, delAll) { return new Promise(resolve => { - commit('DEL_ALL_CACHED_VIEWS') + commit('DEL_ALL_CACHED_VIEWS', delAll) resolve([...state.cachedViews]) }) }, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a7a5abc..28149ed 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,5 @@ -import { login, logout, getInfo } from '@/api/login' -import { getToken, setToken, removeToken } from '@/utils/auth' +import { login, logout, getInfo, getBizPerm } from '@/api/login' +import { getToken, setToken, removeToken, removeCurrentSys } from '@/utils/auth' const user = { state: { @@ -10,22 +10,14 @@ roleList: [], // 角色编号集合 roleNames: [], // 角色名称集合 roleTips: [], // 角色标签集合 - sexList: [], // 性别字典列表 - nationList: [], // 民族字典列表 - nationalityList: [], // 国籍字典列表 - cardTypeList: [], // 证件类型列表 + wellTypes: [], // 支持闸井类型 + deviceTypes: [], // 支持设备类型 + communications: [], // 支持通讯方式 area: '' // 默认地区 }, mutations: { SET_TOKEN: (state, token) => { state.token = token - setToken(token) - }, - SET_ID: (state, id) => { - state.id = id - }, - SET_ACCOUNT: (state, account) => { - state.account = account }, SET_NAME: (state, name) => { state.name = name @@ -45,17 +37,14 @@ SET_DEPTNAME: (state, deptName) => { state.deptName = deptName }, - SET_SEXLIST: (state, sexList) => { - state.sexList = sexList + SET_WELLTYPES: (state, wellTypes) => { + state.wellTypes = wellTypes }, - SET_NATIONLIST: (state, nationList) => { - state.nationList = nationList + SET_DEVICETYPES: (state, deviceTypes) => { + state.deviceTypes = deviceTypes }, - SET_NATIONALITYLIST: (state, nationalityList) => { - state.nationalityList = nationalityList - }, - SET_CARDTYPELIST: (state, cardTypeList) => { - state.cardTypeList = cardTypeList + SET_COMMUNICATIONS: (state, communications) => { + state.communications = communications }, SET_AREA: (state, area) => { state.area = area @@ -69,6 +58,7 @@ login(userInfo).then(response => { if (response.code === 200) { const data = response.data + setToken(data.token) commit('SET_TOKEN', data.token) resolve() } else { @@ -98,13 +88,60 @@ } else { reject('该用户无组织机构') } - commit('SET_ID', data.id) - commit('SET_ACCOUNT', data.account) commit('SET_NAME', data.name) resolve(response) }).catch(error => { reject(error) }) + // getBizPerm().then(response => { + // const data = response.data + // if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + // commit('SET_WELLTYPES', data.wellTypes) + // } else { + // reject('该用户不支持任何闸井类型') + // } + // if (data.deviceTypes && data.deviceTypes.length > 0) { + // commit('SET_DEVICETYPES', data.deviceTypes) + // } else { + // reject('该用户不支持任何设备类型') + // } + // if (data.communications && data.communications.length > 0) { + // commit('SET_COMMUNICATIONS', data.communications) + // } else { + // reject('该用户不支持任何通讯方式') + // } + // commit('SET_AREA', data.area) + // resolve(response) + // }).catch(error => { + // reject(error) + // }) + }) + }, + // 获取用户业务权限 + GetBizPerm({ commit, state }) { + return new Promise((resolve, reject) => { + getBizPerm(state.token).then(response => { + const data = response.data + if (data.wellTypes && data.wellTypes.length > 0) { // 验证返回的wellTypes是否是一个非空数组 + commit('SET_WELLTYPES', data.wellTypes) + } else { + reject('该用户不支持任何闸井类型') + } + if (data.deviceTypes && data.deviceTypes.length > 0) { + commit('SET_DEVICETYPES', data.deviceTypes) + } else { + reject('该用户不支持任何设备类型') + } + if (data.communications && data.communications.length > 0) { + commit('SET_COMMUNICATIONS', data.communications) + } else { + reject('该用户不支持任何通讯方式') + } + commit('SET_AREA', data.area) + resolve(response) + }).catch(error => { + reject(error) + }) }) }, @@ -115,6 +152,7 @@ commit('SET_TOKEN', '') commit('SET_ROLES', []) removeToken() + removeCurrentSys() resolve() }).catch(error => { reject(error) @@ -127,6 +165,7 @@ return new Promise(resolve => { commit('SET_TOKEN', '') removeToken() + removeCurrentSys() resolve() }) } diff --git a/src/utils/auth.js b/src/utils/auth.js index 213f5e6..44af377 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -2,6 +2,7 @@ const TokenKey = 'token' const PublicKey = 'public_key' +const CurrentSystem = 'current_system' export function getToken() { return Cookies.get(TokenKey) @@ -27,3 +28,24 @@ return window.localStorage.removeItem(PublicKey) } +export function getCurrentSys() { + let currentSystem = window.localStorage.getItem(CurrentSystem) + if (typeof (currentSystem) === 'undefined') { + return undefined + } else { + currentSystem = JSON.parse(currentSystem) + return currentSystem + } +} + +export function setCurrentSys(currentSystem) { + console.log('in auth setCurrentSys') + console.log(currentSystem) + const currentSys = JSON.stringify(currentSystem) + return window.localStorage.setItem(CurrentSystem, currentSys) +} + +export function removeCurrentSys() { + return window.localStorage.removeItem(CurrentSystem) +} + diff --git a/src/utils/permission.js b/src/utils/permission.js index 8fee27f..f5e6c09 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -10,7 +10,7 @@ } // 根据用户权限判断是否要显示井类型下拉框 export function showWellType() { - console.log('是否显示井类型下拉') + // console.log('是否显示井类型下拉') const wellTypes = store.getters.wellTypes if (wellTypes.length > 1) return true else return false diff --git a/src/views/dashboard/portal.vue b/src/views/dashboard/portal.vue index c199a38..b517742 100644 --- a/src/views/dashboard/portal.vue +++ b/src/views/dashboard/portal.vue @@ -33,11 +33,20 @@ -
    - 天津园区 +
    + +
    +
    + 天津滨海园区 +
    +
    + 综合安防集成管理平台 +
    +
    -
    - 综合安防集成管理平台 + +
    +
    @@ -45,9 +54,38 @@ - - - - diff --git a/src/views/layout/SupLayout.vue b/src/views/layout/SupLayout.vue index 47cdbc6..5ada200 100644 --- a/src/views/layout/SupLayout.vue +++ b/src/views/layout/SupLayout.vue @@ -15,6 +15,7 @@ diff --git a/src/views/layout/components/AppMain.vue b/src/views/layout/components/AppMain.vue index 2ea268e..0693fbb 100644 --- a/src/views/layout/components/AppMain.vue +++ b/src/views/layout/components/AppMain.vue @@ -4,10 +4,9 @@
    - - + + -
    @@ -17,22 +16,26 @@ export default { name: 'AppMain', computed: { + cachedViews() { + return this.$store.state.tagsView.catchedViews + }, key() { - if (this.$route.meta.keepAlive) { - return this.$route.name !== undefined ? this.$route.name : this.$route - } else { - return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() - } + // if (this.$route.meta.keepAlive) { + // return this.$route.name !== undefined ? this.$route.name : this.$route + // } else { + // return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() + // } + return this.$route.fullPath } } } diff --git a/src/views/layout/components/Sidebar/Item.vue b/src/views/layout/components/Sidebar/Item.vue index b515f61..e4066f1 100644 --- a/src/views/layout/components/Sidebar/Item.vue +++ b/src/views/layout/components/Sidebar/Item.vue @@ -1,7 +1,14 @@ + diff --git a/src/views/layout/components/Sidebar/SidebarItem.vue b/src/views/layout/components/Sidebar/SidebarItem.vue index 988d662..6c2d5ad 100644 --- a/src/views/layout/components/Sidebar/SidebarItem.vue +++ b/src/views/layout/components/Sidebar/SidebarItem.vue @@ -26,7 +26,7 @@ - + @@ -56,6 +56,16 @@ basePath: { type: String, default: '' + }, + tempData: { + type: Object, + default() { + return { + // '/supWork': 5, + // '/supToRegister': 2, + // '/toAdjust': 1 + } + } } }, data() { @@ -105,3 +115,22 @@ } } + + diff --git a/src/views/layout/components/Sidebar/index.vue b/src/views/layout/components/Sidebar/index.vue index f0315ae..861d9e4 100644 --- a/src/views/layout/components/Sidebar/index.vue +++ b/src/views/layout/components/Sidebar/index.vue @@ -5,7 +5,7 @@ :default-active="$route.path" :collapse="isCollapse" mode="vertical" - background-color="#304156" + background-color="#2f3856" text-color="#bfcbd9" active-text-color="#1bb1a5" > @@ -21,8 +21,18 @@ export default { components: { SidebarItem }, computed: { + permission_routers() { + let permission_routers = this.$store.getters.permission_routers + const currentSystem = this.$store.getters.currentSystem + permission_routers = permission_routers.filter(item => { + if (item.meta && item.meta.sys && item.meta.sys === currentSystem.url) { + return true + } + }) + return permission_routers + }, ...mapGetters([ - 'permission_routers', + // 'permission_routers', 'sidebar' ]), isCollapse() { diff --git a/src/views/layout/components/TagsView/index.vue b/src/views/layout/components/TagsView/index.vue index 325c815..3796293 100644 --- a/src/views/layout/components/TagsView/index.vue +++ b/src/views/layout/components/TagsView/index.vue @@ -2,7 +2,7 @@
    {{ tag.title }} - +
      @@ -48,6 +48,14 @@ routes() { return this.$store.state.permission.routers } + // showClose(tag, index) { + // if (tag.meta.affix) { + // return false + // } else if (index === 0) { + // return false + // } + // return true + // } }, watch: { $route() { @@ -67,6 +75,16 @@ this.addTags() }, methods: { + showClose(tag, index) { + if (tag.meta.affix) { + return false + // } else if (index === 0) { + // return false + } else if (this.visitedViews.length === 1) { + return false + } + return true + }, isActive(route) { return route.path === this.$route.path }, @@ -122,6 +140,7 @@ } }) }, + // 刷新页面 refreshSelectedTag(view) { this.$store.dispatch('tagsView/delCachedView', view).then(() => { const { fullPath } = view @@ -132,6 +151,7 @@ }) }) }, + // 关闭当前 closeSelectedTag(view) { this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => { if (this.isActive(view)) { @@ -139,12 +159,14 @@ } }) }, + // 关闭其他 closeOthersTags() { this.$router.push(this.selectedTag) this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => { this.moveToCurrentTag() }) }, + // 关闭全部 closeAllTags(view) { this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => { if (this.affixTags.some(tag => tag.path === view.path)) { diff --git a/src/views/login/index.vue b/src/views/login/index.vue index a57232c..2248197 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -52,6 +52,7 @@ - - - - diff --git a/src/views/layout/SupLayout.vue b/src/views/layout/SupLayout.vue index 47cdbc6..5ada200 100644 --- a/src/views/layout/SupLayout.vue +++ b/src/views/layout/SupLayout.vue @@ -15,6 +15,7 @@ diff --git a/src/views/layout/components/AppMain.vue b/src/views/layout/components/AppMain.vue index 2ea268e..0693fbb 100644 --- a/src/views/layout/components/AppMain.vue +++ b/src/views/layout/components/AppMain.vue @@ -4,10 +4,9 @@
      - - + + -
      @@ -17,22 +16,26 @@ export default { name: 'AppMain', computed: { + cachedViews() { + return this.$store.state.tagsView.catchedViews + }, key() { - if (this.$route.meta.keepAlive) { - return this.$route.name !== undefined ? this.$route.name : this.$route - } else { - return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() - } + // if (this.$route.meta.keepAlive) { + // return this.$route.name !== undefined ? this.$route.name : this.$route + // } else { + // return this.$route.name !== undefined ? this.$route.name + new Date() : this.$route + new Date() + // } + return this.$route.fullPath } } } diff --git a/src/views/layout/components/Sidebar/Item.vue b/src/views/layout/components/Sidebar/Item.vue index b515f61..e4066f1 100644 --- a/src/views/layout/components/Sidebar/Item.vue +++ b/src/views/layout/components/Sidebar/Item.vue @@ -1,7 +1,14 @@ + diff --git a/src/views/layout/components/Sidebar/SidebarItem.vue b/src/views/layout/components/Sidebar/SidebarItem.vue index 988d662..6c2d5ad 100644 --- a/src/views/layout/components/Sidebar/SidebarItem.vue +++ b/src/views/layout/components/Sidebar/SidebarItem.vue @@ -26,7 +26,7 @@ - + @@ -56,6 +56,16 @@ basePath: { type: String, default: '' + }, + tempData: { + type: Object, + default() { + return { + // '/supWork': 5, + // '/supToRegister': 2, + // '/toAdjust': 1 + } + } } }, data() { @@ -105,3 +115,22 @@ } } + + diff --git a/src/views/layout/components/Sidebar/index.vue b/src/views/layout/components/Sidebar/index.vue index f0315ae..861d9e4 100644 --- a/src/views/layout/components/Sidebar/index.vue +++ b/src/views/layout/components/Sidebar/index.vue @@ -5,7 +5,7 @@ :default-active="$route.path" :collapse="isCollapse" mode="vertical" - background-color="#304156" + background-color="#2f3856" text-color="#bfcbd9" active-text-color="#1bb1a5" > @@ -21,8 +21,18 @@ export default { components: { SidebarItem }, computed: { + permission_routers() { + let permission_routers = this.$store.getters.permission_routers + const currentSystem = this.$store.getters.currentSystem + permission_routers = permission_routers.filter(item => { + if (item.meta && item.meta.sys && item.meta.sys === currentSystem.url) { + return true + } + }) + return permission_routers + }, ...mapGetters([ - 'permission_routers', + // 'permission_routers', 'sidebar' ]), isCollapse() { diff --git a/src/views/layout/components/TagsView/index.vue b/src/views/layout/components/TagsView/index.vue index 325c815..3796293 100644 --- a/src/views/layout/components/TagsView/index.vue +++ b/src/views/layout/components/TagsView/index.vue @@ -2,7 +2,7 @@
      {{ tag.title }} - +
        @@ -48,6 +48,14 @@ routes() { return this.$store.state.permission.routers } + // showClose(tag, index) { + // if (tag.meta.affix) { + // return false + // } else if (index === 0) { + // return false + // } + // return true + // } }, watch: { $route() { @@ -67,6 +75,16 @@ this.addTags() }, methods: { + showClose(tag, index) { + if (tag.meta.affix) { + return false + // } else if (index === 0) { + // return false + } else if (this.visitedViews.length === 1) { + return false + } + return true + }, isActive(route) { return route.path === this.$route.path }, @@ -122,6 +140,7 @@ } }) }, + // 刷新页面 refreshSelectedTag(view) { this.$store.dispatch('tagsView/delCachedView', view).then(() => { const { fullPath } = view @@ -132,6 +151,7 @@ }) }) }, + // 关闭当前 closeSelectedTag(view) { this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => { if (this.isActive(view)) { @@ -139,12 +159,14 @@ } }) }, + // 关闭其他 closeOthersTags() { this.$router.push(this.selectedTag) this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => { this.moveToCurrentTag() }) }, + // 关闭全部 closeAllTags(view) { this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => { if (this.affixTags.some(tag => tag.path === view.path)) { diff --git a/src/views/login/index.vue b/src/views/login/index.vue index a57232c..2248197 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -52,6 +52,7 @@