5 changed files with 52 additions and 84 deletions
@ -1,25 +1,34 @@ |
|||||||
import { ConfigParams, Config, ConfigResult } from '../entity/config' |
/** |
||||||
|
* 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||||
|
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||||
|
* author entfrm开发团队-王翔 |
||||||
|
*/ |
||||||
|
import type { ConfigParams, Config } from '/@/api/platform/system/entity/config'; |
||||||
import { defHttp } from '/@/utils/http/axios'; |
import { defHttp } from '/@/utils/http/axios'; |
||||||
import {isDef} from "/@/utils/is"; |
|
||||||
|
|
||||||
enum Api { |
enum Api { |
||||||
Page = '/system_proxy/system/config/list', |
list = '/system_proxy/system/config/list', |
||||||
Save = '/system_proxy/system/config/save', |
add = '/system_proxy/system/config/save', |
||||||
Update = '/system_proxy/system/config/update', |
get = '/system_proxy/system/config', |
||||||
Remove = '/system_proxy/system/config/remove', |
edit = '/system_proxy/system/config/update', |
||||||
|
del = '/system_proxy/system/config/remove', |
||||||
|
getByKey = '/system_proxy/system/config/getByKey' |
||||||
} |
} |
||||||
|
|
||||||
export const list = (params: ConfigParams) => |
/** 查询配置列表 */ |
||||||
defHttp.get({ url: Api.Page, params }); |
export const listConfig = (params?: Partial<ConfigParams>) => defHttp.get({ url: Api.list, params }); |
||||||
|
|
||||||
|
/** 新增配置 */ |
||||||
|
export const addConfig = (params: Partial<Config>) => defHttp.post({ url: Api.add, data: params }); |
||||||
|
|
||||||
export const set = (params: Config) => { |
/** 修改配置 */ |
||||||
if (isDef(params.id)) { |
export const editConfig = (params: Partial<Config>) => defHttp.put({ url: Api.edit, data: params }); |
||||||
return defHttp.put({ url: Api.Update, params }); |
|
||||||
}else { |
/** 查询配置详细 */ |
||||||
return defHttp.post({ url: Api.Save, params }); |
export const getConfig = (id: string) => defHttp.get<Config>({ url: `${Api.get}/${id}` }); |
||||||
} |
|
||||||
} |
/** 删除配置 */ |
||||||
|
export const delConfig = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); |
||||||
|
|
||||||
export const remove = (params: {ids: string}) => |
/** 根据 key 查询配置详细 */ |
||||||
defHttp.delete<ConfigResult>({ url: Api.Remove + `/${params.ids}` }); |
export const getConfigByKey = (id: string) => defHttp.get({ url: `${Api.getByKey}/${id}` }); |
||||||
|
@ -1,63 +1,25 @@ |
|||||||
/** |
/** |
||||||
* @program: kicc-ui |
* @program: kicc-ui |
||||||
* @description: 文件上传实体类 |
* @description: 配置实体类 |
||||||
* 类型定义 |
* 类型定义 |
||||||
* @author: entfrm开发团队-王翔 |
* @author: entfrm开发团队-王翔 |
||||||
* @create: 2022/4/8 |
* @create: 2022/4/8 |
||||||
*/ |
*/ |
||||||
import { Page, R, CommonEntity } from '/@/api/model'; |
import { R } from '/#/axios'; |
||||||
|
import { CommonEntity, Page } from '/@/api/common/data/entity'; |
||||||
export type ConfigParams = { |
|
||||||
/** |
|
||||||
* 参数主键 |
|
||||||
*/ |
|
||||||
id: string; |
|
||||||
|
|
||||||
/** |
|
||||||
* 参数名称 |
|
||||||
*/ |
|
||||||
name: string; |
|
||||||
|
|
||||||
/** |
|
||||||
* 参数键名 |
|
||||||
*/ |
|
||||||
key: string; |
|
||||||
|
|
||||||
/** |
|
||||||
* 系统内置 0:是,1否 |
|
||||||
*/ |
|
||||||
isSys:string; |
|
||||||
|
|
||||||
} & Page; |
|
||||||
|
|
||||||
|
/** 配置查询参数 */ |
||||||
|
export type ConfigParams = Page & Config; |
||||||
|
|
||||||
|
/** 配置对象 */ |
||||||
export interface Config extends CommonEntity { |
export interface Config extends CommonEntity { |
||||||
/** |
|
||||||
* 参数主键 |
|
||||||
*/ |
|
||||||
id: string; |
id: string; |
||||||
|
|
||||||
/** |
|
||||||
* 参数名称 |
|
||||||
*/ |
|
||||||
name: string; |
name: string; |
||||||
|
|
||||||
/** |
|
||||||
* 参数键名 |
|
||||||
*/ |
|
||||||
key: string; |
key: string; |
||||||
|
value: string; |
||||||
/** |
isSys: string; |
||||||
* 参数键值 |
[key: string]: any; |
||||||
*/ |
|
||||||
value:string; |
|
||||||
|
|
||||||
/** |
|
||||||
* 系统内置 0:是,1否 |
|
||||||
*/ |
|
||||||
isSys:string; |
|
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
|
/** 配置响应对象 */ |
||||||
export type ConfigResult = R<Config>; |
export type ConfigResult = R<Config[]>; |
||||||
|
Loading…
Reference in new issue