| | |
| | | const logEntry = common_vendor.ref([]); |
| | | const temp = common_vendor.ref({}); |
| | | const controInfo = common_vendor.ref({}); |
| | | const flag = common_vendor.ref(false); |
| | | let positionInterval; |
| | | common_vendor.onMounted(async () => { |
| | | const option = getCurrentPages()[getCurrentPages().length - 1].options; |
| | | const deviceInfo = JSON.parse(decodeURIComponent(option.device)); |
| | |
| | | ...deviceInfo |
| | | }; |
| | | } catch (error) { |
| | | common_vendor.index.__f__("error", "at pages/router/deviceInfo/index.vue:88", "Failed to fetch device info:", error); |
| | | common_vendor.index.__f__("error", "at pages/router/deviceInfo/index.vue:92", "Failed to fetch device info:", error); |
| | | } |
| | | }); |
| | | const startGetPosition = () => { |
| | | if (positionInterval) { |
| | | clearInterval(positionInterval); |
| | | } |
| | | common_vendor.index.showToast({ |
| | | title: "操作设备中", |
| | | icon: "loading", |
| | | mask: true, |
| | | duration: 3500 |
| | | }); |
| | | positionInterval = setInterval(() => { |
| | | api_index.getControlInfo(state.value.facilityCode).then((res) => { |
| | | if (res.data.position >= 100) { |
| | | flag.value = false; |
| | | clearInterval(positionInterval); |
| | | } |
| | | }).catch((error) => { |
| | | common_vendor.index.__f__("error", "at pages/router/deviceInfo/index.vue:115", "Error fetching control info:", error); |
| | | clearInterval(positionInterval); |
| | | }); |
| | | }, 2e3); |
| | | }; |
| | | const removeSharedDevice = async () => { |
| | | temp.value = { |
| | | facilityCode: state.value.facilityCode |
| | |
| | | }); |
| | | } |
| | | } catch (error) { |
| | | common_vendor.index.__f__("error", "at pages/router/deviceInfo/index.vue:112", "Failed to delete device:", error); |
| | | common_vendor.index.__f__("error", "at pages/router/deviceInfo/index.vue:144", "Failed to delete device:", error); |
| | | } |
| | | }; |
| | | const handleControlChange = (e) => { |
| | |
| | | destinationPosition: e.detail.value |
| | | }; |
| | | api_index.deviceControlInfo(controInfo.value).then((res) => { |
| | | if (res.code === 200) { |
| | | flag.value = true; |
| | | startGetPosition(); |
| | | } |
| | | }).catch((error) => { |
| | | common_vendor.index.__f__("error", "at pages/router/deviceInfo/index.vue:124", "Failed to control device:", error); |
| | | common_vendor.index.__f__("error", "at pages/router/deviceInfo/index.vue:161", "Failed to control device:", error); |
| | | }); |
| | | }; |
| | | const getOpeHistory = () => { |
| | |
| | | logEntry.value = res.data; |
| | | } |
| | | }).catch((e) => { |
| | | common_vendor.index.__f__("log", "at pages/router/deviceInfo/index.vue:135", "fail info", e); |
| | | common_vendor.index.__f__("log", "at pages/router/deviceInfo/index.vue:175", "fail info", e); |
| | | }); |
| | | }; |
| | | const getControlData = () => { |
| | |
| | | f: common_vendor.t(state.value.rssi), |
| | | g: common_vendor.o(handleControlChange), |
| | | h: controlValue.value, |
| | | i: common_vendor.f(logEntry.value, (item, index, i0) => { |
| | | i: flag.value, |
| | | j: common_vendor.f(logEntry.value, (item, index, i0) => { |
| | | return { |
| | | a: common_vendor.t(item.operateName), |
| | | b: common_vendor.t(item.operateStatus), |
| | |
| | | d: index |
| | | }; |
| | | }), |
| | | j: common_vendor.o(removeSharedDevice) |
| | | k: common_vendor.o(removeSharedDevice) |
| | | }); |
| | | }; |
| | | } |