refactor: 系统管理接口和页面重构

Former-commit-id: d16371370c6bf6928bcf0883e1511a1a91ea388d
This commit is contained in:
haoxr
2023-03-11 21:21:54 +08:00
parent 314789ad09
commit 00082202dd
22 changed files with 1664 additions and 1549 deletions

View File

@@ -1,31 +1,31 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
DictQuery,
DictPageResult,
DictTypeQuery,
DictTypePageResult,
DictTypeForm,
DictItemQuery,
DictItemPageResult,
DictItemForm
DictQuery,
DictForm,
DictPageResult
} from './types';
/**
* 获取字典类型分页列表
* 字典类型分页列表
*
* @param queryParams
*/
export function listDictTypePages(
queryParams: DictQuery
): AxiosPromise<DictPageResult> {
export function getDictTypePage(
queryParams: DictTypeQuery
): AxiosPromise<DictTypePageResult> {
return request({
url: '/api/v1/dict/types/pages',
url: '/api/v1/dict/types/page',
method: 'get',
params: queryParams
});
}
/**
* 获取字典类型表单数据
* 字典类型表单数据
*
* @param id
*/
@@ -78,7 +78,7 @@ export function deleteDictTypes(ids: string) {
*
* @param typeCode 字典类型编码
*/
export function getDictionaries(typeCode: string): AxiosPromise<OptionType[]> {
export function getDictOptions(typeCode: string): AxiosPromise<OptionType[]> {
return request({
url: '/api/v1/dict/types/' + typeCode + '/items',
method: 'get'
@@ -86,36 +86,36 @@ export function getDictionaries(typeCode: string): AxiosPromise<OptionType[]> {
}
/**
* 获取字典分页列表
* 字典分页列表
*/
export function listDictItemPages(
queryParams: DictItemQuery
): AxiosPromise<DictItemPageResult> {
export function getDictPage(
queryParams: DictQuery
): AxiosPromise<DictPageResult> {
return request({
url: '/api/v1/dict/items/pages',
url: '/api/v1/dict/page',
method: 'get',
params: queryParams
});
}
/**
* 获取字典数据项表单数据
* 获取字典表单数据
*
* @param id
*/
export function getDictItemData(id: number): AxiosPromise<DictItemForm> {
export function getDictFormData(id: number): AxiosPromise<DictForm> {
return request({
url: '/api/v1/dict/items/' + id + '/form',
url: '/api/v1/dict/' + id + '/form',
method: 'get'
});
}
/**
* 新增字典
* 新增字典
*
* @param data
*/
export function saveDictItem(data: DictItemForm) {
export function addDict(data: DictForm) {
return request({
url: '/api/v1/dict/items',
method: 'post',
@@ -129,22 +129,22 @@ export function saveDictItem(data: DictItemForm) {
* @param id
* @param data
*/
export function updateDictItem(id: number, data: DictItemForm) {
export function updateDict(id: number, data: DictForm) {
return request({
url: '/api/v1/dict/items/' + id,
url: '/api/v1/dict/' + id,
method: 'put',
data: data
});
}
/**
* 批量删除字典数据项
* 删除字典
*
* @param ids 字典项ID多个以英文逗号(,)分割
*/
export function deleteDictItems(ids: string) {
export function deleteDict(ids: string) {
return request({
url: '/api/v1/dict/items/' + ids,
url: '/api/v1/dict/' + ids,
method: 'delete'
});
}

View File

@@ -1,44 +1,74 @@
/**
* 字典查询参数
* 字典类型查询参数
*/
export interface DictQuery extends PageQuery {
export interface DictTypeQuery extends PageQuery {
/**
* 字典名称
* 字典类型名称
*/
name?: string;
}
/**
* 字典类型
* 字典类型分页对象
*/
export interface Dict {
export interface DictTypePageVO {
/**
* 字典类型ID
*/
id: number;
/**
* 类型编码
*/
code: string;
/**
* 类型名称
*/
name: string;
status: number;
remark: string;
/**
* 状态(1:启用;0:禁用)
*/
status?: number;
/**
* 备注
*/
remark?: string;
}
/**
* 字典分页项类型声明
*/
export type DictPageResult = PageResult<Dict[]>;
export type DictTypePageResult = PageResult<DictTypePageVO[]>;
/**
* 字典表单类型声明
*/
export interface DictTypeForm {
id: number | undefined;
name: string;
code: string;
/**
* 字典类型ID
*/
id?: number;
/**
* 类型名称
*/
name?: string;
/**
* 类型编码
*/
code?: string;
/**
* 类型状态1:启用;0:禁用
*/
status: number;
remark: string;
/**
* 备注
*/
remark?: string;
}
/**
* 字典查询参数类型声明
* 字典查询参数
*/
export interface DictItemQuery extends PageQuery {
export interface DictQuery extends PageQuery {
/**
* 字典项名称
*/
@@ -50,35 +80,63 @@ export interface DictItemQuery extends PageQuery {
}
/**
* 字典数据项类型
* 字典分页对象
*/
export interface DictItem {
id: number;
name: string;
value: string;
typeCode: string;
sort: number;
status: number;
defaulted: number;
export interface DictPageVO {
/**
* 字典ID
*/
id?: number;
/**
* 字典名称
*/
name?: string;
/**
* 状态(1:启用;0:禁用)
*/
status?: number;
/**
* 字典值
*/
value?: string;
}
/**
* 字典分页
*/
export type DictPageResult = PageResult<DictPageVO[]>;
/**
* 字典表单
*/
export interface DictForm {
/**
* 字典ID
*/
id?: number;
/**
* 字典名称
*/
name?: string;
/**
* 排序
*/
sort?: number;
/**
* 状态(1:启用;0:禁用)
*/
status?: number;
/**
* 类型编码
*/
typeCode?: string;
/**
* 值
*/
value?: string;
/**
* 备注
*/
remark?: string;
}
/**
* 字典分页项类型声明
*/
export type DictItemPageResult = PageResult<DictItem[]>;
/**
* 字典表单类型声明
*/
export interface DictItemForm {
id?: number;
typeCode?: string;
typeName?: string;
name: string;
code: string;
value: string;
status: number;
sort: number;
remark: string;
}