完成电子钥匙和授权管理员的修改功能
This commit is contained in:
parent
8cdb4dd0c5
commit
7cd011cc9d
27
api/key.js
27
api/key.js
@ -55,3 +55,30 @@ export function getUserNoListRequest(data) {
|
|||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改电子钥匙名称
|
||||||
|
export function updateKeyNameRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/key/modifyKeyNameForAdmin',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改电子钥匙有效期
|
||||||
|
export function updateKeyDateRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/key/updateKeyDate',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取电子钥匙详情
|
||||||
|
export function getKeyRequest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/key/detail',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -1,16 +1,26 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view v-if="info">
|
<view v-if="info">
|
||||||
<view class="item">
|
<view class="item" @click="() => $refs.modalInput.open()">
|
||||||
<view class="item-title">姓名</view>
|
<view class="item-title">姓名</view>
|
||||||
<view class="item-content">{{ info.keyName }}</view>
|
<view class="flex items-center">
|
||||||
|
<view class="item-content mr-2">{{ info.keyName }}</view>
|
||||||
|
<up-icon name="arrow-right"></up-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" style="margin-top: 2rpx">
|
<view class="item" style="margin-top: 2rpx" @click="updateTime">
|
||||||
<view class="item-title">有效期</view>
|
<view class="item-title">有效期</view>
|
||||||
<view v-if="info.keyType === 1">永久</view>
|
<view class="flex items-center">
|
||||||
<view v-else>
|
<view v-if="info.keyType === 1" class="mr-2">永久</view>
|
||||||
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd h:M') }}</view>
|
<view v-else-if="info.keyType === 2" class="mr-2 w-400 text-right">
|
||||||
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd h:M') }}</view>
|
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd h:M') }}</view>
|
||||||
|
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd h:M') }}</view>
|
||||||
|
</view>
|
||||||
|
<view v-else class="mr-2">
|
||||||
|
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd') }}</view>
|
||||||
|
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd') }}</view>
|
||||||
|
</view>
|
||||||
|
<up-icon name="arrow-right"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" style="margin-top: 20rpx">
|
<view class="item" style="margin-top: 20rpx">
|
||||||
@ -25,11 +35,29 @@
|
|||||||
<view class="item-title">发送时间</view>
|
<view class="item-title">发送时间</view>
|
||||||
<view class="item-content">{{ timeFormat(info.sendDate, 'yyyy-mm-dd h:M') }}</view>
|
<view class="item-content">{{ timeFormat(info.sendDate, 'yyyy-mm-dd h:M') }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="item !py-2" style="margin-top: 20rpx">
|
||||||
|
<view class="item-title">仅管理自己创建的用户</view>
|
||||||
|
<switch
|
||||||
|
:checked="info.isOnlyManageSelf"
|
||||||
|
class="transform-scale-90"
|
||||||
|
@click="changeManageSelf"
|
||||||
|
:disabled="true"
|
||||||
|
color="#002ce5"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
<view class="item" style="margin-top: 20rpx" @click="toRecordList">
|
<view class="item" style="margin-top: 20rpx" @click="toRecordList">
|
||||||
<view class="item-title">操作记录</view>
|
<view class="item-title">操作记录</view>
|
||||||
<up-icon name="arrow-right"></up-icon>
|
<up-icon name="arrow-right"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="button" @click="showModal = true">删除</view>
|
<view class="button" @click="showModal = true">删除</view>
|
||||||
|
<ModalInput
|
||||||
|
ref="modalInput"
|
||||||
|
title="请输入姓名"
|
||||||
|
:autoClose="false"
|
||||||
|
placeholder="请输入姓名"
|
||||||
|
:value="info.keyName"
|
||||||
|
@confirm="changeName"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
<up-modal
|
<up-modal
|
||||||
:show="showModal"
|
:show="showModal"
|
||||||
@ -53,19 +81,62 @@
|
|||||||
import { getCurrentInstance, ref } from 'vue'
|
import { getCurrentInstance, ref } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { timeFormat } from 'uview-plus'
|
import { timeFormat } from 'uview-plus'
|
||||||
import { deleteKeyRequest } from '@/api/key'
|
import {
|
||||||
|
deleteKeyRequest,
|
||||||
|
getKeyRequest,
|
||||||
|
updateKeyDateRequest,
|
||||||
|
updateKeyNameRequest
|
||||||
|
} from '@/api/key'
|
||||||
import { useBasicStore } from '@/stores/basic'
|
import { useBasicStore } from '@/stores/basic'
|
||||||
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||||
|
|
||||||
const instance = getCurrentInstance().proxy
|
const instance = getCurrentInstance().proxy
|
||||||
const eventChannel = instance.getOpenerEventChannel()
|
const eventChannel = instance.getOpenerEventChannel()
|
||||||
|
|
||||||
const $basic = useBasicStore()
|
const $basic = useBasicStore()
|
||||||
|
const $bluetooth = useBluetoothStore()
|
||||||
|
|
||||||
const info = ref(null)
|
const info = ref(null)
|
||||||
|
|
||||||
const showModal = ref(false)
|
const showModal = ref(false)
|
||||||
const checked = ref(false)
|
const checked = ref(false)
|
||||||
|
|
||||||
|
const modalInput = ref(null)
|
||||||
|
|
||||||
|
const pending = ref(false)
|
||||||
|
|
||||||
|
const changeName = async name => {
|
||||||
|
if (!name) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请输入姓名',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (pending.value) return
|
||||||
|
pending.value = true
|
||||||
|
const { code, message } = await updateKeyNameRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
keyId: info.value.keyId,
|
||||||
|
keyNameForAdmin: name
|
||||||
|
})
|
||||||
|
pending.value = false
|
||||||
|
if (code === 0) {
|
||||||
|
modalInput.value.close()
|
||||||
|
eventChannel.emit('refresherList', {})
|
||||||
|
info.value.keyName = name
|
||||||
|
uni.showToast({
|
||||||
|
title: '更新成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onLoad(options => {
|
onLoad(options => {
|
||||||
if (options.info) {
|
if (options.info) {
|
||||||
info.value = JSON.parse(options.info)
|
info.value = JSON.parse(options.info)
|
||||||
@ -73,6 +144,56 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const changeManageSelf = async () => {
|
||||||
|
if (pending.value) return
|
||||||
|
pending.value = true
|
||||||
|
uni.showLoading({
|
||||||
|
title: '更新中'
|
||||||
|
})
|
||||||
|
const { code, message } = await updateKeyDateRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
keyId: info.value.keyId,
|
||||||
|
keyType: info.value.keyType,
|
||||||
|
startDate: info.value.startDate,
|
||||||
|
endDate: info.value.endDate,
|
||||||
|
isOnlyManageSelf: info.value.isOnlyManageSelf === 1 ? 0 : 1
|
||||||
|
})
|
||||||
|
pending.value = false
|
||||||
|
uni.hideLoading()
|
||||||
|
if (code === 0) {
|
||||||
|
info.value.isOnlyManageSelf = info.value.isOnlyManageSelf === 1 ? 0 : 1
|
||||||
|
eventChannel.emit('refresherList', {})
|
||||||
|
uni.showToast({
|
||||||
|
title: '更新成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateTime = () => {
|
||||||
|
$basic.routeJump({
|
||||||
|
name: 'temporaryDate',
|
||||||
|
params: {
|
||||||
|
info: JSON.stringify({ ...info.value, type: 'key' })
|
||||||
|
},
|
||||||
|
events: {
|
||||||
|
refresh() {
|
||||||
|
eventChannel.emit('refresherList', {})
|
||||||
|
getKeyRequest({
|
||||||
|
keyId: info.value.keyId
|
||||||
|
}).then(res => {
|
||||||
|
info.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const toRecordList = async () => {
|
const toRecordList = async () => {
|
||||||
$basic.routeJump({
|
$basic.routeJump({
|
||||||
name: 'typeRecordList',
|
name: 'typeRecordList',
|
||||||
|
|||||||
@ -145,6 +145,7 @@
|
|||||||
import { updateRemoteRequest } from '@/api/remote'
|
import { updateRemoteRequest } from '@/api/remote'
|
||||||
import { updatePalmVeinRequest } from '@/api/palmVein'
|
import { updatePalmVeinRequest } from '@/api/palmVein'
|
||||||
import { updateFaceRequest } from '@/api/face'
|
import { updateFaceRequest } from '@/api/face'
|
||||||
|
import { updateKeyDateRequest } from '@/api/key'
|
||||||
|
|
||||||
const instance = getCurrentInstance().proxy
|
const instance = getCurrentInstance().proxy
|
||||||
const eventChannel = instance.getOpenerEventChannel()
|
const eventChannel = instance.getOpenerEventChannel()
|
||||||
@ -265,88 +266,19 @@
|
|||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '更新中'
|
title: '更新中'
|
||||||
})
|
})
|
||||||
|
if (info.value.type === 'key') {
|
||||||
const { code } = await $bluetooth.registerAuthentication({
|
const data = await updateKeyDateRequest({
|
||||||
type: info.value.type,
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
operate: 1,
|
keyId: info.value.keyId,
|
||||||
isAdmin: info.value.type,
|
keyType: 4,
|
||||||
isForce: info.value.isForce,
|
weekDays: weekDays.value.sort(),
|
||||||
isRound: 1,
|
startDate: updateTime(startDate.value, startTimeText.value),
|
||||||
weekDays: weekDays.value.sort(),
|
endDate: updateTime(endDate.value, endTimeText.value),
|
||||||
no: info.value[`${info.value.type}Number`],
|
startTime: updateTime(startDate.value, startTimeText.value),
|
||||||
userCountLimit: 0xffff,
|
endTime: updateTime(endDate.value, endTimeText.value)
|
||||||
keyId: $bluetooth.keyId.toString(),
|
})
|
||||||
uid: $user.userInfo.uid.toString(),
|
|
||||||
startDate: updateTime(startDate.value, startTimeText.value),
|
|
||||||
endDate: updateTime(endDate.value, endTimeText.value),
|
|
||||||
startTime: startTimeText.value,
|
|
||||||
endTime: endTimeText.value
|
|
||||||
})
|
|
||||||
if (code === 0) {
|
|
||||||
let data
|
|
||||||
if (info.value.type === 'card') {
|
|
||||||
data = await updateCardRequest({
|
|
||||||
lockId: $bluetooth.currentLockInfo.lockId,
|
|
||||||
cardId: info.value.cardId,
|
|
||||||
cardType: 4,
|
|
||||||
weekDay: weekDays.value.sort(),
|
|
||||||
startDate: updateTime(startDate.value, startTimeText.value),
|
|
||||||
endDate: updateTime(endDate.value, endTimeText.value),
|
|
||||||
startTime: updateTime(startDate.value, startTimeText.value),
|
|
||||||
endTime: updateTime(endDate.value, endTimeText.value),
|
|
||||||
changeType: 1
|
|
||||||
})
|
|
||||||
} else if (info.value.type === 'fingerprint') {
|
|
||||||
data = await updateFingerprintRequest({
|
|
||||||
lockId: $bluetooth.currentLockInfo.lockId,
|
|
||||||
fingerprintId: info.value.fingerprintId,
|
|
||||||
fingerprintType: 4,
|
|
||||||
weekDay: weekDays.value.sort(),
|
|
||||||
startDate: updateTime(startDate.value, startTimeText.value),
|
|
||||||
endDate: updateTime(endDate.value, endTimeText.value),
|
|
||||||
startTime: updateTime(startDate.value, startTimeText.value),
|
|
||||||
endTime: updateTime(endDate.value, endTimeText.value),
|
|
||||||
changeType: 1
|
|
||||||
})
|
|
||||||
} else if (info.value.type === 'remote') {
|
|
||||||
data = await updateRemoteRequest({
|
|
||||||
lockId: $bluetooth.currentLockInfo.lockId,
|
|
||||||
remoteId: info.value.remoteId,
|
|
||||||
remoteType: 4,
|
|
||||||
weekDay: weekDays.value.sort(),
|
|
||||||
startDate: updateTime(startDate.value, startTimeText.value),
|
|
||||||
endDate: updateTime(endDate.value, endTimeText.value),
|
|
||||||
startTime: updateTime(startDate.value, startTimeText.value),
|
|
||||||
endTime: updateTime(endDate.value, endTimeText.value),
|
|
||||||
changeType: 1
|
|
||||||
})
|
|
||||||
} else if (info.value.type === 'face') {
|
|
||||||
data = await updateFaceRequest({
|
|
||||||
lockId: $bluetooth.currentLockInfo.lockId,
|
|
||||||
faceId: info.value.faceId,
|
|
||||||
faceType: 4,
|
|
||||||
weekDay: weekDays.value.sort(),
|
|
||||||
startDate: updateTime(startDate.value, startTimeText.value),
|
|
||||||
endDate: updateTime(endDate.value, endTimeText.value),
|
|
||||||
startTime: updateTime(startDate.value, startTimeText.value),
|
|
||||||
endTime: updateTime(endDate.value, endTimeText.value),
|
|
||||||
changeType: 1
|
|
||||||
})
|
|
||||||
} else if (info.value.type === 'palmVein') {
|
|
||||||
data = await updatePalmVeinRequest({
|
|
||||||
lockId: $bluetooth.currentLockInfo.lockId,
|
|
||||||
palmVeinId: info.value.palmVeinId,
|
|
||||||
palmVeinType: 4,
|
|
||||||
weekDay: weekDays.value.sort(),
|
|
||||||
startDate: updateTime(startDate.value, startTimeText.value),
|
|
||||||
endDate: updateTime(endDate.value, endTimeText.value),
|
|
||||||
startTime: updateTime(startDate.value, startTimeText.value),
|
|
||||||
endTime: updateTime(endDate.value, endTimeText.value),
|
|
||||||
changeType: 1
|
|
||||||
})
|
|
||||||
}
|
|
||||||
pending.value = false
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
|
pending.value = false
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
eventChannel.emit('refresh', {})
|
eventChannel.emit('refresh', {})
|
||||||
$basic.backAndToast('更新成功')
|
$basic.backAndToast('更新成功')
|
||||||
@ -361,12 +293,108 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pending.value = false
|
const { code } = await $bluetooth.registerAuthentication({
|
||||||
uni.hideLoading()
|
type: info.value.type,
|
||||||
uni.showToast({
|
operate: 1,
|
||||||
title: '操作失败,请重试',
|
isAdmin: info.value.type,
|
||||||
icon: 'none'
|
isForce: info.value.isForce,
|
||||||
|
isRound: 1,
|
||||||
|
weekDays: weekDays.value.sort(),
|
||||||
|
no: info.value[`${info.value.type}Number`],
|
||||||
|
userCountLimit: 0xffff,
|
||||||
|
keyId: $bluetooth.keyId.toString(),
|
||||||
|
uid: $user.userInfo.uid.toString(),
|
||||||
|
startDate: updateTime(startDate.value, startTimeText.value),
|
||||||
|
endDate: updateTime(endDate.value, endTimeText.value),
|
||||||
|
startTime: startTimeText.value,
|
||||||
|
endTime: endTimeText.value
|
||||||
})
|
})
|
||||||
|
if (code === 0) {
|
||||||
|
let data
|
||||||
|
if (info.value.type === 'card') {
|
||||||
|
data = await updateCardRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
cardId: info.value.cardId,
|
||||||
|
cardType: 4,
|
||||||
|
weekDay: weekDays.value.sort(),
|
||||||
|
startDate: updateTime(startDate.value, startTimeText.value),
|
||||||
|
endDate: updateTime(endDate.value, endTimeText.value),
|
||||||
|
startTime: updateTime(startDate.value, startTimeText.value),
|
||||||
|
endTime: updateTime(endDate.value, endTimeText.value),
|
||||||
|
changeType: 1
|
||||||
|
})
|
||||||
|
} else if (info.value.type === 'fingerprint') {
|
||||||
|
data = await updateFingerprintRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
fingerprintId: info.value.fingerprintId,
|
||||||
|
fingerprintType: 4,
|
||||||
|
weekDay: weekDays.value.sort(),
|
||||||
|
startDate: updateTime(startDate.value, startTimeText.value),
|
||||||
|
endDate: updateTime(endDate.value, endTimeText.value),
|
||||||
|
startTime: updateTime(startDate.value, startTimeText.value),
|
||||||
|
endTime: updateTime(endDate.value, endTimeText.value),
|
||||||
|
changeType: 1
|
||||||
|
})
|
||||||
|
} else if (info.value.type === 'remote') {
|
||||||
|
data = await updateRemoteRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
remoteId: info.value.remoteId,
|
||||||
|
remoteType: 4,
|
||||||
|
weekDay: weekDays.value.sort(),
|
||||||
|
startDate: updateTime(startDate.value, startTimeText.value),
|
||||||
|
endDate: updateTime(endDate.value, endTimeText.value),
|
||||||
|
startTime: updateTime(startDate.value, startTimeText.value),
|
||||||
|
endTime: updateTime(endDate.value, endTimeText.value),
|
||||||
|
changeType: 1
|
||||||
|
})
|
||||||
|
} else if (info.value.type === 'face') {
|
||||||
|
data = await updateFaceRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
faceId: info.value.faceId,
|
||||||
|
faceType: 4,
|
||||||
|
weekDay: weekDays.value.sort(),
|
||||||
|
startDate: updateTime(startDate.value, startTimeText.value),
|
||||||
|
endDate: updateTime(endDate.value, endTimeText.value),
|
||||||
|
startTime: updateTime(startDate.value, startTimeText.value),
|
||||||
|
endTime: updateTime(endDate.value, endTimeText.value),
|
||||||
|
changeType: 1
|
||||||
|
})
|
||||||
|
} else if (info.value.type === 'palmVein') {
|
||||||
|
data = await updatePalmVeinRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
palmVeinId: info.value.palmVeinId,
|
||||||
|
palmVeinType: 4,
|
||||||
|
weekDay: weekDays.value.sort(),
|
||||||
|
startDate: updateTime(startDate.value, startTimeText.value),
|
||||||
|
endDate: updateTime(endDate.value, endTimeText.value),
|
||||||
|
startTime: updateTime(startDate.value, startTimeText.value),
|
||||||
|
endTime: updateTime(endDate.value, endTimeText.value),
|
||||||
|
changeType: 1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
pending.value = false
|
||||||
|
uni.hideLoading()
|
||||||
|
if (data.code === 0) {
|
||||||
|
eventChannel.emit('refresh', {})
|
||||||
|
$basic.backAndToast('更新成功')
|
||||||
|
uni.showToast({
|
||||||
|
title: '更新成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: data.message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pending.value = false
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: '操作失败,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,49 +1,89 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="item">
|
<view class="item" @click="() => $refs.modalInput.open()">
|
||||||
<view class="item-title" style="width: 350rpx">姓名</view>
|
<view class="item-title" style="width: 350rpx">姓名</view>
|
||||||
<view class="item-content">{{ currentKeyInfo.keyName }}</view>
|
<view class="flex items-center">
|
||||||
|
<view class="item-content mr-2">{{ $lock.currentKeyInfo.keyName }}</view>
|
||||||
|
<up-icon name="arrow-right"></up-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" style="margin-top: 2rpx">
|
<view class="item" style="margin-top: 2rpx" @click="updateTime">
|
||||||
<view class="item-title">有效期</view>
|
<view class="item-title">有效期</view>
|
||||||
<view v-if="currentKeyInfo.keyType === 1">永久</view>
|
<view class="flex items-center">
|
||||||
<view v-else-if="currentKeyInfo.keyType === 3">单次</view>
|
<view v-if="$lock.currentKeyInfo.keyType === 1" class="mr-2">永久</view>
|
||||||
<view v-else-if="currentKeyInfo.keyType === 4">
|
<view v-else-if="$lock.currentKeyInfo.keyType === 3">单次</view>
|
||||||
<view class="item-content">{{ timeFormat(currentKeyInfo.startDate, 'yyyy-mm-dd') }}</view>
|
<view v-else-if="$lock.currentKeyInfo.keyType === 4" class="mr-2">
|
||||||
<view class="item-content">{{ timeFormat(currentKeyInfo.endDate, 'yyyy-mm-dd') }}</view>
|
<view class="item-content">{{
|
||||||
</view>
|
timeFormat($lock.currentKeyInfo.startDate, 'yyyy-mm-dd')
|
||||||
<view v-else>
|
}}</view>
|
||||||
<view class="item-content">{{
|
<view class="item-content">{{
|
||||||
timeFormat(currentKeyInfo.startDate, 'yyyy-mm-dd h:M')
|
timeFormat($lock.currentKeyInfo.endDate, 'yyyy-mm-dd')
|
||||||
}}</view>
|
}}</view>
|
||||||
<view class="item-content">{{ timeFormat(currentKeyInfo.endDate, 'yyyy-mm-dd h:M') }}</view>
|
</view>
|
||||||
|
<view v-else class="mr-2">
|
||||||
|
<view class="item-content">{{
|
||||||
|
timeFormat($lock.currentKeyInfo.startDate, 'yyyy-mm-dd h:M')
|
||||||
|
}}</view>
|
||||||
|
<view class="item-content">{{
|
||||||
|
timeFormat($lock.currentKeyInfo.endDate, 'yyyy-mm-dd h:M')
|
||||||
|
}}</view>
|
||||||
|
</view>
|
||||||
|
<up-icon v-if="$lock.currentKeyInfo.keyType !== 3" name="arrow-right"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="currentKeyInfo.keyType === 4" class="item" style="margin-top: 2rpx">
|
<view
|
||||||
|
v-if="$lock.currentKeyInfo.keyType === 4"
|
||||||
|
class="item"
|
||||||
|
style="margin-top: 2rpx"
|
||||||
|
@click="updateTime"
|
||||||
|
>
|
||||||
<view class="item-title">有效日</view>
|
<view class="item-title">有效日</view>
|
||||||
<view class="item-content">{{
|
<view class="flex items-center">
|
||||||
convertWeekDaysToChineseString(currentKeyInfo.weekDays)
|
<view class="item-content mr-2">{{
|
||||||
}}</view>
|
$lock.convertWeekDaysToChineseString($lock.currentKeyInfo.weekDays)
|
||||||
|
}}</view>
|
||||||
|
<up-icon name="arrow-right"></up-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" v-if="currentKeyInfo.keyType === 4" style="margin-top: 2rpx">
|
<view
|
||||||
|
class="item"
|
||||||
|
v-if="$lock.currentKeyInfo.keyType === 4"
|
||||||
|
style="margin-top: 2rpx"
|
||||||
|
@click="updateTime"
|
||||||
|
>
|
||||||
<view class="item-title">有效时间</view>
|
<view class="item-title">有效时间</view>
|
||||||
<view class="item-content">
|
<view class="flex items-center">
|
||||||
{{ timeFormat(currentKeyInfo.startDate, 'h:M') }}~{{
|
<view class="item-content mr-2">
|
||||||
timeFormat(currentKeyInfo.endDate, 'h:M')
|
{{ timeFormat($lock.currentKeyInfo.startDate, 'h:M') }}~{{
|
||||||
}}
|
timeFormat($lock.currentKeyInfo.endDate, 'h:M')
|
||||||
|
}}</view
|
||||||
|
>
|
||||||
|
<up-icon name="arrow-right"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" style="margin-top: 20rpx">
|
<view class="item" style="margin-top: 20rpx">
|
||||||
<view class="item-title">接收者</view>
|
<view class="item-title">接收者</view>
|
||||||
<view class="item-content">{{ currentKeyInfo.username }}</view>
|
<view class="item-content">{{ $lock.currentKeyInfo.username }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" style="margin-top: 2rpx">
|
<view class="item" style="margin-top: 2rpx">
|
||||||
<view class="item-title">发送人</view>
|
<view class="item-title">发送人</view>
|
||||||
<view class="item-content">{{ currentKeyInfo.senderUsername }}</view>
|
<view class="item-content">{{ $lock.currentKeyInfo.senderUsername }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" style="margin-top: 2rpx">
|
<view class="item" style="margin-top: 2rpx">
|
||||||
<view class="item-title">发送时间</view>
|
<view class="item-title">发送时间</view>
|
||||||
<view class="item-content">{{ timeFormat(currentKeyInfo.sendDate, 'yyyy-mm-dd h:M') }}</view>
|
<view class="item-content">{{
|
||||||
|
timeFormat($lock.currentKeyInfo.sendDate, 'yyyy-mm-dd h:M')
|
||||||
|
}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="item !py-2" style="margin-top: 20rpx" v-if="$lock.currentKeyInfo.keyRight === 1">
|
||||||
|
<view class="item-title">仅管理自己创建的用户</view>
|
||||||
|
<switch
|
||||||
|
:checked="$lock.currentKeyInfo.isOnlyManageSelf"
|
||||||
|
class="transform-scale-90"
|
||||||
|
@click="changeManageSelf"
|
||||||
|
:disabled="true"
|
||||||
|
color="#002ce5"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="item" style="margin-top: 20rpx" @click="toRecordList">
|
<view class="item" style="margin-top: 20rpx" @click="toRecordList">
|
||||||
<view class="item-title">操作记录</view>
|
<view class="item-title">操作记录</view>
|
||||||
@ -65,116 +105,228 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</up-modal>
|
</up-modal>
|
||||||
|
<ModalInput
|
||||||
|
ref="modalInput"
|
||||||
|
title="请输入姓名"
|
||||||
|
:autoClose="false"
|
||||||
|
placeholder="请输入姓名"
|
||||||
|
:value="$lock.currentKeyInfo.keyName"
|
||||||
|
@confirm="changeName"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
import { mapActions, mapState } from 'pinia'
|
|
||||||
import { timeFormat } from 'uview-plus'
|
import { timeFormat } from 'uview-plus'
|
||||||
|
import { ref } from 'vue'
|
||||||
import { useLockStore } from '@/stores/lock'
|
import { useLockStore } from '@/stores/lock'
|
||||||
import { deleteKeyRequest } from '@/api/key'
|
import {
|
||||||
|
deleteKeyRequest,
|
||||||
|
getKeyRequest,
|
||||||
|
updateKeyDateRequest,
|
||||||
|
updateKeyNameRequest
|
||||||
|
} from '@/api/key'
|
||||||
import { useBasicStore } from '@/stores/basic'
|
import { useBasicStore } from '@/stores/basic'
|
||||||
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||||
|
|
||||||
export default {
|
const $lock = useLockStore()
|
||||||
data() {
|
const $basic = useBasicStore()
|
||||||
return {
|
const $bluetooth = useBluetoothStore()
|
||||||
showModal: false,
|
|
||||||
checked: false
|
const showModal = ref(false)
|
||||||
}
|
const checked = ref(false)
|
||||||
},
|
|
||||||
computed: {
|
const modalInput = ref(null)
|
||||||
...mapState(useLockStore, ['currentKeyInfo', 'keySearch'])
|
|
||||||
},
|
const pending = ref(false)
|
||||||
methods: {
|
|
||||||
timeFormat,
|
const changeManageSelf = async () => {
|
||||||
...mapActions(useLockStore, [
|
if (pending.value) return
|
||||||
'updateKeySearch',
|
pending.value = true
|
||||||
'getKeyList',
|
uni.showLoading({
|
||||||
'convertWeekDaysToChineseString'
|
title: '更新中'
|
||||||
]),
|
})
|
||||||
...mapActions(useBasicStore, ['backAndToast', 'routeJump']),
|
const { code, message } = await updateKeyDateRequest({
|
||||||
async toRecordList() {
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
this.routeJump({
|
keyId: $lock.currentKeyInfo.keyId,
|
||||||
name: 'typeRecordList',
|
keyType: $lock.currentKeyInfo.keyType,
|
||||||
params: {
|
startDate: $lock.currentKeyInfo.startDate,
|
||||||
name: this.currentKeyInfo.keyName,
|
endDate: $lock.currentKeyInfo.endDate,
|
||||||
key: 'keyId',
|
isOnlyManageSelf: $lock.currentKeyInfo.isOnlyManageSelf === 1 ? 0 : 1
|
||||||
id: this.currentKeyInfo.keyId
|
})
|
||||||
}
|
pending.value = false
|
||||||
})
|
uni.hideLoading()
|
||||||
|
if (code === 0) {
|
||||||
|
$lock.updateCurrentKeyInfo({
|
||||||
|
...$lock.currentKeyInfo,
|
||||||
|
isOnlyManageSelf: $lock.currentKeyInfo.isOnlyManageSelf === 1 ? 0 : 1
|
||||||
|
})
|
||||||
|
$lock.updateKeySearch({
|
||||||
|
...$lock.keySearch,
|
||||||
|
pageNo: 1
|
||||||
|
})
|
||||||
|
$lock.getKeyList($lock.keySearch)
|
||||||
|
uni.showToast({
|
||||||
|
title: '更新成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateTime = () => {
|
||||||
|
if ($lock.currentKeyInfo.keyType === 3) return
|
||||||
|
$basic.routeJump({
|
||||||
|
name:
|
||||||
|
$lock.currentKeyInfo.keyType === 1 || $lock.currentKeyInfo.keyType === 2
|
||||||
|
? 'temporaryDate'
|
||||||
|
: 'cycleDate',
|
||||||
|
params: {
|
||||||
|
info: JSON.stringify({ ...$lock.currentKeyInfo, type: 'key' })
|
||||||
},
|
},
|
||||||
cancelModal() {
|
events: {
|
||||||
this.showModal = false
|
refresh() {
|
||||||
this.checked = false
|
$lock.updateKeySearch({
|
||||||
},
|
...$lock.keySearch,
|
||||||
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
|
pageNo: 1
|
||||||
})
|
})
|
||||||
that.getKeyList(that.keySearch)
|
$lock.getKeyList($lock.keySearch)
|
||||||
uni.hideLoading()
|
getKeyRequest({
|
||||||
that.backAndToast('删除成功')
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
} else {
|
keyId: $lock.currentKeyInfo.keyId
|
||||||
uni.hideLoading()
|
}).then(res => {
|
||||||
uni.showToast({
|
$lock.updateCurrentKeyInfo(res.data)
|
||||||
title: 'message',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
|
||||||
async deleteKey() {
|
|
||||||
const that = this
|
|
||||||
if (that.currentKeyInfo.keyRight === 1) {
|
|
||||||
that.showModal = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
uni.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定要删除该钥匙',
|
|
||||||
async success(res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
uni.showLoading({
|
|
||||||
title: '删除中',
|
|
||||||
mask: true
|
|
||||||
})
|
|
||||||
const { code: requestCode, message } = await deleteKeyRequest({
|
|
||||||
keyId: that.currentKeyInfo.keyId
|
|
||||||
})
|
|
||||||
if (requestCode === 0) {
|
|
||||||
uni.hideLoading()
|
|
||||||
that.updateKeySearch({
|
|
||||||
...that.keySearch,
|
|
||||||
pageNo: 1
|
|
||||||
})
|
|
||||||
await that.getKeyList(that.keySearch)
|
|
||||||
that.backAndToast('删除成功')
|
|
||||||
} else {
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: message,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeName = async name => {
|
||||||
|
if (!name) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请输入姓名',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
if (pending.value) return
|
||||||
|
pending.value = true
|
||||||
|
const { code, message } = await updateKeyNameRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
keyId: $lock.currentKeyInfo.keyId,
|
||||||
|
keyNameForAdmin: name
|
||||||
|
})
|
||||||
|
pending.value = false
|
||||||
|
if (code === 0) {
|
||||||
|
modalInput.value.close()
|
||||||
|
$lock.updateKeySearch({
|
||||||
|
...$lock.keySearch,
|
||||||
|
pageNo: 1
|
||||||
|
})
|
||||||
|
$lock.getKeyList($lock.keySearch)
|
||||||
|
$lock.updateCurrentKeyInfo({
|
||||||
|
...$lock.currentKeyInfo,
|
||||||
|
keyName: name
|
||||||
|
})
|
||||||
|
uni.showToast({
|
||||||
|
title: '更新成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const toRecordList = () => {
|
||||||
|
$basic.routeJump({
|
||||||
|
name: 'typeRecordList',
|
||||||
|
params: {
|
||||||
|
name: $lock.currentKeyInfo.keyName,
|
||||||
|
key: 'keyId',
|
||||||
|
id: $lock.currentKeyInfo.keyId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const cancelModal = () => {
|
||||||
|
showModal.value = false
|
||||||
|
checked.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeRadio = () => {
|
||||||
|
checked.value = !checked.value
|
||||||
|
}
|
||||||
|
|
||||||
|
const confirmModal = async () => {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '删除中',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
const { code } = await deleteKeyRequest({
|
||||||
|
keyId: $lock.currentKeyInfo.keyId,
|
||||||
|
includeUnderlings: checked.value ? 1 : 0
|
||||||
|
})
|
||||||
|
showModal.value = false
|
||||||
|
if (code === 0) {
|
||||||
|
$lock.updateKeySearch({
|
||||||
|
...$lock.keySearch,
|
||||||
|
pageNo: 1
|
||||||
|
})
|
||||||
|
$lock.getKeyList($lock.keySearch)
|
||||||
|
uni.hideLoading()
|
||||||
|
$basic.backAndToast('删除成功')
|
||||||
|
} else {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: 'message',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteKey = async () => {
|
||||||
|
if ($lock.currentKeyInfo.keyRight === 1) {
|
||||||
|
showModal.value = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除该钥匙',
|
||||||
|
async success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '删除中',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
const { code: requestCode, message } = await deleteKeyRequest({
|
||||||
|
keyId: $lock.currentKeyInfo.keyId
|
||||||
|
})
|
||||||
|
if (requestCode === 0) {
|
||||||
|
uni.hideLoading()
|
||||||
|
$lock.updateKeySearch({
|
||||||
|
...$lock.keySearch,
|
||||||
|
pageNo: 1
|
||||||
|
})
|
||||||
|
await $lock.getKeyList($lock.keySearch)
|
||||||
|
$lock.backAndToast('删除成功')
|
||||||
|
} else {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -78,6 +78,7 @@
|
|||||||
import { updateRemoteRequest } from '@/api/remote'
|
import { updateRemoteRequest } from '@/api/remote'
|
||||||
import { updateFaceRequest } from '@/api/face'
|
import { updateFaceRequest } from '@/api/face'
|
||||||
import { updatePalmVeinRequest } from '@/api/palmVein'
|
import { updatePalmVeinRequest } from '@/api/palmVein'
|
||||||
|
import { updateKeyDateRequest } from '@/api/key'
|
||||||
|
|
||||||
const instance = getCurrentInstance().proxy
|
const instance = getCurrentInstance().proxy
|
||||||
const eventChannel = instance.getOpenerEventChannel()
|
const eventChannel = instance.getOpenerEventChannel()
|
||||||
@ -108,12 +109,12 @@
|
|||||||
const data = JSON.parse(options.info)
|
const data = JSON.parse(options.info)
|
||||||
if (data.startDate) {
|
if (data.startDate) {
|
||||||
startDate.value = data.startDate
|
startDate.value = data.startDate
|
||||||
endDate.value = data.endDate
|
endDate.value = data.endDate === 0 ? data.startDate + 24 * 60 * 60 * 1000 : data.endDate
|
||||||
info.value = data
|
info.value = data
|
||||||
defaultStartDate.value = data.startDate
|
defaultStartDate.value = data.startDate
|
||||||
defaultEndDate.value = data.endDate
|
defaultEndDate.value =
|
||||||
|
data.endDate === 0 ? data.startDate + 24 * 60 * 60 * 1000 : data.endDate
|
||||||
}
|
}
|
||||||
console.log(info.value)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -139,68 +140,14 @@
|
|||||||
title: '更新中'
|
title: '更新中'
|
||||||
})
|
})
|
||||||
|
|
||||||
const { code } = await $bluetooth.registerAuthentication({
|
if (info.value.type === 'key') {
|
||||||
type: info.value.type,
|
const data = await updateKeyDateRequest({
|
||||||
operate: 1,
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
isAdmin: info.value.type,
|
keyId: info.value.keyId,
|
||||||
isForce: info.value.isForce,
|
keyType: 2,
|
||||||
isRound: 0,
|
startDate: startDate.value,
|
||||||
weekDays: [],
|
endDate: endDate.value
|
||||||
no: info.value[`${info.value.type}Number`],
|
})
|
||||||
userCountLimit: 0xffff,
|
|
||||||
keyId: $bluetooth.keyId.toString(),
|
|
||||||
uid: $user.userInfo.uid.toString(),
|
|
||||||
startDate: startDate.value,
|
|
||||||
endDate: endDate.value
|
|
||||||
})
|
|
||||||
if (code === 0) {
|
|
||||||
let data
|
|
||||||
if (info.value.type === 'card') {
|
|
||||||
data = await updateCardRequest({
|
|
||||||
lockId: $bluetooth.currentLockInfo.lockId,
|
|
||||||
cardId: info.value.cardId,
|
|
||||||
cardType: 2,
|
|
||||||
startDate: startDate.value,
|
|
||||||
endDate: endDate.value,
|
|
||||||
changeType: 1
|
|
||||||
})
|
|
||||||
} else if (info.value.type === 'fingerprint') {
|
|
||||||
data = await updateFingerprintRequest({
|
|
||||||
lockId: $bluetooth.currentLockInfo.lockId,
|
|
||||||
fingerprintId: info.value.fingerprintId,
|
|
||||||
fingerprintType: 2,
|
|
||||||
startDate: startDate.value,
|
|
||||||
endDate: endDate.value,
|
|
||||||
changeType: 1
|
|
||||||
})
|
|
||||||
} else if (info.value.type === 'remote') {
|
|
||||||
data = await updateRemoteRequest({
|
|
||||||
lockId: $bluetooth.currentLockInfo.lockId,
|
|
||||||
remoteId: info.value.remoteId,
|
|
||||||
remoteType: 2,
|
|
||||||
startDate: startDate.value,
|
|
||||||
endDate: endDate.value,
|
|
||||||
changeType: 1
|
|
||||||
})
|
|
||||||
} else if (info.value.type === 'face') {
|
|
||||||
data = await updateFaceRequest({
|
|
||||||
lockId: $bluetooth.currentLockInfo.lockId,
|
|
||||||
faceId: info.value.faceId,
|
|
||||||
faceType: 2,
|
|
||||||
startDate: startDate.value,
|
|
||||||
endDate: endDate.value,
|
|
||||||
changeType: 1
|
|
||||||
})
|
|
||||||
} else if (info.value.type === 'palmVein') {
|
|
||||||
data = await updatePalmVeinRequest({
|
|
||||||
lockId: $bluetooth.currentLockInfo.lockId,
|
|
||||||
palmVeinId: info.value.palmVeinId,
|
|
||||||
palmVeinType: 2,
|
|
||||||
startDate: startDate.value,
|
|
||||||
endDate: endDate.value,
|
|
||||||
changeType: 1
|
|
||||||
})
|
|
||||||
}
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
pending.value = false
|
pending.value = false
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
@ -217,12 +164,91 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pending.value = false
|
const { code } = await $bluetooth.registerAuthentication({
|
||||||
uni.hideLoading()
|
type: info.value.type,
|
||||||
uni.showToast({
|
operate: 1,
|
||||||
title: '操作失败,请重试',
|
isAdmin: info.value.type,
|
||||||
icon: 'none'
|
isForce: info.value.isForce,
|
||||||
|
isRound: 0,
|
||||||
|
weekDays: [],
|
||||||
|
no: info.value[`${info.value.type}Number`],
|
||||||
|
userCountLimit: 0xffff,
|
||||||
|
keyId: $bluetooth.keyId.toString(),
|
||||||
|
uid: $user.userInfo.uid.toString(),
|
||||||
|
startDate: startDate.value,
|
||||||
|
endDate: endDate.value
|
||||||
})
|
})
|
||||||
|
if (code === 0) {
|
||||||
|
let data
|
||||||
|
if (info.value.type === 'card') {
|
||||||
|
data = await updateCardRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
cardId: info.value.cardId,
|
||||||
|
cardType: 2,
|
||||||
|
startDate: startDate.value,
|
||||||
|
endDate: endDate.value,
|
||||||
|
changeType: 1
|
||||||
|
})
|
||||||
|
} else if (info.value.type === 'fingerprint') {
|
||||||
|
data = await updateFingerprintRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
fingerprintId: info.value.fingerprintId,
|
||||||
|
fingerprintType: 2,
|
||||||
|
startDate: startDate.value,
|
||||||
|
endDate: endDate.value,
|
||||||
|
changeType: 1
|
||||||
|
})
|
||||||
|
} else if (info.value.type === 'remote') {
|
||||||
|
data = await updateRemoteRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
remoteId: info.value.remoteId,
|
||||||
|
remoteType: 2,
|
||||||
|
startDate: startDate.value,
|
||||||
|
endDate: endDate.value,
|
||||||
|
changeType: 1
|
||||||
|
})
|
||||||
|
} else if (info.value.type === 'face') {
|
||||||
|
data = await updateFaceRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
faceId: info.value.faceId,
|
||||||
|
faceType: 2,
|
||||||
|
startDate: startDate.value,
|
||||||
|
endDate: endDate.value,
|
||||||
|
changeType: 1
|
||||||
|
})
|
||||||
|
} else if (info.value.type === 'palmVein') {
|
||||||
|
data = await updatePalmVeinRequest({
|
||||||
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
palmVeinId: info.value.palmVeinId,
|
||||||
|
palmVeinType: 2,
|
||||||
|
startDate: startDate.value,
|
||||||
|
endDate: endDate.value,
|
||||||
|
changeType: 1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
uni.hideLoading()
|
||||||
|
pending.value = false
|
||||||
|
if (data.code === 0) {
|
||||||
|
eventChannel.emit('refresh', {})
|
||||||
|
$basic.backAndToast('更新成功')
|
||||||
|
uni.showToast({
|
||||||
|
title: '更新成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: data.message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pending.value = false
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: '操作失败,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user