diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 7d3afbd..26c5e62 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,6 +8,7 @@
/* Layout */
import Layout from '../views/layout/Layout'
+import { systemRouters } from './modules/system'
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
@@ -49,10 +50,12 @@
component: Layout,
redirect: 'dashboard',
name: 'Dashboard',
- hidden: true,
+ // hidden: true,
children: [{
path: 'dashboard',
- component: () => import('@/views/dashboard/index')
+ name: 'Dashboard',
+ component: () => import('@/views/dashboard/index'),
+ meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}]
}
]
@@ -66,55 +69,6 @@
// 异步挂载路由
// 动态需要根据权限加载的路由表
export const asyncRouterMap = [
- {
- 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: '/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'] }
- }
- ]
- },
+ ...systemRouters,
{ path: '*', redirect: '/404', hidden: true }
]
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 7d3afbd..26c5e62 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,6 +8,7 @@
/* Layout */
import Layout from '../views/layout/Layout'
+import { systemRouters } from './modules/system'
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
@@ -49,10 +50,12 @@
component: Layout,
redirect: 'dashboard',
name: 'Dashboard',
- hidden: true,
+ // hidden: true,
children: [{
path: 'dashboard',
- component: () => import('@/views/dashboard/index')
+ name: 'Dashboard',
+ component: () => import('@/views/dashboard/index'),
+ meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}]
}
]
@@ -66,55 +69,6 @@
// 异步挂载路由
// 动态需要根据权限加载的路由表
export const asyncRouterMap = [
- {
- 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: '/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'] }
- }
- ]
- },
+ ...systemRouters,
{ path: '*', redirect: '/404', hidden: true }
]
diff --git a/src/router/modules/system.js b/src/router/modules/system.js
new file mode 100644
index 0000000..0f4fd98
--- /dev/null
+++ b/src/router/modules/system.js
@@ -0,0 +1,65 @@
+/* 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'] }
+ }
+ ]
+}]
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 7d3afbd..26c5e62 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,6 +8,7 @@
/* Layout */
import Layout from '../views/layout/Layout'
+import { systemRouters } from './modules/system'
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
@@ -49,10 +50,12 @@
component: Layout,
redirect: 'dashboard',
name: 'Dashboard',
- hidden: true,
+ // hidden: true,
children: [{
path: 'dashboard',
- component: () => import('@/views/dashboard/index')
+ name: 'Dashboard',
+ component: () => import('@/views/dashboard/index'),
+ meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}]
}
]
@@ -66,55 +69,6 @@
// 异步挂载路由
// 动态需要根据权限加载的路由表
export const asyncRouterMap = [
- {
- 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: '/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'] }
- }
- ]
- },
+ ...systemRouters,
{ path: '*', redirect: '/404', hidden: true }
]
diff --git a/src/router/modules/system.js b/src/router/modules/system.js
new file mode 100644
index 0000000..0f4fd98
--- /dev/null
+++ b/src/router/modules/system.js
@@ -0,0 +1,65 @@
+/* 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'] }
+ }
+ ]
+}]
diff --git a/src/store/getters.js b/src/store/getters.js
index 93860ed..80b80fb 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -1,10 +1,14 @@
const getters = {
sidebar: state => state.app.sidebar, // 侧边栏
device: state => state.app.device, // 设备
+ visitedViews: state => state.tagsView.visitedViews,
+ cachedViews: state => state.tagsView.cachedViews,
kaptcha: state => state.app.kaptcha, // 验证码
publicKey: state => state.app.publicKey, // 公钥
sid: state => state.app.sid, // 用户标识
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, // 角色名称列表
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 7d3afbd..26c5e62 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,6 +8,7 @@
/* Layout */
import Layout from '../views/layout/Layout'
+import { systemRouters } from './modules/system'
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
@@ -49,10 +50,12 @@
component: Layout,
redirect: 'dashboard',
name: 'Dashboard',
- hidden: true,
+ // hidden: true,
children: [{
path: 'dashboard',
- component: () => import('@/views/dashboard/index')
+ name: 'Dashboard',
+ component: () => import('@/views/dashboard/index'),
+ meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}]
}
]
@@ -66,55 +69,6 @@
// 异步挂载路由
// 动态需要根据权限加载的路由表
export const asyncRouterMap = [
- {
- 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: '/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'] }
- }
- ]
- },
+ ...systemRouters,
{ path: '*', redirect: '/404', hidden: true }
]
diff --git a/src/router/modules/system.js b/src/router/modules/system.js
new file mode 100644
index 0000000..0f4fd98
--- /dev/null
+++ b/src/router/modules/system.js
@@ -0,0 +1,65 @@
+/* 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'] }
+ }
+ ]
+}]
diff --git a/src/store/getters.js b/src/store/getters.js
index 93860ed..80b80fb 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -1,10 +1,14 @@
const getters = {
sidebar: state => state.app.sidebar, // 侧边栏
device: state => state.app.device, // 设备
+ visitedViews: state => state.tagsView.visitedViews,
+ cachedViews: state => state.tagsView.cachedViews,
kaptcha: state => state.app.kaptcha, // 验证码
publicKey: state => state.app.publicKey, // 公钥
sid: state => state.app.sid, // 用户标识
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, // 角色名称列表
diff --git a/src/store/index.js b/src/store/index.js
index 9bfa6a7..c7e23ff 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -3,6 +3,7 @@
import app from './modules/app'
import user from './modules/user'
import permission from './modules/permission'
+import tagsView from './modules/tagsView'
import getters from './getters'
Vue.use(Vuex)
@@ -11,7 +12,8 @@
modules: {
app,
user,
- permission
+ permission,
+ tagsView
},
getters
})
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 7d3afbd..26c5e62 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,6 +8,7 @@
/* Layout */
import Layout from '../views/layout/Layout'
+import { systemRouters } from './modules/system'
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
@@ -49,10 +50,12 @@
component: Layout,
redirect: 'dashboard',
name: 'Dashboard',
- hidden: true,
+ // hidden: true,
children: [{
path: 'dashboard',
- component: () => import('@/views/dashboard/index')
+ name: 'Dashboard',
+ component: () => import('@/views/dashboard/index'),
+ meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}]
}
]
@@ -66,55 +69,6 @@
// 异步挂载路由
// 动态需要根据权限加载的路由表
export const asyncRouterMap = [
- {
- 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: '/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'] }
- }
- ]
- },
+ ...systemRouters,
{ path: '*', redirect: '/404', hidden: true }
]
diff --git a/src/router/modules/system.js b/src/router/modules/system.js
new file mode 100644
index 0000000..0f4fd98
--- /dev/null
+++ b/src/router/modules/system.js
@@ -0,0 +1,65 @@
+/* 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'] }
+ }
+ ]
+}]
diff --git a/src/store/getters.js b/src/store/getters.js
index 93860ed..80b80fb 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -1,10 +1,14 @@
const getters = {
sidebar: state => state.app.sidebar, // 侧边栏
device: state => state.app.device, // 设备
+ visitedViews: state => state.tagsView.visitedViews,
+ cachedViews: state => state.tagsView.cachedViews,
kaptcha: state => state.app.kaptcha, // 验证码
publicKey: state => state.app.publicKey, // 公钥
sid: state => state.app.sid, // 用户标识
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, // 角色名称列表
diff --git a/src/store/index.js b/src/store/index.js
index 9bfa6a7..c7e23ff 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -3,6 +3,7 @@
import app from './modules/app'
import user from './modules/user'
import permission from './modules/permission'
+import tagsView from './modules/tagsView'
import getters from './getters'
Vue.use(Vuex)
@@ -11,7 +12,8 @@
modules: {
app,
user,
- permission
+ permission,
+ tagsView
},
getters
})
diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js
new file mode 100644
index 0000000..b7e3be9
--- /dev/null
+++ b/src/store/modules/tagsView.js
@@ -0,0 +1,165 @@
+const state = {
+ visitedViews: [], // 用户访问过的页面
+ cachedViews: [] // 实际keep-alive的路由,可以在配置路由的时候通过meta.noCache来设置是否需要缓存,默认都缓存
+}
+
+const mutations = {
+ ADD_VISITED_VIEW: (state, view) => {
+ if (state.visitedViews.some(v => v.path === view.path)) return
+ state.visitedViews.push(
+ Object.assign({}, view, {
+ title: view.meta.title || 'no-name'
+ })
+ )
+ },
+ ADD_CACHED_VIEW: (state, view) => {
+ if (state.cachedViews.includes(view.name)) return
+ if (!view.meta.noCache) {
+ state.cachedViews.push(view.name)
+ }
+ },
+
+ DEL_VISITED_VIEW: (state, 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
+ }
+ }
+ },
+
+ DEL_OTHERS_VISITED_VIEWS: (state, view) => {
+ state.visitedViews = state.visitedViews.filter(v => {
+ return v.meta.affix || v.path === view.path
+ })
+ },
+ DEL_OTHERS_CACHED_VIEWS: (state, view) => {
+ for (const i of state.cachedViews) {
+ if (i === view.name) {
+ const index = state.cachedViews.indexOf(i)
+ state.cachedViews = state.cachedViews.slice(index, index + 1)
+ break
+ }
+ }
+ },
+
+ DEL_ALL_VISITED_VIEWS: state => {
+ // keep affix tags
+ const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
+ state.visitedViews = affixTags
+ },
+ DEL_ALL_CACHED_VIEWS: state => {
+ state.cachedViews = []
+ },
+
+ UPDATE_VISITED_VIEW: (state, view) => {
+ for (let v of state.visitedViews) {
+ if (v.path === view.path) {
+ v = Object.assign(v, view)
+ break
+ }
+ }
+ }
+}
+
+const actions = {
+ addView({ dispatch }, view) {
+ dispatch('addVisitedView', view)
+ dispatch('addCachedView', view)
+ },
+ addVisitedView({ commit }, view) {
+ commit('ADD_VISITED_VIEW', view)
+ },
+ addCachedView({ commit }, view) {
+ commit('ADD_CACHED_VIEW', view)
+ },
+
+ delView({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delVisitedView', view)
+ dispatch('delCachedView', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delVisitedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_VISITED_VIEW', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delCachedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_CACHED_VIEW', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delOthersViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delOthersVisitedViews', view)
+ dispatch('delOthersCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delOthersVisitedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_VISITED_VIEWS', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delOthersCachedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_CACHED_VIEWS', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delAllViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delAllVisitedViews', view)
+ dispatch('delAllCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delAllVisitedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_VISITED_VIEWS')
+ resolve([...state.visitedViews])
+ })
+ },
+ delAllCachedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_CACHED_VIEWS')
+ resolve([...state.cachedViews])
+ })
+ },
+
+ updateVisitedView({ commit }, view) {
+ commit('UPDATE_VISITED_VIEW', view)
+ }
+}
+
+export default {
+ namespaced: true,
+ state,
+ mutations,
+ actions
+}
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 7d3afbd..26c5e62 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,6 +8,7 @@
/* Layout */
import Layout from '../views/layout/Layout'
+import { systemRouters } from './modules/system'
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
@@ -49,10 +50,12 @@
component: Layout,
redirect: 'dashboard',
name: 'Dashboard',
- hidden: true,
+ // hidden: true,
children: [{
path: 'dashboard',
- component: () => import('@/views/dashboard/index')
+ name: 'Dashboard',
+ component: () => import('@/views/dashboard/index'),
+ meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}]
}
]
@@ -66,55 +69,6 @@
// 异步挂载路由
// 动态需要根据权限加载的路由表
export const asyncRouterMap = [
- {
- 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: '/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'] }
- }
- ]
- },
+ ...systemRouters,
{ path: '*', redirect: '/404', hidden: true }
]
diff --git a/src/router/modules/system.js b/src/router/modules/system.js
new file mode 100644
index 0000000..0f4fd98
--- /dev/null
+++ b/src/router/modules/system.js
@@ -0,0 +1,65 @@
+/* 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'] }
+ }
+ ]
+}]
diff --git a/src/store/getters.js b/src/store/getters.js
index 93860ed..80b80fb 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -1,10 +1,14 @@
const getters = {
sidebar: state => state.app.sidebar, // 侧边栏
device: state => state.app.device, // 设备
+ visitedViews: state => state.tagsView.visitedViews,
+ cachedViews: state => state.tagsView.cachedViews,
kaptcha: state => state.app.kaptcha, // 验证码
publicKey: state => state.app.publicKey, // 公钥
sid: state => state.app.sid, // 用户标识
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, // 角色名称列表
diff --git a/src/store/index.js b/src/store/index.js
index 9bfa6a7..c7e23ff 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -3,6 +3,7 @@
import app from './modules/app'
import user from './modules/user'
import permission from './modules/permission'
+import tagsView from './modules/tagsView'
import getters from './getters'
Vue.use(Vuex)
@@ -11,7 +12,8 @@
modules: {
app,
user,
- permission
+ permission,
+ tagsView
},
getters
})
diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js
new file mode 100644
index 0000000..b7e3be9
--- /dev/null
+++ b/src/store/modules/tagsView.js
@@ -0,0 +1,165 @@
+const state = {
+ visitedViews: [], // 用户访问过的页面
+ cachedViews: [] // 实际keep-alive的路由,可以在配置路由的时候通过meta.noCache来设置是否需要缓存,默认都缓存
+}
+
+const mutations = {
+ ADD_VISITED_VIEW: (state, view) => {
+ if (state.visitedViews.some(v => v.path === view.path)) return
+ state.visitedViews.push(
+ Object.assign({}, view, {
+ title: view.meta.title || 'no-name'
+ })
+ )
+ },
+ ADD_CACHED_VIEW: (state, view) => {
+ if (state.cachedViews.includes(view.name)) return
+ if (!view.meta.noCache) {
+ state.cachedViews.push(view.name)
+ }
+ },
+
+ DEL_VISITED_VIEW: (state, 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
+ }
+ }
+ },
+
+ DEL_OTHERS_VISITED_VIEWS: (state, view) => {
+ state.visitedViews = state.visitedViews.filter(v => {
+ return v.meta.affix || v.path === view.path
+ })
+ },
+ DEL_OTHERS_CACHED_VIEWS: (state, view) => {
+ for (const i of state.cachedViews) {
+ if (i === view.name) {
+ const index = state.cachedViews.indexOf(i)
+ state.cachedViews = state.cachedViews.slice(index, index + 1)
+ break
+ }
+ }
+ },
+
+ DEL_ALL_VISITED_VIEWS: state => {
+ // keep affix tags
+ const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
+ state.visitedViews = affixTags
+ },
+ DEL_ALL_CACHED_VIEWS: state => {
+ state.cachedViews = []
+ },
+
+ UPDATE_VISITED_VIEW: (state, view) => {
+ for (let v of state.visitedViews) {
+ if (v.path === view.path) {
+ v = Object.assign(v, view)
+ break
+ }
+ }
+ }
+}
+
+const actions = {
+ addView({ dispatch }, view) {
+ dispatch('addVisitedView', view)
+ dispatch('addCachedView', view)
+ },
+ addVisitedView({ commit }, view) {
+ commit('ADD_VISITED_VIEW', view)
+ },
+ addCachedView({ commit }, view) {
+ commit('ADD_CACHED_VIEW', view)
+ },
+
+ delView({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delVisitedView', view)
+ dispatch('delCachedView', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delVisitedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_VISITED_VIEW', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delCachedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_CACHED_VIEW', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delOthersViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delOthersVisitedViews', view)
+ dispatch('delOthersCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delOthersVisitedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_VISITED_VIEWS', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delOthersCachedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_CACHED_VIEWS', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delAllViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delAllVisitedViews', view)
+ dispatch('delAllCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delAllVisitedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_VISITED_VIEWS')
+ resolve([...state.visitedViews])
+ })
+ },
+ delAllCachedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_CACHED_VIEWS')
+ resolve([...state.cachedViews])
+ })
+ },
+
+ updateVisitedView({ commit }, view) {
+ commit('UPDATE_VISITED_VIEW', view)
+ }
+}
+
+export default {
+ namespaced: true,
+ state,
+ mutations,
+ actions
+}
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 9008573..c151568 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -19,6 +19,12 @@
SET_TOKEN: (state, token) => {
state.token = token
},
+ SET_ID: (state, id) => {
+ state.id = id
+ },
+ SET_ACCOUNT: (state, account) => {
+ state.account = account
+ },
SET_NAME: (state, name) => {
state.name = name
},
@@ -88,6 +94,8 @@
} else {
reject('该用户无组织机构')
}
+ commit('SET_ID', data.id)
+ commit('SET_ACCOUNT', data.account)
commit('SET_NAME', data.name)
resolve(response)
}).catch(error => {
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 7d3afbd..26c5e62 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,6 +8,7 @@
/* Layout */
import Layout from '../views/layout/Layout'
+import { systemRouters } from './modules/system'
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
@@ -49,10 +50,12 @@
component: Layout,
redirect: 'dashboard',
name: 'Dashboard',
- hidden: true,
+ // hidden: true,
children: [{
path: 'dashboard',
- component: () => import('@/views/dashboard/index')
+ name: 'Dashboard',
+ component: () => import('@/views/dashboard/index'),
+ meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}]
}
]
@@ -66,55 +69,6 @@
// 异步挂载路由
// 动态需要根据权限加载的路由表
export const asyncRouterMap = [
- {
- 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: '/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'] }
- }
- ]
- },
+ ...systemRouters,
{ path: '*', redirect: '/404', hidden: true }
]
diff --git a/src/router/modules/system.js b/src/router/modules/system.js
new file mode 100644
index 0000000..0f4fd98
--- /dev/null
+++ b/src/router/modules/system.js
@@ -0,0 +1,65 @@
+/* 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'] }
+ }
+ ]
+}]
diff --git a/src/store/getters.js b/src/store/getters.js
index 93860ed..80b80fb 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -1,10 +1,14 @@
const getters = {
sidebar: state => state.app.sidebar, // 侧边栏
device: state => state.app.device, // 设备
+ visitedViews: state => state.tagsView.visitedViews,
+ cachedViews: state => state.tagsView.cachedViews,
kaptcha: state => state.app.kaptcha, // 验证码
publicKey: state => state.app.publicKey, // 公钥
sid: state => state.app.sid, // 用户标识
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, // 角色名称列表
diff --git a/src/store/index.js b/src/store/index.js
index 9bfa6a7..c7e23ff 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -3,6 +3,7 @@
import app from './modules/app'
import user from './modules/user'
import permission from './modules/permission'
+import tagsView from './modules/tagsView'
import getters from './getters'
Vue.use(Vuex)
@@ -11,7 +12,8 @@
modules: {
app,
user,
- permission
+ permission,
+ tagsView
},
getters
})
diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js
new file mode 100644
index 0000000..b7e3be9
--- /dev/null
+++ b/src/store/modules/tagsView.js
@@ -0,0 +1,165 @@
+const state = {
+ visitedViews: [], // 用户访问过的页面
+ cachedViews: [] // 实际keep-alive的路由,可以在配置路由的时候通过meta.noCache来设置是否需要缓存,默认都缓存
+}
+
+const mutations = {
+ ADD_VISITED_VIEW: (state, view) => {
+ if (state.visitedViews.some(v => v.path === view.path)) return
+ state.visitedViews.push(
+ Object.assign({}, view, {
+ title: view.meta.title || 'no-name'
+ })
+ )
+ },
+ ADD_CACHED_VIEW: (state, view) => {
+ if (state.cachedViews.includes(view.name)) return
+ if (!view.meta.noCache) {
+ state.cachedViews.push(view.name)
+ }
+ },
+
+ DEL_VISITED_VIEW: (state, 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
+ }
+ }
+ },
+
+ DEL_OTHERS_VISITED_VIEWS: (state, view) => {
+ state.visitedViews = state.visitedViews.filter(v => {
+ return v.meta.affix || v.path === view.path
+ })
+ },
+ DEL_OTHERS_CACHED_VIEWS: (state, view) => {
+ for (const i of state.cachedViews) {
+ if (i === view.name) {
+ const index = state.cachedViews.indexOf(i)
+ state.cachedViews = state.cachedViews.slice(index, index + 1)
+ break
+ }
+ }
+ },
+
+ DEL_ALL_VISITED_VIEWS: state => {
+ // keep affix tags
+ const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
+ state.visitedViews = affixTags
+ },
+ DEL_ALL_CACHED_VIEWS: state => {
+ state.cachedViews = []
+ },
+
+ UPDATE_VISITED_VIEW: (state, view) => {
+ for (let v of state.visitedViews) {
+ if (v.path === view.path) {
+ v = Object.assign(v, view)
+ break
+ }
+ }
+ }
+}
+
+const actions = {
+ addView({ dispatch }, view) {
+ dispatch('addVisitedView', view)
+ dispatch('addCachedView', view)
+ },
+ addVisitedView({ commit }, view) {
+ commit('ADD_VISITED_VIEW', view)
+ },
+ addCachedView({ commit }, view) {
+ commit('ADD_CACHED_VIEW', view)
+ },
+
+ delView({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delVisitedView', view)
+ dispatch('delCachedView', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delVisitedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_VISITED_VIEW', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delCachedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_CACHED_VIEW', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delOthersViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delOthersVisitedViews', view)
+ dispatch('delOthersCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delOthersVisitedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_VISITED_VIEWS', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delOthersCachedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_CACHED_VIEWS', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delAllViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delAllVisitedViews', view)
+ dispatch('delAllCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delAllVisitedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_VISITED_VIEWS')
+ resolve([...state.visitedViews])
+ })
+ },
+ delAllCachedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_CACHED_VIEWS')
+ resolve([...state.cachedViews])
+ })
+ },
+
+ updateVisitedView({ commit }, view) {
+ commit('UPDATE_VISITED_VIEW', view)
+ }
+}
+
+export default {
+ namespaced: true,
+ state,
+ mutations,
+ actions
+}
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 9008573..c151568 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -19,6 +19,12 @@
SET_TOKEN: (state, token) => {
state.token = token
},
+ SET_ID: (state, id) => {
+ state.id = id
+ },
+ SET_ACCOUNT: (state, account) => {
+ state.account = account
+ },
SET_NAME: (state, name) => {
state.name = name
},
@@ -88,6 +94,8 @@
} else {
reject('该用户无组织机构')
}
+ commit('SET_ID', data.id)
+ commit('SET_ACCOUNT', data.account)
commit('SET_NAME', data.name)
resolve(response)
}).catch(error => {
diff --git a/src/views/layout/Layout.vue b/src/views/layout/Layout.vue
index a451849..c7b94e7 100644
--- a/src/views/layout/Layout.vue
+++ b/src/views/layout/Layout.vue
@@ -9,6 +9,8 @@
+
+
@@ -22,10 +24,12 @@
+
+
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 7d3afbd..26c5e62 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,6 +8,7 @@
/* Layout */
import Layout from '../views/layout/Layout'
+import { systemRouters } from './modules/system'
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
@@ -49,10 +50,12 @@
component: Layout,
redirect: 'dashboard',
name: 'Dashboard',
- hidden: true,
+ // hidden: true,
children: [{
path: 'dashboard',
- component: () => import('@/views/dashboard/index')
+ name: 'Dashboard',
+ component: () => import('@/views/dashboard/index'),
+ meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}]
}
]
@@ -66,55 +69,6 @@
// 异步挂载路由
// 动态需要根据权限加载的路由表
export const asyncRouterMap = [
- {
- 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: '/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'] }
- }
- ]
- },
+ ...systemRouters,
{ path: '*', redirect: '/404', hidden: true }
]
diff --git a/src/router/modules/system.js b/src/router/modules/system.js
new file mode 100644
index 0000000..0f4fd98
--- /dev/null
+++ b/src/router/modules/system.js
@@ -0,0 +1,65 @@
+/* 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'] }
+ }
+ ]
+}]
diff --git a/src/store/getters.js b/src/store/getters.js
index 93860ed..80b80fb 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -1,10 +1,14 @@
const getters = {
sidebar: state => state.app.sidebar, // 侧边栏
device: state => state.app.device, // 设备
+ visitedViews: state => state.tagsView.visitedViews,
+ cachedViews: state => state.tagsView.cachedViews,
kaptcha: state => state.app.kaptcha, // 验证码
publicKey: state => state.app.publicKey, // 公钥
sid: state => state.app.sid, // 用户标识
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, // 角色名称列表
diff --git a/src/store/index.js b/src/store/index.js
index 9bfa6a7..c7e23ff 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -3,6 +3,7 @@
import app from './modules/app'
import user from './modules/user'
import permission from './modules/permission'
+import tagsView from './modules/tagsView'
import getters from './getters'
Vue.use(Vuex)
@@ -11,7 +12,8 @@
modules: {
app,
user,
- permission
+ permission,
+ tagsView
},
getters
})
diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js
new file mode 100644
index 0000000..b7e3be9
--- /dev/null
+++ b/src/store/modules/tagsView.js
@@ -0,0 +1,165 @@
+const state = {
+ visitedViews: [], // 用户访问过的页面
+ cachedViews: [] // 实际keep-alive的路由,可以在配置路由的时候通过meta.noCache来设置是否需要缓存,默认都缓存
+}
+
+const mutations = {
+ ADD_VISITED_VIEW: (state, view) => {
+ if (state.visitedViews.some(v => v.path === view.path)) return
+ state.visitedViews.push(
+ Object.assign({}, view, {
+ title: view.meta.title || 'no-name'
+ })
+ )
+ },
+ ADD_CACHED_VIEW: (state, view) => {
+ if (state.cachedViews.includes(view.name)) return
+ if (!view.meta.noCache) {
+ state.cachedViews.push(view.name)
+ }
+ },
+
+ DEL_VISITED_VIEW: (state, 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
+ }
+ }
+ },
+
+ DEL_OTHERS_VISITED_VIEWS: (state, view) => {
+ state.visitedViews = state.visitedViews.filter(v => {
+ return v.meta.affix || v.path === view.path
+ })
+ },
+ DEL_OTHERS_CACHED_VIEWS: (state, view) => {
+ for (const i of state.cachedViews) {
+ if (i === view.name) {
+ const index = state.cachedViews.indexOf(i)
+ state.cachedViews = state.cachedViews.slice(index, index + 1)
+ break
+ }
+ }
+ },
+
+ DEL_ALL_VISITED_VIEWS: state => {
+ // keep affix tags
+ const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
+ state.visitedViews = affixTags
+ },
+ DEL_ALL_CACHED_VIEWS: state => {
+ state.cachedViews = []
+ },
+
+ UPDATE_VISITED_VIEW: (state, view) => {
+ for (let v of state.visitedViews) {
+ if (v.path === view.path) {
+ v = Object.assign(v, view)
+ break
+ }
+ }
+ }
+}
+
+const actions = {
+ addView({ dispatch }, view) {
+ dispatch('addVisitedView', view)
+ dispatch('addCachedView', view)
+ },
+ addVisitedView({ commit }, view) {
+ commit('ADD_VISITED_VIEW', view)
+ },
+ addCachedView({ commit }, view) {
+ commit('ADD_CACHED_VIEW', view)
+ },
+
+ delView({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delVisitedView', view)
+ dispatch('delCachedView', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delVisitedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_VISITED_VIEW', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delCachedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_CACHED_VIEW', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delOthersViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delOthersVisitedViews', view)
+ dispatch('delOthersCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delOthersVisitedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_VISITED_VIEWS', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delOthersCachedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_CACHED_VIEWS', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delAllViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delAllVisitedViews', view)
+ dispatch('delAllCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delAllVisitedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_VISITED_VIEWS')
+ resolve([...state.visitedViews])
+ })
+ },
+ delAllCachedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_CACHED_VIEWS')
+ resolve([...state.cachedViews])
+ })
+ },
+
+ updateVisitedView({ commit }, view) {
+ commit('UPDATE_VISITED_VIEW', view)
+ }
+}
+
+export default {
+ namespaced: true,
+ state,
+ mutations,
+ actions
+}
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 9008573..c151568 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -19,6 +19,12 @@
SET_TOKEN: (state, token) => {
state.token = token
},
+ SET_ID: (state, id) => {
+ state.id = id
+ },
+ SET_ACCOUNT: (state, account) => {
+ state.account = account
+ },
SET_NAME: (state, name) => {
state.name = name
},
@@ -88,6 +94,8 @@
} else {
reject('该用户无组织机构')
}
+ commit('SET_ID', data.id)
+ commit('SET_ACCOUNT', data.account)
commit('SET_NAME', data.name)
resolve(response)
}).catch(error => {
diff --git a/src/views/layout/Layout.vue b/src/views/layout/Layout.vue
index a451849..c7b94e7 100644
--- a/src/views/layout/Layout.vue
+++ b/src/views/layout/Layout.vue
@@ -9,6 +9,8 @@
+
+
@@ -22,10 +24,12 @@
+
+
diff --git a/src/views/layout/components/TagsView/index.vue b/src/views/layout/components/TagsView/index.vue
new file mode 100644
index 0000000..85aec74
--- /dev/null
+++ b/src/views/layout/components/TagsView/index.vue
@@ -0,0 +1,287 @@
+
+
+
+
+ {{ tag.title }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 7d3afbd..26c5e62 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,6 +8,7 @@
/* Layout */
import Layout from '../views/layout/Layout'
+import { systemRouters } from './modules/system'
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
@@ -49,10 +50,12 @@
component: Layout,
redirect: 'dashboard',
name: 'Dashboard',
- hidden: true,
+ // hidden: true,
children: [{
path: 'dashboard',
- component: () => import('@/views/dashboard/index')
+ name: 'Dashboard',
+ component: () => import('@/views/dashboard/index'),
+ meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}]
}
]
@@ -66,55 +69,6 @@
// 异步挂载路由
// 动态需要根据权限加载的路由表
export const asyncRouterMap = [
- {
- 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: '/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'] }
- }
- ]
- },
+ ...systemRouters,
{ path: '*', redirect: '/404', hidden: true }
]
diff --git a/src/router/modules/system.js b/src/router/modules/system.js
new file mode 100644
index 0000000..0f4fd98
--- /dev/null
+++ b/src/router/modules/system.js
@@ -0,0 +1,65 @@
+/* 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'] }
+ }
+ ]
+}]
diff --git a/src/store/getters.js b/src/store/getters.js
index 93860ed..80b80fb 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -1,10 +1,14 @@
const getters = {
sidebar: state => state.app.sidebar, // 侧边栏
device: state => state.app.device, // 设备
+ visitedViews: state => state.tagsView.visitedViews,
+ cachedViews: state => state.tagsView.cachedViews,
kaptcha: state => state.app.kaptcha, // 验证码
publicKey: state => state.app.publicKey, // 公钥
sid: state => state.app.sid, // 用户标识
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, // 角色名称列表
diff --git a/src/store/index.js b/src/store/index.js
index 9bfa6a7..c7e23ff 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -3,6 +3,7 @@
import app from './modules/app'
import user from './modules/user'
import permission from './modules/permission'
+import tagsView from './modules/tagsView'
import getters from './getters'
Vue.use(Vuex)
@@ -11,7 +12,8 @@
modules: {
app,
user,
- permission
+ permission,
+ tagsView
},
getters
})
diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js
new file mode 100644
index 0000000..b7e3be9
--- /dev/null
+++ b/src/store/modules/tagsView.js
@@ -0,0 +1,165 @@
+const state = {
+ visitedViews: [], // 用户访问过的页面
+ cachedViews: [] // 实际keep-alive的路由,可以在配置路由的时候通过meta.noCache来设置是否需要缓存,默认都缓存
+}
+
+const mutations = {
+ ADD_VISITED_VIEW: (state, view) => {
+ if (state.visitedViews.some(v => v.path === view.path)) return
+ state.visitedViews.push(
+ Object.assign({}, view, {
+ title: view.meta.title || 'no-name'
+ })
+ )
+ },
+ ADD_CACHED_VIEW: (state, view) => {
+ if (state.cachedViews.includes(view.name)) return
+ if (!view.meta.noCache) {
+ state.cachedViews.push(view.name)
+ }
+ },
+
+ DEL_VISITED_VIEW: (state, 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
+ }
+ }
+ },
+
+ DEL_OTHERS_VISITED_VIEWS: (state, view) => {
+ state.visitedViews = state.visitedViews.filter(v => {
+ return v.meta.affix || v.path === view.path
+ })
+ },
+ DEL_OTHERS_CACHED_VIEWS: (state, view) => {
+ for (const i of state.cachedViews) {
+ if (i === view.name) {
+ const index = state.cachedViews.indexOf(i)
+ state.cachedViews = state.cachedViews.slice(index, index + 1)
+ break
+ }
+ }
+ },
+
+ DEL_ALL_VISITED_VIEWS: state => {
+ // keep affix tags
+ const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
+ state.visitedViews = affixTags
+ },
+ DEL_ALL_CACHED_VIEWS: state => {
+ state.cachedViews = []
+ },
+
+ UPDATE_VISITED_VIEW: (state, view) => {
+ for (let v of state.visitedViews) {
+ if (v.path === view.path) {
+ v = Object.assign(v, view)
+ break
+ }
+ }
+ }
+}
+
+const actions = {
+ addView({ dispatch }, view) {
+ dispatch('addVisitedView', view)
+ dispatch('addCachedView', view)
+ },
+ addVisitedView({ commit }, view) {
+ commit('ADD_VISITED_VIEW', view)
+ },
+ addCachedView({ commit }, view) {
+ commit('ADD_CACHED_VIEW', view)
+ },
+
+ delView({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delVisitedView', view)
+ dispatch('delCachedView', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delVisitedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_VISITED_VIEW', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delCachedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_CACHED_VIEW', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delOthersViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delOthersVisitedViews', view)
+ dispatch('delOthersCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delOthersVisitedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_VISITED_VIEWS', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delOthersCachedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_CACHED_VIEWS', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delAllViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delAllVisitedViews', view)
+ dispatch('delAllCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delAllVisitedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_VISITED_VIEWS')
+ resolve([...state.visitedViews])
+ })
+ },
+ delAllCachedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_CACHED_VIEWS')
+ resolve([...state.cachedViews])
+ })
+ },
+
+ updateVisitedView({ commit }, view) {
+ commit('UPDATE_VISITED_VIEW', view)
+ }
+}
+
+export default {
+ namespaced: true,
+ state,
+ mutations,
+ actions
+}
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 9008573..c151568 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -19,6 +19,12 @@
SET_TOKEN: (state, token) => {
state.token = token
},
+ SET_ID: (state, id) => {
+ state.id = id
+ },
+ SET_ACCOUNT: (state, account) => {
+ state.account = account
+ },
SET_NAME: (state, name) => {
state.name = name
},
@@ -88,6 +94,8 @@
} else {
reject('该用户无组织机构')
}
+ commit('SET_ID', data.id)
+ commit('SET_ACCOUNT', data.account)
commit('SET_NAME', data.name)
resolve(response)
}).catch(error => {
diff --git a/src/views/layout/Layout.vue b/src/views/layout/Layout.vue
index a451849..c7b94e7 100644
--- a/src/views/layout/Layout.vue
+++ b/src/views/layout/Layout.vue
@@ -9,6 +9,8 @@
+
+
@@ -22,10 +24,12 @@
+
+
diff --git a/src/views/layout/components/TagsView/index.vue b/src/views/layout/components/TagsView/index.vue
new file mode 100644
index 0000000..85aec74
--- /dev/null
+++ b/src/views/layout/components/TagsView/index.vue
@@ -0,0 +1,287 @@
+
+
+
+
+ {{ tag.title }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/areaSelectTree.vue b/src/views/system/area/areaSelectTree.vue
new file mode 100644
index 0000000..dadb634
--- /dev/null
+++ b/src/views/system/area/areaSelectTree.vue
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 7d3afbd..26c5e62 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,6 +8,7 @@
/* Layout */
import Layout from '../views/layout/Layout'
+import { systemRouters } from './modules/system'
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
@@ -49,10 +50,12 @@
component: Layout,
redirect: 'dashboard',
name: 'Dashboard',
- hidden: true,
+ // hidden: true,
children: [{
path: 'dashboard',
- component: () => import('@/views/dashboard/index')
+ name: 'Dashboard',
+ component: () => import('@/views/dashboard/index'),
+ meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}]
}
]
@@ -66,55 +69,6 @@
// 异步挂载路由
// 动态需要根据权限加载的路由表
export const asyncRouterMap = [
- {
- 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: '/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'] }
- }
- ]
- },
+ ...systemRouters,
{ path: '*', redirect: '/404', hidden: true }
]
diff --git a/src/router/modules/system.js b/src/router/modules/system.js
new file mode 100644
index 0000000..0f4fd98
--- /dev/null
+++ b/src/router/modules/system.js
@@ -0,0 +1,65 @@
+/* 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'] }
+ }
+ ]
+}]
diff --git a/src/store/getters.js b/src/store/getters.js
index 93860ed..80b80fb 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -1,10 +1,14 @@
const getters = {
sidebar: state => state.app.sidebar, // 侧边栏
device: state => state.app.device, // 设备
+ visitedViews: state => state.tagsView.visitedViews,
+ cachedViews: state => state.tagsView.cachedViews,
kaptcha: state => state.app.kaptcha, // 验证码
publicKey: state => state.app.publicKey, // 公钥
sid: state => state.app.sid, // 用户标识
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, // 角色名称列表
diff --git a/src/store/index.js b/src/store/index.js
index 9bfa6a7..c7e23ff 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -3,6 +3,7 @@
import app from './modules/app'
import user from './modules/user'
import permission from './modules/permission'
+import tagsView from './modules/tagsView'
import getters from './getters'
Vue.use(Vuex)
@@ -11,7 +12,8 @@
modules: {
app,
user,
- permission
+ permission,
+ tagsView
},
getters
})
diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js
new file mode 100644
index 0000000..b7e3be9
--- /dev/null
+++ b/src/store/modules/tagsView.js
@@ -0,0 +1,165 @@
+const state = {
+ visitedViews: [], // 用户访问过的页面
+ cachedViews: [] // 实际keep-alive的路由,可以在配置路由的时候通过meta.noCache来设置是否需要缓存,默认都缓存
+}
+
+const mutations = {
+ ADD_VISITED_VIEW: (state, view) => {
+ if (state.visitedViews.some(v => v.path === view.path)) return
+ state.visitedViews.push(
+ Object.assign({}, view, {
+ title: view.meta.title || 'no-name'
+ })
+ )
+ },
+ ADD_CACHED_VIEW: (state, view) => {
+ if (state.cachedViews.includes(view.name)) return
+ if (!view.meta.noCache) {
+ state.cachedViews.push(view.name)
+ }
+ },
+
+ DEL_VISITED_VIEW: (state, 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
+ }
+ }
+ },
+
+ DEL_OTHERS_VISITED_VIEWS: (state, view) => {
+ state.visitedViews = state.visitedViews.filter(v => {
+ return v.meta.affix || v.path === view.path
+ })
+ },
+ DEL_OTHERS_CACHED_VIEWS: (state, view) => {
+ for (const i of state.cachedViews) {
+ if (i === view.name) {
+ const index = state.cachedViews.indexOf(i)
+ state.cachedViews = state.cachedViews.slice(index, index + 1)
+ break
+ }
+ }
+ },
+
+ DEL_ALL_VISITED_VIEWS: state => {
+ // keep affix tags
+ const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
+ state.visitedViews = affixTags
+ },
+ DEL_ALL_CACHED_VIEWS: state => {
+ state.cachedViews = []
+ },
+
+ UPDATE_VISITED_VIEW: (state, view) => {
+ for (let v of state.visitedViews) {
+ if (v.path === view.path) {
+ v = Object.assign(v, view)
+ break
+ }
+ }
+ }
+}
+
+const actions = {
+ addView({ dispatch }, view) {
+ dispatch('addVisitedView', view)
+ dispatch('addCachedView', view)
+ },
+ addVisitedView({ commit }, view) {
+ commit('ADD_VISITED_VIEW', view)
+ },
+ addCachedView({ commit }, view) {
+ commit('ADD_CACHED_VIEW', view)
+ },
+
+ delView({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delVisitedView', view)
+ dispatch('delCachedView', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delVisitedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_VISITED_VIEW', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delCachedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_CACHED_VIEW', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delOthersViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delOthersVisitedViews', view)
+ dispatch('delOthersCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delOthersVisitedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_VISITED_VIEWS', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delOthersCachedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_CACHED_VIEWS', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delAllViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delAllVisitedViews', view)
+ dispatch('delAllCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delAllVisitedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_VISITED_VIEWS')
+ resolve([...state.visitedViews])
+ })
+ },
+ delAllCachedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_CACHED_VIEWS')
+ resolve([...state.cachedViews])
+ })
+ },
+
+ updateVisitedView({ commit }, view) {
+ commit('UPDATE_VISITED_VIEW', view)
+ }
+}
+
+export default {
+ namespaced: true,
+ state,
+ mutations,
+ actions
+}
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 9008573..c151568 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -19,6 +19,12 @@
SET_TOKEN: (state, token) => {
state.token = token
},
+ SET_ID: (state, id) => {
+ state.id = id
+ },
+ SET_ACCOUNT: (state, account) => {
+ state.account = account
+ },
SET_NAME: (state, name) => {
state.name = name
},
@@ -88,6 +94,8 @@
} else {
reject('该用户无组织机构')
}
+ commit('SET_ID', data.id)
+ commit('SET_ACCOUNT', data.account)
commit('SET_NAME', data.name)
resolve(response)
}).catch(error => {
diff --git a/src/views/layout/Layout.vue b/src/views/layout/Layout.vue
index a451849..c7b94e7 100644
--- a/src/views/layout/Layout.vue
+++ b/src/views/layout/Layout.vue
@@ -9,6 +9,8 @@
+
+
@@ -22,10 +24,12 @@
+
+
diff --git a/src/views/layout/components/TagsView/index.vue b/src/views/layout/components/TagsView/index.vue
new file mode 100644
index 0000000..85aec74
--- /dev/null
+++ b/src/views/layout/components/TagsView/index.vue
@@ -0,0 +1,287 @@
+
+
+
+
+ {{ tag.title }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/areaSelectTree.vue b/src/views/system/area/areaSelectTree.vue
new file mode 100644
index 0000000..dadb634
--- /dev/null
+++ b/src/views/system/area/areaSelectTree.vue
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/editArea.vue b/src/views/system/area/editArea.vue
new file mode 100644
index 0000000..2715711
--- /dev/null
+++ b/src/views/system/area/editArea.vue
@@ -0,0 +1,218 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 7d3afbd..26c5e62 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,6 +8,7 @@
/* Layout */
import Layout from '../views/layout/Layout'
+import { systemRouters } from './modules/system'
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
@@ -49,10 +50,12 @@
component: Layout,
redirect: 'dashboard',
name: 'Dashboard',
- hidden: true,
+ // hidden: true,
children: [{
path: 'dashboard',
- component: () => import('@/views/dashboard/index')
+ name: 'Dashboard',
+ component: () => import('@/views/dashboard/index'),
+ meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}]
}
]
@@ -66,55 +69,6 @@
// 异步挂载路由
// 动态需要根据权限加载的路由表
export const asyncRouterMap = [
- {
- 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: '/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'] }
- }
- ]
- },
+ ...systemRouters,
{ path: '*', redirect: '/404', hidden: true }
]
diff --git a/src/router/modules/system.js b/src/router/modules/system.js
new file mode 100644
index 0000000..0f4fd98
--- /dev/null
+++ b/src/router/modules/system.js
@@ -0,0 +1,65 @@
+/* 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'] }
+ }
+ ]
+}]
diff --git a/src/store/getters.js b/src/store/getters.js
index 93860ed..80b80fb 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -1,10 +1,14 @@
const getters = {
sidebar: state => state.app.sidebar, // 侧边栏
device: state => state.app.device, // 设备
+ visitedViews: state => state.tagsView.visitedViews,
+ cachedViews: state => state.tagsView.cachedViews,
kaptcha: state => state.app.kaptcha, // 验证码
publicKey: state => state.app.publicKey, // 公钥
sid: state => state.app.sid, // 用户标识
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, // 角色名称列表
diff --git a/src/store/index.js b/src/store/index.js
index 9bfa6a7..c7e23ff 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -3,6 +3,7 @@
import app from './modules/app'
import user from './modules/user'
import permission from './modules/permission'
+import tagsView from './modules/tagsView'
import getters from './getters'
Vue.use(Vuex)
@@ -11,7 +12,8 @@
modules: {
app,
user,
- permission
+ permission,
+ tagsView
},
getters
})
diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js
new file mode 100644
index 0000000..b7e3be9
--- /dev/null
+++ b/src/store/modules/tagsView.js
@@ -0,0 +1,165 @@
+const state = {
+ visitedViews: [], // 用户访问过的页面
+ cachedViews: [] // 实际keep-alive的路由,可以在配置路由的时候通过meta.noCache来设置是否需要缓存,默认都缓存
+}
+
+const mutations = {
+ ADD_VISITED_VIEW: (state, view) => {
+ if (state.visitedViews.some(v => v.path === view.path)) return
+ state.visitedViews.push(
+ Object.assign({}, view, {
+ title: view.meta.title || 'no-name'
+ })
+ )
+ },
+ ADD_CACHED_VIEW: (state, view) => {
+ if (state.cachedViews.includes(view.name)) return
+ if (!view.meta.noCache) {
+ state.cachedViews.push(view.name)
+ }
+ },
+
+ DEL_VISITED_VIEW: (state, 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
+ }
+ }
+ },
+
+ DEL_OTHERS_VISITED_VIEWS: (state, view) => {
+ state.visitedViews = state.visitedViews.filter(v => {
+ return v.meta.affix || v.path === view.path
+ })
+ },
+ DEL_OTHERS_CACHED_VIEWS: (state, view) => {
+ for (const i of state.cachedViews) {
+ if (i === view.name) {
+ const index = state.cachedViews.indexOf(i)
+ state.cachedViews = state.cachedViews.slice(index, index + 1)
+ break
+ }
+ }
+ },
+
+ DEL_ALL_VISITED_VIEWS: state => {
+ // keep affix tags
+ const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
+ state.visitedViews = affixTags
+ },
+ DEL_ALL_CACHED_VIEWS: state => {
+ state.cachedViews = []
+ },
+
+ UPDATE_VISITED_VIEW: (state, view) => {
+ for (let v of state.visitedViews) {
+ if (v.path === view.path) {
+ v = Object.assign(v, view)
+ break
+ }
+ }
+ }
+}
+
+const actions = {
+ addView({ dispatch }, view) {
+ dispatch('addVisitedView', view)
+ dispatch('addCachedView', view)
+ },
+ addVisitedView({ commit }, view) {
+ commit('ADD_VISITED_VIEW', view)
+ },
+ addCachedView({ commit }, view) {
+ commit('ADD_CACHED_VIEW', view)
+ },
+
+ delView({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delVisitedView', view)
+ dispatch('delCachedView', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delVisitedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_VISITED_VIEW', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delCachedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_CACHED_VIEW', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delOthersViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delOthersVisitedViews', view)
+ dispatch('delOthersCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delOthersVisitedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_VISITED_VIEWS', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delOthersCachedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_CACHED_VIEWS', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delAllViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delAllVisitedViews', view)
+ dispatch('delAllCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delAllVisitedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_VISITED_VIEWS')
+ resolve([...state.visitedViews])
+ })
+ },
+ delAllCachedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_CACHED_VIEWS')
+ resolve([...state.cachedViews])
+ })
+ },
+
+ updateVisitedView({ commit }, view) {
+ commit('UPDATE_VISITED_VIEW', view)
+ }
+}
+
+export default {
+ namespaced: true,
+ state,
+ mutations,
+ actions
+}
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 9008573..c151568 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -19,6 +19,12 @@
SET_TOKEN: (state, token) => {
state.token = token
},
+ SET_ID: (state, id) => {
+ state.id = id
+ },
+ SET_ACCOUNT: (state, account) => {
+ state.account = account
+ },
SET_NAME: (state, name) => {
state.name = name
},
@@ -88,6 +94,8 @@
} else {
reject('该用户无组织机构')
}
+ commit('SET_ID', data.id)
+ commit('SET_ACCOUNT', data.account)
commit('SET_NAME', data.name)
resolve(response)
}).catch(error => {
diff --git a/src/views/layout/Layout.vue b/src/views/layout/Layout.vue
index a451849..c7b94e7 100644
--- a/src/views/layout/Layout.vue
+++ b/src/views/layout/Layout.vue
@@ -9,6 +9,8 @@
+
+
@@ -22,10 +24,12 @@
+
+
diff --git a/src/views/layout/components/TagsView/index.vue b/src/views/layout/components/TagsView/index.vue
new file mode 100644
index 0000000..85aec74
--- /dev/null
+++ b/src/views/layout/components/TagsView/index.vue
@@ -0,0 +1,287 @@
+
+
+
+
+ {{ tag.title }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/areaSelectTree.vue b/src/views/system/area/areaSelectTree.vue
new file mode 100644
index 0000000..dadb634
--- /dev/null
+++ b/src/views/system/area/areaSelectTree.vue
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/editArea.vue b/src/views/system/area/editArea.vue
new file mode 100644
index 0000000..2715711
--- /dev/null
+++ b/src/views/system/area/editArea.vue
@@ -0,0 +1,218 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/listArea.vue b/src/views/system/area/listArea.vue
new file mode 100644
index 0000000..1d73f81
--- /dev/null
+++ b/src/views/system/area/listArea.vue
@@ -0,0 +1,214 @@
+
+
+
+
+
+
+
+
+
+ 搜索
+ 新增
+
+
+
+
+
+
+
+
+
+ {{ scope.row[column.value] }}
+
+
+
+
+ 修改
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 7d3afbd..26c5e62 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,6 +8,7 @@
/* Layout */
import Layout from '../views/layout/Layout'
+import { systemRouters } from './modules/system'
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
@@ -49,10 +50,12 @@
component: Layout,
redirect: 'dashboard',
name: 'Dashboard',
- hidden: true,
+ // hidden: true,
children: [{
path: 'dashboard',
- component: () => import('@/views/dashboard/index')
+ name: 'Dashboard',
+ component: () => import('@/views/dashboard/index'),
+ meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}]
}
]
@@ -66,55 +69,6 @@
// 异步挂载路由
// 动态需要根据权限加载的路由表
export const asyncRouterMap = [
- {
- 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: '/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'] }
- }
- ]
- },
+ ...systemRouters,
{ path: '*', redirect: '/404', hidden: true }
]
diff --git a/src/router/modules/system.js b/src/router/modules/system.js
new file mode 100644
index 0000000..0f4fd98
--- /dev/null
+++ b/src/router/modules/system.js
@@ -0,0 +1,65 @@
+/* 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'] }
+ }
+ ]
+}]
diff --git a/src/store/getters.js b/src/store/getters.js
index 93860ed..80b80fb 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -1,10 +1,14 @@
const getters = {
sidebar: state => state.app.sidebar, // 侧边栏
device: state => state.app.device, // 设备
+ visitedViews: state => state.tagsView.visitedViews,
+ cachedViews: state => state.tagsView.cachedViews,
kaptcha: state => state.app.kaptcha, // 验证码
publicKey: state => state.app.publicKey, // 公钥
sid: state => state.app.sid, // 用户标识
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, // 角色名称列表
diff --git a/src/store/index.js b/src/store/index.js
index 9bfa6a7..c7e23ff 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -3,6 +3,7 @@
import app from './modules/app'
import user from './modules/user'
import permission from './modules/permission'
+import tagsView from './modules/tagsView'
import getters from './getters'
Vue.use(Vuex)
@@ -11,7 +12,8 @@
modules: {
app,
user,
- permission
+ permission,
+ tagsView
},
getters
})
diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js
new file mode 100644
index 0000000..b7e3be9
--- /dev/null
+++ b/src/store/modules/tagsView.js
@@ -0,0 +1,165 @@
+const state = {
+ visitedViews: [], // 用户访问过的页面
+ cachedViews: [] // 实际keep-alive的路由,可以在配置路由的时候通过meta.noCache来设置是否需要缓存,默认都缓存
+}
+
+const mutations = {
+ ADD_VISITED_VIEW: (state, view) => {
+ if (state.visitedViews.some(v => v.path === view.path)) return
+ state.visitedViews.push(
+ Object.assign({}, view, {
+ title: view.meta.title || 'no-name'
+ })
+ )
+ },
+ ADD_CACHED_VIEW: (state, view) => {
+ if (state.cachedViews.includes(view.name)) return
+ if (!view.meta.noCache) {
+ state.cachedViews.push(view.name)
+ }
+ },
+
+ DEL_VISITED_VIEW: (state, 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
+ }
+ }
+ },
+
+ DEL_OTHERS_VISITED_VIEWS: (state, view) => {
+ state.visitedViews = state.visitedViews.filter(v => {
+ return v.meta.affix || v.path === view.path
+ })
+ },
+ DEL_OTHERS_CACHED_VIEWS: (state, view) => {
+ for (const i of state.cachedViews) {
+ if (i === view.name) {
+ const index = state.cachedViews.indexOf(i)
+ state.cachedViews = state.cachedViews.slice(index, index + 1)
+ break
+ }
+ }
+ },
+
+ DEL_ALL_VISITED_VIEWS: state => {
+ // keep affix tags
+ const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
+ state.visitedViews = affixTags
+ },
+ DEL_ALL_CACHED_VIEWS: state => {
+ state.cachedViews = []
+ },
+
+ UPDATE_VISITED_VIEW: (state, view) => {
+ for (let v of state.visitedViews) {
+ if (v.path === view.path) {
+ v = Object.assign(v, view)
+ break
+ }
+ }
+ }
+}
+
+const actions = {
+ addView({ dispatch }, view) {
+ dispatch('addVisitedView', view)
+ dispatch('addCachedView', view)
+ },
+ addVisitedView({ commit }, view) {
+ commit('ADD_VISITED_VIEW', view)
+ },
+ addCachedView({ commit }, view) {
+ commit('ADD_CACHED_VIEW', view)
+ },
+
+ delView({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delVisitedView', view)
+ dispatch('delCachedView', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delVisitedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_VISITED_VIEW', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delCachedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_CACHED_VIEW', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delOthersViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delOthersVisitedViews', view)
+ dispatch('delOthersCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delOthersVisitedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_VISITED_VIEWS', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delOthersCachedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_CACHED_VIEWS', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delAllViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delAllVisitedViews', view)
+ dispatch('delAllCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delAllVisitedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_VISITED_VIEWS')
+ resolve([...state.visitedViews])
+ })
+ },
+ delAllCachedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_CACHED_VIEWS')
+ resolve([...state.cachedViews])
+ })
+ },
+
+ updateVisitedView({ commit }, view) {
+ commit('UPDATE_VISITED_VIEW', view)
+ }
+}
+
+export default {
+ namespaced: true,
+ state,
+ mutations,
+ actions
+}
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 9008573..c151568 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -19,6 +19,12 @@
SET_TOKEN: (state, token) => {
state.token = token
},
+ SET_ID: (state, id) => {
+ state.id = id
+ },
+ SET_ACCOUNT: (state, account) => {
+ state.account = account
+ },
SET_NAME: (state, name) => {
state.name = name
},
@@ -88,6 +94,8 @@
} else {
reject('该用户无组织机构')
}
+ commit('SET_ID', data.id)
+ commit('SET_ACCOUNT', data.account)
commit('SET_NAME', data.name)
resolve(response)
}).catch(error => {
diff --git a/src/views/layout/Layout.vue b/src/views/layout/Layout.vue
index a451849..c7b94e7 100644
--- a/src/views/layout/Layout.vue
+++ b/src/views/layout/Layout.vue
@@ -9,6 +9,8 @@
+
+
@@ -22,10 +24,12 @@
+
+
diff --git a/src/views/layout/components/TagsView/index.vue b/src/views/layout/components/TagsView/index.vue
new file mode 100644
index 0000000..85aec74
--- /dev/null
+++ b/src/views/layout/components/TagsView/index.vue
@@ -0,0 +1,287 @@
+
+
+
+
+ {{ tag.title }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/areaSelectTree.vue b/src/views/system/area/areaSelectTree.vue
new file mode 100644
index 0000000..dadb634
--- /dev/null
+++ b/src/views/system/area/areaSelectTree.vue
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/editArea.vue b/src/views/system/area/editArea.vue
new file mode 100644
index 0000000..2715711
--- /dev/null
+++ b/src/views/system/area/editArea.vue
@@ -0,0 +1,218 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/listArea.vue b/src/views/system/area/listArea.vue
new file mode 100644
index 0000000..1d73f81
--- /dev/null
+++ b/src/views/system/area/listArea.vue
@@ -0,0 +1,214 @@
+
+
+
+
+
+
+
+
+
+ 搜索
+ 新增
+
+
+
+
+
+
+
+
+
+ {{ scope.row[column.value] }}
+
+
+
+
+ 修改
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/dict/editDict.vue b/src/views/system/dict/editDict.vue
new file mode 100644
index 0000000..394b0ea
--- /dev/null
+++ b/src/views/system/dict/editDict.vue
@@ -0,0 +1,229 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 添加
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 7d3afbd..26c5e62 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,6 +8,7 @@
/* Layout */
import Layout from '../views/layout/Layout'
+import { systemRouters } from './modules/system'
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
@@ -49,10 +50,12 @@
component: Layout,
redirect: 'dashboard',
name: 'Dashboard',
- hidden: true,
+ // hidden: true,
children: [{
path: 'dashboard',
- component: () => import('@/views/dashboard/index')
+ name: 'Dashboard',
+ component: () => import('@/views/dashboard/index'),
+ meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}]
}
]
@@ -66,55 +69,6 @@
// 异步挂载路由
// 动态需要根据权限加载的路由表
export const asyncRouterMap = [
- {
- 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: '/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'] }
- }
- ]
- },
+ ...systemRouters,
{ path: '*', redirect: '/404', hidden: true }
]
diff --git a/src/router/modules/system.js b/src/router/modules/system.js
new file mode 100644
index 0000000..0f4fd98
--- /dev/null
+++ b/src/router/modules/system.js
@@ -0,0 +1,65 @@
+/* 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'] }
+ }
+ ]
+}]
diff --git a/src/store/getters.js b/src/store/getters.js
index 93860ed..80b80fb 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -1,10 +1,14 @@
const getters = {
sidebar: state => state.app.sidebar, // 侧边栏
device: state => state.app.device, // 设备
+ visitedViews: state => state.tagsView.visitedViews,
+ cachedViews: state => state.tagsView.cachedViews,
kaptcha: state => state.app.kaptcha, // 验证码
publicKey: state => state.app.publicKey, // 公钥
sid: state => state.app.sid, // 用户标识
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, // 角色名称列表
diff --git a/src/store/index.js b/src/store/index.js
index 9bfa6a7..c7e23ff 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -3,6 +3,7 @@
import app from './modules/app'
import user from './modules/user'
import permission from './modules/permission'
+import tagsView from './modules/tagsView'
import getters from './getters'
Vue.use(Vuex)
@@ -11,7 +12,8 @@
modules: {
app,
user,
- permission
+ permission,
+ tagsView
},
getters
})
diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js
new file mode 100644
index 0000000..b7e3be9
--- /dev/null
+++ b/src/store/modules/tagsView.js
@@ -0,0 +1,165 @@
+const state = {
+ visitedViews: [], // 用户访问过的页面
+ cachedViews: [] // 实际keep-alive的路由,可以在配置路由的时候通过meta.noCache来设置是否需要缓存,默认都缓存
+}
+
+const mutations = {
+ ADD_VISITED_VIEW: (state, view) => {
+ if (state.visitedViews.some(v => v.path === view.path)) return
+ state.visitedViews.push(
+ Object.assign({}, view, {
+ title: view.meta.title || 'no-name'
+ })
+ )
+ },
+ ADD_CACHED_VIEW: (state, view) => {
+ if (state.cachedViews.includes(view.name)) return
+ if (!view.meta.noCache) {
+ state.cachedViews.push(view.name)
+ }
+ },
+
+ DEL_VISITED_VIEW: (state, 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
+ }
+ }
+ },
+
+ DEL_OTHERS_VISITED_VIEWS: (state, view) => {
+ state.visitedViews = state.visitedViews.filter(v => {
+ return v.meta.affix || v.path === view.path
+ })
+ },
+ DEL_OTHERS_CACHED_VIEWS: (state, view) => {
+ for (const i of state.cachedViews) {
+ if (i === view.name) {
+ const index = state.cachedViews.indexOf(i)
+ state.cachedViews = state.cachedViews.slice(index, index + 1)
+ break
+ }
+ }
+ },
+
+ DEL_ALL_VISITED_VIEWS: state => {
+ // keep affix tags
+ const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
+ state.visitedViews = affixTags
+ },
+ DEL_ALL_CACHED_VIEWS: state => {
+ state.cachedViews = []
+ },
+
+ UPDATE_VISITED_VIEW: (state, view) => {
+ for (let v of state.visitedViews) {
+ if (v.path === view.path) {
+ v = Object.assign(v, view)
+ break
+ }
+ }
+ }
+}
+
+const actions = {
+ addView({ dispatch }, view) {
+ dispatch('addVisitedView', view)
+ dispatch('addCachedView', view)
+ },
+ addVisitedView({ commit }, view) {
+ commit('ADD_VISITED_VIEW', view)
+ },
+ addCachedView({ commit }, view) {
+ commit('ADD_CACHED_VIEW', view)
+ },
+
+ delView({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delVisitedView', view)
+ dispatch('delCachedView', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delVisitedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_VISITED_VIEW', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delCachedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_CACHED_VIEW', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delOthersViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delOthersVisitedViews', view)
+ dispatch('delOthersCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delOthersVisitedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_VISITED_VIEWS', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delOthersCachedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_CACHED_VIEWS', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delAllViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delAllVisitedViews', view)
+ dispatch('delAllCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delAllVisitedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_VISITED_VIEWS')
+ resolve([...state.visitedViews])
+ })
+ },
+ delAllCachedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_CACHED_VIEWS')
+ resolve([...state.cachedViews])
+ })
+ },
+
+ updateVisitedView({ commit }, view) {
+ commit('UPDATE_VISITED_VIEW', view)
+ }
+}
+
+export default {
+ namespaced: true,
+ state,
+ mutations,
+ actions
+}
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 9008573..c151568 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -19,6 +19,12 @@
SET_TOKEN: (state, token) => {
state.token = token
},
+ SET_ID: (state, id) => {
+ state.id = id
+ },
+ SET_ACCOUNT: (state, account) => {
+ state.account = account
+ },
SET_NAME: (state, name) => {
state.name = name
},
@@ -88,6 +94,8 @@
} else {
reject('该用户无组织机构')
}
+ commit('SET_ID', data.id)
+ commit('SET_ACCOUNT', data.account)
commit('SET_NAME', data.name)
resolve(response)
}).catch(error => {
diff --git a/src/views/layout/Layout.vue b/src/views/layout/Layout.vue
index a451849..c7b94e7 100644
--- a/src/views/layout/Layout.vue
+++ b/src/views/layout/Layout.vue
@@ -9,6 +9,8 @@
+
+
@@ -22,10 +24,12 @@
+
+
diff --git a/src/views/layout/components/TagsView/index.vue b/src/views/layout/components/TagsView/index.vue
new file mode 100644
index 0000000..85aec74
--- /dev/null
+++ b/src/views/layout/components/TagsView/index.vue
@@ -0,0 +1,287 @@
+
+
+
+
+ {{ tag.title }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/areaSelectTree.vue b/src/views/system/area/areaSelectTree.vue
new file mode 100644
index 0000000..dadb634
--- /dev/null
+++ b/src/views/system/area/areaSelectTree.vue
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/editArea.vue b/src/views/system/area/editArea.vue
new file mode 100644
index 0000000..2715711
--- /dev/null
+++ b/src/views/system/area/editArea.vue
@@ -0,0 +1,218 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/listArea.vue b/src/views/system/area/listArea.vue
new file mode 100644
index 0000000..1d73f81
--- /dev/null
+++ b/src/views/system/area/listArea.vue
@@ -0,0 +1,214 @@
+
+
+
+
+
+
+
+
+
+ 搜索
+ 新增
+
+
+
+
+
+
+
+
+
+ {{ scope.row[column.value] }}
+
+
+
+
+ 修改
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/dict/editDict.vue b/src/views/system/dict/editDict.vue
new file mode 100644
index 0000000..394b0ea
--- /dev/null
+++ b/src/views/system/dict/editDict.vue
@@ -0,0 +1,229 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 添加
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/dict/listDict.vue b/src/views/system/dict/listDict.vue
new file mode 100644
index 0000000..bcca9d1
--- /dev/null
+++ b/src/views/system/dict/listDict.vue
@@ -0,0 +1,217 @@
+
+
+
+
+
+
+
+
+
+ 搜索
+ 新增
+
+
+
+
+
+
+
+
+
+ {{ scope.row[column.value] }}
+
+
+
+
+ 修改
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/api/area.js b/src/api/area.js
index de1855a..a5a6b0d 100644
--- a/src/api/area.js
+++ b/src/api/area.js
@@ -23,3 +23,45 @@
})
}
+// 区域查询,非分页,加载树用
+export function getAreaTree(params) {
+ return request({
+ url: 'area/list',
+ method: 'get',
+ params
+ })
+}
+// 区域类型查询
+export function getAreaType() {
+ return request({
+ url: 'dict/code/levelType',
+ method: 'get'
+ })
+}
+
+// 添加区域
+export function addArea(params) {
+ return request({
+ url: 'area/add',
+ method: 'post',
+ params
+ })
+}
+// 修改区域机构
+export function updateArea(params) {
+ return request({
+ url: 'area/update',
+ method: 'post',
+ params
+ })
+}
+// 删除区域机构
+export function delArea(id) {
+ return request({
+ url: 'area/delete',
+ method: 'post',
+ params: {
+ id: id
+ }
+ })
+}
diff --git a/src/api/dict.js b/src/api/dict.js
new file mode 100644
index 0000000..3415b6d
--- /dev/null
+++ b/src/api/dict.js
@@ -0,0 +1,39 @@
+/**
+ * 字典接口
+ */
+import request from '@/utils/request'
+// 字典查询
+export function getDictList(params) {
+ return request({
+ url: 'dict/listPage',
+ method: 'get',
+ params
+ })
+}
+
+// 添加字典
+export function addDict(params) {
+ return request({
+ url: 'dict/add',
+ method: 'post',
+ params
+ })
+}
+// 修改字典机构
+export function updateDict(params) {
+ return request({
+ url: 'dict/update',
+ method: 'post',
+ params
+ })
+}
+// 删除字典机构
+export function delDict(id) {
+ return request({
+ url: 'dict/delete',
+ method: 'post',
+ params: {
+ dictId: id
+ }
+ })
+}
diff --git a/src/icons/svg/icon-base.svg b/src/icons/svg/icon-base.svg
new file mode 100644
index 0000000..6271178
--- /dev/null
+++ b/src/icons/svg/icon-base.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/icons/svg/icon-dict.svg b/src/icons/svg/icon-dict.svg
new file mode 100644
index 0000000..16275bc
--- /dev/null
+++ b/src/icons/svg/icon-dict.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 7d3afbd..26c5e62 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,6 +8,7 @@
/* Layout */
import Layout from '../views/layout/Layout'
+import { systemRouters } from './modules/system'
/**
* hidden: true if `hidden:true` will not show in the sidebar(default is false)
@@ -49,10 +50,12 @@
component: Layout,
redirect: 'dashboard',
name: 'Dashboard',
- hidden: true,
+ // hidden: true,
children: [{
path: 'dashboard',
- component: () => import('@/views/dashboard/index')
+ name: 'Dashboard',
+ component: () => import('@/views/dashboard/index'),
+ meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true }
}]
}
]
@@ -66,55 +69,6 @@
// 异步挂载路由
// 动态需要根据权限加载的路由表
export const asyncRouterMap = [
- {
- 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: '/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'] }
- }
- ]
- },
+ ...systemRouters,
{ path: '*', redirect: '/404', hidden: true }
]
diff --git a/src/router/modules/system.js b/src/router/modules/system.js
new file mode 100644
index 0000000..0f4fd98
--- /dev/null
+++ b/src/router/modules/system.js
@@ -0,0 +1,65 @@
+/* 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'] }
+ }
+ ]
+}]
diff --git a/src/store/getters.js b/src/store/getters.js
index 93860ed..80b80fb 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -1,10 +1,14 @@
const getters = {
sidebar: state => state.app.sidebar, // 侧边栏
device: state => state.app.device, // 设备
+ visitedViews: state => state.tagsView.visitedViews,
+ cachedViews: state => state.tagsView.cachedViews,
kaptcha: state => state.app.kaptcha, // 验证码
publicKey: state => state.app.publicKey, // 公钥
sid: state => state.app.sid, // 用户标识
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, // 角色名称列表
diff --git a/src/store/index.js b/src/store/index.js
index 9bfa6a7..c7e23ff 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -3,6 +3,7 @@
import app from './modules/app'
import user from './modules/user'
import permission from './modules/permission'
+import tagsView from './modules/tagsView'
import getters from './getters'
Vue.use(Vuex)
@@ -11,7 +12,8 @@
modules: {
app,
user,
- permission
+ permission,
+ tagsView
},
getters
})
diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js
new file mode 100644
index 0000000..b7e3be9
--- /dev/null
+++ b/src/store/modules/tagsView.js
@@ -0,0 +1,165 @@
+const state = {
+ visitedViews: [], // 用户访问过的页面
+ cachedViews: [] // 实际keep-alive的路由,可以在配置路由的时候通过meta.noCache来设置是否需要缓存,默认都缓存
+}
+
+const mutations = {
+ ADD_VISITED_VIEW: (state, view) => {
+ if (state.visitedViews.some(v => v.path === view.path)) return
+ state.visitedViews.push(
+ Object.assign({}, view, {
+ title: view.meta.title || 'no-name'
+ })
+ )
+ },
+ ADD_CACHED_VIEW: (state, view) => {
+ if (state.cachedViews.includes(view.name)) return
+ if (!view.meta.noCache) {
+ state.cachedViews.push(view.name)
+ }
+ },
+
+ DEL_VISITED_VIEW: (state, 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
+ }
+ }
+ },
+
+ DEL_OTHERS_VISITED_VIEWS: (state, view) => {
+ state.visitedViews = state.visitedViews.filter(v => {
+ return v.meta.affix || v.path === view.path
+ })
+ },
+ DEL_OTHERS_CACHED_VIEWS: (state, view) => {
+ for (const i of state.cachedViews) {
+ if (i === view.name) {
+ const index = state.cachedViews.indexOf(i)
+ state.cachedViews = state.cachedViews.slice(index, index + 1)
+ break
+ }
+ }
+ },
+
+ DEL_ALL_VISITED_VIEWS: state => {
+ // keep affix tags
+ const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
+ state.visitedViews = affixTags
+ },
+ DEL_ALL_CACHED_VIEWS: state => {
+ state.cachedViews = []
+ },
+
+ UPDATE_VISITED_VIEW: (state, view) => {
+ for (let v of state.visitedViews) {
+ if (v.path === view.path) {
+ v = Object.assign(v, view)
+ break
+ }
+ }
+ }
+}
+
+const actions = {
+ addView({ dispatch }, view) {
+ dispatch('addVisitedView', view)
+ dispatch('addCachedView', view)
+ },
+ addVisitedView({ commit }, view) {
+ commit('ADD_VISITED_VIEW', view)
+ },
+ addCachedView({ commit }, view) {
+ commit('ADD_CACHED_VIEW', view)
+ },
+
+ delView({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delVisitedView', view)
+ dispatch('delCachedView', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delVisitedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_VISITED_VIEW', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delCachedView({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_CACHED_VIEW', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delOthersViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delOthersVisitedViews', view)
+ dispatch('delOthersCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delOthersVisitedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_VISITED_VIEWS', view)
+ resolve([...state.visitedViews])
+ })
+ },
+ delOthersCachedViews({ commit, state }, view) {
+ return new Promise(resolve => {
+ commit('DEL_OTHERS_CACHED_VIEWS', view)
+ resolve([...state.cachedViews])
+ })
+ },
+
+ delAllViews({ dispatch, state }, view) {
+ return new Promise(resolve => {
+ dispatch('delAllVisitedViews', view)
+ dispatch('delAllCachedViews', view)
+ resolve({
+ visitedViews: [...state.visitedViews],
+ cachedViews: [...state.cachedViews]
+ })
+ })
+ },
+ delAllVisitedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_VISITED_VIEWS')
+ resolve([...state.visitedViews])
+ })
+ },
+ delAllCachedViews({ commit, state }) {
+ return new Promise(resolve => {
+ commit('DEL_ALL_CACHED_VIEWS')
+ resolve([...state.cachedViews])
+ })
+ },
+
+ updateVisitedView({ commit }, view) {
+ commit('UPDATE_VISITED_VIEW', view)
+ }
+}
+
+export default {
+ namespaced: true,
+ state,
+ mutations,
+ actions
+}
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 9008573..c151568 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -19,6 +19,12 @@
SET_TOKEN: (state, token) => {
state.token = token
},
+ SET_ID: (state, id) => {
+ state.id = id
+ },
+ SET_ACCOUNT: (state, account) => {
+ state.account = account
+ },
SET_NAME: (state, name) => {
state.name = name
},
@@ -88,6 +94,8 @@
} else {
reject('该用户无组织机构')
}
+ commit('SET_ID', data.id)
+ commit('SET_ACCOUNT', data.account)
commit('SET_NAME', data.name)
resolve(response)
}).catch(error => {
diff --git a/src/views/layout/Layout.vue b/src/views/layout/Layout.vue
index a451849..c7b94e7 100644
--- a/src/views/layout/Layout.vue
+++ b/src/views/layout/Layout.vue
@@ -9,6 +9,8 @@
+
+
@@ -22,10 +24,12 @@
+
+
diff --git a/src/views/layout/components/TagsView/index.vue b/src/views/layout/components/TagsView/index.vue
new file mode 100644
index 0000000..85aec74
--- /dev/null
+++ b/src/views/layout/components/TagsView/index.vue
@@ -0,0 +1,287 @@
+
+
+
+
+ {{ tag.title }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/areaSelectTree.vue b/src/views/system/area/areaSelectTree.vue
new file mode 100644
index 0000000..dadb634
--- /dev/null
+++ b/src/views/system/area/areaSelectTree.vue
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/editArea.vue b/src/views/system/area/editArea.vue
new file mode 100644
index 0000000..2715711
--- /dev/null
+++ b/src/views/system/area/editArea.vue
@@ -0,0 +1,218 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/area/listArea.vue b/src/views/system/area/listArea.vue
new file mode 100644
index 0000000..1d73f81
--- /dev/null
+++ b/src/views/system/area/listArea.vue
@@ -0,0 +1,214 @@
+
+
+
+
+
+
+
+
+
+ 搜索
+ 新增
+
+
+
+
+
+
+
+
+
+ {{ scope.row[column.value] }}
+
+
+
+
+ 修改
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/dict/editDict.vue b/src/views/system/dict/editDict.vue
new file mode 100644
index 0000000..394b0ea
--- /dev/null
+++ b/src/views/system/dict/editDict.vue
@@ -0,0 +1,229 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 添加
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/dict/listDict.vue b/src/views/system/dict/listDict.vue
new file mode 100644
index 0000000..bcca9d1
--- /dev/null
+++ b/src/views/system/dict/listDict.vue
@@ -0,0 +1,217 @@
+
+
+
+
+
+
+
+
+
+ 搜索
+ 新增
+
+
+
+
+
+
+
+
+
+ {{ scope.row[column.value] }}
+
+
+
+
+ 修改
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/user/resetPwd.vue b/src/views/system/user/resetPwd.vue
index e03e18c..b09c6f2 100644
--- a/src/views/system/user/resetPwd.vue
+++ b/src/views/system/user/resetPwd.vue
@@ -32,6 +32,7 @@
if (value === '') {
callback(new Error('旧密码不能为空'))
}
+ callback()
}
const validatePass = (rule, value, callback) => {
console.log('验证密码')