50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
import http from '@/utils/http'
|
|
import type * as T from '@/types/equipment.d'
|
|
|
|
const BASE_URL = '/equipment'
|
|
|
|
/** @desc 分页查询设备列表 */
|
|
export function pageEquipment(query: T.EquipmentPageQuery) {
|
|
return http.get<T.EquipmentResp[]>(`${BASE_URL}/page`, query)
|
|
}
|
|
|
|
/** @desc 查询设备列表 */
|
|
export function listEquipment(query?: T.EquipmentPageQuery) {
|
|
return http.get<T.EquipmentResp[]>(`${BASE_URL}/list`, query)
|
|
}
|
|
|
|
/** @desc 查询设备详情 */
|
|
export function getEquipmentDetail(equipmentId: string) {
|
|
return http.get<T.EquipmentResp>(`${BASE_URL}/detail/${equipmentId}`)
|
|
}
|
|
|
|
/** @desc 新增设备 */
|
|
export function createEquipment(data: T.EquipmentReq) {
|
|
return http.post(`${BASE_URL}`, data)
|
|
}
|
|
|
|
/** @desc 更新设备 */
|
|
export function updateEquipment(equipmentId: string, data: T.EquipmentReq) {
|
|
return http.put(`${BASE_URL}/${equipmentId}`, data)
|
|
}
|
|
|
|
/** @desc 删除设备 */
|
|
export function deleteEquipment(equipmentId: string) {
|
|
return http.del(`${BASE_URL}/${equipmentId}`)
|
|
}
|
|
|
|
/** @desc 设备状态变更 */
|
|
export function changeEquipmentStatus(equipmentId: string, status: string) {
|
|
return http.put(`${BASE_URL}/${equipmentId}/status`, { status })
|
|
}
|
|
|
|
/** @desc 设备分配 */
|
|
export function assignEquipment(equipmentId: string, userId: string) {
|
|
return http.put(`${BASE_URL}/${equipmentId}/assign`, { userId })
|
|
}
|
|
|
|
/** @desc 设备归还 */
|
|
export function returnEquipment(equipmentId: string) {
|
|
return http.put(`${BASE_URL}/${equipmentId}/return`)
|
|
}
|