| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- /**
- * Copyright (c) 2013-Now https://jeesite.com All rights reserved.
- * No deletion without permission, or be held responsible to law.
- * @author ThinkGem
- */
- import { defHttp } from '@jeesite/core/utils/http/axios';
- import type { Page } from '@jeesite/core/api/model/baseModel';
- import { useGlobSetting } from '@jeesite/core/hooks/setting';
- import type { TableInfo } from './types/dto';
- import type { TplPageParams } from './types/query';
- const { adminPath } = useGlobSetting();
- export type TplPageResult = Partial<Page<TableInfo>> & {
- list?: TableInfo[];
- records?: TableInfo[];
- total?: number;
- count?: number;
- };
- export type TplCategoryResult =
- | string[]
- | Array<Record<string, any>>
- | {
- data?: string[] | Array<Record<string, any>>;
- list?: string[] | Array<Record<string, any>>;
- records?: string[] | Array<Record<string, any>>;
- result?: string[] | Array<Record<string, any>>;
- };
- /**
- * 获取模板分页列表
- */
- export const tplPage = (params: TplPageParams) => defHttp.get<TplPageResult>({ url: adminPath + '/tpl/page', params });
- /**
- * 获取模板详情
- */
- export const tplDetail = (params: { id: number }) => defHttp.get<TableInfo>({ url: adminPath + '/tpl/detail', params });
- /**
- * 获取模板分类
- */
- export const tplCategoryList = () =>
- defHttp.get<TplCategoryResult>({ url: adminPath + '/tpl/cag' }, { skipSuccessMessage: true, skipErrorMessage: true });
- /**
- * 校验模板名称是否可用
- */
- export const tplCheckTableName = (oldTableNameCn: string, tableNameCn: string) =>
- defHttp.get<any>(
- {
- url: adminPath + '/tpl/checkName',
- params: { oldTableNameCn, tableNameCn, name: tableNameCn },
- },
- { skipSuccessMessage: true, skipErrorMessage: true },
- );
- /**
- * 创建模板
- */
- export const tplCreate = (params?: any, data?: TableInfo) =>
- defHttp.postJson<TableInfo>({ url: adminPath + '/tpl/create', params, data }, { skipSuccessMessage: true });
- /**
- * 更新模板
- */
- export const tplUpdate = (params?: any, data?: TableInfo) =>
- defHttp.postJson<TableInfo>({ url: adminPath + '/tpl/update', params, data }, { skipSuccessMessage: true });
- /**
- * 删除模板
- */
- export const tplDelete = (params: { id: number }) =>
- defHttp.delete<void>({ url: adminPath + '/tpl/delete', params }, { skipSuccessMessage: true });
|