| | |
| | | import request from '@/utils/http' |
| | | |
| | | export function buildUserListParams(params = {}) { |
| | | return { |
| | | current: params.current || 1, |
| | | pageSize: params.pageSize || params.size || 20, |
| | | username: params.username, |
| | | nickname: params.nickname, |
| | | phone: params.phone, |
| | | status: params.status, |
| | | deptId: params.deptId |
| | | } |
| | | } |
| | | |
| | | export function buildRoleListParams(params = {}) { |
| | | return { |
| | | current: params.current || 1, |
| | | pageSize: params.pageSize || params.size || 20, |
| | | name: params.name, |
| | | code: params.code, |
| | | memo: params.memo, |
| | | status: params.status |
| | | } |
| | | } |
| | | |
| | | function fetchGetUserList(params) { |
| | | return request.get({ |
| | | url: '/api/user/list', |
| | | params |
| | | }) |
| | | return request.post({ url: '/user/page', params: buildUserListParams(params) }) |
| | | } |
| | | |
| | | function fetchSaveUser(params) { |
| | | return request.post({ url: '/user/save', params }) |
| | | } |
| | | |
| | | function fetchUpdateUser(params) { |
| | | return request.post({ url: '/user/update', params }) |
| | | } |
| | | |
| | | function fetchDeleteUser(id) { |
| | | return request.post({ url: `/user/remove/${id}` }) |
| | | } |
| | | |
| | | function fetchResetUserPassword(params) { |
| | | return request.post({ url: '/auth/reset/password', params }) |
| | | } |
| | | |
| | | function fetchUpdateUserStatus(params) { |
| | | return request.post({ url: '/user/update', params }) |
| | | } |
| | | |
| | | function fetchGetUserDetail(id) { |
| | | return request.get({ url: `/user/${id}` }) |
| | | } |
| | | |
| | | function fetchGetRoleList(params) { |
| | | return request.get({ |
| | | url: '/api/role/list', |
| | | return request.post({ url: '/role/page', params: buildRoleListParams(params) }) |
| | | } |
| | | |
| | | function fetchSaveRole(params) { |
| | | return request.post({ url: '/role/save', params }) |
| | | } |
| | | |
| | | function fetchUpdateRole(params) { |
| | | return request.post({ url: '/role/update', params }) |
| | | } |
| | | |
| | | function fetchDeleteRole(id) { |
| | | return request.post({ url: `/role/remove/${id}` }) |
| | | } |
| | | |
| | | function fetchGetRoleOptions(params) { |
| | | return request.post({ url: '/role/list', params }) |
| | | } |
| | | |
| | | function fetchGetDeptTree(params) { |
| | | return request.post({ url: '/dept/tree', params }) |
| | | } |
| | | |
| | | function fetchGetMenuTree(params) { |
| | | return request.post({ url: '/menu/tree', params }) |
| | | } |
| | | |
| | | function fetchGetRoleScopeList(scopeType, roleId) { |
| | | const urlMap = { |
| | | menu: '/role/scope/list', |
| | | pda: '/rolePda/scope/list', |
| | | matnr: '/roleMatnr/scope/list', |
| | | warehouse: '/roleWarehouse/scope/list' |
| | | } |
| | | return request.get({ url: urlMap[scopeType], params: { roleId } }) |
| | | } |
| | | |
| | | function fetchUpdateRoleScope(scopeType, params) { |
| | | const urlMap = { |
| | | menu: '/role/scope/update', |
| | | pda: '/rolePda/scope/update', |
| | | matnr: '/roleMatnr/scope/update', |
| | | warehouse: '/roleWarehouse/scope/update' |
| | | } |
| | | return request.post({ url: urlMap[scopeType], params }) |
| | | } |
| | | |
| | | function fetchGetUserLoginList(params) { |
| | | return request.post({ |
| | | url: '/userLogin/page', |
| | | params |
| | | }) |
| | | } |
| | | function fetchGetMenuList() { |
| | | return request.get({ |
| | | url: '/api/v3/system/menus/simple' |
| | | }) |
| | | |
| | | function fetchGetMenuList(params) { |
| | | return fetchGetMenuTree(params) |
| | | } |
| | | export { fetchGetMenuList, fetchGetRoleList, fetchGetUserList } |
| | | |
| | | export { |
| | | fetchGetUserList, |
| | | fetchSaveUser, |
| | | fetchUpdateUser, |
| | | fetchDeleteUser, |
| | | fetchResetUserPassword, |
| | | fetchUpdateUserStatus, |
| | | fetchGetUserDetail, |
| | | fetchGetRoleList, |
| | | fetchSaveRole, |
| | | fetchUpdateRole, |
| | | fetchDeleteRole, |
| | | fetchGetRoleOptions, |
| | | fetchGetDeptTree, |
| | | fetchGetMenuTree, |
| | | fetchGetRoleScopeList, |
| | | fetchUpdateRoleScope, |
| | | fetchGetUserLoginList, |
| | | fetchGetMenuList |
| | | } |