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