|
|
@@ -1,52 +1,52 @@
|
|
|
-import axios from "axios"
|
|
|
+import axios from "axios";
|
|
|
import mockData from "../input-data/data3.js";
|
|
|
|
|
|
export function getWholeData(sceneCode) {
|
|
|
- let url = `${process.env.VUE_APP_API_URL_PREFIX}laser/route/${sceneCode}/getRouteInfo`
|
|
|
- return axios
|
|
|
- .get(url)
|
|
|
- .then((res) => {
|
|
|
- if (Array.isArray(res.data.data) && res.data.data.length > 0) {
|
|
|
- return res.data.data
|
|
|
- } else {
|
|
|
- throw('getWholeData结果异常!')
|
|
|
- }
|
|
|
- })
|
|
|
+ let url = `${process.env.VUE_APP_API_URL_PREFIX}laser/route/${sceneCode}/getRouteInfo`;
|
|
|
+ return axios.get(url).then((res) => {
|
|
|
+ if (Array.isArray(res.data.data) && res.data.data.length > 0) {
|
|
|
+ return res.data.data;
|
|
|
+ } else {
|
|
|
+ throw "getWholeData结果异常!";
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
export function uploadWholeData(sceneCode, wholeData) {
|
|
|
- let url = `${process.env.VUE_APP_API_URL_PREFIX}laser/route/${sceneCode}/editRouteInfo`
|
|
|
+ let url = `${process.env.VUE_APP_API_URL_PREFIX}laser/route/${sceneCode}/editRouteInfo`;
|
|
|
return axios
|
|
|
.post(url, {
|
|
|
list: wholeData,
|
|
|
- }).then((res) => {
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
if (res?.data?.code === 200) {
|
|
|
- return res?.data?.msg
|
|
|
+ return res?.data?.msg;
|
|
|
} else {
|
|
|
- throw(res?.data?.msg || '操作失败')
|
|
|
+ throw res?.data?.msg || "操作失败";
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
export function resetWholeData(sceneCode) {
|
|
|
- let url = `${process.env.VUE_APP_API_URL_PREFIX}laser/route/resetRouteInfo/${sceneCode}`
|
|
|
- return axios
|
|
|
- .get(url).then((res) => {
|
|
|
- if (res?.data?.code === 200) {
|
|
|
- return res?.data?.msg
|
|
|
- } else {
|
|
|
- throw(res?.data?.msg || '操作失败')
|
|
|
- }
|
|
|
- })
|
|
|
+ let url = `${process.env.VUE_APP_API_URL_PREFIX}laser/route/resetRouteInfo/${sceneCode}`;
|
|
|
+ return axios.get(url).then((res) => {
|
|
|
+ if (res?.data?.code === 200) {
|
|
|
+ return res?.data?.msg;
|
|
|
+ } else {
|
|
|
+ throw res?.data?.msg || "操作失败";
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
export function reportTagInfo(data) {
|
|
|
- const url = `https://test.4dkankan.com/openDevice/ingest`
|
|
|
+ console.error("reporting", data);
|
|
|
+
|
|
|
+ const url = `https://test.4dkankan.com/openDevice/ingest/${data.sceneNum}`;
|
|
|
|
|
|
return axios.post(url, data).then((res) => {
|
|
|
if (res?.data?.code === 200 || res?.status === 200) {
|
|
|
- return res?.data?.msg || 'report success'
|
|
|
+ return res?.data?.msg || "report success";
|
|
|
} else {
|
|
|
- throw(res?.data?.msg || 'report failed')
|
|
|
+ throw res?.data?.msg || "report failed";
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|