用户管理
diff --git a/leave-school-vue/src/mock/index.js b/leave-school-vue/src/mock/index.js
index c2ab223..34a75e5 100644
--- a/leave-school-vue/src/mock/index.js
+++ b/leave-school-vue/src/mock/index.js
@@ -21,6 +21,7 @@
import sectionreportApi from './sectionreport'
import leaveschoolnodeApi from './leaveschoolnode'
+import userApi from './user'
// 登录
Mock.mock(/\/api\/login\/login/, 'post', loginApi.loginByUsername)
@@ -125,4 +126,11 @@
Mock.mock(/\/api\/procedures\/node\/delete-node/, 'delete', leaveschoolnodeApi.deleteData)
Mock.mock(/\/api\/procedures\/node\/get-item/, 'get', leaveschoolnodeApi.getItem)
+// 用户管理
+Mock.mock(/\/api\/system\/user\/list-api/, 'get', userApi.getPage)
+Mock.mock(/\/api\/system\/user\/dept-list/, 'get', userApi.getUserList)
+Mock.mock(/\/api\/system\/user\/create-user/, 'post', userApi.createData)
+Mock.mock(/\/api\/system\/user\/delete-user/, 'delete', userApi.deleteData)
+Mock.mock(/\/api\/system\/user\/get-item/, 'get', userApi.getItem)
+
export default Mock
diff --git a/leave-school-vue/src/mock/menulist.js b/leave-school-vue/src/mock/menulist.js
index 616ae59..55292e5 100644
--- a/leave-school-vue/src/mock/menulist.js
+++ b/leave-school-vue/src/mock/menulist.js
@@ -3,6 +3,19 @@
const menuList = [
{
+ path: '/permission',
+ code: 'permission',
+ meta: { title: '用户权限管理', icon: 'permission' },
+ children: [
+ {
+ path: 'user',
+ code: 'user',
+ resource: '/views/systemmanagement/user/index',
+ meta: { title: '用户管理', icon: 'user' }
+ }
+ ]
+ },
+ {
path: '/dictionary',
code: 'dictionary',
meta: { title: '数据字典管理', icon: 'dictionary' },
diff --git a/leave-school-vue/src/mock/user.js b/leave-school-vue/src/mock/user.js
new file mode 100644
index 0000000..431f833
--- /dev/null
+++ b/leave-school-vue/src/mock/user.js
@@ -0,0 +1,119 @@
+import Mock from 'mockjs'
+import { param2Obj, parseTime } from '@/utils'
+
+const userList = Mock.mock({
+ 'list|26': [{
+ 'id': '@increment',
+ 'rownum': '@id',
+ 'ghxh': '@id',
+ 'xm': '000@id',
+ 'zhlb|1': ['教职工', '学生', '其他'],
+ 'xb|1': ['男', '女'],
+ 'zt|1': ['启用', '停用'],
+ 'yx': '@cword(3, 5)',
+ 'xybm': '@word(6, 10)',
+ 'gzdw': '@word(6, 10)',
+ 'sj': '@cword(3, 5)',
+ 'wx': '@cword(3, 5)',
+ 'qq': '@cword(3, 5)'
+ }]
+}).list
+
+const zhlbList = Mock.mock(
+ [{
+ 'value': 'teacher',
+ 'label': '教职工'
+ },
+ {
+ 'value': 'student',
+ 'label': '学生'
+ },
+ {
+ 'value': 'other',
+ 'label': '其他'
+ }]
+)
+
+const xbList = Mock.mock(
+ [{
+ 'value': 'male',
+ 'label': '男'
+ },
+ {
+ 'value': 'female',
+ 'label': '女'
+ }]
+)
+const ztList = Mock.mock(
+ [{
+ 'value': 'on',
+ 'label': '启用'
+ },
+ {
+ 'value': 'off',
+ 'label': '停用'
+ }]
+)
+export default{
+ getPage: config => {
+ const { zhlb, ghxhxm, pageIndex = 1, pageSize = 20 } = param2Obj(config.url)
+ const mockList = userList.filter(item => {
+ if (zhlb && item.zhlb !== zhlb) return false
+ if (ghxhxm && item.ghxh + '' !== ghxhxm + '' && item.xm + '' !== ghxhxm + '') return false
+ return true
+ })
+
+ const pageList = mockList.filter((item, index) => index < pageSize * pageIndex && index >= pageSize * (pageIndex - 1))
+ return {
+ xbList: xbList,
+ ztList: ztList,
+ zhlbList: zhlbList,
+ items: pageList,
+ recordCount: mockList.length,
+ code: 200
+ }
+ },
+ getItem: config => {
+ const { id } = param2Obj(config.url)
+ const mockList = userList.filter(item => item.id + '' === id + '')
+ return {
+ data: mockList.length > 0 ? mockList[0] : null,
+ code: 200
+ }
+ },
+ createData: config => {
+ const user = JSON.parse(config.body)
+ user.cjsj = parseTime(new Date(), '{y}-{m}-{d}')
+ if (!user.id) {
+ user.id = '' + parseInt(Math.random() * 100) + 1024 // mock a id
+ userList.unshift(user)
+ } else {
+ for (let i = 0; i < userList.length; i++) {
+ if (userList[i].id + '' === user.id + '') {
+ userList.splice(i, 1, user)
+ break
+ }
+ }
+ }
+ return {
+ item: user,
+ code: 200
+ }
+ },
+ deleteData: config => {
+ const user = JSON.parse(config.body)
+ let index = -1
+ for (let i = 0; i < userList.length; i++) {
+ if (userList[i].id + '' === user.id + '') {
+ index = i
+ break
+ }
+ }
+ if (index > -1) {
+ userList.splice(index, 1)
+ }
+ return {
+ code: 200
+ }
+ }
+}