diff --git a/src/pages/cabinet/cabinetDetail.vue b/src/pages/cabinet/cabinetDetail.vue index 71655d1..c30c13a 100644 --- a/src/pages/cabinet/cabinetDetail.vue +++ b/src/pages/cabinet/cabinetDetail.vue @@ -81,7 +81,15 @@ - {{ "柜门" + state.detail.deviceCode + "-" + item.cabinetNo }} + + {{ "柜门" + state.detail.deviceCode + "-" + item.cabinetNo }} + + 检修开门 +    + 检修关门 + + + 货柜号: {{ item.cabinetNo }} @@ -134,13 +142,47 @@ onShow(async () => { const res = await doorApi.hardDoorDetail({ hardDoorId: state.id }) if (res.code == 0) { state.detail = res.data - return + } else { + uni.showToast({ title: res.msg, icon: "none" }) } - uni.showToast({ title: res.msg, icon: "none" }) } catch (error: any) { uni.showToast({ title: error.msg, icon: "none" }) } finally { uni.hideLoading() } }) + +// 检修开门 +const checkOpenAccess = async (cabinetNo: string) => { + try { + uni.showLoading({ title: "开门中...", mask: true }) + const res: any = await doorApi.openAccess({ hardDoorId: state.id, cabinetNo }) + if (res.code == 0) { + uni.showToast({ title: "开门成功", icon: "none" }) + } else { + uni.showToast({ title: res.msg, icon: "none" }) + } + } catch (error: any) { + uni.showToast({ title: error.msg, icon: "none" }) + } finally { + uni.hideLoading() + } +} + +// 检修关门 +const checkCloseAccess = async (cabinetNo: string) => { + try { + uni.showLoading({ title: "关门中...", mask: true }) + const res = await doorApi.closeAccess({ hardDoorId: state.id, cabinetNo }) + if (res.code == 0) { + uni.showToast({ title: "关门成功", icon: "none" }) + } else { + uni.showToast({ title: res.msg, icon: "none" }) + } + } catch (error: any) { + uni.showToast({ title: error.msg, icon: "none" }) + } finally { + uni.hideLoading() + } +} diff --git a/src/pages/tabbar/cabinet.vue b/src/pages/tabbar/cabinet.vue index 81e1c17..a3253e8 100644 --- a/src/pages/tabbar/cabinet.vue +++ b/src/pages/tabbar/cabinet.vue @@ -17,7 +17,7 @@ {{ item.hardName }} {{ item.deviceCode }} - + 货柜详情 diff --git a/src/sheep/api/door.ts b/src/sheep/api/door.ts index c700347..608992a 100644 --- a/src/sheep/api/door.ts +++ b/src/sheep/api/door.ts @@ -173,7 +173,6 @@ export default { showLoading: false, }, }), - /** * app检修关门 * @param hardDoorId 智能柜id