mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-25 06:57:15 +08:00
style: 优化前端 CRUD 相关命名
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
import { DeptParam } from '@/api/system/dept';
|
||||
import { MenuParam } from '@/api/system/menu';
|
||||
import { RoleParam } from '@/api/system/role';
|
||||
import { ListParam as DeptParam } from '@/api/system/dept';
|
||||
import { ListParam as MenuParam } from '@/api/system/menu';
|
||||
import { ListParam as RoleParam } from '@/api/system/role';
|
||||
import { TreeNodeData } from '@arco-design/web-vue';
|
||||
import { LabelValueState } from '@/store/modules/dict/types';
|
||||
|
||||
|
@@ -3,7 +3,7 @@ import qs from 'query-string';
|
||||
|
||||
const BASE_URL = '/monitor/online/user';
|
||||
|
||||
export interface OnlineUserRecord {
|
||||
export interface DataRecord {
|
||||
token: string;
|
||||
username: string;
|
||||
nickname: string;
|
||||
@@ -13,19 +13,19 @@ export interface OnlineUserRecord {
|
||||
loginTime: string;
|
||||
}
|
||||
|
||||
export interface OnlineUserParam extends Partial<OnlineUserRecord> {
|
||||
export interface ListParam extends Partial<DataRecord> {
|
||||
page: number;
|
||||
size: number;
|
||||
sort: Array<string>;
|
||||
}
|
||||
|
||||
export interface OnlineUserListRes {
|
||||
list: OnlineUserRecord[];
|
||||
export interface ListRes {
|
||||
list: DataRecord[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export function listOnlineUser(params: OnlineUserParam) {
|
||||
return axios.get<OnlineUserListRes>(BASE_URL, {
|
||||
export function list(params: ListParam) {
|
||||
return axios.get<ListRes>(BASE_URL, {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
|
@@ -3,7 +3,7 @@ import qs from 'query-string';
|
||||
|
||||
const BASE_URL = '/system/dept';
|
||||
|
||||
export interface DeptRecord {
|
||||
export interface DataRecord {
|
||||
id?: string;
|
||||
name: string;
|
||||
parentId?: string;
|
||||
@@ -15,18 +15,18 @@ export interface DeptRecord {
|
||||
createTime?: string;
|
||||
updateUserString?: string;
|
||||
updateTime?: string;
|
||||
children?: Array<DeptRecord>;
|
||||
children?: Array<DataRecord>;
|
||||
parentName?: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export interface DeptParam {
|
||||
export interface ListParam {
|
||||
name?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
export function listDept(params: DeptParam) {
|
||||
return axios.get<DeptRecord[]>(`${BASE_URL}/tree`, {
|
||||
export function list(params: ListParam) {
|
||||
return axios.get<DataRecord[]>(`${BASE_URL}/tree`, {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
@@ -34,18 +34,18 @@ export function listDept(params: DeptParam) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getDept(id: string) {
|
||||
return axios.get<DeptRecord>(`${BASE_URL}/${id}`);
|
||||
export function get(id: string) {
|
||||
return axios.get<DataRecord>(`${BASE_URL}/${id}`);
|
||||
}
|
||||
|
||||
export function addDept(req: DeptRecord) {
|
||||
export function add(req: DataRecord) {
|
||||
return axios.post(BASE_URL, req);
|
||||
}
|
||||
|
||||
export function updateDept(req: DeptRecord, id: string) {
|
||||
export function update(req: DataRecord, id: string) {
|
||||
return axios.put(`${BASE_URL}/${id}`, req);
|
||||
}
|
||||
|
||||
export function deleteDept(ids: string | Array<string>) {
|
||||
export function del(ids: string | Array<string>) {
|
||||
return axios.delete(`${BASE_URL}/${ids}`);
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ import qs from 'query-string';
|
||||
|
||||
const BASE_URL = '/system/menu';
|
||||
|
||||
export interface MenuRecord {
|
||||
export interface DataRecord {
|
||||
id?: string;
|
||||
title: string;
|
||||
parentId?: string;
|
||||
@@ -22,17 +22,17 @@ export interface MenuRecord {
|
||||
createTime?: string;
|
||||
updateUserString?: string;
|
||||
updateTime?: string;
|
||||
children?: Array<MenuRecord>;
|
||||
children?: Array<DataRecord>;
|
||||
parentName?: string;
|
||||
}
|
||||
|
||||
export interface MenuParam {
|
||||
export interface ListParam {
|
||||
name?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
export function listMenu(params: MenuParam) {
|
||||
return axios.get<MenuRecord[]>(`${BASE_URL}/tree`, {
|
||||
export function list(params: ListParam) {
|
||||
return axios.get<DataRecord[]>(`${BASE_URL}/tree`, {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
@@ -40,18 +40,18 @@ export function listMenu(params: MenuParam) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getMenu(id: string) {
|
||||
return axios.get<MenuRecord>(`${BASE_URL}/${id}`);
|
||||
export function get(id: string) {
|
||||
return axios.get<DataRecord>(`${BASE_URL}/${id}`);
|
||||
}
|
||||
|
||||
export function addMenu(req: MenuRecord) {
|
||||
export function add(req: DataRecord) {
|
||||
return axios.post(BASE_URL, req);
|
||||
}
|
||||
|
||||
export function updateMenu(req: MenuRecord, id: string) {
|
||||
export function update(req: DataRecord, id: string) {
|
||||
return axios.put(`${BASE_URL}/${id}`, req);
|
||||
}
|
||||
|
||||
export function deleteMenu(ids: string | Array<string>) {
|
||||
export function del(ids: string | Array<string>) {
|
||||
return axios.delete(`${BASE_URL}/${ids}`);
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ import qs from 'query-string';
|
||||
|
||||
const BASE_URL = '/system/role';
|
||||
|
||||
export interface RoleRecord {
|
||||
export interface DataRecord {
|
||||
id?: string;
|
||||
name: string;
|
||||
code?: string;
|
||||
@@ -21,7 +21,7 @@ export interface RoleRecord {
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export interface RoleParam {
|
||||
export interface ListParam {
|
||||
name?: string;
|
||||
status?: number;
|
||||
page?: number;
|
||||
@@ -29,13 +29,13 @@ export interface RoleParam {
|
||||
sort?: Array<string>;
|
||||
}
|
||||
|
||||
export interface RoleListRes {
|
||||
list: RoleRecord[];
|
||||
export interface ListRes {
|
||||
list: DataRecord[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export function listRole(params: RoleParam) {
|
||||
return axios.get<RoleListRes>(`${BASE_URL}`, {
|
||||
export function list(params: ListParam) {
|
||||
return axios.get<ListRes>(`${BASE_URL}`, {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
@@ -43,18 +43,18 @@ export function listRole(params: RoleParam) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getRole(id: string) {
|
||||
return axios.get<RoleRecord>(`${BASE_URL}/${id}`);
|
||||
export function get(id: string) {
|
||||
return axios.get<DataRecord>(`${BASE_URL}/${id}`);
|
||||
}
|
||||
|
||||
export function addRole(req: RoleRecord) {
|
||||
export function add(req: DataRecord) {
|
||||
return axios.post(BASE_URL, req);
|
||||
}
|
||||
|
||||
export function updateRole(req: RoleRecord, id: string) {
|
||||
export function update(req: DataRecord, id: string) {
|
||||
return axios.put(`${BASE_URL}/${id}`, req);
|
||||
}
|
||||
|
||||
export function deleteRole(ids: string | Array<string>) {
|
||||
export function del(ids: string | Array<string>) {
|
||||
return axios.delete(`${BASE_URL}/${ids}`);
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ import qs from 'query-string';
|
||||
|
||||
const BASE_URL = '/system/user';
|
||||
|
||||
export interface UserRecord {
|
||||
export interface DataRecord {
|
||||
id?: string;
|
||||
username: string;
|
||||
nickname: string;
|
||||
@@ -25,7 +25,7 @@ export interface UserRecord {
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export interface UserParam {
|
||||
export interface ListParam {
|
||||
username?: string;
|
||||
status?: number;
|
||||
createTime?: Array<string>;
|
||||
@@ -34,13 +34,13 @@ export interface UserParam {
|
||||
sort?: Array<string>;
|
||||
}
|
||||
|
||||
export interface UserListRes {
|
||||
list: UserRecord[];
|
||||
export interface ListRes {
|
||||
list: DataRecord[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export function listUser(params: UserParam) {
|
||||
return axios.get<UserListRes>(`${BASE_URL}`, {
|
||||
export function list(params: ListParam) {
|
||||
return axios.get<ListRes>(`${BASE_URL}`, {
|
||||
params,
|
||||
paramsSerializer: (obj) => {
|
||||
return qs.stringify(obj);
|
||||
@@ -48,19 +48,19 @@ export function listUser(params: UserParam) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getUser(id: string) {
|
||||
return axios.get<UserRecord>(`${BASE_URL}/${id}`);
|
||||
export function get(id: string) {
|
||||
return axios.get<DataRecord>(`${BASE_URL}/${id}`);
|
||||
}
|
||||
|
||||
export function addUser(req: UserRecord) {
|
||||
export function add(req: DataRecord) {
|
||||
return axios.post(BASE_URL, req);
|
||||
}
|
||||
|
||||
export function updateUser(req: UserRecord, id: string) {
|
||||
export function update(req: DataRecord, id: string) {
|
||||
return axios.put(`${BASE_URL}/${id}`, req);
|
||||
}
|
||||
|
||||
export function deleteUser(ids: string | Array<string>) {
|
||||
export function del(ids: string | Array<string>) {
|
||||
return axios.delete(`${BASE_URL}/${ids}`);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user