修改授权管理员删除钥匙流程

This commit is contained in:
范鹏 2024-09-03 14:21:40 +08:00
parent a686dfad84
commit 3fd9995e05

View File

@ -38,6 +38,15 @@
</view>
</view>
<view class="button-logout" @click="deleteLock">删除</view>
<up-modal :show="showModal" title="是否删除授权管理员钥匙?" :showCancelButton="true" width="600rpx" @cancel="cancelModal"
@confirm="confirmModal">
<view class="slot-content" @click="changeRadio">
<view style="display: flex;align-items: center;">
<radio :checked="checked"></radio>
<view>同时删除其发送的所有钥匙钥匙删除后不能恢复</view>
</view>
</view>
</up-modal>
</view>
</template>
@ -54,7 +63,9 @@ import { useBasicStore } from '@/stores/basic'
export default {
data () {
return {
unlockApp: 0
unlockApp: 0,
showModal: false,
checked: false
}
},
computed: {
@ -69,6 +80,39 @@ export default {
...mapActions(useBluetoothStore, ['resetDevice', 'updateCurrentLockInfo']),
...mapActions(useLockStore, ['getLockList', 'updateLockSearch']),
...mapActions(useBasicStore, ['backAndToast']),
changeRadio() {
this.checked = !this.checked
},
cancelModal() {
this.showModal = false
this.checked = false
},
async confirmModal() {
uni.showLoading({
title: '删除中',
mask: true
})
const that = this
const { code } = await deleteKeyRequest({
keyId: that.keyId,
includeUnderlings: that.checked ? 1 : 0
})
if(code === 0) {
uni.hideLoading()
that.updateLockSearch({
...that.lockSearch,
pageNo: 1
})
that.getLockList(that.lockSearch)
that.backAndToast('删除成功', 2)
} else {
uni.hideLoading()
uni.showToast({
title: 'message',
icon: 'none'
})
}
},
async changeUnlockApp(value) {
uni.showLoading({
title: '更新中',
@ -98,6 +142,10 @@ export default {
},
deleteLock() {
const that = this
if(this.currentLockInfo.userType !== 110301 && this.currentLockInfo.keyRight === 1) {
this.showModal = true
return
}
const message = that.currentLockInfo.userType === 110301 ? '删除锁后,所有信息都会一起删除,确定删除锁吗?' : '确定删除该钥匙吗?'
uni.showModal({
title: '提示',
@ -215,4 +263,21 @@ page {
height: 3rpx;
background: #EBEBEB;
}
radio .wx-radio-input.wx-radio-input-checked {
border: none;
background: #c1885a;
}
radio .wx-radio-input.wx-radio-input-checked::before {
border-radius: 50%; /* 圆角 */
width: 28rpx; /* 选中后对勾大小,不要超过背景的尺寸 */
height: 28rpx; /* 选中后对勾大小,不要超过背景的尺寸 */
line-height: 28rpx;
text-align: center;
font-size: 20rpx; /* 对勾大小 30rpx */
color: #fff; /* 对勾颜色 白色 */
background: #c1885a;
transform: translate(-50%, -50%) scale(1);
}
</style>