64 lines
1.2 KiB
TypeScript
64 lines
1.2 KiB
TypeScript
|
import axios from 'axios';
|
||
|
|
||
|
export interface ProductRecord {
|
||
|
size: number;
|
||
|
current: number;
|
||
|
name?: string;
|
||
|
pageable?: string;
|
||
|
type?: string;
|
||
|
links?: string;
|
||
|
}
|
||
|
|
||
|
export interface ProductCreateRecord {
|
||
|
name: string;
|
||
|
model: string;
|
||
|
type?: string;
|
||
|
link?: string;
|
||
|
remark?: string;
|
||
|
params:[{
|
||
|
name: string;
|
||
|
identifier: string;
|
||
|
type: string;
|
||
|
dataType: string;
|
||
|
}];
|
||
|
}
|
||
|
|
||
|
|
||
|
// 分页查询
|
||
|
export function queryProductList(data: ProductRecord) {
|
||
|
return axios({
|
||
|
url: '/api/rest/product',
|
||
|
method: 'get',
|
||
|
params: data,
|
||
|
});
|
||
|
}
|
||
|
// 模糊查询获取产品列表
|
||
|
export function queryProductListAll(data: ProductRecord) {
|
||
|
return axios({
|
||
|
url: '/api/rest/product/fuzzy',
|
||
|
method: 'get',
|
||
|
params: data,
|
||
|
});
|
||
|
}
|
||
|
|
||
|
// 查看详情
|
||
|
export function queryProductDetail(id: number) {
|
||
|
return axios.get(`/api/rest/product/${id}`);
|
||
|
}
|
||
|
|
||
|
// 新增
|
||
|
export function createProduct(data: ProductCreateRecord) {
|
||
|
return axios.post(`/api/rest/product`, data);
|
||
|
}
|
||
|
|
||
|
// 修改
|
||
|
export function updateProduct(id: number, data: ProductCreateRecord){
|
||
|
return axios.patch(`/api/rest/product/${id}`, data);
|
||
|
}
|
||
|
|
||
|
// 删除
|
||
|
export function deleteProduct(id: number) {
|
||
|
return axios.delete(`/api/rest/product/${id}`);
|
||
|
}
|
||
|
|