fix: 绑定解绑塘口数据,bug修复。
This commit is contained in:
@@ -22,7 +22,9 @@ export function deviceUnbind(data){
|
||||
}
|
||||
// 将设备及开关绑定到塘口
|
||||
export function bandDeviceToPond(data){
|
||||
return httpService.put(API.POND.BIND_DEVICE(), {data})
|
||||
const store = useRootUserStore();
|
||||
const userId = store.getRootUserId || Taro.getStorageSync('UserId');
|
||||
return httpService.put(`${API.POND.BIND_DEVICE()}?rootUserId=${userId}`, {data})
|
||||
}
|
||||
// 设备图表数据
|
||||
export function deviceHistory(params){
|
||||
|
||||
@@ -1119,13 +1119,33 @@ function onconfirm(list) {
|
||||
if (res.code == 200) {
|
||||
state.show = true;
|
||||
state.msg = "操作成功";
|
||||
pond2();
|
||||
pond1();
|
||||
pondChildInfo.value.getDeviceList();
|
||||
// 先关闭弹窗
|
||||
bandDevShow.value = false;
|
||||
// 延迟刷新数据,确保后端数据更新完成
|
||||
setTimeout(() => {
|
||||
// 先刷新塘口列表(会自动选中当前塘口)
|
||||
pond1();
|
||||
// 等待 pond1 完成后再刷新设备详情
|
||||
setTimeout(() => {
|
||||
if (pondChildInfo.value && pondChildInfo.value.getDeviceList) {
|
||||
pondChildInfo.value.getDeviceList();
|
||||
}
|
||||
}, 500);
|
||||
}, 500);
|
||||
} else {
|
||||
// 操作失败也关闭弹窗
|
||||
bandDevShow.value = false;
|
||||
state.show = true;
|
||||
state.msg = res.msg || "绑定失败,请重试";
|
||||
state.type = "fail";
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
.catch((error) => {
|
||||
// 网络错误也关闭弹窗
|
||||
bandDevShow.value = false;
|
||||
state.show = true;
|
||||
state.msg = "网络错误,请重试";
|
||||
state.type = "fail";
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
bandDevShow.value = false;
|
||||
|
||||
Reference in New Issue
Block a user