| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import { PaginationProps } from '/@/components/Table';
- import { defHttp } from '/@/utils/http/axios';
- enum Api {
- listdays = '/safety/ventanalyMonitorData/listdays',
- getDeviceList = '/ventanaly-device/monitor/device',
- getHistoryData = '/ventanaly-device/history/getHistoryData',
- }
- /**
- * 列表接口
- * @param params
- */
- export const list = (deviceCode: string, deviceInfo: any, formData: any, pagination: PaginationProps) => {
- if (deviceInfo.stationType === 'redis') {
- return defHttp.post({
- url: Api.getHistoryData,
- params: {
- pageNum: pagination.current,
- pageSize: pagination.pageSize,
- column: 'createTime',
- startTime: formData.ttime_begin,
- endTime: formData.ttime_end,
- deviceId: formData.gdeviceid,
- strtype: deviceCode + '*',
- interval: formData.skip || '1h',
- isEmployee: deviceCode.startsWith('vehicle') ? false : true,
- },
- });
- } else {
- return defHttp
- .get({
- url: Api.listdays,
- params: {
- pageNo: pagination.current,
- pageSize: pagination.pageSize,
- column: 'createTime',
- strtype: deviceInfo.strtype || deviceCode.concat('*'),
- ...formData,
- },
- })
- .then((r) => {
- if (r.datalist) return r.datalist;
- return { total: 0, records: [] };
- });
- }
- };
- /**
- * 根据设备编码获取设备列表
- * @param params
- */
- export const getDeviceList = (params) =>
- defHttp.post({ url: Api.getDeviceList, params }).then((r) => {
- if (r.records && r.records.length) {
- return r.records;
- }
- if (r.msgTxt && r.msgTxt.length) {
- return r.msgTxt[0].datalist;
- }
- return [];
- });
|