|
|
|
import type { GetModelAttributeListParams, ModelAttribute, ModelAttributeWithForm, ModelService, SimpleAttribute } from './types'
|
|
|
|
import { defHttp } from '@/utils/http/axios'
|
|
|
|
|
|
|
|
export function getAllModelServices(productId: string) {
|
|
|
|
return defHttp.get<ModelService[]>({
|
|
|
|
url: '/thingModel/select',
|
|
|
|
params: {
|
|
|
|
productId,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export function createModelService(data: Partial<ModelService>) {
|
|
|
|
return defHttp.post({
|
|
|
|
url: '/thingModel/save',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export function updateModelService(data: Partial<ModelService>) {
|
|
|
|
return defHttp.post({
|
|
|
|
url: '/thingModel/update',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export function deleteModelService(id: string) {
|
|
|
|
return defHttp.post({
|
|
|
|
url: `/thingModel/remove?id=${id}`,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getModelAttributeList(params: GetModelAttributeListParams) {
|
|
|
|
return defHttp.get<PageResult<ModelAttribute>>({
|
|
|
|
url: '/thingModel/item/page',
|
|
|
|
params,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export function createModelAttribute(data: ModelAttributeWithForm) {
|
|
|
|
return defHttp.post({
|
|
|
|
url: '/thingModel/item/save',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export function updateModelAttribute(data: ModelAttributeWithForm) {
|
|
|
|
return defHttp.post({
|
|
|
|
url: '/thingModel/item/update',
|
|
|
|
data,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export function deleteModelAttribute(id: string) {
|
|
|
|
return defHttp.post({
|
|
|
|
url: `/thingModel/item/remove?id=${id}`,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getAllModelAttributes(productId: string, itemType: number) {
|
|
|
|
return defHttp.get<SimpleAttribute[]>({
|
|
|
|
url: '/thingModel/item/queryList',
|
|
|
|
params: {
|
|
|
|
productId,
|
|
|
|
itemType,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|