|
@@ -1,13 +1,14 @@
|
|
import http from '@/api'
|
|
import http from '@/api'
|
|
import { parseStrEmpty } from '@/utils/common'
|
|
import { parseStrEmpty } from '@/utils/common'
|
|
-
|
|
|
|
|
|
+import { UserForm, UserQuery, UserVO, UserInfoVO } from '@/api/interface/system/user'
|
|
|
|
+import { DeptVO } from '@/api/interface/system/dept'
|
|
/**
|
|
/**
|
|
* @name 查询用户列表
|
|
* @name 查询用户列表
|
|
* @param query 参数
|
|
* @param query 参数
|
|
* @returns 返回列表
|
|
* @returns 返回列表
|
|
*/
|
|
*/
|
|
-export const listUserApi = (query: any) => {
|
|
|
|
- return http.get<any>('/system/user/list', query, { loading: true })
|
|
|
|
|
|
+export const listUserApi = (query: UserQuery) => {
|
|
|
|
+ return http.get<UserVO[]>('/system/user/list', query, { loading: true })
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -15,8 +16,8 @@ export const listUserApi = (query: any) => {
|
|
* @param userId userId
|
|
* @param userId userId
|
|
* @returns returns
|
|
* @returns returns
|
|
*/
|
|
*/
|
|
-export const getUserApi = (userId?: string) => {
|
|
|
|
- return http.get<any>(`/system/user/` + parseStrEmpty(userId))
|
|
|
|
|
|
+export const getUserApi = (userId?: string | number) => {
|
|
|
|
+ return http.get<UserInfoVO>(`/system/user/` + parseStrEmpty(userId))
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -24,14 +25,14 @@ export const getUserApi = (userId?: string) => {
|
|
* @returns returns
|
|
* @returns returns
|
|
*/
|
|
*/
|
|
export const deptTreeSelectApi = () => {
|
|
export const deptTreeSelectApi = () => {
|
|
- return http.get<any>(`/system/user/deptTree`)
|
|
|
|
|
|
+ return http.get<DeptVO[]>(`/system/user/deptTree`)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* @name 新增用户
|
|
* @name 新增用户
|
|
* @returns returns
|
|
* @returns returns
|
|
*/
|
|
*/
|
|
-export const addUserApi = (data: any) => {
|
|
|
|
|
|
+export const addUserApi = (data: UserForm) => {
|
|
return http.post<any>('/system/user', data, { loading: false })
|
|
return http.post<any>('/system/user', data, { loading: false })
|
|
}
|
|
}
|
|
|
|
|
|
@@ -39,7 +40,7 @@ export const addUserApi = (data: any) => {
|
|
* @name 修改用户
|
|
* @name 修改用户
|
|
* @returns returns
|
|
* @returns returns
|
|
*/
|
|
*/
|
|
-export const updateUserApi = (data: any) => {
|
|
|
|
|
|
+export const updateUserApi = (data: UserForm) => {
|
|
return http.put<any>('/system/user', data, { loading: false })
|
|
return http.put<any>('/system/user', data, { loading: false })
|
|
}
|
|
}
|
|
|
|
|
|
@@ -47,7 +48,7 @@ export const updateUserApi = (data: any) => {
|
|
* @name 删除用户
|
|
* @name 删除用户
|
|
* @returns returns
|
|
* @returns returns
|
|
*/
|
|
*/
|
|
-export const delUserApi = (userId: any) => {
|
|
|
|
|
|
+export const delUserApi = (userId: Array<string | number> | string | number) => {
|
|
return http.delete<any>(`/system/user/${userId}`)
|
|
return http.delete<any>(`/system/user/${userId}`)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -57,7 +58,7 @@ export const delUserApi = (userId: any) => {
|
|
* @param status status
|
|
* @param status status
|
|
* @returns returns
|
|
* @returns returns
|
|
*/
|
|
*/
|
|
-export const changeUserStatus = (data: any) => {
|
|
|
|
|
|
+export const changeUserStatus = (data: { userId: number | string; version: number; status: string }) => {
|
|
return http.put<any>('/system/user/changeStatus', data, { loading: false })
|
|
return http.put<any>('/system/user/changeStatus', data, { loading: false })
|
|
}
|
|
}
|
|
|
|
|
|
@@ -108,7 +109,7 @@ export const uploadAvatarApi = (params: FormData) => {
|
|
* @returns returns
|
|
* @returns returns
|
|
*/
|
|
*/
|
|
export const getUserProfileApi = () => {
|
|
export const getUserProfileApi = () => {
|
|
- return http.get<any>(`/system/user/profile`)
|
|
|
|
|
|
+ return http.get<UserInfoVO>(`/system/user/profile`)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -116,7 +117,7 @@ export const getUserProfileApi = () => {
|
|
* @param data data
|
|
* @param data data
|
|
* @returns returns
|
|
* @returns returns
|
|
*/
|
|
*/
|
|
-export const updateUserProfileApi = (data: any) => {
|
|
|
|
|
|
+export const updateUserProfileApi = (data: UserForm) => {
|
|
return http.put<any>('/system/user/profile', data, { loading: false })
|
|
return http.put<any>('/system/user/profile', data, { loading: false })
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -124,6 +125,6 @@ export const updateUserProfileApi = (data: any) => {
|
|
* @param data data
|
|
* @param data data
|
|
* @returns returns
|
|
* @returns returns
|
|
*/
|
|
*/
|
|
-export const updateUserPwdApi = (data: any) => {
|
|
|
|
|
|
+export const updateUserPwdApi = (data: { oldPassword: string; newPassword: string }) => {
|
|
return http.put<any>('system/user/profile/updatePwd', data, { loading: false })
|
|
return http.put<any>('system/user/profile/updatePwd', data, { loading: false })
|
|
}
|
|
}
|