2024-12-26 11:34:54 +08:00
|
|
|
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;
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
2025-01-04 21:47:34 +08:00
|
|
|
export interface ProductUpdateRecord extends ProductCreateRecord {
|
|
|
|
id: number;
|
|
|
|
productType: string;
|
|
|
|
}
|
|
|
|
|
2024-12-26 11:34:54 +08:00
|
|
|
|
|
|
|
// 分页查询
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 修改
|
2025-01-04 21:47:34 +08:00
|
|
|
export function updateProduct(data: ProductUpdateRecord){
|
|
|
|
return axios.patch(`/api/rest/product/${data.id}`, data);
|
2024-12-26 11:34:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// 删除
|
|
|
|
export function deleteProduct(id: number) {
|
|
|
|
return axios.delete(`/api/rest/product/${id}`);
|
|
|
|
}
|
|
|
|
|