Files
DjangoAdmin_Django_EleVue/public/templates/ui/api.ts.tpl
T
2026-09-11 11:39:07 +08:00

84 lines
1.9 KiB
Smarty

import { http } from '@/utils/http/axios';
/**
* @description: {{ module_comment }}分页列表
*/
export function get{{ model_class_name }}Page(params?) {
return http.request({
url: '/{{ route_prefix }}/page',
method: 'GET',
params,
});
}
/**
* 获取全部{{ module_comment }}列表
* @param params 参数
* @returns 返回结果
*/
export function get{{ model_class_name }}List(params?) {
return http.request({
url: '/{{ route_prefix }}/list',
method: 'GET',
params,
});
}
/**
* @description: 根据ID获取{{ module_comment }}详情
* @param {{ primary_key }} {{ module_comment }}ID
*/
export function get{{ model_class_name }}Detail({{ primary_key }}) {
return http.request({
url: '/{{ route_prefix }}/detail/' + {{ primary_key }},
method: 'get',
});
}
/**
* @description: 添加{{ module_comment }}
* @param data {{ module_comment }}数据
*/
export function {{ model_class_name_camel }}Add(data: any) {
return http.request({
url: '/{{ route_prefix }}/add',
method: 'POST',
data,
});
}
/**
* @description: 更新{{ module_comment }}
* @param data {{ module_comment }}数据
*/
export function {{ model_class_name_camel }}Update(data: any) {
return http.request({
url: '/{{ route_prefix }}/update',
method: 'PUT',
data,
});
}
/**
* @description: 删除{{ module_comment }}
* @param {{ primary_key }} {{ module_comment }}ID
*/
export function {{ model_class_name_camel }}Delete({{ primary_key }}) {
return http.request({
url: '/{{ route_prefix }}/delete/' + {{ primary_key }},
method: 'DELETE',
});
}
/**
* @description: 批量删除{{ module_comment }}
* @param data {{ module_comment }}ID数组
*/
export function {{ model_class_name_camel }}BatchDelete(data: any) {
return http.request({
url: '/{{ route_prefix }}/batchDelete',
method: 'DELETE',
data,
});
}