From 3149b92f15b11e7ab8bd0183ca5153a5f9b744a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Mon, 17 Feb 2025 17:46:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=94=B5=E5=AD=90=E9=92=A5=E5=8C=99?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=88=E6=9D=83=E4=B8=8E=E5=86=BB=E7=BB=93?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/key.js | 36 +++++++ components/ModalInput/ModalInput.vue | 20 ++-- pages/adminDetail/adminDetail.vue | 126 +++++++++++++++++++++++ pages/keyDetail/keyDetail.vue | 148 +++++++++++++++++++++++++++ 4 files changed, 323 insertions(+), 7 deletions(-) diff --git a/api/key.js b/api/key.js index c3755c6..cc0ccfc 100644 --- a/api/key.js +++ b/api/key.js @@ -82,3 +82,39 @@ export function getKeyRequest(data) { data }) } + +// 冻结电子钥匙 +export function freezeKeyRequest(data) { + return request({ + url: '/key/freeze', + method: 'POST', + data + }) +} + +// 解冻电子钥匙 +export function unfreezeKeyRequest(data) { + return request({ + url: '/key/unfreeze', + method: 'POST', + data + }) +} + +// 设置授权管理员 +export function authorizeKeyRequest(data) { + return request({ + url: '/key/authorize', + method: 'POST', + data + }) +} + +// 取消授权管理员 +export function unauthorizeKeyRequest(data) { + return request({ + url: '/key/unauthorize', + method: 'POST', + data + }) +} diff --git a/components/ModalInput/ModalInput.vue b/components/ModalInput/ModalInput.vue index bdbc21a..47405b1 100644 --- a/components/ModalInput/ModalInput.vue +++ b/components/ModalInput/ModalInput.vue @@ -4,12 +4,20 @@ {{ title }} - - - diff --git a/pages/adminDetail/adminDetail.vue b/pages/adminDetail/adminDetail.vue index cc4e045..87506bf 100644 --- a/pages/adminDetail/adminDetail.vue +++ b/pages/adminDetail/adminDetail.vue @@ -49,7 +49,49 @@ 操作记录 + + {{ + info.keyStatus === 110405 ? '解冻' : '冻结' + }} + {{ + info.keyRight === 1 ? '取消授权管理员' : '授权管理员' + }} + 删除 + + + + + 同时{{ info.keyStatus === 110405 ? '解冻' : '冻结' }}其发送的钥匙 + + + + {{ info.keyStatus === 110405 ? '取消冻结' : '冻结' }}会在用户APP连网后生效 + + + + + {{ + info.keyRight === 1 + ? '取消授权会在用户APP连网后生效' + : '授权用户拥有管理员的大部分权限,比如发送要是、发送密码' + }} + + { + showModalFreeze.value = true + } + + const authorize = async () => { + showModalAuthorize.value = true + } + + const cancelModalFreeze = () => { + showModalFreeze.value = false + checkedFreeze.value = false + } + + const cancelModalAuthorize = () => { + showModalAuthorize.value = false + } + + const changeRadioFreeze = () => { + checkedFreeze.value = !checkedFreeze.value + } + + const confirmModalFreeze = async () => { + uni.showLoading({ + title: '更新中', + mask: true + }) + const { code, message } = + info.value.keyStatus === 110405 + ? await unfreezeKeyRequest({ + keyId: info.value.keyId, + includeUnderlings: checkedFreeze.value ? 1 : 0 + }) + : await freezeKeyRequest({ + keyId: info.value.keyId, + includeUnderlings: checkedFreeze.value ? 1 : 0 + }) + if (code === 0) { + showModalFreeze.value = false + eventChannel.emit('refresherList', {}) + uni.hideLoading() + $basic.backAndToast(info.value.keyStatus === 110405 ? '解冻成功' : '冻结成功') + } else { + uni.hideLoading() + uni.showToast({ + title: message, + icon: 'none' + }) + } + } + + const confirmModalAuthorize = async () => { + uni.showLoading({ + title: '更新中', + mask: true + }) + const { code, message } = + info.value.keyRight === 1 + ? await unauthorizeKeyRequest({ + keyId: info.value.keyId + }) + : await authorizeKeyRequest({ + keyId: info.value.keyId + }) + if (code === 0) { + showModalAuthorize.value = false + eventChannel.emit('refresherList', {}) + uni.hideLoading() + $basic.backAndToast(info.value.keyRight === 1 ? '取消授权成功' : '授权成功') + } else { + uni.hideLoading() + uni.showToast({ + title: message, + icon: 'none' + }) + } + } + onLoad(options => { if (options.info) { info.value = JSON.parse(options.info) diff --git a/pages/keyDetail/keyDetail.vue b/pages/keyDetail/keyDetail.vue index 7b8e3da..f0e8dd3 100644 --- a/pages/keyDetail/keyDetail.vue +++ b/pages/keyDetail/keyDetail.vue @@ -89,6 +89,18 @@ 操作记录 + + {{ $lock.currentKeyInfo.keyStatus === 110405 ? '解冻' : '冻结' }} + {{ $lock.currentKeyInfo.keyRight === 1 ? '取消授权管理员' : '授权管理员' }} + 删除 + + + + + 同时{{ $lock.currentKeyInfo.keyStatus === 110405 ? '解冻' : '冻结' }}其发送的钥匙 + + + + {{ + $lock.currentKeyInfo.keyStatus === 110405 ? '取消冻结' : '冻结' + }}会在用户APP连网后生效 + + + + + {{ + $lock.currentKeyInfo.keyRight === 1 + ? '取消授权会在用户APP连网后生效' + : '授权用户拥有管理员的大部分权限,比如发送要是、发送密码' + }} + + { + showModalFreeze.value = true + } + + const authorize = async () => { + showModalAuthorize.value = true + } + const changeManageSelf = async () => { if (pending.value) return pending.value = true @@ -264,10 +335,23 @@ checked.value = false } + const cancelModalFreeze = () => { + showModalFreeze.value = false + checkedFreeze.value = false + } + + const cancelModalAuthorize = () => { + showModalAuthorize.value = false + } + const changeRadio = () => { checked.value = !checked.value } + const changeRadioFreeze = () => { + checkedFreeze.value = !checkedFreeze.value + } + const confirmModal = async () => { uni.showLoading({ title: '删除中', @@ -295,6 +379,70 @@ } } + const confirmModalFreeze = async () => { + uni.showLoading({ + title: '更新中', + mask: true + }) + const { code, message } = + $lock.currentKeyInfo.keyStatus === 110405 + ? await unfreezeKeyRequest({ + keyId: $lock.currentKeyInfo.keyId, + includeUnderlings: checkedFreeze.value ? 1 : 0 + }) + : await freezeKeyRequest({ + keyId: $lock.currentKeyInfo.keyId, + includeUnderlings: checkedFreeze.value ? 1 : 0 + }) + if (code === 0) { + showModalFreeze.value = false + $lock.updateKeySearch({ + ...$lock.keySearch, + pageNo: 1 + }) + $lock.getKeyList($lock.keySearch) + uni.hideLoading() + $basic.backAndToast($lock.currentKeyInfo.keyStatus === 110405 ? '解冻成功' : '冻结成功') + } else { + uni.hideLoading() + uni.showToast({ + title: message, + icon: 'none' + }) + } + } + + const confirmModalAuthorize = async () => { + uni.showLoading({ + title: '更新中', + mask: true + }) + const { code, message } = + $lock.currentKeyInfo.keyRight === 1 + ? await unauthorizeKeyRequest({ + keyId: $lock.currentKeyInfo.keyId + }) + : await authorizeKeyRequest({ + keyId: $lock.currentKeyInfo.keyId + }) + if (code === 0) { + showModalAuthorize.value = false + $lock.updateKeySearch({ + ...$lock.keySearch, + pageNo: 1 + }) + $lock.getKeyList($lock.keySearch) + uni.hideLoading() + $basic.backAndToast($lock.currentKeyInfo.keyRight === 1 ? '取消授权成功' : '授权成功') + } else { + uni.hideLoading() + uni.showToast({ + title: message, + icon: 'none' + }) + } + } + const deleteKey = async () => { if ($lock.currentKeyInfo.keyRight === 1) { showModal.value = true From b195fe5a49f08484230bd19a3460f6a59fcb71e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E9=B9=8F?= Date: Mon, 17 Feb 2025 18:50:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=99=A8UI=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/LockDatetimePicker/LockDatetimePicker.vue | 3 ++- components/ModalInput/ModalInput.vue | 2 +- pages/cycleDate/cycleDate.vue | 12 ++++++++---- pages/temporaryDate/temporaryDate.vue | 2 ++ uni.scss | 4 ---- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/components/LockDatetimePicker/LockDatetimePicker.vue b/components/LockDatetimePicker/LockDatetimePicker.vue index 016dec7..8a3ac53 100644 --- a/components/LockDatetimePicker/LockDatetimePicker.vue +++ b/components/LockDatetimePicker/LockDatetimePicker.vue @@ -8,7 +8,8 @@ { - text.value = e.target.value + text.value = e } const confirm = () => { diff --git a/pages/cycleDate/cycleDate.vue b/pages/cycleDate/cycleDate.vue index ea47fc0..eadc2f1 100644 --- a/pages/cycleDate/cycleDate.vue +++ b/pages/cycleDate/cycleDate.vue @@ -88,11 +88,12 @@ >