|
|
@@ -1,25 +1,28 @@
|
|
|
import axios from "axios";
|
|
|
-const config = {
|
|
|
- // baseURL: "http://192.168.1.109:32080",
|
|
|
- baseURL: '/',
|
|
|
- noNeedInterceptor: false,
|
|
|
- headers: {
|
|
|
- Authorization: localStorage.getItem("token"),
|
|
|
- },
|
|
|
-};
|
|
|
+
|
|
|
+function getConfig() {
|
|
|
+ return {
|
|
|
+ // baseURL: "http://192.168.1.109:32080",
|
|
|
+ baseURL: "/",
|
|
|
+ noNeedInterceptor: false,
|
|
|
+ headers: {
|
|
|
+ Authorization: localStorage.getItem("token"),
|
|
|
+ },
|
|
|
+ };
|
|
|
+}
|
|
|
|
|
|
export async function addRule(data) {
|
|
|
- const res = await axios.post("/api/unialarm/add_rule", data, config);
|
|
|
+ const res = await axios.post("/api/unialarm/add_rule", data, getConfig());
|
|
|
return res.statusText ? res.data : res;
|
|
|
}
|
|
|
|
|
|
export async function editRule(data) {
|
|
|
- const res = await axios.post("/api/unialarm/edit_rule", data, config);
|
|
|
+ const res = await axios.post("/api/unialarm/edit_rule", data, getConfig());
|
|
|
return res.statusText ? res.data : res;
|
|
|
}
|
|
|
|
|
|
export async function searchPoint(data) {
|
|
|
- const res = await axios.post("/api/unialarm/search_point", data, config);
|
|
|
+ const res = await axios.post("/api/unialarm/search_point", data, getConfig());
|
|
|
return res.statusText ? res.data : res;
|
|
|
}
|
|
|
|
|
|
@@ -55,14 +58,14 @@ export async function getAlarmHistory({
|
|
|
diagram_uuid,
|
|
|
op_order: false,
|
|
|
},
|
|
|
- config
|
|
|
+ getConfig()
|
|
|
);
|
|
|
return res.statusText ? res.data : res;
|
|
|
}
|
|
|
|
|
|
export async function download(url) {
|
|
|
const newConfig = {
|
|
|
- baseURL: config.baseURL,
|
|
|
+ baseURL: getConfig().baseURL,
|
|
|
noNeedInterceptor: true,
|
|
|
responseType: "blob",
|
|
|
};
|
|
|
@@ -76,7 +79,7 @@ export async function getRuleIdByPointId(point_id) {
|
|
|
{
|
|
|
point_id,
|
|
|
},
|
|
|
- config
|
|
|
+ getConfig()
|
|
|
);
|
|
|
return res.statusText ? res.data : res;
|
|
|
}
|
|
|
@@ -86,13 +89,17 @@ export async function detailAlarm(id) {
|
|
|
{
|
|
|
id,
|
|
|
},
|
|
|
- config
|
|
|
+ getConfig()
|
|
|
);
|
|
|
return res.statusText ? res.data : res;
|
|
|
}
|
|
|
|
|
|
export async function confirmAlarm(data) {
|
|
|
- const res = await axios.post("/api/unialarm/confirm_alarm", data, config);
|
|
|
+ const res = await axios.post(
|
|
|
+ "/api/unialarm/confirm_alarm",
|
|
|
+ data,
|
|
|
+ getConfig()
|
|
|
+ );
|
|
|
return res.statusText ? res.data : res;
|
|
|
}
|
|
|
|
|
|
@@ -104,7 +111,7 @@ export async function getAlarmPointData(rule_id, begin, end) {
|
|
|
begin,
|
|
|
end,
|
|
|
},
|
|
|
- config
|
|
|
+ getConfig()
|
|
|
);
|
|
|
return res.statusText ? res.data : res;
|
|
|
}
|
|
|
@@ -122,13 +129,13 @@ export async function getRuleList(point_id) {
|
|
|
status: 0,
|
|
|
sub_type: 12,
|
|
|
},
|
|
|
- config
|
|
|
+ getConfig()
|
|
|
);
|
|
|
return res.statusText ? res.data : res;
|
|
|
}
|
|
|
|
|
|
export async function getGroupList() {
|
|
|
- const res = await axios.post("/api/unialarm/get_group_list", {}, config);
|
|
|
+ const res = await axios.post("/api/unialarm/get_group_list", {}, getConfig());
|
|
|
return res.statusText ? res.data : res;
|
|
|
}
|
|
|
|