From 823c54aed77fd5e3413c9663451a2801846d6a29 Mon Sep 17 00:00:00 2001
From: fengerli <528575642@qq.com>
Date: Sat, 16 Aug 2025 17:37:24 +0800
Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=8A=A5=E8=AD=A6=EF=BC=8C?=
=?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=AE=BE=E5=A4=87=E5=AE=9E=E6=97=B6=E7=8A=B6?=
=?UTF-8?q?=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/6170/allShare/index.vue | 6 +-
pages/6170/callPolice/index.vue | 753 +++++++++++++++--------------
pages/6170/deviceControl/index.vue | 93 ++--
pages/common/send/index.vue | 1 -
4 files changed, 465 insertions(+), 388 deletions(-)
diff --git a/pages/6170/allShare/index.vue b/pages/6170/allShare/index.vue
index bb6a4ef..cc0307e 100644
--- a/pages/6170/allShare/index.vue
+++ b/pages/6170/allShare/index.vue
@@ -249,14 +249,10 @@
},
onLoad() {
this.onIntall()
- // 绑定页面做了监听,新增成功,刷新页面
- uni.$on('refreshDeviceList', () => {
- this.onIntall()
- });
},
beforeDestroy() {
// 组件销毁前移除监听器
- uni.$off('refreshDeviceList');
+
},
}
diff --git a/pages/6170/callPolice/index.vue b/pages/6170/callPolice/index.vue
index 2fda5e2..99f4a2e 100644
--- a/pages/6170/callPolice/index.vue
+++ b/pages/6170/callPolice/index.vue
@@ -3,9 +3,10 @@
全选
-
+
-
+
@@ -46,400 +47,448 @@
\ No newline at end of file
diff --git a/pages/6170/deviceControl/index.vue b/pages/6170/deviceControl/index.vue
index bc2ce87..8ed74fe 100644
--- a/pages/6170/deviceControl/index.vue
+++ b/pages/6170/deviceControl/index.vue
@@ -309,6 +309,7 @@
lightModeB: false,
lightModeC: false, //激光提示框
items: [],
+ pendingMainMode: null, // 选中的索引
isFormExpanded: true, // 默认展开
deviceID: '',
itemInfo: {},
@@ -553,21 +554,38 @@
toggleForm() {
this.isFormExpanded = !this.isFormExpanded;
},
+ // onItemClick(index) {
+ // const selectedItem = this.items[index];
+ // if (selectedItem.text === '激光') {
+ // this.lightModeC = true;
+ // } else {
+ // // 更新选中状态
+ // this.items = this.items.map((item, i) => ({
+ // ...item,
+ // selected: i === index
+ // }));
+ // this.currentMainMode = selectedItem.text;
+ // this.selectedItemIndex = index;
+ // // 强制更新视图(如果需要)
+ // this.$forceUpdate();
+ // }
+ // },
onItemClick(index) {
- const selectedItem = this.items[index];
- if (selectedItem.text === '激光') {
+ const item = this.items[index];
+ // 激光模式特殊处理
+ if (item.text === '激光') {
this.lightModeC = true;
- } else {
- // 更新选中状态
- this.items = this.items.map((item, i) => ({
- ...item,
- selected: i === index
- }));
- this.currentMainMode = selectedItem.text;
- this.selectedItemIndex = index;
- // 强制更新视图(如果需要)
- this.$forceUpdate();
+ return;
}
+ // 只更新临时选中状态
+ this.selectedItemIndex = index;
+ // UI高亮效果(不影响实际模式)
+ this.items = this.items.map((item, i) => ({
+ ...item,
+ selected: i === index
+ }));
+ // 显示临时选中的模式名称(视觉反馈)
+ this.pendingMainMode = item.text;
},
// 灯光模式的确认
handleSumbit() {
@@ -589,7 +607,6 @@
this.isProcessing = true
if (this.selectedItemIndex === null) return;
const selectedItem = this.items[this.selectedItemIndex];
- // 准备请求数据
let data = {
deviceId: this.computedDeviceId,
instructValue: selectedItem.instructValue,
@@ -598,6 +615,9 @@
};
lightModeSettings(data).then((res) => {
if (res.code == 200) {
+ // 只有确认成功才更新实际模式,选中模式
+ this.currentMainMode = this.pendingMainMode;
+ this.selectedItemIndex = selectedItem;
uni.showToast({
title: res.msg,
icon: 'none'
@@ -914,20 +934,29 @@
};
// 3.解除告警状态
const registerRes = await deviceSendAlarmMessage(data);
- if (registerRes.code == 200) {
+ if (registerRes.code !== 200) {
+ uni.showToast({
+ title: registerRes.msg,
+ icon: 'none'
+ })
+ return
+ }
+ // 4. 获取设备状态
+ const statusRes = await this.getdeviceSTatus(2, batchId);
+ if (statusRes.data.functionAccess === 'OK') {
uni.showToast({
title: statusRes.msg,
icon: 'none'
});
- // 刷新详情接口
- this.fetchDeviceDetail(this.computedDeviceId, true);
uni.$emit('deviceStatusUpdate', {});
this.showPopupFlag = false
- } else {
- uni.showToast({
- title: registerRes.message,
- icon: 'none'
- });
+ if (this.apiType === 'listA') {
+ this.fetchDeviceDetail(this.computedDeviceId)
+ } else {
+ // 分享权限详情
+ this.fetchSharedDeviceDetail(this.itemInfo.id)
+ }
+
}
} catch (error) {
uni.showToast({
@@ -1091,6 +1120,7 @@
title: error.msg,
icon: 'none'
})
+ uni.hideLoading()
}
},
// 操作说明
@@ -1187,15 +1217,18 @@
this.deviceInfo.batteryRemainingTime = deviceState[5];
}
setTimeout(() => {
- this.fetchDeviceDetail(data.data.id, true).then(
- () => {
- if (this.deviceInfo.batteryPercentage <
- 20) {
- this.popupType = 'bettery';
- this.popupMessage = '请及时充电';
- this.showPopupFlag = true;
- }
- });
+ if (this.deviceInfo.batteryPercentage <
+ 20) {
+ this.popupType = 'bettery';
+ this.popupMessage = '请及时充电';
+ this.showPopupFlag = true;
+ }
+ if (this.apiType === 'listA') {
+ this.fetchDeviceDetail(data.data.id)
+ } else {
+ // 分享权限详情
+ this.fetchSharedDeviceDetail(data.data.id)
+ }
}, 10000);
// 上报电量,在列表里面同步
uni.$emit('deviceStatusUpdate', {
diff --git a/pages/common/send/index.vue b/pages/common/send/index.vue
index 7861a5c..5d35263 100644
--- a/pages/common/send/index.vue
+++ b/pages/common/send/index.vue
@@ -82,7 +82,6 @@
* @param {number} [interval=1000] - 轮询间隔(毫秒)
*/
async getdeviceSTatus(val, batchId, interval = 800) {
- let retries = 0;
const checkStatus = async () => {
try {
const data = {