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/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 @@ {{ title }} - { - text.value = e.target.value + text.value = e } const confirm = () => { @@ -72,5 +80,3 @@ close }) - - 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/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 @@ > 操作记录 + + {{ $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 diff --git a/pages/temporaryDate/temporaryDate.vue b/pages/temporaryDate/temporaryDate.vue index 608740a..3474f30 100644 --- a/pages/temporaryDate/temporaryDate.vue +++ b/pages/temporaryDate/temporaryDate.vue @@ -47,6 +47,7 @@ v-model="defaultStartDate" mode="datetime" closeOnClickOverlay + :itemHeight="70" :visibleItemCount="5" @close="showStartDate = false" @confirm="confirmDate('start', $event)" @@ -58,6 +59,7 @@ v-model="defaultEndDate" mode="datetime" closeOnClickOverlay + :itemHeight="70" :visibleItemCount="5" @close="showEndDate = false" @confirm="confirmDate('end', $event)" diff --git a/uni.scss b/uni.scss index 8410453..642511a 100644 --- a/uni.scss +++ b/uni.scss @@ -77,7 +77,3 @@ $uni-color-subtitle: #555555; // 二级标题颜色 $uni-font-size-subtitle:26px; $uni-color-paragraph: #3F536E; // 文章段落颜色 $uni-font-size-paragraph:15px; - -.u-picker__view { - height: 500rpx !important; -}