You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

189 lines
5.0 KiB

import request from '@/config/axios'
import {
apiResponse,
PageResultShipRespVo,
shipHistoryPageRequest,
ShipRespVo,
ShorePowerBerth
} from '@/types/shorepower'
/** 地图信息 */
export interface Map {
id: number // 编号
parentId?: number // 父级编号
type?: number // 类型
name?: string // 名称
data: string // 数据
}
// 地图 API
export const MapApi = {
// 查询地图分页
getMapPage: async (params: any) => {
return await request.get({ url: `/shorepower/map/page`, params })
},
// 查询地图详情
getMap: async (id: number) => {
return await request.get({ url: `/shorepower/map/get?id=` + id })
},
// 新增地图
createMap: async (data: Map) => {
return await request.post({ url: `/shorepower/map/create`, data })
},
// 修改地图
updateMap: async (data: Map) => {
return await request.put({ url: `/shorepower/map/update`, data })
},
// 删除地图
deleteMap: async (id: number) => {
return await request.delete({ url: `/shorepower/map/delete?id=` + id })
},
/** 批量删除地图 */
deleteMapList: async (ids: number[]) => {
return await request.delete({ url: `/shorepower/map/delete-list?ids=${ids.join(',')}` })
},
// 导出地图 Excel
exportMap: async (params) => {
return await request.download({ url: `/shorepower/map/export-excel`, params })
},
// 查询地图详情
getAllData: async (type?: number, parentId?: number) => {
const params = type
? parentId
? `?type=$${type}&parentId=${parentId}`
: `?type=${type}`
: parentId
? `?parentId=${parentId}`
: ''
const data = await request.get({ url: `/shorepower/map/expand/selectAll` + params })
return data
},
// 查询船舶信息
getShipInfo: async (params: any) => {
return await request.post({
url: `/shorepower/shore-power-and-ship/expand/getShipInfo`,
params
})
},
// 查询用电接口设备状态
getDeviceStatusByIds: async (ids: any) => {
return await request.get({
url: `/energy/device/getDeviceStatusByIds?ids=${ids.join(',')}`
// params
})
},
// 查询全部设备实时数据
getRealtimeAllData: async (params: any) => {
return await request.get({
url: `/energy/measure-data-realtime/getAll`,
params
})
},
// 查询多个设备实时数据
getRealtimeDataByIdList: async (params: any) => {
return await request.get({
url: `/energy/measure-data-realtime/getByIdList`,
params
})
},
// 查询多个设备年数据
getYearDataByIdList: async (params: any) => {
return await request.get({
url: `/energy/select/year/getByIdList`,
params
})
},
// 查询多个设备周数据
getWeekDataByIdList: async (params: any) => {
return await request.get({
url: `/energy/select/week/getByIdList`,
params
})
},
// 查询多个设备月数据
getMonthDataByIdList: async (params: any) => {
return await request.get({
url: `/energy/select/month/getByIdList`,
params
})
},
// 查询多个设备日数据
getDayDataByIdList: async (params: any) => {
return await request.get({
url: `/energy/select/day/getByIdList`,
params
})
},
// 查询所有船舶和岸电设备ID和名称列表
getBerthIdAndNameList: async () => {
return await request.get({
url: `/shorepower/berth/expand/selectIdAndNameList`
})
},
getShorepowerIdAndNameList: async () => {
return await request.get({
url: `/shorepower/berth/expand/selectIdAndNameList`
})
},
// 查询所有码头和名称列表
getDockIdAndNameList: async () => {
return await request.get({
url: `/shorepower/dock/expand/selectIdAndNameList`
})
},
// 查询所有起运港和到达港和名称列表
getHarborDistrictIdAndNameList: async () => {
return await request.get({
url: `/shorepower/harbor-district/expand/selectIdAndNameList`
})
},
getByStartAndEndTimeAndTimeType: async (params: any) => {
return await request.get({
url: `/energy/select/getByStartAndEndTimeAndTimeType`,
params
})
},
// 查询所有码头和名称列表
getShorepowerIdAndNameListByHarborDistrictId: async (
harborDistrictId: number
): Promise<ShorePowerBerth[]> => {
return await request.get({
url: `/shorepower/shore-power/expand/selectAllByHarborDistrict?harborDistrictId=${harborDistrictId}`
})
},
// 查询船舶历史数据分页
getShipHistoryPage: async (
params: shipHistoryPageRequest
): Promise<apiResponse<PageResultShipRespVo<ShipRespVo>>> => {
return await request.post({
url: `/shorepower/shore-power-and-ship/expand/getHistoryPage`,
params
})
},
getApplyShipCount: async (): Promise<apiResponse<any>> => {
return await request.get({
url: `shorepower/apply/getShipCount`
// params
})
}
}