/** * 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> & { list?: TableInfo[]; records?: TableInfo[]; total?: number; count?: number; }; export type TplCategoryResult = | string[] | Array> | { data?: string[] | Array>; list?: string[] | Array>; records?: string[] | Array>; result?: string[] | Array>; }; /** * 获取模板分页列表 */ export const tplPage = (params: TplPageParams) => defHttp.get({ url: adminPath + '/tpl/page', params }); /** * 获取模板详情 */ export const tplDetail = (params: { id: number }) => defHttp.get({ url: adminPath + '/tpl/detail', params }); /** * 获取模板分类 */ export const tplCategoryList = () => defHttp.get({ url: adminPath + '/tpl/cag' }, { skipSuccessMessage: true, skipErrorMessage: true }); /** * 校验模板名称是否可用 */ export const tplCheckTableName = (oldTableNameCn: string, tableNameCn: string) => defHttp.get( { url: adminPath + '/tpl/checkName', params: { oldTableNameCn, tableNameCn, name: tableNameCn }, }, { skipSuccessMessage: true, skipErrorMessage: true }, ); /** * 创建模板 */ export const tplCreate = (params?: any, data?: TableInfo) => defHttp.postJson({ url: adminPath + '/tpl/create', params, data }, { skipSuccessMessage: true }); /** * 更新模板 */ export const tplUpdate = (params?: any, data?: TableInfo) => defHttp.postJson({ url: adminPath + '/tpl/update', params, data }, { skipSuccessMessage: true }); /** * 删除模板 */ export const tplDelete = (params: { id: number }) => defHttp.delete({ url: adminPath + '/tpl/delete', params }, { skipSuccessMessage: true });