Commit 477ec56fe3d759df8e1d896c8400a96953ccab82
1 parent
0e2463be
权限
Showing
24 changed files
with
1659 additions
and
130 deletions
package.json
src/api/systemData/commonFields.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 获取字段列表 | |
| 4 | +export function getList(data) { | |
| 5 | + return request({ | |
| 6 | + url: '/api/system/CommonFields', | |
| 7 | + method: 'get', | |
| 8 | + data | |
| 9 | + }) | |
| 10 | +} | |
| 11 | +// 获取字段信息 | |
| 12 | +export function getInfo(id) { | |
| 13 | + return request({ | |
| 14 | + url: `/api/system/CommonFields/${id}`, | |
| 15 | + method: 'get' | |
| 16 | + }) | |
| 17 | +} | |
| 18 | +// 删除字段 | |
| 19 | +export function Delete(id) { | |
| 20 | + return request({ | |
| 21 | + url: `/api/system/CommonFields/${id}`, | |
| 22 | + method: 'DELETE' | |
| 23 | + }) | |
| 24 | +} | |
| 25 | +// 修改字段 | |
| 26 | +export function Update(data) { | |
| 27 | + return request({ | |
| 28 | + url: `/api/system/CommonFields/${data.id}`, | |
| 29 | + method: 'PUT', | |
| 30 | + data | |
| 31 | + }) | |
| 32 | +} | |
| 33 | +// 新建字段 | |
| 34 | +export function Create(data) { | |
| 35 | + return request({ | |
| 36 | + url: '/api/system/CommonFields', | |
| 37 | + method: 'post', | |
| 38 | + data | |
| 39 | + }) | |
| 40 | +} | ... | ... |
src/api/systemData/dataBackup.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 获取数据备份列表(带分页) | |
| 4 | +export function getDataBackupList(data) { | |
| 5 | + return request({ | |
| 6 | + url: '/api/system/DataBackup', | |
| 7 | + method: 'GET', | |
| 8 | + data | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 添加数据备份 | |
| 13 | +export function createDataBackup() { | |
| 14 | + return request({ | |
| 15 | + url: '/api/system/DataBackup', | |
| 16 | + method: 'POST' | |
| 17 | + }) | |
| 18 | +} | |
| 19 | + | |
| 20 | +// 删除数据备份 | |
| 21 | +export function delDataBackup(id) { | |
| 22 | + return request({ | |
| 23 | + url: `/api/system/DataBackup/${id}`, | |
| 24 | + method: 'DELETE' | |
| 25 | + }) | |
| 26 | +} | |
| 0 | 27 | \ No newline at end of file | ... | ... |
src/api/systemData/dataInterface.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 获取接口列表(分页) | |
| 4 | +export function getDataInterfaceList(data) { | |
| 5 | + return request({ | |
| 6 | + url: '/api/system/DataInterface', | |
| 7 | + method: 'GET', | |
| 8 | + data | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 获取接口列表下拉框 | |
| 13 | +export function getDataInterfaceSelector() { | |
| 14 | + return request({ | |
| 15 | + url: '/api/system/DataInterface/Selector', | |
| 16 | + method: 'GET' | |
| 17 | + }) | |
| 18 | +} | |
| 19 | + | |
| 20 | +// 添加接口 | |
| 21 | +export function createDataInterface(data) { | |
| 22 | + return request({ | |
| 23 | + url: '/api/system/DataInterface', | |
| 24 | + method: 'POST', | |
| 25 | + data | |
| 26 | + }) | |
| 27 | +} | |
| 28 | + | |
| 29 | +// 修改接口 | |
| 30 | +export function updateDataInterface(data) { | |
| 31 | + return request({ | |
| 32 | + url: `/api/system/DataInterface/${data.id}`, | |
| 33 | + method: 'PUT', | |
| 34 | + data | |
| 35 | + }) | |
| 36 | +} | |
| 37 | + | |
| 38 | +// 获取接口数据 | |
| 39 | +export function getDataInterfaceInfo(id) { | |
| 40 | + return request({ | |
| 41 | + url: `/api/system/DataInterface/${id}`, | |
| 42 | + method: 'GET' | |
| 43 | + }) | |
| 44 | +} | |
| 45 | + | |
| 46 | +// 删除接口数据 | |
| 47 | +export function delDataInterface(id) { | |
| 48 | + return request({ | |
| 49 | + url: `/api/system/DataInterface/${id}`, | |
| 50 | + method: 'DELETE' | |
| 51 | + }) | |
| 52 | +} | |
| 53 | + | |
| 54 | +// 更新接口状态 | |
| 55 | +export function updateDataInterfaceState(id) { | |
| 56 | + return request({ | |
| 57 | + url: `/api/system/DataInterface/${id}/Actions/State`, | |
| 58 | + method: 'PUT' | |
| 59 | + }) | |
| 60 | +} | |
| 61 | + | |
| 62 | +// 获取接口分类 | |
| 63 | +export function getDataInterfaceTypeSelector() { | |
| 64 | + return request({ | |
| 65 | + url: '/api/system/DictionaryData/9c43287481364d348c0ea0d0f64b38be/Data/Selector', | |
| 66 | + method: 'GET' | |
| 67 | + }) | |
| 68 | +} | |
| 69 | + | |
| 70 | +// 获取接口数据 | |
| 71 | +export function previewDataInterface(id) { | |
| 72 | + return request({ | |
| 73 | + url: `/api/system/DataInterface/${id}/Actions/Response`, | |
| 74 | + method: 'GET' | |
| 75 | + }) | |
| 76 | +} | |
| 77 | + | |
| 78 | +// 导出数据接口数据 | |
| 79 | +export function exportData(id) { | |
| 80 | + return request({ | |
| 81 | + url: `/api/system/DataInterface/${id}/Action/Export`, | |
| 82 | + method: 'GET' | |
| 83 | + }) | |
| 84 | +} | |
| 85 | + | |
| 86 | +// 获取数据接口调用日志列表 | |
| 87 | +export function getDataInterfaceLog(id, data) { | |
| 88 | + return request({ | |
| 89 | + url: `/api/system/DataInterfaceLog/${id}`, | |
| 90 | + method: 'GET', | |
| 91 | + data | |
| 92 | + }) | |
| 93 | +} | |
| 0 | 94 | \ No newline at end of file | ... | ... |
src/api/systemData/dataModel.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 获取数据库表列表 | |
| 4 | +export function DataModelList(id, data) { | |
| 5 | + return request({ | |
| 6 | + url: `/api/system/DataModel/${id}/Tables`, | |
| 7 | + method: 'get', | |
| 8 | + data | |
| 9 | + }) | |
| 10 | +} | |
| 11 | +// 添加数据表 | |
| 12 | +export function DataModelCreate(linkId, data) { | |
| 13 | + return request({ | |
| 14 | + url: `/api/system/DataModel/${linkId}/Table`, | |
| 15 | + method: 'post', | |
| 16 | + data | |
| 17 | + }) | |
| 18 | +} | |
| 19 | +// 预览数据库表 | |
| 20 | +export function DataModelData(linkId, table, data) { | |
| 21 | + return request({ | |
| 22 | + url: `/api/system/DataModel/${linkId}/Table/${table}/Preview`, | |
| 23 | + method: 'get', | |
| 24 | + data | |
| 25 | + }) | |
| 26 | +} | |
| 27 | +// 删除数据表 | |
| 28 | +export function DataModelDelete(linkId, id) { | |
| 29 | + return request({ | |
| 30 | + url: `/api/system/DataModel/${linkId}/Table/${id}`, | |
| 31 | + method: 'delete', | |
| 32 | + }) | |
| 33 | +} | |
| 34 | +// 获取数据库表字段列表 | |
| 35 | +export function DataModelFieldList(linkId, table, type) { | |
| 36 | + return request({ | |
| 37 | + url: `/api/system/DataModel/${linkId}/Tables/${table}/Fields?type=${type}`, | |
| 38 | + method: 'get' | |
| 39 | + }) | |
| 40 | +} | |
| 41 | +// 获取数据表 | |
| 42 | +export function DataModelInfo(linkId, id) { | |
| 43 | + return request({ | |
| 44 | + url: `/api/system/DataModel/${linkId}/Table/${id}`, | |
| 45 | + method: 'get', | |
| 46 | + }) | |
| 47 | +} | |
| 48 | +// 修改数据表 | |
| 49 | +export function DataModelUpdate(linkId, data) { | |
| 50 | + return request({ | |
| 51 | + url: `/api/system/DataModel/${linkId}/Table`, | |
| 52 | + method: 'put', | |
| 53 | + data | |
| 54 | + }) | |
| 55 | +} | |
| 56 | +// 导出 | |
| 57 | +export function exportTpl(linkId, id) { | |
| 58 | + return request({ | |
| 59 | + url: `/api/system/DataModel/${linkId}/Table/${id}/Action/Export`, | |
| 60 | + method: 'get' | |
| 61 | + }) | |
| 62 | +} | |
| 0 | 63 | \ No newline at end of file | ... | ... |
src/api/systemData/dataSource.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +export function getDataSourceList(data) { | |
| 4 | + return request({ | |
| 5 | + url: '/api/system/DataSource', | |
| 6 | + method: 'get', | |
| 7 | + data | |
| 8 | + }) | |
| 9 | +} | |
| 10 | +export function DataSourceCreate(data) { | |
| 11 | + return request({ | |
| 12 | + url: '/api/system/DataSource', | |
| 13 | + method: 'post', | |
| 14 | + data | |
| 15 | + }) | |
| 16 | +} | |
| 17 | +export function DataSourceDelete(id) { | |
| 18 | + return request({ | |
| 19 | + url: `/api/system/DataSource/${id}`, | |
| 20 | + method: 'delete', | |
| 21 | + }) | |
| 22 | +} | |
| 23 | +export function DataSourceInfo(id) { | |
| 24 | + return request({ | |
| 25 | + url: `/api/system/DataSource/${id}`, | |
| 26 | + method: 'get', | |
| 27 | + }) | |
| 28 | +} | |
| 29 | +export function DataSourceUpdate(data) { | |
| 30 | + return request({ | |
| 31 | + url: `/api/system/DataSource/${data.id}`, | |
| 32 | + method: 'put', | |
| 33 | + data | |
| 34 | + }) | |
| 35 | +} | |
| 36 | +export function TestDbConnection(data) { | |
| 37 | + return request({ | |
| 38 | + url: `/api/system/DataSource/Actions/Test`, | |
| 39 | + method: 'post', | |
| 40 | + data | |
| 41 | + }) | |
| 42 | +} | |
| 43 | +export function getDataSourceListAll() { | |
| 44 | + return request({ | |
| 45 | + url: '/api/system/DataSource/Selector', | |
| 46 | + method: 'get', | |
| 47 | + }) | |
| 48 | +} | |
| 49 | +export function Execute(data) { | |
| 50 | + return request({ | |
| 51 | + url: `/api/system/DataSync/Actions/Execute`, | |
| 52 | + method: 'post', | |
| 53 | + data | |
| 54 | + }) | |
| 55 | +} | |
| 56 | +export function DataSync(data) { | |
| 57 | + return request({ | |
| 58 | + url: `api/system/DataSync`, | |
| 59 | + method: 'post', | |
| 60 | + data | |
| 61 | + }) | |
| 62 | +} | |
| 0 | 63 | \ No newline at end of file | ... | ... |
src/api/systemData/dictionary.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 获取数据字典分类 | |
| 4 | +export function getDictionaryType() { | |
| 5 | + return request({ | |
| 6 | + url: '/api/system/DictionaryType', | |
| 7 | + method: 'GET' | |
| 8 | + }) | |
| 9 | +} | |
| 10 | + | |
| 11 | +// 获取字典分类下拉框列表 | |
| 12 | +export function getDictionaryTypeSelector(id) { | |
| 13 | + return request({ | |
| 14 | + url: '/api/system/DictionaryType/Selector/' + (!!id ? id : 0), | |
| 15 | + method: 'GET' | |
| 16 | + }) | |
| 17 | +} | |
| 18 | + | |
| 19 | +// 添加数据字典分类 | |
| 20 | +export function createDictionaryType(data) { | |
| 21 | + return request({ | |
| 22 | + url: `/api/system/DictionaryType`, | |
| 23 | + method: 'POST', | |
| 24 | + data | |
| 25 | + }) | |
| 26 | +} | |
| 27 | + | |
| 28 | +// 修改数据字典分类 | |
| 29 | +export function updateDictionaryType(data) { | |
| 30 | + return request({ | |
| 31 | + url: `/api/system/DictionaryType/${data.id}`, | |
| 32 | + method: 'PUT', | |
| 33 | + data | |
| 34 | + }) | |
| 35 | +} | |
| 36 | + | |
| 37 | +// 获取数据字典分类信息 | |
| 38 | +export function getDictionaryTypeInfo(id) { | |
| 39 | + return request({ | |
| 40 | + url: `/api/system/DictionaryType/${id}`, | |
| 41 | + method: 'GET' | |
| 42 | + }) | |
| 43 | +} | |
| 44 | + | |
| 45 | +// 删除数据字典分类 | |
| 46 | +export function delDictionaryType(id) { | |
| 47 | + return request({ | |
| 48 | + url: `/api/system/DictionaryType/${id}`, | |
| 49 | + method: 'DELETE' | |
| 50 | + }) | |
| 51 | +} | |
| 52 | + | |
| 53 | +// 获取数据字典列表 | |
| 54 | +export function getDictionaryDataList(typeId, data) { | |
| 55 | + return request({ | |
| 56 | + url: `/api/system/DictionaryData/${typeId}`, | |
| 57 | + method: 'GET', | |
| 58 | + data | |
| 59 | + }) | |
| 60 | +} | |
| 61 | + | |
| 62 | +// 获取数据字典列表(分类+内容) | |
| 63 | +export function getDictionaryAll() { | |
| 64 | + return request({ | |
| 65 | + url: `/api/system/DictionaryData/All`, | |
| 66 | + method: 'GET' | |
| 67 | + }) | |
| 68 | +} | |
| 69 | + | |
| 70 | +// 获取字典分类下拉框(项目上级) | |
| 71 | +export function getDictionaryDataTypeSelector(dictionaryTypeId, isTree, id) { | |
| 72 | + return request({ | |
| 73 | + url: `/api/system/DictionaryData/${dictionaryTypeId}/Selector/` + (!!id ? id : 0), | |
| 74 | + method: 'GET', | |
| 75 | + data: { isTree } | |
| 76 | + }) | |
| 77 | +} | |
| 78 | + | |
| 79 | +// 获取字典数据下拉框列表 | |
| 80 | +export function getDictionaryDataSelector(dictionaryTypeId) { | |
| 81 | + return request({ | |
| 82 | + url: `/api/system/DictionaryData/${dictionaryTypeId}/Data/Selector`, | |
| 83 | + method: 'GET' | |
| 84 | + }) | |
| 85 | +} | |
| 86 | + | |
| 87 | +// 添加数据字典 | |
| 88 | +export function createDictionaryData(data) { | |
| 89 | + return request({ | |
| 90 | + url: '/api/system/DictionaryData', | |
| 91 | + method: 'POST', | |
| 92 | + data | |
| 93 | + }) | |
| 94 | +} | |
| 95 | + | |
| 96 | +// 修改数据字典 | |
| 97 | +export function updateDictionaryData(data) { | |
| 98 | + return request({ | |
| 99 | + url: `/api/system/DictionaryData/${data.id}`, | |
| 100 | + method: 'PUT', | |
| 101 | + data | |
| 102 | + }) | |
| 103 | +} | |
| 104 | + | |
| 105 | +// 获取数据字典信息 | |
| 106 | +export function getDictionaryDataInfo(id) { | |
| 107 | + return request({ | |
| 108 | + url: `/api/system/DictionaryData/${id}/Info`, | |
| 109 | + method: 'GET' | |
| 110 | + }) | |
| 111 | +} | |
| 112 | + | |
| 113 | +// 删除数据字典信息 | |
| 114 | +export function delDictionaryData(id) { | |
| 115 | + return request({ | |
| 116 | + url: `/api/system/DictionaryData/${id}`, | |
| 117 | + method: 'DELETE' | |
| 118 | + }) | |
| 119 | +} | |
| 120 | + | |
| 121 | +// 更新字典状态 | |
| 122 | +export function updateDictionaryState(id) { | |
| 123 | + return request({ | |
| 124 | + url: `/api/system/DictionaryData/${id}/Actions/State`, | |
| 125 | + method: 'PUT' | |
| 126 | + }) | |
| 127 | +} | |
| 128 | + | |
| 129 | +// 导出数据字典数据 | |
| 130 | +export function exportData(id) { | |
| 131 | + return request({ | |
| 132 | + url: `/api/system/DictionaryData/${id}/Action/Export`, | |
| 133 | + method: 'GET' | |
| 134 | + }) | |
| 135 | +} | |
| 0 | 136 | \ No newline at end of file | ... | ... |
src/assets/images/404.png
0 → 100644
46.3 KB
src/permission.js
| ... | ... | @@ -23,14 +23,21 @@ router.beforeEach((to, from, next) => { |
| 23 | 23 | isRelogin.show = true |
| 24 | 24 | |
| 25 | 25 | // 判断当前用户是否已拉取完user_info信息 |
| 26 | - store.dispatch('GetInfo').then(() => { | |
| 26 | + store.dispatch('GetInfo').then((res) => { | |
| 27 | 27 | isRelogin.show = false |
| 28 | - next({ ...to, replace: true }) | |
| 29 | - // store.dispatch('GenerateRoutes').then(accessRoutes => { | |
| 30 | - // // 根据roles权限生成可访问的路由表 | |
| 31 | - // router.addRoutes(accessRoutes) // 动态添加可访问路由表 | |
| 32 | - // next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 | |
| 33 | - // }) | |
| 28 | + store.dispatch('generateRoutes', res).then(accessRoutes => { | |
| 29 | + console.log(accessRoutes); | |
| 30 | + // 根据roles权限生成可访问的路由表 | |
| 31 | + // router.addRoutes(accessRoutes) // 动态添加可访问路由表 | |
| 32 | + console.log(router.addRoutes); | |
| 33 | + router.addRoutes([{ | |
| 34 | + path: '/404', | |
| 35 | + component: (resolve) => require(['@/views/error-page/404'], resolve), | |
| 36 | + hidden: true | |
| 37 | + }]) // 动态添加可访问路由表 | |
| 38 | + console.log(router); | |
| 39 | + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 | |
| 40 | + }) | |
| 34 | 41 | }).catch(err => { |
| 35 | 42 | store.dispatch('LogOut').then(() => { |
| 36 | 43 | Message.error(err) | ... | ... |
src/router/index.js
| ... | ... | @@ -2,45 +2,58 @@ |
| 2 | 2 | import Vue from "vue"; |
| 3 | 3 | import VueRouter from "vue-router"; |
| 4 | 4 | import Layout from '@/views/homePage/HomePage.vue' |
| 5 | - | |
| 5 | +import baseRouter from './modules/base' | |
| 6 | 6 | |
| 7 | 7 | Vue.use(VueRouter); |
| 8 | 8 | |
| 9 | -const router = new VueRouter({ | |
| 10 | - mode: 'hash', // 使用 hash 模式 | |
| 11 | - routes: [ | |
| 12 | - { | |
| 13 | - path: '', | |
| 14 | - component: Layout, | |
| 15 | - name: 'homePage', | |
| 16 | - children: [ | |
| 17 | - { | |
| 18 | - path: '/homePage', | |
| 19 | - name: 'homePage', | |
| 20 | - component: () => import('@/views/overView/Overview.vue'), | |
| 21 | - meta: { title: '首页', icon: 'dashboard', affix: true } | |
| 22 | - }, | |
| 23 | - ] | |
| 24 | - }, | |
| 25 | - { | |
| 26 | - path: '', | |
| 27 | - component: Layout, | |
| 28 | - name: 'infoList', | |
| 29 | - children: [ | |
| 30 | - { | |
| 31 | - path: '/infoList', | |
| 32 | - name: 'infoList', | |
| 33 | - component: () => import('@/views/systemPage/InfoList.vue'), | |
| 34 | - meta: { title: '系统', icon: 'dashboard', affix: true } | |
| 35 | - }, | |
| 36 | - ] | |
| 37 | - }, | |
| 38 | - { | |
| 39 | - path: '/login', | |
| 40 | - name: 'login', | |
| 41 | - component: () => import('@/views/Login.vue'), | |
| 42 | - }, | |
| 43 | - ] | |
| 44 | -}); | |
| 9 | +export const constantRoutes = [ | |
| 10 | + { | |
| 11 | + path: '/404', | |
| 12 | + name: '404', | |
| 13 | + component: (resolve) => require(['@/views/error-page/404.vue'], resolve), | |
| 14 | + hidden: true | |
| 15 | + }, | |
| 16 | + { | |
| 17 | + path: '/login', | |
| 18 | + component: (resolve) => require(['@/views/Login.vue'], resolve), | |
| 19 | + hidden: true | |
| 20 | + }, | |
| 21 | + { | |
| 22 | + path: '', | |
| 23 | + name: 'homePage', | |
| 24 | + component: Layout, | |
| 25 | + children: [ | |
| 26 | + { | |
| 27 | + path: '/homePage', | |
| 28 | + name: 'homePage', | |
| 29 | + component: (resolve) => require(['@/views/overView/Overview.vue'], resolve), | |
| 30 | + meta: { title: '首页', icon: 'dashboard', affix: true }, | |
| 31 | + }, | |
| 32 | + ], | |
| 33 | + hidden: true | |
| 34 | + }, | |
| 35 | + ...baseRouter | |
| 36 | +] | |
| 37 | + | |
| 38 | +const createRouter = () => { | |
| 39 | + return new VueRouter({ | |
| 40 | + mode: 'hash', // 使用 hash 模式 | |
| 41 | + routes: constantRoutes | |
| 42 | + }); | |
| 43 | +} | |
| 44 | + | |
| 45 | +const originalPush = VueRouter.prototype.push | |
| 46 | +VueRouter.prototype.push = function push(location) { | |
| 47 | + return originalPush.call(this, location).catch(err => { | |
| 48 | + if (err && err.name != 'NavigationDuplicated') this.replace('/404') | |
| 49 | + }) | |
| 50 | +} | |
| 51 | + | |
| 52 | +const router = createRouter(); | |
| 53 | + | |
| 54 | +export function resetRouter() { | |
| 55 | + const newRouter = createRouter() | |
| 56 | + router.matcher = newRouter.matcher // reset router | |
| 57 | +} | |
| 45 | 58 | |
| 46 | 59 | export default router; |
| 47 | 60 | \ No newline at end of file | ... | ... |
src/router/modules/base.js
0 → 100644
| 1 | +// 基础路由 | |
| 2 | +import Layout from '@/views/homePage/HomePage.vue' | |
| 3 | + | |
| 4 | +const baseRouter = [ | |
| 5 | + { | |
| 6 | + path: '', | |
| 7 | + meta: { title: '基础信息库', icon: 'dashboard', affix: true }, | |
| 8 | + component: Layout, | |
| 9 | + children: [ | |
| 10 | + { | |
| 11 | + path: '/infoList', | |
| 12 | + name: 'infoList', | |
| 13 | + component: (resolve) => require(['@/views/systemPage/InfoList.vue'], resolve), | |
| 14 | + meta: { title: '应用信息', icon: 'dashboard', affix: true }, | |
| 15 | + id: 3, | |
| 16 | + }, | |
| 17 | + { | |
| 18 | + path: '/baseComapnyInfo', | |
| 19 | + name: 'baseComapnyInfo', | |
| 20 | + component: (resolve) => require(['@/views/baseComapnyInfo/index.vue'], resolve), | |
| 21 | + meta: { title: '公司信息', icon: 'dashboard', affix: true }, | |
| 22 | + id: 4, | |
| 23 | + } | |
| 24 | + ] | |
| 25 | + }, | |
| 26 | +] | |
| 27 | +export default baseRouter | |
| 0 | 28 | \ No newline at end of file | ... | ... |
src/store/modules/permission.js
| 1 | 1 | // import auth from '@/plugins/auth' |
| 2 | -import router, { constantRoutes, dynamicRoutes } from '@/router' | |
| 2 | +import { constantRoutes } from '@/router' | |
| 3 | +import VueRouter from "vue-router"; | |
| 3 | 4 | // import { getRouters } from '@/api/menu' |
| 4 | 5 | import Layout from '@/views/homePage/HomePage.vue' |
| 5 | -import ParentView from '@/components/ParentView' | |
| 6 | +import baseRouters from '@/router/modules/base' | |
| 6 | 7 | |
| 7 | 8 | const permission = { |
| 8 | 9 | state: { |
| 9 | 10 | routes: [], |
| 10 | - addRoutes: [], | |
| 11 | - defaultRoutes: [], | |
| 12 | - topbarRouters: [], | |
| 13 | - sidebarRouters: [] | |
| 11 | + addRoutes: [] | |
| 14 | 12 | }, |
| 15 | 13 | mutations: { |
| 16 | 14 | SET_ROUTES: (state, routes) => { |
| 17 | 15 | state.addRoutes = routes |
| 18 | 16 | state.routes = constantRoutes.concat(routes) |
| 19 | - }, | |
| 20 | - SET_DEFAULT_ROUTES: (state, routes) => { | |
| 21 | - state.defaultRoutes = constantRoutes.concat(routes) | |
| 22 | - }, | |
| 23 | - SET_TOPBAR_ROUTES: (state, routes) => { | |
| 24 | - state.topbarRouters = routes | |
| 25 | - }, | |
| 26 | - SET_SIDEBAR_ROUTERS: (state, routes) => { | |
| 27 | - state.sidebarRouters = routes | |
| 28 | - }, | |
| 17 | + } | |
| 29 | 18 | }, |
| 30 | 19 | actions: { |
| 31 | - // 生成路由 | |
| 32 | - GenerateRoutes({ commit }) { | |
| 20 | + generateRoutes({ commit }, route) { | |
| 33 | 21 | return new Promise(resolve => { |
| 34 | - // 向后端请求路由数据 | |
| 35 | - // getRouters().then(res => { | |
| 36 | - // let data = res.data.filter(v => !(v.name && v.name == 'System')); | |
| 37 | - // const sdata = JSON.parse(JSON.stringify(data)) | |
| 38 | - // const rdata = JSON.parse(JSON.stringify(data)) | |
| 39 | - // const sidebarRoutes = filterAsyncRouter(sdata) | |
| 40 | - // const rewriteRoutes = filterAsyncRouter(rdata, false, true) | |
| 41 | - // const asyncRoutes = filterDynamicRoutes(dynamicRoutes); | |
| 42 | - // rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true }) | |
| 43 | - // router.addRoutes(asyncRoutes); | |
| 44 | - // commit('SET_ROUTES', rewriteRoutes) | |
| 45 | - // commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes)) | |
| 46 | - // commit('SET_DEFAULT_ROUTES', sidebarRoutes) | |
| 47 | - // commit('SET_TOPBAR_ROUTES', sidebarRoutes) | |
| 48 | - // resolve(rewriteRoutes) | |
| 49 | - // }) | |
| 22 | + let accessedRoutes | |
| 23 | + let dtRoutes = { | |
| 24 | + path: '/', | |
| 25 | + component: Layout, | |
| 26 | + redirect: '/homePage', | |
| 27 | + children: [ | |
| 28 | + ...baseRouters, | |
| 29 | + ...route, | |
| 30 | + { | |
| 31 | + path: '/404', | |
| 32 | + component: (resolve) => require(['@/views/error-page/404'], resolve), | |
| 33 | + hidden: true | |
| 34 | + }, | |
| 35 | + ] | |
| 36 | + }; | |
| 37 | + accessedRoutes = [ | |
| 38 | + dtRoutes, | |
| 39 | + { | |
| 40 | + path: '*', | |
| 41 | + redirect: '/404', | |
| 42 | + hidden: true | |
| 43 | + } | |
| 44 | + ] | |
| 45 | + console.log(accessedRoutes, baseRouters); | |
| 46 | + commit('SET_ROUTES', accessedRoutes) | |
| 47 | + resolve(accessedRoutes) | |
| 50 | 48 | }) |
| 51 | 49 | } |
| 52 | 50 | } | ... | ... |
src/store/modules/user.js
| 1 | 1 | import { login, getInfo, logout } from '@/api/index' |
| 2 | 2 | import { getToken, setToken, removeToken } from '@/utils/auth' |
| 3 | +import { resetRouter } from '@/router' | |
| 3 | 4 | import md5 from "js-md5"; // 密码加密 |
| 5 | +const define = require('@/utils/define') | |
| 6 | +import qs from 'qs' | |
| 7 | + | |
| 4 | 8 | |
| 5 | 9 | const user = { |
| 6 | 10 | state: { |
| ... | ... | @@ -10,6 +14,9 @@ const user = { |
| 10 | 14 | avatar: '', |
| 11 | 15 | roles: [], |
| 12 | 16 | address: '', |
| 17 | + loginLoading: '', | |
| 18 | + userInfo: {}, | |
| 19 | + menuList: [], | |
| 13 | 20 | }, |
| 14 | 21 | |
| 15 | 22 | mutations: { |
| ... | ... | @@ -30,6 +37,15 @@ const user = { |
| 30 | 37 | }, |
| 31 | 38 | SET_ADDRESS: (state, address) => { |
| 32 | 39 | state.address = address |
| 40 | + }, | |
| 41 | + SET_LOGIN_LOADING: (state, loginLoading) => { | |
| 42 | + state.loginLoading = loginLoading | |
| 43 | + }, | |
| 44 | + SET_USERINFO: (state, userInfo) => { | |
| 45 | + state.userInfo = userInfo | |
| 46 | + }, | |
| 47 | + SET_MENULIST: (state, menuList) => { | |
| 48 | + state.menuList = menuList | |
| 33 | 49 | } |
| 34 | 50 | }, |
| 35 | 51 | |
| ... | ... | @@ -53,19 +69,121 @@ const user = { |
| 53 | 69 | GetInfo({ commit, state }) { |
| 54 | 70 | return new Promise((resolve, reject) => { |
| 55 | 71 | getInfo().then((res) => { |
| 56 | - let { data } = res; | |
| 57 | - const user = data.userInfo | |
| 58 | - const avatar = (user.headIcon == "" || user.headIcon == null) || require("@/assets/images/user.jpg"); | |
| 59 | - if (user.roleIds && user.roleIds.length > 0) { // 验证返回的roles是否是一个非空数组 | |
| 60 | - commit('SET_ROLES', user.roleIds) | |
| 72 | + let { menuList, userInfo, permissionList } = res.data | |
| 73 | + const avatar = (userInfo.headIcon == "" || userInfo.headIcon == null) || require("@/assets/images/user.jpg"); | |
| 74 | + if (!menuList.length) { | |
| 75 | + reject('您的权限不足,请联系管理员') | |
| 76 | + return false; | |
| 77 | + } | |
| 78 | + let routerList = [] | |
| 79 | + | |
| 80 | + function setData(list) { | |
| 81 | + for (let i = 0; i < list.length; i++) { | |
| 82 | + const e = list[i] | |
| 83 | + let name = e.enCode.replace(/\./g, '-') | |
| 84 | + e.vueName = name | |
| 85 | + if (e.type == 1) { | |
| 86 | + e.path = '/' + e.enCode | |
| 87 | + if (e.hasChildren && e.children.length) { | |
| 88 | + setData(e.children) | |
| 89 | + } | |
| 90 | + } | |
| 91 | + if (e.type == 2) { | |
| 92 | + let path = e.urlAddress | |
| 93 | + if (path.indexOf("?") > -1) path = path.split("?")[0] | |
| 94 | + e.path = '/' + e.urlAddress | |
| 95 | + let newObj = { | |
| 96 | + path: '/' + path, | |
| 97 | + component: (resolve) => require([`@/views/${path}`], resolve), | |
| 98 | + name: name, | |
| 99 | + meta: { | |
| 100 | + title: name, | |
| 101 | + icon: e.icon, | |
| 102 | + zhTitle: e.fullName, | |
| 103 | + modelId: e.id | |
| 104 | + } | |
| 105 | + } | |
| 106 | + routerList.push(newObj) | |
| 107 | + } | |
| 108 | + // 功能、字典、报表、门户 | |
| 109 | + if ([3, 4, 5, 8].indexOf(e.type) > -1) { | |
| 110 | + let propertyJson = e.propertyJson ? JSON.parse(e.propertyJson) : null, | |
| 111 | + relationId = '', | |
| 112 | + isTree = 0, | |
| 113 | + componentUrl = '' | |
| 114 | + if (propertyJson) { | |
| 115 | + relationId = propertyJson.moduleId || '' | |
| 116 | + isTree = propertyJson.isTree || 0 | |
| 117 | + } | |
| 118 | + if (e.type == 3) { | |
| 119 | + componentUrl = 'dynamicModel' | |
| 120 | + } else if (e.type == 4) { | |
| 121 | + componentUrl = 'dynamicDictionary' | |
| 122 | + } else if (e.type == 5) { | |
| 123 | + componentUrl = 'dynamicDataReport' | |
| 124 | + } else { | |
| 125 | + componentUrl = 'dynamicPortal' | |
| 126 | + } | |
| 127 | + e.path = '/' + e.urlAddress | |
| 128 | + let newObj = { | |
| 129 | + path: '/' + e.urlAddress, | |
| 130 | + component: (resolve) => require([`@/views/basic/${componentUrl}`], resolve), | |
| 131 | + name: e.enCode, | |
| 132 | + meta: { | |
| 133 | + title: name, | |
| 134 | + icon: e.icon, | |
| 135 | + zhTitle: e.fullName, | |
| 136 | + modelId: e.id, | |
| 137 | + relationId, | |
| 138 | + isTree | |
| 139 | + } | |
| 140 | + } | |
| 141 | + routerList.push(newObj) | |
| 142 | + } | |
| 143 | + // 大屏 | |
| 144 | + if (e.type == 6) { | |
| 145 | + let propertyJson = e.propertyJson ? JSON.parse(e.propertyJson) : null, | |
| 146 | + moduleId = ''; | |
| 147 | + if (propertyJson) moduleId = propertyJson.moduleId || '' | |
| 148 | + e.path = `${define.dataV}/view/${moduleId}?token=${getToken()}` | |
| 149 | + } | |
| 150 | + // 外链 | |
| 151 | + if (e.type == 7) { | |
| 152 | + if (e.linkTarget === "_self") { | |
| 153 | + e.path = '/' + e.enCode | |
| 154 | + let newObj = { | |
| 155 | + path: '/' + e.enCode, | |
| 156 | + component: (resolve) => require([`@/views/basic/externalLink`], resolve), | |
| 157 | + name: e.enCode, | |
| 158 | + meta: { | |
| 159 | + title: name, | |
| 160 | + icon: e.icon, | |
| 161 | + zhTitle: e.fullName, | |
| 162 | + modelId: e.id, | |
| 163 | + urlAddress: e.urlAddress | |
| 164 | + } | |
| 165 | + } | |
| 166 | + routerList.push(newObj) | |
| 167 | + } else { | |
| 168 | + const path = e.urlAddress.replace(/\${dataV}/g, define.dataV).replace(/\${nccToken}/g, getToken()) | |
| 169 | + e.path = path | |
| 170 | + } | |
| 171 | + } | |
| 172 | + } | |
| 173 | + } | |
| 174 | + setData(menuList); | |
| 175 | + if (userInfo.roleIds && userInfo.roleIds.length > 0) { // 验证返回的roles是否是一个非空数组 | |
| 176 | + commit('SET_ROLES', userInfo.roleIds) | |
| 61 | 177 | } else { |
| 62 | 178 | commit('SET_ROLES', ['ROLE_DEFAULT']) |
| 63 | 179 | } |
| 64 | - commit('SET_ID', user.userId) | |
| 65 | - commit('SET_NAME', user.userName) | |
| 180 | + commit('SET_ID', userInfo.userId) | |
| 181 | + commit('SET_NAME', userInfo.userName) | |
| 66 | 182 | commit('SET_AVATAR', avatar) |
| 67 | - commit('SET_ADDRESS', user.loginIPAddressName) | |
| 68 | - resolve(res) | |
| 183 | + commit('SET_ADDRESS', userInfo.loginIPAddressName) | |
| 184 | + commit('SET_USERINFO', userInfo) | |
| 185 | + commit('SET_MENULIST', menuList) | |
| 186 | + resolve(routerList) | |
| 69 | 187 | }).catch(error => { |
| 70 | 188 | reject(error) |
| 71 | 189 | }) | ... | ... |
src/utils/define.js
0 → 100644
| 1 | +// 开发环境接口配置 | |
| 2 | +// JAVA Boot版本对应后端接口地址 | |
| 3 | +// JAVA Cloud对应网关地址 | |
| 4 | +const APIURl = 'http://localhost:8061' | |
| 5 | + | |
| 6 | +module.exports = { | |
| 7 | + APIURl: APIURl, | |
| 8 | + timeout: process.env.NODE_ENV === 'development' ? 10000 : 1000000, | |
| 9 | + WebSocketUrl: process.env.NODE_ENV === 'development' ? APIURl.replace('http', 'ws') + '/api/message/websocket' : process.env.VUE_APP_BASE_WSS, | |
| 10 | + comUploadUrl: process.env.VUE_APP_BASE_API + '/api/file/Uploader', | |
| 11 | + comUrl: process.env.VUE_APP_BASE_API, | |
| 12 | + // 本地文件预览 | |
| 13 | + filePreviewServer: process.env.NODE_ENV === 'development' ? 'http://localhost:30090' : process.env.VUE_APP_BASE_API + '/FileServer', | |
| 14 | + // 大屏应用前端路径 | |
| 15 | + dataV: process.env.NODE_ENV === 'development' ? 'http://localhost:8100/DataV' : process.env.VUE_APP_BASE_API + '/DataV', | |
| 16 | + // 数据报表接口-java boot | |
| 17 | + reportServer: process.env.NODE_ENV === 'development' ? 'http://localhost:30007' : process.env.VUE_APP_BASE_API + '/ReportServer', | |
| 18 | + // 数据报表接口-java cloud | |
| 19 | + // reportServer: process.env.NODE_ENV === 'development' ? 'http://localhost:30000' : process.env.VUE_APP_BASE_API, | |
| 20 | + // 报表前端 | |
| 21 | + report: process.env.NODE_ENV === 'development' ? 'http://localhost:8200' : process.env.VUE_APP_BASE_API + '/Report', | |
| 22 | + version: '3.2' | |
| 23 | +} | |
| 0 | 24 | \ No newline at end of file | ... | ... |
src/utils/ncc.js
0 → 100644
| 1 | +import store from '@/store' | |
| 2 | +import dayjs from 'dayjs' | |
| 3 | +import context from '@/main' | |
| 4 | +const STORAGEPREFIX = 'ncc_' | |
| 5 | +const STORAGETYPE = window.localStorage | |
| 6 | + | |
| 7 | +const ncc = { | |
| 8 | + toDateText(dateTimeStamp) { | |
| 9 | + let result = '' | |
| 10 | + let minute = 1000 * 60; //把分,时,天,周,半个月,一个月用毫秒表示 | |
| 11 | + let hour = minute * 60; | |
| 12 | + let day = hour * 24; | |
| 13 | + let week = day * 7; | |
| 14 | + let halfamonth = day * 15; | |
| 15 | + let month = day * 30; | |
| 16 | + let now = new Date().getTime(); //获取当前时间毫秒 | |
| 17 | + let diffValue = now - dateTimeStamp; //时间差 | |
| 18 | + if (diffValue < 0) return "刚刚" | |
| 19 | + let minC = diffValue / minute; //计算时间差的分,时,天,周,月 | |
| 20 | + let hourC = diffValue / hour; | |
| 21 | + let dayC = diffValue / day; | |
| 22 | + let weekC = diffValue / week; | |
| 23 | + let monthC = diffValue / month; | |
| 24 | + if (monthC >= 1 && monthC <= 3) { | |
| 25 | + result = " " + parseInt(monthC) + "月前" | |
| 26 | + } else if (weekC >= 1 && weekC <= 3) { | |
| 27 | + result = " " + parseInt(weekC) + "周前" | |
| 28 | + } else if (dayC >= 1 && dayC <= 6) { | |
| 29 | + result = " " + parseInt(dayC) + "天前" | |
| 30 | + } else if (hourC >= 1 && hourC <= 23) { | |
| 31 | + result = " " + parseInt(hourC) + "小时前" | |
| 32 | + } else if (minC >= 1 && minC <= 59) { | |
| 33 | + result = " " + parseInt(minC) + "分钟前" | |
| 34 | + } else if (diffValue >= 0 && diffValue <= minute) { | |
| 35 | + result = "刚刚" | |
| 36 | + } else { | |
| 37 | + let datetime = new Date(); | |
| 38 | + datetime.setTime(dateTimeStamp); | |
| 39 | + let Nyear = datetime.getFullYear(); | |
| 40 | + let Nmonth = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1; | |
| 41 | + let Ndate = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate(); | |
| 42 | + let Nhour = datetime.getHours() < 10 ? "0" + datetime.getHours() : datetime.getHours(); | |
| 43 | + let Nminute = datetime.getMinutes() < 10 ? "0" + datetime.getMinutes() : datetime.getMinutes(); | |
| 44 | + let Nsecond = datetime.getSeconds() < 10 ? "0" + datetime.getSeconds() : datetime.getSeconds(); | |
| 45 | + result = Nyear + "-" + Nmonth + "-" + Ndate | |
| 46 | + } | |
| 47 | + return result; | |
| 48 | + }, | |
| 49 | + getDate(format, strInterval, number) { | |
| 50 | + var myDate = new Date(); | |
| 51 | + var dtTmp = new Date(); | |
| 52 | + if (!!strInterval) { | |
| 53 | + switch (strInterval) { | |
| 54 | + case 's': | |
| 55 | + myDate = new Date(Date.parse(dtTmp) + (1000 * number)); // 秒 | |
| 56 | + break; | |
| 57 | + case 'n': | |
| 58 | + myDate = new Date(Date.parse(dtTmp) + (60000 * number)); // 分 | |
| 59 | + break; | |
| 60 | + case 'h': | |
| 61 | + myDate = new Date(Date.parse(dtTmp) + (3600000 * number)); // 小时 | |
| 62 | + break; | |
| 63 | + case 'd': | |
| 64 | + myDate = new Date(Date.parse(dtTmp) + (86400000 * number)); // 天 | |
| 65 | + break; | |
| 66 | + case 'w': | |
| 67 | + myDate = new Date(Date.parse(dtTmp) + ((86400000 * 7) * number)); // 星期 | |
| 68 | + break; | |
| 69 | + case 'q': | |
| 70 | + myDate = new Date(dtTmp.getFullYear(), (dtTmp.getMonth()) + number * 3, dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds()); // 季度 | |
| 71 | + break; | |
| 72 | + case 'm': | |
| 73 | + myDate = new Date(dtTmp.getFullYear(), (dtTmp.getMonth()) + number, dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds()); // 月 | |
| 74 | + break; | |
| 75 | + case 'y': | |
| 76 | + myDate = new Date((dtTmp.getFullYear() + number), dtTmp.getMonth(), dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds()); // 年 | |
| 77 | + break; | |
| 78 | + default: | |
| 79 | + } | |
| 80 | + } | |
| 81 | + return ncc.toDate(myDate, format); | |
| 82 | + }, | |
| 83 | + toDate(v, format) { | |
| 84 | + format = format ? format : "yyyy-MM-dd HH:mm" | |
| 85 | + if (!v) return ""; | |
| 86 | + var d = v; | |
| 87 | + if (typeof v === 'string') { | |
| 88 | + if (v.indexOf("/Date(") > -1) | |
| 89 | + d = new Date(parseInt(v.replace("/Date(", "").replace(")/", ""), 10)); | |
| 90 | + else | |
| 91 | + d = new Date(Date.parse(v.replace(/-/g, "/").replace("T", " ").split(".")[0])); | |
| 92 | + } else { | |
| 93 | + d = new Date(v) | |
| 94 | + } | |
| 95 | + var o = { | |
| 96 | + "M+": d.getMonth() + 1, | |
| 97 | + "d+": d.getDate(), | |
| 98 | + "h+": d.getHours(), | |
| 99 | + "H+": d.getHours(), | |
| 100 | + "m+": d.getMinutes(), | |
| 101 | + "s+": d.getSeconds(), | |
| 102 | + "q+": Math.floor((d.getMonth() + 3) / 3), | |
| 103 | + "S": d.getMilliseconds() | |
| 104 | + }; | |
| 105 | + if (/(y+)/.test(format)) { | |
| 106 | + format = format.replace(RegExp.$1, (d.getFullYear() + "").substr(4 - RegExp.$1.length)); | |
| 107 | + } | |
| 108 | + for (var k in o) { | |
| 109 | + if (new RegExp("(" + k + ")").test(format)) { | |
| 110 | + format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); | |
| 111 | + } | |
| 112 | + } | |
| 113 | + return format; | |
| 114 | + }, | |
| 115 | + getThatDay(space) { | |
| 116 | + if (space == undefined) { | |
| 117 | + space = 0 | |
| 118 | + } | |
| 119 | + | |
| 120 | + let date = new Date() | |
| 121 | + date.setTime(date.getTime() + 86400000 * space) | |
| 122 | + return this.assemblyDay({ | |
| 123 | + year: date.getFullYear(), | |
| 124 | + month: date.getMonth(), | |
| 125 | + date: date.getDate() | |
| 126 | + }) | |
| 127 | + }, | |
| 128 | + assemblyDay(data) { | |
| 129 | + let year = data.year.toString() | |
| 130 | + data.month = Number(data.month + 1) | |
| 131 | + let month = this.complement(data.month) | |
| 132 | + let date = this.complement(data.date) | |
| 133 | + return year + '-' + month + '-' + date | |
| 134 | + }, | |
| 135 | + complement(value, digit) { | |
| 136 | + digit = digit ? digit : 2 | |
| 137 | + value = Number(value) | |
| 138 | + if (value < Math.pow(10, digit - 1)) { | |
| 139 | + let text = '' | |
| 140 | + for (let i = 0; i < digit - value.toString().length; i++) { | |
| 141 | + text = text + '0' | |
| 142 | + } | |
| 143 | + return text + value | |
| 144 | + } else { | |
| 145 | + return value.toString() | |
| 146 | + } | |
| 147 | + }, | |
| 148 | + toTreeViewJson(data, id, parentIdText, idText) { | |
| 149 | + parentIdText = parentIdText ? parentIdText : 'parentId' | |
| 150 | + idText = idText ? idText : 'id' | |
| 151 | + id = id ? id : 0 | |
| 152 | + let treeJson = []; | |
| 153 | + let childNode = data.filter(v => v[parentIdText] == id); | |
| 154 | + if (childNode.length > 0) { | |
| 155 | + for (let i = 0; i < childNode.length; i++) { | |
| 156 | + let treeModel = { | |
| 157 | + ...childNode[i], | |
| 158 | + hasChildren: !!data.filter(v => v[parentIdText] == childNode[i][idText]).length, | |
| 159 | + ChildNodes: ncc.toTreeViewJson(data, childNode[i][idText], parentIdText, idText), | |
| 160 | + isexpand: childNode[i].isexpand == undefined ? true : childNode[i].isexpand, | |
| 161 | + complete: true, | |
| 162 | + } | |
| 163 | + treeJson.push(treeModel); | |
| 164 | + } | |
| 165 | + } | |
| 166 | + return treeJson; | |
| 167 | + }, | |
| 168 | + toFileSize(size) { | |
| 169 | + if (size == null || size == "") { | |
| 170 | + return ""; | |
| 171 | + } | |
| 172 | + if (size < 1024.00) | |
| 173 | + return ncc.toDecimal(size) + " 字节"; | |
| 174 | + else if (size >= 1024.00 && size < 1048576) | |
| 175 | + return ncc.toDecimal(size / 1024.00) + " KB"; | |
| 176 | + else if (size >= 1048576 && size < 1073741824) | |
| 177 | + return ncc.toDecimal(size / 1024.00 / 1024.00) + " MB"; | |
| 178 | + else if (size >= 1073741824) | |
| 179 | + return ncc.toDecimal(size / 1024.00 / 1024.00 / 1024.00) + " GB"; | |
| 180 | + }, | |
| 181 | + toDecimal(num) { | |
| 182 | + if (num == null) { | |
| 183 | + num = "0"; | |
| 184 | + } | |
| 185 | + num = num.toString().replace(/\$|\,/g, ''); | |
| 186 | + if (isNaN(num)) | |
| 187 | + num = "0"; | |
| 188 | + var sign = (num == (num = Math.abs(num))); | |
| 189 | + num = Math.floor(num * 100 + 0.50000000001); | |
| 190 | + var cents = num % 100; | |
| 191 | + num = Math.floor(num / 100).toString(); | |
| 192 | + if (cents < 10) | |
| 193 | + cents = "0" + cents; | |
| 194 | + for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) | |
| 195 | + num = num.substring(0, num.length - (4 * i + 3)) + '' + | |
| 196 | + num.substring(num.length - (4 * i + 3)); | |
| 197 | + return (((sign) ? '' : '-') + num + '.' + cents); | |
| 198 | + }, | |
| 199 | + toUrl(url) { | |
| 200 | + return process.env.VUE_APP_BASE_API + url; | |
| 201 | + }, | |
| 202 | + getAuth() { | |
| 203 | + return store.getters.token; | |
| 204 | + }, | |
| 205 | + // 基于dayjs日期格式化,时间戳(毫秒)转日期 | |
| 206 | + dateFormat(date, format) { | |
| 207 | + format = format || 'YYYY-MM-DD HH:mm' | |
| 208 | + if (!date) return '' | |
| 209 | + return dayjs(date).format(format) | |
| 210 | + }, | |
| 211 | + // 基于dayjs日期格式化,日期转时间戳(毫秒) | |
| 212 | + timestamp(val) { | |
| 213 | + return dayjs(val).valueOf() | |
| 214 | + }, | |
| 215 | + // 基于dayjs日期格式化, 表格专用 | |
| 216 | + tableDateFormat(row, column, cellValue) { | |
| 217 | + let format = 'YYYY-MM-DD HH:mm' | |
| 218 | + if (!cellValue) return '' | |
| 219 | + return dayjs(cellValue).format(format) | |
| 220 | + }, | |
| 221 | + storageSet(obj) { | |
| 222 | + for (let i in obj) { | |
| 223 | + cacheItem(i, obj[i]) | |
| 224 | + } | |
| 225 | + | |
| 226 | + function cacheItem(key, val) { | |
| 227 | + key = STORAGEPREFIX + key | |
| 228 | + let valType = typeof(val) | |
| 229 | + if (val !== null) { | |
| 230 | + var valConstructor = val.constructor | |
| 231 | + } | |
| 232 | + if (valType === 'string' || valType === 'number' || valType === 'boolean') { | |
| 233 | + if (valConstructor === String) { | |
| 234 | + val = val + '|String' | |
| 235 | + } else if (valConstructor === Number) { | |
| 236 | + val = val + '|Number' | |
| 237 | + } else if (valConstructor === Boolean) { | |
| 238 | + val = val + '|Boolean' | |
| 239 | + } | |
| 240 | + STORAGETYPE.setItem(key, val) | |
| 241 | + } else if (valType === 'object') { | |
| 242 | + if (val === null) { | |
| 243 | + val = JSON.stringify(val) + '|Null' | |
| 244 | + STORAGETYPE.setItem(key, val) | |
| 245 | + } else { | |
| 246 | + if (valConstructor === Array) { | |
| 247 | + val = JSON.stringify(val) + '|Array' | |
| 248 | + } else if (valConstructor === Object) { | |
| 249 | + val = JSON.stringify(val) + '|Object' | |
| 250 | + } | |
| 251 | + STORAGETYPE.setItem(key, val) | |
| 252 | + } | |
| 253 | + } | |
| 254 | + } | |
| 255 | + }, | |
| 256 | + storageGet(key) { | |
| 257 | + key = STORAGEPREFIX + key | |
| 258 | + let keyName = STORAGETYPE.getItem(key) | |
| 259 | + if (keyName === null) { | |
| 260 | + return null | |
| 261 | + } | |
| 262 | + let valArr = keyName.split('|') | |
| 263 | + let getDataType = valArr[valArr.length - 1] | |
| 264 | + valArr.splice(valArr.length - 1, 1) | |
| 265 | + let val = valArr.join('') | |
| 266 | + if (getDataType === 'Number') { | |
| 267 | + val = parseInt(val) | |
| 268 | + } else if (getDataType === 'Boolean') { | |
| 269 | + if (val === 'true') { | |
| 270 | + val = true | |
| 271 | + } else { | |
| 272 | + val = false | |
| 273 | + } | |
| 274 | + } else if (getDataType === 'Array' || getDataType === 'Object' || getDataType === 'Null') { | |
| 275 | + val = JSON.parse(val) | |
| 276 | + } | |
| 277 | + return val | |
| 278 | + }, | |
| 279 | + storageRemove(key) { | |
| 280 | + STORAGETYPE.removeItem(STORAGEPREFIX + key) | |
| 281 | + }, | |
| 282 | + storageClear() { | |
| 283 | + for (let i in STORAGETYPE) { | |
| 284 | + if (i.indexOf(STORAGEPREFIX) !== -1) { | |
| 285 | + STORAGETYPE.removeItem(i) | |
| 286 | + } | |
| 287 | + } | |
| 288 | + }, | |
| 289 | + hasP(enCode) { | |
| 290 | + const permissionList = store.getters && store.getters.permissionList | |
| 291 | + const modelId = context.$route.meta.modelId || '' | |
| 292 | + if (!modelId) return false | |
| 293 | + const list = permissionList.filter(o => o.modelId === modelId) | |
| 294 | + if (!list.length) return false | |
| 295 | + const columnList = list[0] && list[0].column ? list[0].column : [] | |
| 296 | + if (!columnList.length) return false | |
| 297 | + const hasPermission = columnList.some(column => column.enCode === enCode) | |
| 298 | + if (hasPermission) return true | |
| 299 | + return false | |
| 300 | + }, | |
| 301 | + hasFormP(enCode) { | |
| 302 | + return true; | |
| 303 | + const permissionList = store.getters && store.getters.permissionList | |
| 304 | + const modelId = context.$route.meta.modelId || '' | |
| 305 | + if (!modelId) return false | |
| 306 | + const list = permissionList.filter(o => o.modelId === modelId) | |
| 307 | + if (!list.length) return false | |
| 308 | + const formList = list[0] && list[0].form ? list[0].form : [] | |
| 309 | + if (!formList.length) return false | |
| 310 | + const hasPermission = formList.some(form => form.enCode === enCode) | |
| 311 | + if (hasPermission) return true | |
| 312 | + return false | |
| 313 | + }, | |
| 314 | + hasBtnP(enCode) { | |
| 315 | + const permissionList = store.getters && store.getters.permissionList | |
| 316 | + const modelId = context.$route.meta.modelId || '' | |
| 317 | + if (!modelId) return false | |
| 318 | + const list = permissionList.filter(o => o.modelId === modelId) | |
| 319 | + if (!list.length) return false | |
| 320 | + const btnList = list[0] && list[0].button ? list[0].button : [] | |
| 321 | + if (!btnList.length) return false | |
| 322 | + const hasPermission = btnList.some(btn => btn.enCode === enCode) | |
| 323 | + if (hasPermission) return true | |
| 324 | + return false | |
| 325 | + } | |
| 326 | +} | |
| 327 | +export default ncc | |
| 0 | 328 | \ No newline at end of file | ... | ... |
src/views/Login.vue
| ... | ... | @@ -33,7 +33,9 @@ |
| 33 | 33 | <!-- 忘记密码? --> |
| 34 | 34 | </div> |
| 35 | 35 | </div> |
| 36 | - <div class="login-button" @click="toHome">登录</div> | |
| 36 | + <div class="login-button" @click="toHome"> | |
| 37 | + {{ loading ? "登录中。。。" : "登录" }} | |
| 38 | + </div> | |
| 37 | 39 | </el-form> |
| 38 | 40 | </div> |
| 39 | 41 | </div> |
| ... | ... | @@ -45,7 +47,11 @@ import { login } from "@/api/index"; |
| 45 | 47 | import { setToken } from "@/utils/auth"; |
| 46 | 48 | export default { |
| 47 | 49 | name: "Login", |
| 48 | - components: {}, | |
| 50 | + components: { | |
| 51 | + loginLoading() { | |
| 52 | + return this.$store.state.user.loginLoading; | |
| 53 | + }, | |
| 54 | + }, | |
| 49 | 55 | data() { |
| 50 | 56 | return { |
| 51 | 57 | form: { |
| ... | ... | @@ -56,17 +62,32 @@ export default { |
| 56 | 62 | account: { required: true, message: "用户名不能为空", trigger: "blur" }, |
| 57 | 63 | password: { required: true, message: "密码不能为空", trigger: "blur" }, |
| 58 | 64 | }, |
| 65 | + loading: false, | |
| 59 | 66 | }; |
| 60 | 67 | }, |
| 68 | + watch: { | |
| 69 | + loginLoading(val) { | |
| 70 | + if (!val) this.loading = false; | |
| 71 | + }, | |
| 72 | + }, | |
| 61 | 73 | created() {}, |
| 62 | 74 | mounted() {}, |
| 63 | 75 | methods: { |
| 64 | 76 | toHome() { |
| 77 | + if (this.loading) return; | |
| 78 | + | |
| 65 | 79 | this.$refs["form"].validate((valid) => { |
| 66 | 80 | if (valid) { |
| 67 | - this.$store.dispatch("Login", this.form).then(() => { | |
| 68 | - this.$router.push({ path: "/homePage" }); | |
| 69 | - }); | |
| 81 | + this.loading = true; | |
| 82 | + this.$store.commit("SET_LOGIN_LOADING", true); | |
| 83 | + this.$store | |
| 84 | + .dispatch("Login", this.form) | |
| 85 | + .then(() => { | |
| 86 | + this.$router.push({ path: "/homePage" }); | |
| 87 | + }) | |
| 88 | + .catch(() => { | |
| 89 | + this.$store.commit("SET_LOGIN_LOADING", false); | |
| 90 | + }); | |
| 70 | 91 | } |
| 71 | 92 | }); |
| 72 | 93 | }, | ... | ... |
src/views/baseComapnyInfo/ExportBox.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog title="导出数据" :close-on-click-modal="false" :visible.sync="visible" | |
| 3 | + class="NCC-dialog NCC-dialog_center" lock-scroll width="600px"> | |
| 4 | + <el-form label-position="top" label-width="80px"> | |
| 5 | + <el-form-item label="数据选择"> | |
| 6 | + <el-radio-group v-model="type"> | |
| 7 | + <el-radio :label="0">当前页面数据</el-radio> | |
| 8 | + <el-radio :label="1">全部页面数据</el-radio> | |
| 9 | + </el-radio-group> | |
| 10 | + </el-form-item> | |
| 11 | + <el-form-item label="导出字段"> | |
| 12 | + <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" | |
| 13 | + @change="handleCheckAllChange">全选</el-checkbox> | |
| 14 | + <el-checkbox-group v-model="columns" @change="handleCheckedChange"> | |
| 15 | + <el-checkbox v-for="item in columnList" :label="item.prop" :key="item.prop"> | |
| 16 | + {{item.label}} | |
| 17 | + </el-checkbox> | |
| 18 | + </el-checkbox-group> | |
| 19 | + </el-form-item> | |
| 20 | + </el-form> | |
| 21 | + <span slot="footer" class="dialog-footer"> | |
| 22 | + <el-button @click="visible=false">取 消</el-button> | |
| 23 | + <el-button type="primary" @click="downLoad">导 出</el-button> | |
| 24 | + </span> | |
| 25 | + </el-dialog> | |
| 26 | +</template> | |
| 27 | + | |
| 28 | +<script> | |
| 29 | +export default { | |
| 30 | + data() { | |
| 31 | + return { | |
| 32 | + visible: false, | |
| 33 | + btnLoading: false, | |
| 34 | + type: 0, | |
| 35 | + columns: [], | |
| 36 | + checkAll: true, | |
| 37 | + isIndeterminate: false, | |
| 38 | + columnList: [] | |
| 39 | + } | |
| 40 | + }, | |
| 41 | + methods: { | |
| 42 | + init(columnList) { | |
| 43 | + this.visible = true | |
| 44 | + this.columnList = columnList | |
| 45 | + this.columns = columnList.map(o => o.prop) | |
| 46 | + }, | |
| 47 | + handleCheckAllChange(val) { | |
| 48 | + this.columns = val ? this.columnList.map(o => o.prop) : []; | |
| 49 | + this.isIndeterminate = false; | |
| 50 | + }, | |
| 51 | + handleCheckedChange(value) { | |
| 52 | + let checkedCount = value.length; | |
| 53 | + this.checkAll = checkedCount === this.columnList.length; | |
| 54 | + this.isIndeterminate = checkedCount > 0 && checkedCount < this.columnList.length; | |
| 55 | + }, | |
| 56 | + downLoad() { | |
| 57 | + this.$emit('download', { dataType: this.type, selectKey: this.columns.join(',') }) | |
| 58 | + } | |
| 59 | + } | |
| 60 | +} | |
| 61 | +</script> | |
| 62 | +<style lang="scss" scoped> | |
| 63 | +>>> .el-dialog__body { | |
| 64 | + padding: 20px !important; | |
| 65 | +} | |
| 66 | +</style> | |
| 0 | 67 | \ No newline at end of file | ... | ... |
src/views/baseComapnyInfo/Form.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情' : '编辑'" :close-on-click-modal="false" | |
| 3 | + :visible.sync="visible" class="NCC-dialog NCC-dialog_center" lock-scroll width="70%"> | |
| 4 | + <el-row :gutter="15" class=""> | |
| 5 | + <el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" | |
| 6 | + :disabled="!!isDetail" :rules="rules"> | |
| 7 | + <el-col :span="24" v-if="false"> | |
| 8 | + <el-form-item label="主键" prop="id"> | |
| 9 | + <el-input v-model="dataForm.id" placeholder="请输入" clearable :style='{ "width": "100%" }'> | |
| 10 | + </el-input> | |
| 11 | + </el-form-item> | |
| 12 | + </el-col> | |
| 13 | + <el-col :span="24"> | |
| 14 | + <el-form-item label="公司名称" prop="companyName"> | |
| 15 | + <el-input v-model="dataForm.companyName" placeholder="请输入" clearable required | |
| 16 | + :style='{ "width": "100%" }'> | |
| 17 | + </el-input> | |
| 18 | + </el-form-item> | |
| 19 | + </el-col> | |
| 20 | + <el-col :span="24"> | |
| 21 | + <el-form-item label="社会信用代" prop="socialCreditAgency"> | |
| 22 | + <el-input v-model="dataForm.socialCreditAgency" placeholder="请输入" clearable | |
| 23 | + :style='{ "width": "100%" }'> | |
| 24 | + </el-input> | |
| 25 | + </el-form-item> | |
| 26 | + </el-col> | |
| 27 | + <el-col :span="24"> | |
| 28 | + <el-form-item label="公司法人" prop="legalPerson"> | |
| 29 | + <el-input v-model="dataForm.legalPerson" placeholder="请输入" clearable :style='{ "width": "100%" }'> | |
| 30 | + </el-input> | |
| 31 | + </el-form-item> | |
| 32 | + </el-col> | |
| 33 | + <el-col :span="24"> | |
| 34 | + <el-form-item label="公司地址" prop="address"> | |
| 35 | + <el-input v-model="dataForm.address" placeholder="请输入" clearable :style='{ "width": "100%" }'> | |
| 36 | + </el-input> | |
| 37 | + </el-form-item> | |
| 38 | + </el-col> | |
| 39 | + <el-col :span="24"> | |
| 40 | + <el-form-item label="联系方式" prop="contactInformation"> | |
| 41 | + <el-input v-model="dataForm.contactInformation" placeholder="请输入" clearable | |
| 42 | + :style='{ "width": "100%" }'> | |
| 43 | + </el-input> | |
| 44 | + </el-form-item> | |
| 45 | + </el-col> | |
| 46 | + <el-col :span="24"> | |
| 47 | + <el-form-item label="资质证明" prop="qualificationCertificate"> | |
| 48 | + <NCC-UploadFz v-model="dataForm.qualificationCertificate" :fileSize="5" sizeUnit="MB" :limit="9" | |
| 49 | + buttonText="点击上传"> | |
| 50 | + </NCC-UploadFz> | |
| 51 | + </el-form-item> | |
| 52 | + </el-col> | |
| 53 | + <el-col :span="24"> | |
| 54 | + <el-form-item label="其他信息" prop="otherInfo"> | |
| 55 | + <NCC-Quill v-model="dataForm.otherInfo" placeholder="请输入内容..."> | |
| 56 | + </NCC-Quill> | |
| 57 | + </el-form-item> | |
| 58 | + </el-col> | |
| 59 | + </el-form> | |
| 60 | + </el-row> | |
| 61 | + <span slot="footer" class="dialog-footer"> | |
| 62 | + <el-button @click="visible = false">取 消</el-button> | |
| 63 | + <el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail">确 定</el-button> | |
| 64 | + </span> | |
| 65 | + </el-dialog> | |
| 66 | +</template> | |
| 67 | +<script> | |
| 68 | +import request from '@/utils/request' | |
| 69 | +import { getDictionaryDataSelector } from '@/api/systemData/dictionary' | |
| 70 | +import { previewDataInterface } from '@/api/systemData/dataInterface' | |
| 71 | +export default { | |
| 72 | + components: {}, | |
| 73 | + props: [], | |
| 74 | + data() { | |
| 75 | + return { | |
| 76 | + loading: false, | |
| 77 | + visible: false, | |
| 78 | + isDetail: false, | |
| 79 | + dataForm: { | |
| 80 | + id: '', | |
| 81 | + id: undefined, | |
| 82 | + companyName: undefined, | |
| 83 | + socialCreditAgency: undefined, | |
| 84 | + legalPerson: undefined, | |
| 85 | + address: undefined, | |
| 86 | + contactInformation: undefined, | |
| 87 | + qualificationCertificate: [], | |
| 88 | + otherInfo: undefined, | |
| 89 | + }, | |
| 90 | + rules: { | |
| 91 | + companyName: [ | |
| 92 | + { | |
| 93 | + required: true, | |
| 94 | + message: '请输入公司名称', | |
| 95 | + trigger: 'blur' | |
| 96 | + }, | |
| 97 | + ], | |
| 98 | + contactInformation: [ | |
| 99 | + { | |
| 100 | + pattern: /^1[3456789]\d{9}$|^0\d{2,3}-?\d{7,8}$/, | |
| 101 | + message: '请输入正确的联系方式', | |
| 102 | + trigger: 'blur' | |
| 103 | + }, | |
| 104 | + ], | |
| 105 | + }, | |
| 106 | + } | |
| 107 | + }, | |
| 108 | + computed: {}, | |
| 109 | + watch: {}, | |
| 110 | + created() { | |
| 111 | + }, | |
| 112 | + mounted() { | |
| 113 | + }, | |
| 114 | + methods: { | |
| 115 | + goBack() { | |
| 116 | + this.$emit('refresh') | |
| 117 | + }, | |
| 118 | + init(id, isDetail) { | |
| 119 | + this.dataForm.id = id || 0; | |
| 120 | + this.visible = true; | |
| 121 | + this.isDetail = isDetail || false; | |
| 122 | + this.$nextTick(() => { | |
| 123 | + // this.$refs['elForm'].resetFields(); | |
| 124 | + if (this.dataForm.id) { | |
| 125 | + request({ | |
| 126 | + url: '/api/Extend/BaseComapnyInfo/' + this.dataForm.id, | |
| 127 | + method: 'get' | |
| 128 | + }).then(res => { | |
| 129 | + this.dataForm = res.data; | |
| 130 | + if (!this.dataForm.qualificationCertificate) this.dataForm.qualificationCertificate = []; | |
| 131 | + }) | |
| 132 | + } | |
| 133 | + }) | |
| 134 | + }, | |
| 135 | + dataFormSubmit() { | |
| 136 | + this.$refs['elForm'].validate((valid) => { | |
| 137 | + if (valid) { | |
| 138 | + if (!this.dataForm.id) { | |
| 139 | + request({ | |
| 140 | + url: `/api/Extend/BaseComapnyInfo`, | |
| 141 | + method: 'post', | |
| 142 | + data: this.dataForm, | |
| 143 | + }).then((res) => { | |
| 144 | + this.$message({ | |
| 145 | + message: res.msg, | |
| 146 | + type: 'success', | |
| 147 | + duration: 1000, | |
| 148 | + onClose: () => { | |
| 149 | + this.visible = false, | |
| 150 | + this.$emit('refresh', true) | |
| 151 | + } | |
| 152 | + }) | |
| 153 | + }) | |
| 154 | + } else { | |
| 155 | + request({ | |
| 156 | + url: '/api/Extend/BaseComapnyInfo/' + this.dataForm.id, | |
| 157 | + method: 'PUT', | |
| 158 | + data: this.dataForm | |
| 159 | + }).then((res) => { | |
| 160 | + this.$message({ | |
| 161 | + message: res.msg, | |
| 162 | + type: 'success', | |
| 163 | + duration: 1000, | |
| 164 | + onClose: () => { | |
| 165 | + this.visible = false | |
| 166 | + this.$emit('refresh', true) | |
| 167 | + } | |
| 168 | + }) | |
| 169 | + }) | |
| 170 | + } | |
| 171 | + } | |
| 172 | + }) | |
| 173 | + }, | |
| 174 | + } | |
| 175 | +} | |
| 176 | +</script> | ... | ... |
src/views/baseComapnyInfo/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div> | |
| 3 | + <div class="item-box info-box">公司信息 weferarfve</div> | |
| 4 | + <!-- <div class="NCC-common-layout-center"> | |
| 5 | + <el-row class="NCC-common-search-box" :gutter="16"> | |
| 6 | + <el-form @submit.native.prevent> | |
| 7 | + <el-col :span="6"> | |
| 8 | + <el-form-item label="公司名称"> | |
| 9 | + <el-input v-model="query.companyName" placeholder="公司名称" clearable /> | |
| 10 | + </el-form-item> | |
| 11 | + </el-col> | |
| 12 | + <el-col :span="6"> | |
| 13 | + <el-form-item label="公司法人"> | |
| 14 | + <el-input v-model="query.legalPerson" placeholder="公司法人" clearable /> | |
| 15 | + </el-form-item> | |
| 16 | + </el-col> | |
| 17 | + <el-col :span="6"> | |
| 18 | + <el-form-item label="社会信用代"> | |
| 19 | + <el-input v-model="query.socialCreditAgency" placeholder="社会信用代" clearable /> | |
| 20 | + </el-form-item> | |
| 21 | + </el-col> | |
| 22 | + <el-col :span="6"> | |
| 23 | + <el-form-item> | |
| 24 | + <el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button> | |
| 25 | + <el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button> | |
| 26 | + </el-form-item> | |
| 27 | + </el-col> | |
| 28 | + </el-form> | |
| 29 | + </el-row> | |
| 30 | + <div class="NCC-common-layout-main NCC-flex-main"> | |
| 31 | + <div class="NCC-common-head"> | |
| 32 | + <div> | |
| 33 | + <el-button type="primary" icon="el-icon-plus" @click="addOrUpdateHandle()" >新增</el-button> | |
| 34 | + <el-button type="text" icon="el-icon-download" @click="exportData()" >导出</el-button> | |
| 35 | + </div> | |
| 36 | + <div class="NCC-common-head-right"> | |
| 37 | + <el-tooltip effect="dark" content="刷新" placement="top"> | |
| 38 | + <el-link icon="icon-ym icon-ym-Refresh NCC-common-head-icon" :underline="false" @click="reset()" /> | |
| 39 | + </el-tooltip> | |
| 40 | + <screenfull isContainer /> | |
| 41 | + </div> | |
| 42 | + </div> | |
| 43 | + <NCC-table v-loading="listLoading" :data="list"> | |
| 44 | + <el-table-column prop="id" label="主键" align="left" /> | |
| 45 | + <el-table-column prop="companyName" label="公司名称" align="left" /> | |
| 46 | + <el-table-column prop="socialCreditAgency" label="社会信用代" align="left" /> | |
| 47 | + <el-table-column prop="legalPerson" label="公司法人" align="left" /> | |
| 48 | + <el-table-column prop="address" label="公司地址" align="left"/> | |
| 49 | + <el-table-column prop="contactInformation" label="联系方式" align="left" /> | |
| 50 | + <el-table-column label="操作" fixed="right" width="100"> | |
| 51 | + <template slot-scope="scope"> | |
| 52 | + <el-button type="text" @click="addOrUpdateHandle(scope.row.id)">编辑</el-button> | |
| 53 | + <el-button type="text" @click="handleDel(scope.row.id)" class="NCC-table-delBtn">删除</el-button> | |
| 54 | + </template> | |
| 55 | + </el-table-column> | |
| 56 | + </NCC-table> | |
| 57 | + <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData" /> | |
| 58 | + </div> | |
| 59 | + </div> | |
| 60 | + <NCC-Form v-if="formVisible" ref="NCCForm" @refresh="refresh" /> | |
| 61 | + <ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download" /> --> | |
| 62 | + </div> | |
| 63 | +</template> | |
| 64 | +<script> | |
| 65 | +import request from "@/utils/request"; | |
| 66 | +import NCC from "@/utils/ncc.js"; | |
| 67 | +import { getDictionaryDataSelector } from "@/api/systemData/dictionary"; | |
| 68 | +import NCCForm from "./Form"; | |
| 69 | +import ExportBox from "./ExportBox"; | |
| 70 | +import { previewDataInterface } from "@/api/systemData/dataInterface"; | |
| 71 | +export default { | |
| 72 | + components: { NCCForm, ExportBox }, | |
| 73 | + data() { | |
| 74 | + return { | |
| 75 | + showAll: false, | |
| 76 | + query: { | |
| 77 | + companyName: undefined, | |
| 78 | + legalPerson: undefined, | |
| 79 | + socialCreditAgency: undefined, | |
| 80 | + }, | |
| 81 | + list: [], | |
| 82 | + listLoading: true, | |
| 83 | + multipleSelection: [], | |
| 84 | + total: 0, | |
| 85 | + listQuery: { | |
| 86 | + currentPage: 1, | |
| 87 | + pageSize: 20, | |
| 88 | + sort: "desc", | |
| 89 | + sidx: "", | |
| 90 | + }, | |
| 91 | + formVisible: false, | |
| 92 | + exportBoxVisible: false, | |
| 93 | + columnList: [ | |
| 94 | + { prop: "id", label: "主键" }, | |
| 95 | + { prop: "companyName", label: "公司名称" }, | |
| 96 | + { prop: "socialCreditAgency", label: "社会信用代" }, | |
| 97 | + { prop: "legalPerson", label: "公司法人" }, | |
| 98 | + { prop: "address", label: "公司地址" }, | |
| 99 | + { prop: "contactInformation", label: "联系方式" }, | |
| 100 | + ], | |
| 101 | + }; | |
| 102 | + }, | |
| 103 | + computed: {}, | |
| 104 | + created() { | |
| 105 | + // this.initData(); | |
| 106 | + }, | |
| 107 | + methods: { | |
| 108 | + initData() { | |
| 109 | + this.listLoading = true; | |
| 110 | + let _query = { | |
| 111 | + ...this.listQuery, | |
| 112 | + ...this.query, | |
| 113 | + }; | |
| 114 | + let query = {}; | |
| 115 | + for (let key in _query) { | |
| 116 | + if (Array.isArray(_query[key])) { | |
| 117 | + query[key] = _query[key].join(); | |
| 118 | + } else { | |
| 119 | + query[key] = _query[key]; | |
| 120 | + } | |
| 121 | + } | |
| 122 | + request({ | |
| 123 | + url: `/api/Extend/BaseComapnyInfo`, | |
| 124 | + method: "GET", | |
| 125 | + data: query, | |
| 126 | + }).then((res) => { | |
| 127 | + this.list = res.data.list; | |
| 128 | + this.total = res.data.pagination.total; | |
| 129 | + this.listLoading = false; | |
| 130 | + }); | |
| 131 | + }, | |
| 132 | + handleDel(id) { | |
| 133 | + this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", { | |
| 134 | + type: "warning", | |
| 135 | + }) | |
| 136 | + .then(() => { | |
| 137 | + request({ | |
| 138 | + url: `/api/Extend/BaseComapnyInfo/${id}`, | |
| 139 | + method: "DELETE", | |
| 140 | + }).then((res) => { | |
| 141 | + this.$message({ | |
| 142 | + type: "success", | |
| 143 | + message: res.msg, | |
| 144 | + onClose: () => { | |
| 145 | + this.initData(); | |
| 146 | + }, | |
| 147 | + }); | |
| 148 | + }); | |
| 149 | + }) | |
| 150 | + .catch(() => {}); | |
| 151 | + }, | |
| 152 | + addOrUpdateHandle(id, isDetail) { | |
| 153 | + this.formVisible = true; | |
| 154 | + this.$nextTick(() => { | |
| 155 | + this.$refs.NCCForm.init(id, isDetail); | |
| 156 | + }); | |
| 157 | + }, | |
| 158 | + exportData() { | |
| 159 | + this.exportBoxVisible = true; | |
| 160 | + this.$nextTick(() => { | |
| 161 | + this.$refs.ExportBox.init(this.columnList); | |
| 162 | + }); | |
| 163 | + }, | |
| 164 | + download(data) { | |
| 165 | + let query = { ...data, ...this.listQuery, ...this.query }; | |
| 166 | + request({ | |
| 167 | + url: `/api/Extend/BaseComapnyInfo/Actions/Export`, | |
| 168 | + method: "GET", | |
| 169 | + data: query, | |
| 170 | + }).then((res) => { | |
| 171 | + if (!res.data.url) return; | |
| 172 | + window.location.href = this.define.comUrl + res.data.url; | |
| 173 | + this.$refs.ExportBox.visible = false; | |
| 174 | + this.exportBoxVisible = false; | |
| 175 | + }); | |
| 176 | + }, | |
| 177 | + search() { | |
| 178 | + this.listQuery = { | |
| 179 | + currentPage: 1, | |
| 180 | + pageSize: 20, | |
| 181 | + sort: "desc", | |
| 182 | + sidx: "", | |
| 183 | + }; | |
| 184 | + this.initData(); | |
| 185 | + }, | |
| 186 | + refresh(isrRefresh) { | |
| 187 | + this.formVisible = false; | |
| 188 | + if (isrRefresh) this.reset(); | |
| 189 | + }, | |
| 190 | + reset() { | |
| 191 | + for (let key in this.query) { | |
| 192 | + this.query[key] = undefined; | |
| 193 | + } | |
| 194 | + this.listQuery = { | |
| 195 | + currentPage: 1, | |
| 196 | + pageSize: 20, | |
| 197 | + sort: "desc", | |
| 198 | + sidx: "", | |
| 199 | + }; | |
| 200 | + this.initData(); | |
| 201 | + }, | |
| 202 | + }, | |
| 203 | +}; | |
| 204 | +</script> | |
| 205 | +<style lang="scss" scoped> | |
| 206 | +.item-box.info-box { | |
| 207 | + height: 70vh; | |
| 208 | + :deep(.el-table__body-wrapper.is-scrolling-none) { | |
| 209 | + height: calc(100% - 47px); | |
| 210 | + overflow-y: scroll; | |
| 211 | + } | |
| 212 | +} | |
| 213 | +</style> | ... | ... |
src/views/basic/externalLink/index.vue
0 → 100644
src/views/error-page/404.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="app-container http404-container"> | |
| 3 | + <div class="http404"> | |
| 4 | + <img src="@/assets/images/404.png" alt="404" class="pic-404"> | |
| 5 | + <div class="bullshit"> | |
| 6 | + <el-link type="primary" class="bullshit__oops" :underline="false">OOPS!</el-link> | |
| 7 | + <div class="bullshit__headline">{{ message }}</div> | |
| 8 | + <div class="bullshit__info">请检查您输入的URL是否正确,或单击按钮返回首页。</div> | |
| 9 | + <el-button type="primary" size="large" @click="$router.push('/home')">返回首页</el-button> | |
| 10 | + </div> | |
| 11 | + </div> | |
| 12 | + </div> | |
| 13 | +</template> | |
| 14 | + | |
| 15 | +<script> | |
| 16 | + | |
| 17 | +export default { | |
| 18 | + name: 'Page404', | |
| 19 | + computed: { | |
| 20 | + message() { | |
| 21 | + return '抱歉,你访问的页面不存在或无权访问!' | |
| 22 | + } | |
| 23 | + } | |
| 24 | +} | |
| 25 | +</script> | |
| 26 | + | |
| 27 | +<style lang="scss" scoped> | |
| 28 | +.http404-container { | |
| 29 | + display: flex; | |
| 30 | + justify-content: center; | |
| 31 | + align-items: center; | |
| 32 | +} | |
| 33 | +.http404 { | |
| 34 | + .pic-404 { | |
| 35 | + position: relative; | |
| 36 | + float: left; | |
| 37 | + width: 500px; | |
| 38 | + overflow: hidden; | |
| 39 | + margin-right: 100px; | |
| 40 | + } | |
| 41 | + .bullshit { | |
| 42 | + position: relative; | |
| 43 | + float: left; | |
| 44 | + width: 350px; | |
| 45 | + padding: 90px 0; | |
| 46 | + overflow: hidden; | |
| 47 | + &__oops { | |
| 48 | + font-size: 32px; | |
| 49 | + font-weight: bold; | |
| 50 | + line-height: 40px; | |
| 51 | + opacity: 0; | |
| 52 | + margin-bottom: 20px; | |
| 53 | + animation-name: slideUp; | |
| 54 | + animation-duration: 0.5s; | |
| 55 | + animation-fill-mode: forwards; | |
| 56 | + } | |
| 57 | + &__headline { | |
| 58 | + font-size: 20px; | |
| 59 | + line-height: 24px; | |
| 60 | + color: #222; | |
| 61 | + font-weight: bold; | |
| 62 | + opacity: 0; | |
| 63 | + margin-bottom: 10px; | |
| 64 | + animation-name: slideUp; | |
| 65 | + animation-duration: 0.5s; | |
| 66 | + animation-delay: 0.1s; | |
| 67 | + animation-fill-mode: forwards; | |
| 68 | + } | |
| 69 | + &__info { | |
| 70 | + font-size: 13px; | |
| 71 | + line-height: 21px; | |
| 72 | + color: grey; | |
| 73 | + opacity: 0; | |
| 74 | + margin-bottom: 40px; | |
| 75 | + animation-name: slideUp; | |
| 76 | + animation-duration: 0.5s; | |
| 77 | + animation-delay: 0.2s; | |
| 78 | + animation-fill-mode: forwards; | |
| 79 | + } | |
| 80 | + &__return-home { | |
| 81 | + float: left; | |
| 82 | + animation-name: slideUp; | |
| 83 | + animation-duration: 0.5s; | |
| 84 | + animation-delay: 0.3s; | |
| 85 | + animation-fill-mode: forwards; | |
| 86 | + } | |
| 87 | + @keyframes slideUp { | |
| 88 | + 0% { | |
| 89 | + transform: translateY(60px); | |
| 90 | + opacity: 0; | |
| 91 | + } | |
| 92 | + 100% { | |
| 93 | + transform: translateY(0); | |
| 94 | + opacity: 1; | |
| 95 | + } | |
| 96 | + } | |
| 97 | + } | |
| 98 | +} | |
| 99 | +</style> | ... | ... |
src/views/homePage/HomePage.vue
| 1 | -r | |
| 2 | 1 | <template> |
| 3 | 2 | <div class="HomePage"> |
| 4 | 3 | <Header /> |
| 5 | 4 | <div class="content"> |
| 6 | - <el-menu :default-active="activeMenu" class="navs" router> | |
| 7 | - <el-menu-item index="/homePage"> | |
| 8 | - <i class="el-icon-s-home"></i> | |
| 9 | - <span slot="title">主 页</span> | |
| 10 | - </el-menu-item> | |
| 11 | - <el-menu-item index="/infoList"> | |
| 12 | - <i class="el-icon-menu"></i> | |
| 13 | - <span slot="title">系统管理</span> | |
| 14 | - </el-menu-item> | |
| 15 | - <el-menu-item v-for="(item, index) in navList" :key="index"> | |
| 16 | - <i class="el-icon-circle-plus"></i> | |
| 17 | - <span slot="title">{{ item.title }}</span> | |
| 18 | - </el-menu-item> | |
| 19 | - </el-menu> | |
| 5 | + <div class="navs"> | |
| 6 | + <el-menu | |
| 7 | + :default-active="activeMenu" | |
| 8 | + class="el-menu-vertical-demo" | |
| 9 | + :collapse="true" | |
| 10 | + router | |
| 11 | + > | |
| 12 | + <el-menu-item index="/homePage"> | |
| 13 | + <i class="el-icon-menu"></i> | |
| 14 | + <span slot="title">首页</span> | |
| 15 | + </el-menu-item> | |
| 16 | + <div v-for="v in navList" :key="v.id"> | |
| 17 | + <template v-if="v.children && v.children.length"> | |
| 18 | + <el-submenu :index="v.path"> | |
| 19 | + <template slot="title"> | |
| 20 | + <i class="el-icon-location"></i> | |
| 21 | + </template> | |
| 22 | + <el-menu-item-group> | |
| 23 | + <span slot="title">分组一</span> | |
| 24 | + <el-menu-item :index="item.path" v-for="item in v.children" :key="item.id">{{item.meta.title}}</el-menu-item> | |
| 25 | + </el-menu-item-group> | |
| 26 | + </el-submenu> | |
| 27 | + </template> | |
| 28 | + <template v-else> | |
| 29 | + <el-menu-item :index="v.path"> | |
| 30 | + <i class="el-icon-menu"></i> | |
| 31 | + <span slot="title">{{v.meta.title}}</span> | |
| 32 | + </el-menu-item> | |
| 33 | + </template> | |
| 34 | + </div> | |
| 35 | + </el-menu> | |
| 36 | + </div> | |
| 20 | 37 | <div class="table-box"> |
| 21 | 38 | <div class="search"> |
| 22 | 39 | <div class="ipt-box"> |
| ... | ... | @@ -66,17 +83,18 @@ export default { |
| 66 | 83 | }, |
| 67 | 84 | data() { |
| 68 | 85 | return { |
| 69 | - navList: [], | |
| 86 | + navList: this.$router.options.routes.filter(v => !v.hidden), | |
| 70 | 87 | searchKeyword: "", |
| 71 | 88 | }; |
| 72 | 89 | }, |
| 73 | 90 | created() { |
| 74 | - this.navList = navArr; | |
| 91 | + console.log(this.$router.options.routes.filter(v => !v.hidden)); | |
| 75 | 92 | }, |
| 76 | 93 | mounted() {}, |
| 77 | 94 | computed: { |
| 78 | 95 | // 默认激活的菜单 |
| 79 | 96 | activeMenu() { |
| 97 | + console.log('activeMenu', this.$route.path); | |
| 80 | 98 | return this.$route.path; |
| 81 | 99 | }, |
| 82 | 100 | }, |
| ... | ... | @@ -92,5 +110,5 @@ export default { |
| 92 | 110 | </script> |
| 93 | 111 | |
| 94 | 112 | <style scoped lang="scss"> |
| 95 | -@import "@/assets/style/homePage.scss"; | |
| 113 | +@import "./homePage.scss"; | |
| 96 | 114 | </style> | ... | ... |
src/views/homePage/components/Header.vue
| ... | ... | @@ -6,10 +6,12 @@ |
| 6 | 6 | <div class="title">内部系统</div> |
| 7 | 7 | <div class="user"> |
| 8 | 8 | <div class="head"> |
| 9 | - <el-image :src="userInfo.avatar" fit="cover"></el-image> | |
| 9 | + <el-image :src="avatar" fit="cover"></el-image> | |
| 10 | 10 | </div> |
| 11 | 11 | <el-dropdown @command="handleCommand"> |
| 12 | - <div class="info">{{ userInfo.name }}({{ userInfo.address }})</div> | |
| 12 | + <div class="info"> | |
| 13 | + {{ userInfo.userName }}({{ userInfo.organizeName }}) | |
| 14 | + </div> | |
| 13 | 15 | <el-dropdown-menu slot="dropdown" router> |
| 14 | 16 | <el-dropdown-item>修改信息</el-dropdown-item> |
| 15 | 17 | <passwordForm> |
| ... | ... | @@ -27,13 +29,13 @@ export default { |
| 27 | 29 | name: "Header", |
| 28 | 30 | data() { |
| 29 | 31 | return { |
| 30 | - userInfo: this.$store.state.user, | |
| 32 | + userInfo: this.$store.state.user.userInfo, | |
| 33 | + avatar: this.$store.state.user.avatar, | |
| 31 | 34 | }; |
| 32 | 35 | }, |
| 33 | 36 | mounted() {}, |
| 34 | 37 | methods: { |
| 35 | 38 | toLogin() { |
| 36 | - console.log(111); | |
| 37 | 39 | this.$router.push({ path: "/login" }); |
| 38 | 40 | }, |
| 39 | 41 | handleCommand(command) { | ... | ... |
src/assets/style/homePage.scss renamed to src/views/homePage/homePage.scss
| ... | ... | @@ -19,26 +19,28 @@ |
| 19 | 19 | border-radius: 0px 10px 10px 0px; |
| 20 | 20 | padding: 25px; |
| 21 | 21 | border-right: unset; |
| 22 | - .el-menu-item { | |
| 23 | - display: flex; | |
| 24 | - flex-direction: column; | |
| 25 | - align-items: center; | |
| 26 | - color: #fff; | |
| 27 | - margin-bottom: 15px; | |
| 28 | - &.is-active { | |
| 29 | - border-radius: 5px; | |
| 30 | - background-color: #67c23a; | |
| 31 | - } | |
| 32 | - &:hover { | |
| 33 | - background-color: #dfdada56; | |
| 22 | + .el-menu-vertical-demo:not(.el-menu--collapse) { | |
| 23 | + width: 200px; | |
| 24 | + min-height: 400px; | |
| 25 | + } | |
| 26 | + :deep(.el-menu) { | |
| 27 | + background-color: transparent; | |
| 28 | + border-right: unset; | |
| 29 | + .el-submenu__title { | |
| 30 | + display: flex; | |
| 31 | + flex-direction: column; | |
| 32 | + align-items: center; | |
| 33 | + line-height: 30px; | |
| 34 | + justify-content: center; | |
| 35 | + &:hover { | |
| 36 | + background-color: #dfdada56; | |
| 37 | + } | |
| 34 | 38 | } |
| 35 | 39 | i { |
| 36 | - font-size: 30px; | |
| 37 | 40 | color: #fff; |
| 38 | 41 | } |
| 39 | - span { | |
| 40 | - color: #fff; | |
| 41 | - line-height: 36px; | |
| 42 | + .el-submenu__icon-arrow.el-icon-arrow-right { | |
| 43 | + display: none; | |
| 42 | 44 | } |
| 43 | 45 | } |
| 44 | 46 | } | ... | ... |