hbt-prevention-ui/src/service/device.service.ts

44 lines
1.7 KiB
TypeScript

import BaseService from "hbt-common/service/base.service"
import type { AxiosResponse } from 'axios'
import { ActionResult } from "hbt-common/models/actionResult";
export default class DeviceService extends BaseService<any>{
constructor(){
super()
}
public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/device/inventory/getList';
return this.get(url,params)
}
public selectById(id):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/device/inventory/detail?id='+id;
return this.get(url,null,true)
}
// 新增或更新
public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
if(add){
const url = this.prefix.prevention+'/device/inventory/add';
return this.post(url,params,{},showLoading)
}else{
const url = this.prefix.prevention+'/device/inventory/update';
return this.put(url,params,{},showLoading)
}
}
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention +'/device/inventory';
return this.deleteBatch(url,params,{},true)
}
public selectByPage2(params: any):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/device/inventory/getList';
return this.get(url,params)
}
//检查项目
public selectProjectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/device/item/list';
return this.get(url,params)
}
}