| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import { defHttp } from '/@/utils/http/axios';
- import { AesEncryption } from '/@/utils/cipher';
- import { loginCipher } from '/@/settings/encryptionSetting';
- import { useVentStore } from '/@/store/modules/vent';
- enum Api {
- DEVICE_CONTROL = '/safety/ventanalyMonitorData/devicecontrol', // 开关控制
- SPRAY_CONTROL = '/ventanaly-device/safety/ventanalyMonitorData/batchDevicecontrol', // 皮带三级防灭火批量控制
- modalNameList = '/ventanaly-device/safety/modelAlarmInfo/getAllModelFileJson',
- }
- // Get personal center-basic settings
- export const deviceControlApi = (data) => {
- // 加密password
- const encryption = new AesEncryption({ key: loginCipher.key, iv: loginCipher.iv });
- data.password = encryption.encryptByAES(data.password);
- return defHttp.put({ url: Api.DEVICE_CONTROL, data });
- };
- // 皮带三级防灭火批量控制
- export const sprayControlApi = (data) => {
- const encryption = new AesEncryption({ key: loginCipher.key, iv: loginCipher.iv });
- // 判断传入是数组还是单个对象
- if (Array.isArray(data)) {
- // 批量:遍历每一条加密password
- const encryptList = data.map((item) => {
- return {
- ...item,
- password: encryption.encryptByAES(item.password),
- };
- });
- return defHttp.put({ url: Api.SPRAY_CONTROL, data: encryptList });
- } else {
- data.password = encryption.encryptByAES(data.password);
- return defHttp.put({ url: Api.SPRAY_CONTROL, data });
- }
- };
- export const getModalType = async () => {
- const res = await defHttp.get({ url: Api.modalNameList });
- // 处理文件名称
- debugger;
- };
|