plantScreen/src/api.js
2024-01-09 18:33:44 +08:00

85 lines
2.1 KiB
JavaScript

import axios from "axios";
// 创建axios 实例
const instacne = axios.create({
// baseURL:"http://192.168.1.10:8686",
// baseURL: "http://ceshi-suyuan.lihaink.cn/",
baseURL: "https://suyuan.lihaink.cn/",
timeout: 30000,
});
// 请求拦截
instacne.interceptors.request.use(
(config) => {
// 在发送请求之前做什么
return config;
},
(err) => {
return Promise.reject(err);
}
);
// 响应拦截
instacne.interceptors.response.use(
(res) => {
return res.data;
},
(err) => {
return Promise.reject(err);
}
);
export function deviceAlarmCountApi(params) {
return instacne.get('/api/dataview.device/deviceAlarmCount', { params })
}
export function deviceCountApi(params) {
return instacne.get('/api/dataview.device/deviceCount', { params })
}
export function plantProductCountApi(params) {
return instacne.get('/api/dataview.land/plantProductCount', { params })
}
export function landCollectionListApi(params) {
return instacne.get('/api/dataview.land/landCollectionList', { params })
}
export function landMonitorAlarmHistoryApi(params) {
return instacne.get('/api/dataview.land/landMonitorAlarmHistory', { params })
}
export function landListApi(params) {
return instacne.get('/api/dataview.land/landList', { params })
}
export function productListApi(params) {
return instacne.get('/api/dataview.land/productList', { params })
}
export function areaPlantTypeCountApi(params) {
return instacne.get('/api/dataview.land/areaPlantTypeCount', { params })
}
export function monitorInfoApi(params) {
return instacne.get('/api/dataview.land/monitorInfo', { params })
}
export function deviceCountLandApi(params) {
return instacne.get('/api/dataview.land/deviceCount', { params })
}
export function centralCountApi(params) {
return instacne.get('/api/dataview.land/centralCount', { params })
}
export function townsCenter(params) {
return instacne.get('/common/geo/towns', { params })
}
// /api/dataview.land/centralCount?areaCode=510521&streetCode=510521100
// /api/dataview.land/deviceCount?areaCode=510521&streetCode=510521100&land_id=18