92 lines
2.1 KiB
JavaScript
92 lines
2.1 KiB
JavaScript
import {
|
|
GET_BUILDING_API,
|
|
POST_BUILDING_API,
|
|
DELETE_BUILDING_API,
|
|
GET_AUTHPAGE_API,
|
|
GET_SUBAUTHPAGE_API,
|
|
GET_ALL_DEVICE_API,
|
|
GET_FUNCTION_LIST_API,
|
|
} from "./api";
|
|
import instance from "@/util/request";
|
|
import apihandler from "@/util/apiHandler";
|
|
|
|
export const getBuildings = async () => {
|
|
const res = await instance.post(GET_BUILDING_API);
|
|
|
|
return apihandler(res.code, res.data, {
|
|
msg: res.msg,
|
|
code: res.code,
|
|
});
|
|
};
|
|
|
|
export const postBuildings = async ({ full_name, building_guid }) => {
|
|
const res = await instance.post(POST_BUILDING_API, {
|
|
full_name,
|
|
building_guid,
|
|
});
|
|
|
|
return apihandler(res.code, res.data, {
|
|
msg: res.msg,
|
|
code: res.code,
|
|
});
|
|
};
|
|
|
|
export const deleteBuildings = async (building_guid) => {
|
|
const res = await instance.post(DELETE_BUILDING_API, { building_guid });
|
|
|
|
return apihandler(res.code, res.data, {
|
|
msg: res.msg,
|
|
code: res.code,
|
|
});
|
|
};
|
|
|
|
export const getAuth = async (building_id) => {
|
|
const res = await instance.get(GET_FUNCTION_LIST_API, {
|
|
params: { building_id },
|
|
});
|
|
return apihandler(res.code, res.data, {
|
|
msg: res.msg,
|
|
code: res.code,
|
|
});
|
|
};
|
|
|
|
export const getAllSysSidebar = async (building_guid) => {
|
|
const res = await instance.post(GET_SUBAUTHPAGE_API, { building_guid });
|
|
return apihandler(res.code, res.data, {
|
|
msg: res.msg,
|
|
code: res.code,
|
|
});
|
|
};
|
|
|
|
export const getSysSidebar = async (building_tag) => {
|
|
const res = await instance.post(GET_SUBAUTHPAGE_API, {
|
|
building_tag,
|
|
});
|
|
|
|
return apihandler(res.code, res.data, {
|
|
msg: res.msg,
|
|
code: res.code,
|
|
});
|
|
};
|
|
|
|
export const getAllDevice = async () => {
|
|
const res = await instance.post(GET_ALL_DEVICE_API);
|
|
|
|
return apihandler(res.code, res.data, {
|
|
msg: res.msg,
|
|
code: res.code,
|
|
});
|
|
};
|
|
|
|
export const ackSingleAlarm = async (uuid) => {
|
|
const res = await instance.post(
|
|
`/obix/alarm/${uuid}/ack`,
|
|
'<obj is="obix:AckAlarmIn"><str name="ackUser" val="obix" /></obj>'
|
|
);
|
|
console.log("acked", res);
|
|
return apihandler(res.code, res, {
|
|
msg: res.msg,
|
|
code: res.code,
|
|
});
|
|
};
|