diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..71b754b --- /dev/null +++ b/README.en.md @@ -0,0 +1,36 @@ +# 大娃-VUE + +#### Description +大娃前端 + +#### Software Architecture +Software architecture description + +#### Installation + +1. xxxx +2. xxxx +3. xxxx + +#### Instructions + +1. xxxx +2. xxxx +3. xxxx + +#### Contribution + +1. Fork the repository +2. Create Feat_xxx branch +3. Commit your code +4. Create Pull Request + + +#### Gitee Feature + +1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md +2. Gitee blog [blog.gitee.com](https://blog.gitee.com) +3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) +4. The most valuable open source project [GVP](https://gitee.com/gvp) +5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) +6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/src/api/security/menu.js b/src/api/security/menu.js index 709bf2a..055e38b 100644 --- a/src/api/security/menu.js +++ b/src/api/security/menu.js @@ -2,11 +2,11 @@ import request from '@/utils/request' const menuApi = { add: 'sys/menu/add', - get: 'sys/menu/get', - update: 'sys/menu/update', - del: 'sys/menu/delete', - updateStatus: 'sys/menu/updateStatus', - list: 'sys/menu/listByParentId' + edit: 'sys/menu/edit', + del: 'sys/menu/del', + list: 'sys/menu/list', + tree: 'sys/menu/tree', + treeForGrant: 'sys/menu/treeForGrant' } export function menuAdd (params) { @@ -16,38 +16,38 @@ export function menuAdd (params) { data: params }) } -export function menuGet (params) { +export function menuEdit (params) { return request({ - url: menuApi.get, + url: menuApi.edit, method: 'post', data: params }) } -export function menuUpdate (params) { - return request({ - url: menuApi.update, - method: 'post', - data: params - }) -} -export function menuDelete (params) { +export function menuDel (params) { return request({ url: menuApi.del, method: 'post', - data: params + params: params }) } export function menuList (params) { return request({ url: menuApi.list, - method: 'post', - data: params + method: 'get', + params: params }) } -export function menuUpdateStatus (params) { +export function menuTree (params) { return request({ - url: menuApi.updateStatus, - method: 'post', - data: params + url: menuApi.tree, + method: 'get', + params: params + }) +} +export function menuTreeForGrant (params) { + return request({ + url: menuApi.treeForGrant, + method: 'get', + params: params }) } diff --git a/src/api/security/role.js b/src/api/security/role.js index 037d981..e219e51 100644 --- a/src/api/security/role.js +++ b/src/api/security/role.js @@ -2,11 +2,12 @@ import request from '@/utils/request' const roleApi = { add: '/sys/role/add', - get: '/sys/role/getById', - update: '/sys/role/update', - del: '/sys/role/delete', - page: '/sys/role/page', - updateStatus: '/sys/role/updateStatus' + edit: '/sys/role/edit', + del: '/sys/role/del', + page: '/sys/role/pageList', + list: '/sys/role/list', + ownMenu: '/sys/role/ownMenu', + grantMenu: '/sys/role/grantMenu' } export function roleAdd (params) { @@ -16,37 +17,44 @@ export function roleAdd (params) { data: params }) } -export function roleGet (params) { +export function roleEdit (params) { return request({ - url: roleApi.get, + url: roleApi.edit, method: 'post', data: params }) } -export function roleUpdate (params) { - return request({ - url: roleApi.update, - method: 'post', - data: params - }) -} -export function roleDelete (params) { +export function roleDel (params) { return request({ url: roleApi.del, method: 'post', - data: params + params: params }) } export function rolePage (params) { return request({ url: roleApi.page, - method: 'post', - data: params + method: 'get', + params: params }) } -export function roleUpdateStatus (params) { +export function roleList (params) { return request({ - url: roleApi.updateStatus, + url: roleApi.list, + method: 'get', + params: params + }) +} +export function roleOwnMenu (params) { + return request({ + url: roleApi.ownMenu, + method: 'post', + params: params + }) +} +export function roleGrantMenu (params) { + return request({ + url: roleApi.grantMenu, method: 'post', data: params }) diff --git a/src/api/security/user.js b/src/api/security/user.js index 7ef02bc..659b2b5 100644 --- a/src/api/security/user.js +++ b/src/api/security/user.js @@ -4,16 +4,17 @@ const userApi = { login: '/login', logout: '/logout', add: '/sys/user/add', - get: '/sys/user/get', - update: '/sys/user/update', - del: '/sys/user/delete', - page: '/sys/user/page', - updateEnabled: '/sys/user/updateEnabled', - getInfo: '/sys/user/getInfo' + edit: '/sys/user/edit', + del: '/sys/user/del', + page: '/sys/user/pageList', + getInfo: '/sys/user/getInfo', + ownRole: '/sys/user/ownRole', + grantRole: '/sys/user/grantRole' } const userPasswordApi = { update: '/sys/user/passwordUpdate', + reset: '/sys/user/passwordReset' } export function userLogin (params) { @@ -24,48 +25,35 @@ export function userLogin (params) { }) } -export function userAdd (params) { +export function userAdd (params,password) { return request({ url: userApi.add, method: 'post', - data: params + data: params, + params: password }) } -export function userGet (params) { +export function userEdit (params) { return request({ - url: userApi.get, + url: userApi.edit, method: 'post', data: params }) } -export function userUpdate (params) { - return request({ - url: userApi.update, - method: 'post', - data: params - }) -} -export function userDelete (params) { +export function userDel (params) { return request({ url: userApi.del, method: 'post', - data: params + params: params }) } export function userPage (params) { return request({ url: userApi.page, - method: 'post', - data: params + method: 'get', + params: params }) } -export function userLogout (params) { - // return request({ - // url: userApi.logout, - // method: 'post', - // data: params - // }) -} export function getInfo (params) { return request({ url: userApi.getInfo, @@ -73,9 +61,16 @@ export function getInfo (params) { data: params }) } -export function userUpdateEnabled (params) { +export function userOwnRole (params) { return request({ - url: userApi.updateEnabled, + url: userApi.ownRole, + method: 'post', + params: params + }) +} +export function userGrantRole (params) { + return request({ + url: userApi.grantRole, method: 'post', data: params }) @@ -87,3 +82,10 @@ export function passwordUpdate (params) { data: params }) } +export function passwordReset (params) { + return request({ + url: userPasswordApi.reset, + method: 'post', + data: params + }) +} diff --git a/src/components/Table/index.js b/src/components/Table/index.js index 7b1b717..94494c2 100644 --- a/src/components/Table/index.js +++ b/src/components/Table/index.js @@ -162,6 +162,10 @@ export default { pageSize: (pagination && pagination.pageSize) || this.localPagination.pageSize }) || false + // 后端数据rows为null保存修复 + if (r.rows == null) { + r.rows = [] + } // 为防止删除数据后导致页面当前页面数据长度为 0 ,自动翻页到上一页 if (r.rows.length === 0 && this.showPagination && this.localPagination.current > 1) { this.localPagination.current-- @@ -178,7 +182,13 @@ export default { // } catch (e) { // this.localPagination = false // } - this.localDataSource = r.rows // 返回结果中的数组数据 + // 返回结果中的数组数据 + if (this.showPagination === false) { + // 不分页的直接是在data中,我们在界面中直接就是返回了data + this.localDataSource = r + } else { + this.localDataSource = r.rows + } this.localLoading = false }) } diff --git a/src/config/router.config.js b/src/config/router.config.js index ebbbd14..b128734 100644 --- a/src/config/router.config.js +++ b/src/config/router.config.js @@ -52,9 +52,9 @@ export const asyncRouterMap = [ meta: { title: '角色管理', keepAlive: true } }, { - path: '/security/resource', - name: 'SecurityResource', - component: () => import('@/views/security/resource/ResourceTree'), + path: '/security/menu', + name: 'SecurityMenu', + component: () => import('@/views/security/menu/MenuList'), meta: { title: '菜单管理', keepAlive: true } }, { @@ -84,24 +84,24 @@ export const asyncRouterMap = [ component: () => import('@/views/project/ProjectList'), meta: { title: '自主项目', keepAlive: true, permission: ['form'] }, }, + // { + // path: '/project/add', + // name: 'ProjectForm', + // component: () => import('@/views/project/ProjectForm'), + // meta: { title: '新增项目', keepAlive: true, permission: ['form'], show: false } + // }, { - path: '/project/add', - name: 'ProjectForm', - component: () => import('@/views/project/ProjectForm'), - meta: { title: '新增项目', keepAlive: true, permission: ['form'], show: false } - }, - { - path: '/project/addClass', - name: 'addClass', - component: () => import('@/views/project/AddClass'), - meta: { title: '新增种类', keepAlive: true, permission: ['form'] } - }, - { - path: '/project/unitSelect', - name: 'unitSelect', - component: () => import('@/views/project/ProjectUnitSelect'), - meta: { title: '选择单位', keepAlive: true, permission: ['form'] } + path: '/project/projectStepForm', + name: 'projectStepForm', + component: () => import('@/views/project/form/ProjectStepForm'), + meta: { title: '新增项目-分布', keepAlive: true, permission: ['form'] } }, + // { + // path: '/project/unitSelect', + // name: 'unitSelect', + // component: () => import('@/views/project/ProjectUnitSelect'), + // meta: { title: '选择单位', keepAlive: true, permission: ['form'] } + // }, { path: '/form/step-form', name: 'StepForm', diff --git a/src/core/lazy_use.js b/src/core/lazy_use.js index 45c00e5..5dd1817 100644 --- a/src/core/lazy_use.js +++ b/src/core/lazy_use.js @@ -48,7 +48,8 @@ import { space, Transfer, Tree, - Empty + Empty, + TreeSelect } from 'ant-design-vue' import Viser from 'viser-vue' @@ -105,6 +106,7 @@ Vue.use(space) Vue.use(Tree) Vue.use(Transfer) Vue.use(Empty) +Vue.use(TreeSelect) Vue.prototype.$confirm = Modal.confirm Vue.prototype.$message = message diff --git a/src/utils/request.js b/src/utils/request.js index 1150477..aa5f63f 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -49,7 +49,7 @@ const errorHandler = (error) => { request.interceptors.request.use(config => { // const token = storage.get(ACCESS_TOKEN) // 由于登录接口待联调,token使用默认值 - const token = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImU1MmNhNTQ4LThmYmMtNGUyNC1iZjZjLWEzZjgwNDAwMDNiMCJ9._j_AHCd4I_PTWk4mt9euUzlABBoiqsNAIjVGrFJPWv8ZyoqgH9JPs2QFHtoj1Vly8cgtOri8X0ylbttglCcUQQ' + const token = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjIwMzU2Nzg5LWYyOGEtNDYxYi1iNTRhLTM2MWYzZjdhZjg2NSJ9.4vGoaj9KK8aYp9gEz2cnRM8MBWPrqIo8O5wNgbYK4-JUE3naeEuejjr3JfZ57TLbMYWqG1MkJ0kAT-2GMgreGQ' // 如果 token 存在,让每个请求携带自定义 token 请根据实际情况自行修改 if (token) { config.headers[ACCESS_TOKEN] = token diff --git a/src/utils/util.js b/src/utils/util.js index 274ff18..b801bce 100644 --- a/src/utils/util.js +++ b/src/utils/util.js @@ -65,3 +65,23 @@ export function removeLoadingAnimate (id = '', timeout = 1500) { document.body.removeChild(document.getElementById(id)) }, timeout) } + +export function listToTree (list, tree, parentId) { + list.forEach(item => { + if (item.pid === parentId) { + const child = { + ...item, + scopedSlots: { + icon: 'icon' + }, + children: [] + } + listToTree(list, child.children, item.id) + if (child.children.length <= 0) { + delete child.children + } + tree.push(child) + } + }) + return tree +} diff --git a/src/views/filterMap/menuTypeMap.js b/src/views/filterMap/menuTypeMap.js new file mode 100644 index 0000000..93bbc91 --- /dev/null +++ b/src/views/filterMap/menuTypeMap.js @@ -0,0 +1,5 @@ +export const menuTypeMap = { + 0: '目录', + 1: '菜单', + 2: '按钮' +} diff --git a/src/views/filterMap/sexMap.js b/src/views/filterMap/sexMap.js new file mode 100644 index 0000000..7cfea1e --- /dev/null +++ b/src/views/filterMap/sexMap.js @@ -0,0 +1,5 @@ +export const sexMap = { + 0: '未知', + 1: '男', + 2: '女' +} diff --git a/src/views/list/TableList.vue b/src/views/list/TableList.vue index 986eb2b..ba58a04 100644 --- a/src/views/list/TableList.vue +++ b/src/views/list/TableList.vue @@ -303,6 +303,7 @@ export default { }, onSelectChange (selectedRowKeys, selectedRows) { this.selectedRowKeys = selectedRowKeys + console.log(this.selectedRowKeys.length) this.selectedRows = selectedRows }, toggleAdvanced () { diff --git a/src/views/project/ProjectForm.vue b/src/views/project/ProjectForm.vue deleted file mode 100644 index 12eaf19..0000000 --- a/src/views/project/ProjectForm.vue +++ /dev/null @@ -1,131 +0,0 @@ - - diff --git a/src/views/project/ProjectList.vue b/src/views/project/ProjectList.vue index c8af6b3..d8bd0cc 100644 --- a/src/views/project/ProjectList.vue +++ b/src/views/project/ProjectList.vue @@ -75,7 +75,7 @@ import moment from 'moment' import { STable } from '@/components' import { getProjectList } from '@/api/project/project' -import ProjectForm from '@/views/project/ProjectForm' +import ProjectForm from '@/views/project/form/ProjectForm' import router from '@/router/index.js' export default { @@ -107,7 +107,6 @@ export default { { title: '项目状态', dataIndex: 'status', - key: 'status', customRender: (text, record, index) => { //项目状态 1-未发布 2-未开始 3-进行中 4-已完成 5-已中止 if (text == 1) { @@ -132,7 +131,6 @@ export default { { title: '操作', width: 200, - key: 'status', align: 'center', scopedSlots: { customRender: 'action' }, }, diff --git a/src/views/project/form/ProjectCourseSelect.vue b/src/views/project/form/ProjectCourseSelect.vue new file mode 100644 index 0000000..f542728 --- /dev/null +++ b/src/views/project/form/ProjectCourseSelect.vue @@ -0,0 +1,38 @@ + + + + \ No newline at end of file diff --git a/src/views/project/form/ProjectForm.vue b/src/views/project/form/ProjectForm.vue new file mode 100644 index 0000000..6a4c936 --- /dev/null +++ b/src/views/project/form/ProjectForm.vue @@ -0,0 +1,188 @@ + + diff --git a/src/views/project/form/ProjectStepForm.vue b/src/views/project/form/ProjectStepForm.vue new file mode 100644 index 0000000..80df7b0 --- /dev/null +++ b/src/views/project/form/ProjectStepForm.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/src/views/project/ProjectUnitSelect.vue b/src/views/project/form/ProjectUnitSelect.vue similarity index 92% rename from src/views/project/ProjectUnitSelect.vue rename to src/views/project/form/ProjectUnitSelect.vue index 6c7318c..9101380 100644 --- a/src/views/project/ProjectUnitSelect.vue +++ b/src/views/project/form/ProjectUnitSelect.vue @@ -1,7 +1,7 @@