修复电子钥匙相关bug
This commit is contained in:
parent
0ef64ecd61
commit
ede3acd285
@ -40,6 +40,15 @@
|
||||
<view class="item-content">{{ timeFormat(currentKeyInfo.sendDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
<view class="button" @click="deleteKey">删除钥匙</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>
|
||||
|
||||
@ -52,7 +61,10 @@ import { useBasicStore } from '@/stores/basic'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {}
|
||||
return {
|
||||
showModal: false,
|
||||
checked: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(useLockStore, ['currentKeyInfo', 'keySearch']),
|
||||
@ -61,8 +73,46 @@ export default {
|
||||
timeFormat,
|
||||
...mapActions(useLockStore, ['updateKeySearch', 'getKeyList', 'convertWeekDaysToChineseString']),
|
||||
...mapActions(useBasicStore, ['backAndToast']),
|
||||
cancelModal() {
|
||||
this.showModal = false
|
||||
this.checked = false
|
||||
},
|
||||
changeRadio() {
|
||||
this.checked = !this.checked
|
||||
},
|
||||
async confirmModal() {
|
||||
uni.showLoading({
|
||||
title: '删除中',
|
||||
mask: true
|
||||
})
|
||||
const that = this
|
||||
const { code } = await deleteKeyRequest({
|
||||
keyId: that.currentKeyInfo.keyId,
|
||||
includeUnderlings: that.checked ? 1 : 0
|
||||
})
|
||||
that.showModal = false
|
||||
if(code === 0) {
|
||||
that.updateKeySearch({
|
||||
...that.keySearch,
|
||||
pageNo: 1
|
||||
})
|
||||
that.getKeyList(that.keySearch)
|
||||
uni.hideLoading()
|
||||
that.backAndToast('删除成功')
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: 'message',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
async deleteKey () {
|
||||
const that = this
|
||||
if(that.currentKeyInfo.keyRight === 1) {
|
||||
that.showModal = true
|
||||
return
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要删除该钥匙',
|
||||
|
||||
@ -20,8 +20,11 @@
|
||||
<view class="key" @click="toKeyDetail(key)">
|
||||
<image class="key-left" :src="key.headUrl" mode="aspectFill"></image>
|
||||
<view class="key-right">
|
||||
<view style="display: flex; align-items: center">
|
||||
<view style="display: flex;">
|
||||
<view class="key-right-top">{{ key.keyName }}</view>
|
||||
<image class="key-admin" mode="aspectFill" v-if="key.keyRight === 1 && key.lockSetting.remoteUnlock
|
||||
=== 1" src="/static/images/icon_remote_unlock.png"></image>
|
||||
<image class="key-admin" mode="aspectFill" v-if="key.keyRight === 1" src="/static/images/icon_admin.png"></image>
|
||||
<view class="key-status" :style="{ color: (key.keyStatus === 110401) ? '#63b8af' : '#df282d' }">
|
||||
{{ getKeyStatus(key.keyStatus) }}
|
||||
</view>
|
||||
@ -39,6 +42,15 @@
|
||||
<view class="button-reset" @click="resetKey">重置钥匙</view>
|
||||
<view class="button-create" @click="toCreateKey">发送钥匙</view>
|
||||
</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,6 +66,8 @@ import { deleteKeyRequest, resetKeyRequest } from '@/api/key'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
showModal: false,
|
||||
checked: false,
|
||||
deviceInfo: null,
|
||||
refresherTriggered: false,
|
||||
requestFinished: false,
|
||||
@ -62,7 +76,8 @@ export default {
|
||||
style: {
|
||||
backgroundColor: '#f56c6c'
|
||||
}
|
||||
}]
|
||||
}],
|
||||
deleteKeyId: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -87,6 +102,43 @@ export default {
|
||||
methods: {
|
||||
...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo']),
|
||||
...mapActions(useLockStore, ['getKeyList', 'updateCurrentKeyInfo', 'updateKeySearch', 'getKeyStatus']),
|
||||
changeRadio() {
|
||||
this.checked = !this.checked
|
||||
},
|
||||
async confirmModal() {
|
||||
uni.showLoading({
|
||||
title: '删除中',
|
||||
mask: true
|
||||
})
|
||||
const that = this
|
||||
const { code } = await deleteKeyRequest({
|
||||
keyId: that.deleteKeyId,
|
||||
includeUnderlings: that.checked ? 1 : 0
|
||||
})
|
||||
that.showModal = false
|
||||
if(code === 0) {
|
||||
that.updateKeySearch({
|
||||
...that.keySearch,
|
||||
pageNo: 1
|
||||
})
|
||||
that.getKeyList(that.keySearch)
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: 'message',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
cancelModal() {
|
||||
this.showModal = false
|
||||
this.checked = false
|
||||
},
|
||||
toKeyDetail(key) {
|
||||
this.updateCurrentKeyInfo(key)
|
||||
this.routeJump({
|
||||
@ -98,6 +150,11 @@ export default {
|
||||
const that = this
|
||||
let index = this.keyList.findIndex(item => item.keyId === key.keyId)
|
||||
that.$refs.swipeItem[index].closeHandler()
|
||||
if(data.keyRight === 1) {
|
||||
this.deleteKeyId = key.keyId
|
||||
this.showModal = true
|
||||
return
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要删除该钥匙',
|
||||
@ -274,6 +331,7 @@ page {
|
||||
width: 574rpx;
|
||||
|
||||
.key-right-top {
|
||||
max-width: 450rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
padding-bottom: 6rpx;
|
||||
@ -282,6 +340,13 @@ page {
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.key-admin {
|
||||
margin-top: 8rpx;
|
||||
margin-left: 10rpx;
|
||||
width: 25rpx;
|
||||
height: 25rpx;
|
||||
}
|
||||
|
||||
.key-right-bottom {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
@ -289,6 +354,7 @@ page {
|
||||
}
|
||||
|
||||
.key-status {
|
||||
margin-top: 4rpx;
|
||||
margin-left: auto;
|
||||
font-size: 26rpx;
|
||||
color: #63b8af;
|
||||
|
||||
@ -134,6 +134,7 @@ export default {
|
||||
keyId: that.keyId,
|
||||
includeUnderlings: that.checked ? 1 : 0
|
||||
})
|
||||
that.showModal = false
|
||||
if(code === 0) {
|
||||
uni.hideLoading()
|
||||
that.updateLockSearch({
|
||||
|
||||
BIN
static/images/icon_admin.png
Executable file
BIN
static/images/icon_admin.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
static/images/icon_remote_unlock.png
Executable file
BIN
static/images/icon_remote_unlock.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
@ -45,7 +45,7 @@ export const useLockStore = defineStore('lock', {
|
||||
searchStr: '',
|
||||
endDate: '0',
|
||||
startDate: '0',
|
||||
keyStatus: [110401,110402,110412],
|
||||
keyStatus: [110401, 110402, 110412, 110405, 110403],
|
||||
keyRight: 0
|
||||
},
|
||||
}
|
||||
@ -93,10 +93,14 @@ export const useLockStore = defineStore('lock', {
|
||||
getKeyStatus(keyStatus) {
|
||||
if(keyStatus === 110401) {
|
||||
return '正常'
|
||||
} else if(keyStatus === 110403) {
|
||||
return '未生效'
|
||||
} else if(keyStatus === 110402) {
|
||||
return '待接收'
|
||||
} else if(keyStatus === 110412) {
|
||||
return '已过期'
|
||||
} else if(keyStatus === 110405) {
|
||||
return '已冻结'
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user