Commit a08bd4fb authored by 崔佳豪's avatar 崔佳豪

fix(EC_RealTimeInfo): 组件服务优化

parent 4af880d5
......@@ -16,4 +16,14 @@ export default {
'/PandaMonitor': '/PandaMonitor',
},
},
'/PandaCore': {
target: proxyURL,
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
pathRewrite: {
'/PandaCore': '/PandaCore',
},
},
};
import { request } from '@wisdom-utils/utils';
const REQUEST_METHOD_GET = 'get';
const REQUEST_METHOD_POST = 'post';
// eslint-disable-next-line no-undef
const baseUrl = typeof DUMI_TYPE !== 'undefined' && DUMI_TYPE === 'dumi' ? '/api' : '';
// 获取监控展示配置
export function getMonitorConfig({ params, data } = {}) {
return request({
url: `/PandaMonitor/Monitor/MonitorConfig/GetMonitorConf`,
method: REQUEST_METHOD_GET,
params,
data,
});
}
// 获取传感器类型
export function getSensorType({ params, data } = {}) {
return request({
url: `/PandaCore/GCK/Sensor/GetSensorType`,
method: REQUEST_METHOD_GET,
params,
data,
});
}
// 获取设备实时数据
export function getDeviceRealInfo({ params, data } = {}) {
return request({
url: `/PandaMonitor/Monitor/Device/GetDeviceRealInfo`,
method: REQUEST_METHOD_POST,
params,
data,
});
}
// 获取点表地址
export function getPointAddressEntry({ params, data } = {}) {
return request({
url: `/PandaMonitor/Monitor/PointAddress/GetPointAddressEntry`,
method: REQUEST_METHOD_GET,
params,
data,
});
}
// 获取点表版本
export function getPointAddress({ params, data } = {}) {
return request({
url: `/PandaMonitor/Monitor/PointAddress/GetPointAddress`,
method: REQUEST_METHOD_GET,
params,
data,
});
}
......@@ -20,53 +20,55 @@ const GET_DEVICE_REAL_INFO =
// const GET_SENSOR_TYPE = '/api/Publish/GCK/Sensor/GetSensorType'; //获取传感器类型
// const GET_DEVICE_REAL_INFO = '/api/Publish/GCK/Device/DeviceRealInfo'; //获取设备实时数据
const realTimeInfoService = {
getDeviceConf: {
url: GET_DEVICE_CONF,
method: REQUEST_METHOD_GET,
type: REQUEST_HTTP,
},
getPointAddressEntry: {
url: GET_POINT_ADDRESS_ENTRY,
method: REQUEST_METHOD_GET,
type: REQUEST_HTTP,
},
getSensorType: {
url: GET_SENSOR_TYPE,
method: REQUEST_METHOD_GET,
type: REQUEST_HTTP,
},
getDeviceRealInfo: {
url: GET_DEVICE_REAL_INFO,
method: REQUEST_METHOD_POST,
type: REQUEST_HTTP,
},
};
// const realTimeInfoService = {
// getDeviceConf: {
// url: GET_DEVICE_CONF,
// method: REQUEST_METHOD_GET,
// type: REQUEST_HTTP,
// },
// getPointAddressEntry: {
// url: GET_POINT_ADDRESS_ENTRY,
// method: REQUEST_METHOD_GET,
// type: REQUEST_HTTP,
// },
// getSensorType: {
// url: GET_SENSOR_TYPE,
// method: REQUEST_METHOD_GET,
// type: REQUEST_HTTP,
// },
// getDeviceRealInfo: {
// url: GET_DEVICE_REAL_INFO,
// method: REQUEST_METHOD_POST,
// type: REQUEST_HTTP,
// },
// };
const rtService = service(realTimeInfoService);
// const rtService = service(realTimeInfoService);
const getDeviceConf = rtService.getDeviceConf;
const getPointAddressEntry = rtService.getPointAddressEntry;
const getSensorType = rtService.getSensorType;
const getDeviceRealInfo = rtService.getDeviceRealInfo;
// const getDeviceConf = rtService.getDeviceConf;
// const getPointAddressEntry = rtService.getPointAddressEntry;
// const getSensorType = rtService.getSensorType;
// const getDeviceRealInfo = rtService.getDeviceRealInfo;
const Demo = () => {
return (
<div style={{ width: '200px', height: '60px', background: 'black' }}>
<RealTimeInfo
deviceConfService={getDeviceConf}
pointAddressEntryService={getPointAddressEntry}
sensorTypeService={getSensorType}
deviceRealInfoService={getDeviceRealInfo}
deviceRealInfoParams={{
userID: '1',
pageIndex: 1,
pageSize: 20,
isFocus: false,
accountFieldParams: [{ AName: '二供泵房' }, { AName: '二供机组' }],
equipmentCode: 'EGBF00000001',
}}
user={'1'}
deviceParams={[
{
deviceType: '二供泵房',
deviceCode: 'EGBF00000001',
},
{
deviceType: '二供机组',
deviceCode: 'EGJZ00000001',
},
{
deviceType: '二供机组',
deviceCode: 'EGJZ00000002',
},
]}
user={1}
/>
</div>
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment