You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.4 KiB
TypeScript
79 lines
2.4 KiB
TypeScript
/*
|
|
* @Author: donghao donghao@supervision.ltd
|
|
* @Date: 2024-01-25 16:53:15
|
|
* @LastEditors: donghao donghao@supervision.ltd
|
|
* @LastEditTime: 2024-06-18 09:28:19
|
|
* @FilePath: \general-ai-platform-web\mock\deviceGroup.ts
|
|
* @Description: 节点设备设置 mock
|
|
*/
|
|
import {
|
|
mockGetDeviceGroupData1,
|
|
mockGetDeviceGroupData2,
|
|
mockGetDeviceGroupData3,
|
|
mockGetDeviceGroupFkSelectData,
|
|
mockGetDeviceGroupListData,
|
|
mockGetDeviceGroupSettingData,
|
|
mockGetDeviceGroupTreeData,
|
|
} from './pools/deviceGroupData';
|
|
import { successMockApiProps } from './typing';
|
|
import { fetchCurrPageByList, fetchMockSuccessFullByOther } from './utils/apiMock';
|
|
export default {
|
|
// 节点列表分页
|
|
'GET /api/device_group/getDeviceGroupList': async (req: Request, res: Response) => {
|
|
const { pageNo, pageSize } = req.query;
|
|
const resData: successMockApiProps = {
|
|
...fetchCurrPageByList({
|
|
...mockGetDeviceGroupListData,
|
|
data: { ...mockGetDeviceGroupListData.data, pageNo, pageSize: pageSize || 10 },
|
|
}),
|
|
};
|
|
res.json(resData);
|
|
},
|
|
|
|
// 设备节点树列表
|
|
'GET /api/device_group/setting_data': async (req: Request, res: Response) => {
|
|
const resData: successMockApiProps = {
|
|
...fetchMockSuccessFullByOther(mockGetDeviceGroupSettingData),
|
|
};
|
|
res.json(resData);
|
|
},
|
|
|
|
/** 未启用 */
|
|
// 设备节点选项列表
|
|
'GET /api/device_group/getDeviceGroupFkSelect': async (req: Request, res: Response) => {
|
|
const resData: successMockApiProps = {
|
|
...fetchMockSuccessFullByOther(mockGetDeviceGroupFkSelectData),
|
|
};
|
|
res.json(resData);
|
|
},
|
|
// 设备节点树列表
|
|
'GET /api/device_group/getDeviceGroupTree': async (req: Request, res: Response) => {
|
|
const resData: successMockApiProps = {
|
|
...fetchMockSuccessFullByOther(mockGetDeviceGroupTreeData),
|
|
};
|
|
res.json(resData);
|
|
},
|
|
|
|
// 节点详情
|
|
'GET /api/device_group/getDeviceGroupById': async (req: Request, res: Response) => {
|
|
const { id } = req.query;
|
|
let currRes = {};
|
|
switch (Number(id)) {
|
|
case 2:
|
|
currRes = mockGetDeviceGroupData1;
|
|
break;
|
|
case 3:
|
|
currRes = mockGetDeviceGroupData2;
|
|
break;
|
|
case 5:
|
|
currRes = mockGetDeviceGroupData3;
|
|
break;
|
|
}
|
|
|
|
const resData: successMockApiProps = {
|
|
...fetchMockSuccessFullByOther(currRes),
|
|
};
|
|
res.json(resData);
|
|
},
|
|
};
|