import axios from "axios";
|
import { Pagination } from "@/types/global";
|
|
export interface User {
|
userId: string;
|
userName: string;
|
nickName: string;
|
email: string;
|
phoneNumber: string;
|
dept: any;
|
createTime: string;
|
status: string;
|
}
|
|
export interface Organization {
|
deptId: string;
|
deptName: string;
|
email: string;
|
leader: string;
|
phone: string;
|
orderNum: string;
|
parentId: string;
|
status: string;
|
address: string;
|
parentName: string;
|
}
|
|
export interface Result<T> {
|
code: number;
|
msg: string;
|
rows: T;
|
total: number;
|
}
|
|
export function UserList(params: Pagination) {
|
return axios.get<Result<User[]>>("/base/system/user/list", { params });
|
}
|
|
export function Userstatus(userID, status) {
|
return axios.put("/base/system/user/changeStatus", { "userId": userID, "status": status });
|
}
|
|
export function UserChangePwd(userId) {
|
return axios.put("/base/system/user/profile/updatePwd", { "userId": userId });
|
}
|
|
|
export function UserEdit(user) {
|
return axios.put("/base/system/user", { user });
|
}
|
|
export function UserAdd(user) {
|
return axios.post("/base/system/user", { user });
|
}
|
|
export function UserDelete(userId) {
|
return axios.delete("/base/system/user/" + userId);
|
}
|
|
export function OrganizationList(key: string) {
|
return axios.post<Result<Organization[]>>("/base/system/dept/list", { "deptName": key });
|
}
|
|
|
export function OrganizationAdd(organization) {
|
return axios.post("/base/system/dept", { organization });
|
}
|
|
export function OrganizationDelete(id) {
|
return axios.delete("/base/system/dept/" + id);
|
}
|
|
export function OrganizationUpdate(organization) {
|
return axios.put("/base/system/dept", { organization });
|
}
|
|
|
export function OrganizationById(id) {
|
return axios.get<Result<Organization>>("/base/system/dept/" + id);
|
}
|