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.
73 lines
2.2 KiB
TypeScript
73 lines
2.2 KiB
TypeScript
/*
|
|
* @Author: donghao donghao@supervision.ltd
|
|
* @Date: 2024-01-25 16:53:15
|
|
* @LastEditors: donghao donghao@supervision.ltd
|
|
* @LastEditTime: 2024-02-05 15:24:11
|
|
* @FilePath: \general-ai-platform-web\mock\deviceCategory.ts
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
*/
|
|
|
|
/**设备组模块 mock */
|
|
|
|
import {
|
|
mockGetDeviceGroupData1,
|
|
mockGetDeviceGroupData2,
|
|
mockGetDeviceGroupData3,
|
|
mockGetDeviceGroupFkSelectData,
|
|
mockGetDeviceGroupListData,
|
|
mockGetDeviceGroupTreeData,
|
|
} from './pools/deviceGroupData';
|
|
import { successMockApiProps } from './typing';
|
|
import { fetchCurrPageByList, fetchMockSuccessFullByOther } from './utils/apiMock';
|
|
export default {
|
|
// 设备组列表分页
|
|
'POST /api/v1/device_group/getDeviceGroupList': async (req: Request, res: Response) => {
|
|
const { page, pageSize } = req.body;
|
|
|
|
const resData: successMockApiProps = {
|
|
|
|
...fetchCurrPageByList({
|
|
...mockGetDeviceGroupListData,
|
|
data: { ...mockGetDeviceGroupListData.data, page, pageSize: pageSize || 10 },
|
|
}),
|
|
};
|
|
res.send(resData);
|
|
},
|
|
|
|
// 设备组网点选项列表
|
|
'POST /api/v1/device_group/getDeviceGroupFkSelect': async (req: Request, res: Response) => {
|
|
const resData: successMockApiProps = {
|
|
...fetchMockSuccessFullByOther(mockGetDeviceGroupFkSelectData),
|
|
};
|
|
res.send(resData);
|
|
},
|
|
// 设备组网点树列表
|
|
'POST /api/v1/device_group/getDeviceGroupTree': async (req: Request, res: Response) => {
|
|
const resData: successMockApiProps = {
|
|
...fetchMockSuccessFullByOther(mockGetDeviceGroupTreeData),
|
|
};
|
|
res.send(resData);
|
|
},
|
|
// 设备组详情
|
|
'POST /api/v1/device_group/getDeviceGroupById': async (req: Request, res: Response) => {
|
|
const { id } = req.body;
|
|
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.send(resData);
|
|
},
|
|
};
|