完成指纹、遥控、人脸、掌静脉信息修改功能
This commit is contained in:
parent
8b8b3ccf0b
commit
fee5aa62e3
18
api/face.js
18
api/face.js
@ -46,3 +46,21 @@ export function addFaceRequest(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新人脸
|
||||
export function updateFaceRequest(data) {
|
||||
return request({
|
||||
url: '/face/update',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 人脸详情
|
||||
export function getFaceRequest(data) {
|
||||
return request({
|
||||
url: '/face/detail',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
@ -37,3 +37,21 @@ export function addFingerprintRequest(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新指纹
|
||||
export function updateFingerprintRequest(data) {
|
||||
return request({
|
||||
url: '/fingerprint/changePeriod',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 指纹详情
|
||||
export function getFingerprintRequest(data) {
|
||||
return request({
|
||||
url: '/fingerprint/detail',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
@ -46,3 +46,21 @@ export function addPalmVeinRequest(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新掌纹
|
||||
export function updatePalmVeinRequest(data) {
|
||||
return request({
|
||||
url: '/palmVein/update',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 掌纹详情
|
||||
export function getPalmVeinRequest(data) {
|
||||
return request({
|
||||
url: '/palmVein/detail',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
@ -46,3 +46,21 @@ export function addRemoteRequest(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新远程
|
||||
export function updateRemoteRequest(data) {
|
||||
return request({
|
||||
url: '/remote/update',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 远程详情
|
||||
export function getRemoteRequest(data) {
|
||||
return request({
|
||||
url: '/remote/detail',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
@ -53,13 +53,15 @@
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
startDate: params.value.startDate,
|
||||
endDate: params.value.endDate,
|
||||
startTime: params.value.startDate,
|
||||
endTime: params.value.endDate,
|
||||
faceName: params.value.faceName,
|
||||
faceNumber: String(data.faceNumber),
|
||||
faceUserNo: String(data.faceNumber),
|
||||
faceType: params.value.faceType,
|
||||
addType: 1,
|
||||
weekDay: params.value.weekDays,
|
||||
fingerRight: params.value.isAdmin,
|
||||
faceRight: params.value.isAdmin,
|
||||
isCoerced: params.value.isForce === 1 ? 2 : 1
|
||||
})
|
||||
if (code === 0) {
|
||||
|
||||
@ -58,6 +58,8 @@
|
||||
startDate: params.startDate,
|
||||
endDate: params.endDate,
|
||||
weekDay: params.weekDays,
|
||||
startTime: params.startDate,
|
||||
endTime: params.endDate,
|
||||
fingerprintName: params.fingerprintName,
|
||||
fingerprintNumber: String(data.fingerprintNumber),
|
||||
fingerprintUserNo: String(data.fingerprintNumber),
|
||||
|
||||
@ -51,6 +51,8 @@
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
startDate: params.startDate,
|
||||
endDate: params.endDate,
|
||||
startTime: params.startDate,
|
||||
endTime: params.endDate,
|
||||
palmVeinName: params.palmVeinName,
|
||||
palmVeinNumber: String(data.palmVeinNumber),
|
||||
palmVeinUserNo: String(data.palmVeinNumber),
|
||||
|
||||
@ -55,6 +55,8 @@
|
||||
startDate: params.startDate,
|
||||
endDate: params.endDate,
|
||||
remoteName: params.remoteName,
|
||||
startTime: params.startDate,
|
||||
endTime: params.endDate,
|
||||
remoteNumber: String(data.remoteNumber),
|
||||
remoteUserNo: String(data.remoteNumber),
|
||||
remoteType: params.remoteType,
|
||||
|
||||
@ -141,6 +141,10 @@
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { updateFingerprintRequest } from '@/api/fingerprint'
|
||||
import { updateRemoteRequest } from '@/api/remote'
|
||||
import { updatePalmVeinRequest } from '@/api/palmVein'
|
||||
import { updateFaceRequest } from '@/api/face'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
@ -168,6 +172,8 @@
|
||||
const defaultStartDate = ref(0)
|
||||
const defaultEndDate = ref(0)
|
||||
|
||||
const pending = ref(false)
|
||||
|
||||
const list = ['一', '二', '三', '四', '五', '六', '日']
|
||||
|
||||
const canSubmit = computed(() => {
|
||||
@ -184,6 +190,11 @@
|
||||
if (options.info) {
|
||||
const data = JSON.parse(options.info)
|
||||
info.value = data
|
||||
if (info.value.type) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '修改有效期'
|
||||
})
|
||||
}
|
||||
if (data.startDate) {
|
||||
weekDays.value = data.weekDays || data.weekDay
|
||||
startDate.value = data.startDate
|
||||
@ -247,6 +258,10 @@
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (pending.value) {
|
||||
return
|
||||
}
|
||||
pending.value = true
|
||||
uni.showLoading({
|
||||
title: '更新中'
|
||||
})
|
||||
@ -268,19 +283,71 @@
|
||||
endTime: endTimeText.value
|
||||
})
|
||||
if (code === 0) {
|
||||
const { code, message } = 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
|
||||
})
|
||||
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 (code === 0) {
|
||||
if (data.code === 0) {
|
||||
eventChannel.emit('refresh', {})
|
||||
$basic.backAndToast('更新成功')
|
||||
uni.showToast({
|
||||
@ -289,11 +356,12 @@
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
title: data.message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
pending.value = false
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '操作失败,请重试',
|
||||
|
||||
@ -5,30 +5,44 @@
|
||||
<view class="item-title">人脸号</view>
|
||||
<view class="item-content">{{ info.faceNumber }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item" style="margin-top: 2rpx" @click="() => $refs.modalInput.open()">
|
||||
<view class="item-title">姓名</view>
|
||||
<view class="item-content">{{ info.faceName }}</view>
|
||||
<view class="flex items-center">
|
||||
<view class="item-content mr-2">{{ info.faceName }}</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item" style="margin-top: 2rpx" @click="updateTime">
|
||||
<view class="item-title">有效期</view>
|
||||
<view v-if="info.faceType === 1">永久</view>
|
||||
<view v-else-if="info.faceType === 2">
|
||||
<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>
|
||||
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd') }}</view>
|
||||
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd') }}</view>
|
||||
<view class="flex items-center">
|
||||
<view v-if="info.faceType === 1" class="mr-2">永久</view>
|
||||
<view v-else-if="info.faceType === 2" class="mr-2 w-400 text-right">
|
||||
<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 class="item" style="margin-top: 2rpx" v-if="info.faceType === 4">
|
||||
<view class="item" style="margin-top: 2rpx" v-if="info.faceType === 4" @click="updateTime">
|
||||
<view class="item-title">有效日</view>
|
||||
<view class="item-content">{{ $lock.convertWeekDaysToChineseString(info.weekDay) }}</view>
|
||||
<view class="flex items-center">
|
||||
<view class="item-content mr-2">{{
|
||||
$lock.convertWeekDaysToChineseString(info.weekDay)
|
||||
}}</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx" v-if="info.faceType === 4">
|
||||
<view class="item" style="margin-top: 2rpx" v-if="info.faceType === 4" @click="updateTime">
|
||||
<view class="item-title">有效时间</view>
|
||||
<view class="item-content">
|
||||
{{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
|
||||
<view class="flex items-center">
|
||||
<view class="item-content mr-2">
|
||||
{{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
|
||||
</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 20rpx">
|
||||
@ -39,11 +53,30 @@
|
||||
<view class="item-title">添加时间</view>
|
||||
<view class="item-content">{{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
|
||||
<view class="item !py-2" style="margin-top: 20rpx">
|
||||
<view class="item-title">是否为管理员</view>
|
||||
<switch
|
||||
@click="disabled"
|
||||
:checked="info.faceRight"
|
||||
class="transform-scale-90"
|
||||
:disabled="true"
|
||||
color="#002ce5"
|
||||
/>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 20rpx" @click="toRecordList">
|
||||
<view class="item-title">操作记录</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
<view class="button" @click="deletePassword">删除</view>
|
||||
<ModalInput
|
||||
ref="modalInput"
|
||||
title="请输入姓名"
|
||||
:autoClose="false"
|
||||
placeholder="请输入姓名"
|
||||
:value="info.faceName"
|
||||
@confirm="changeName"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@ -54,15 +87,83 @@
|
||||
import { timeFormat } from 'uview-plus'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { getFaceRequest, updateFaceRequest } from '@/api/face'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
|
||||
const $lock = useLockStore()
|
||||
const $basic = useBasicStore()
|
||||
const $bluetooth = useBluetoothStore()
|
||||
|
||||
const info = ref(null)
|
||||
|
||||
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 updateFaceRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
faceId: info.value.faceId,
|
||||
faceType: info.value.faceType,
|
||||
faceName: name,
|
||||
changeType: 1
|
||||
})
|
||||
pending.value = false
|
||||
if (code === 0) {
|
||||
modalInput.value.close()
|
||||
eventChannel.emit('refresherList', {})
|
||||
info.value.faceName = name
|
||||
uni.showToast({
|
||||
title: '更新成功',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const updateTime = () => {
|
||||
$basic.routeJump({
|
||||
name: info.value.faceType === 1 || info.value.faceType === 2 ? 'temporaryDate' : 'cycleDate',
|
||||
params: {
|
||||
info: JSON.stringify({ ...info.value, type: 'face' })
|
||||
},
|
||||
events: {
|
||||
refresh() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
getFaceRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
faceId: info.value.faceId
|
||||
}).then(res => {
|
||||
info.value = res.data
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const disabled = () => {
|
||||
uni.showToast({
|
||||
title: '暂不支持修改',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
onLoad(options => {
|
||||
if (options.info) {
|
||||
info.value = JSON.parse(options.info)
|
||||
|
||||
@ -354,6 +354,12 @@
|
||||
events: {
|
||||
delete() {
|
||||
deleteItem({ ...item, back: true })
|
||||
},
|
||||
refresherList() {
|
||||
pageNo.value = 1
|
||||
getList({
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -5,30 +5,54 @@
|
||||
<view class="item-title">指纹号</view>
|
||||
<view class="item-content">{{ info.fingerprintNumber }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item" style="margin-top: 2rpx" @click="() => $refs.modalInput.open()">
|
||||
<view class="item-title">姓名</view>
|
||||
<view class="item-content">{{ info.fingerprintName }}</view>
|
||||
<view class="flex items-center">
|
||||
<view class="item-content mr-2">{{ info.fingerprintName }}</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item" style="margin-top: 2rpx" @click="updateTime">
|
||||
<view class="item-title">有效期</view>
|
||||
<view v-if="info.fingerprintType === 1">永久</view>
|
||||
<view v-else-if="info.fingerprintType === 2">
|
||||
<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>
|
||||
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd') }}</view>
|
||||
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd') }}</view>
|
||||
<view class="flex items-center">
|
||||
<view v-if="info.fingerprintType === 1" class="mr-2">永久</view>
|
||||
<view v-else-if="info.fingerprintType === 2" class="mr-2 w-400 text-right">
|
||||
<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 class="item" style="margin-top: 2rpx" v-if="info.fingerprintType === 4">
|
||||
<view
|
||||
class="item"
|
||||
style="margin-top: 2rpx"
|
||||
v-if="info.fingerprintType === 4"
|
||||
@click="updateTime"
|
||||
>
|
||||
<view class="item-title">有效日</view>
|
||||
<view class="item-content">{{ $lock.convertWeekDaysToChineseString(info.weekDay) }}</view>
|
||||
<view class="flex items-center">
|
||||
<view class="item-content mr-2">{{
|
||||
$lock.convertWeekDaysToChineseString(info.weekDay)
|
||||
}}</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx" v-if="info.fingerprintType === 4">
|
||||
<view
|
||||
class="item"
|
||||
style="margin-top: 2rpx"
|
||||
v-if="info.fingerprintType === 4"
|
||||
@click="updateTime"
|
||||
>
|
||||
<view class="item-title">有效时间</view>
|
||||
<view class="item-content">
|
||||
{{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
|
||||
<view class="flex items-center">
|
||||
<view class="item-content mr-2">
|
||||
{{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
|
||||
</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 20rpx">
|
||||
@ -39,11 +63,40 @@
|
||||
<view class="item-title">添加时间</view>
|
||||
<view class="item-content">{{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
|
||||
<view class="item !py-2" style="margin-top: 20rpx">
|
||||
<view class="item-title">胁迫指纹</view>
|
||||
<switch
|
||||
:checked="info.isCoerced === 2"
|
||||
class="transform-scale-90"
|
||||
@click="changeCoerced"
|
||||
:disabled="true"
|
||||
color="#002ce5"
|
||||
/>
|
||||
</view>
|
||||
<view class="item !py-2" style="margin-top: 2rpx">
|
||||
<view class="item-title">是否为管理员</view>
|
||||
<switch
|
||||
@click="disabled"
|
||||
:checked="info.fingerRight"
|
||||
class="transform-scale-90"
|
||||
:disabled="true"
|
||||
color="#002ce5"
|
||||
/>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 20rpx" @click="toRecordList">
|
||||
<view class="item-title">操作记录</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
<view class="button" @click="deletePassword">删除</view>
|
||||
<ModalInput
|
||||
ref="modalInput"
|
||||
title="请输入姓名"
|
||||
:autoClose="false"
|
||||
placeholder="请输入姓名"
|
||||
:value="info.fingerprintName"
|
||||
@confirm="changeName"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@ -54,6 +107,9 @@
|
||||
import { timeFormat } from 'uview-plus'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { getFingerprintRequest, updateFingerprintRequest } from '@/api/fingerprint'
|
||||
|
||||
const $basic = useBasicStore()
|
||||
|
||||
@ -61,9 +117,134 @@
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
|
||||
const $lock = useLockStore()
|
||||
const $user = useUserStore()
|
||||
const $bluetooth = useBluetoothStore()
|
||||
|
||||
const info = ref(null)
|
||||
|
||||
const modalInput = ref(null)
|
||||
|
||||
const pending = ref(false)
|
||||
|
||||
const disabled = () => {
|
||||
uni.showToast({
|
||||
title: '暂不支持修改',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
const changeCoerced = async () => {
|
||||
if (pending.value) return
|
||||
pending.value = true
|
||||
uni.showLoading({
|
||||
title: '更新中'
|
||||
})
|
||||
const { code } = await $bluetooth.registerAuthentication({
|
||||
type: 'fingerprint',
|
||||
operate: 1,
|
||||
isAdmin: info.value.isAdmin,
|
||||
isForce: info.value.isCoerced === 2 ? 0 : 1,
|
||||
isRound: info.value.fingerprintType === 4 ? 1 : 0,
|
||||
weekDays: info.value.weekDay,
|
||||
no: info.value.fingerprintNumber,
|
||||
userCountLimit: 0xffff,
|
||||
keyId: $bluetooth.keyId.toString(),
|
||||
uid: $user.userInfo.uid.toString(),
|
||||
startDate: info.value.startDate,
|
||||
endDate: info.value.endDate,
|
||||
startTime:
|
||||
info.value.fingerprintType === 4 ? timeFormat(info.value.startDate, 'h:M') : '00:00',
|
||||
endTime: info.value.fingerprintType === 4 ? timeFormat(info.value.endDate, 'h:M') : '00:00'
|
||||
})
|
||||
if (code === 0) {
|
||||
const { code, message } = await updateFingerprintRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
fingerprintId: info.value.fingerprintId,
|
||||
fingerprintType: info.value.fingerprintType,
|
||||
isCoerced: info.value.isCoerced === 2 ? 1 : 2,
|
||||
changeType: 1
|
||||
})
|
||||
pending.value = false
|
||||
uni.hideLoading()
|
||||
if (code === 0) {
|
||||
info.value.isCoerced = info.value.isCoerced === 2 ? 1 : 2
|
||||
eventChannel.emit('refresherList', {})
|
||||
uni.showToast({
|
||||
title: '更新成功',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
pending.value = false
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '操作失败,请重试',
|
||||
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 updateFingerprintRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
fingerprintId: info.value.fingerprintId,
|
||||
fingerprintType: info.value.fingerprintType,
|
||||
fingerprintName: name,
|
||||
changeType: 1
|
||||
})
|
||||
pending.value = false
|
||||
if (code === 0) {
|
||||
modalInput.value.close()
|
||||
eventChannel.emit('refresherList', {})
|
||||
info.value.fingerprintName = name
|
||||
uni.showToast({
|
||||
title: '更新成功',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const updateTime = () => {
|
||||
$basic.routeJump({
|
||||
name:
|
||||
info.value.fingerprintType === 1 || info.value.fingerprintType === 2
|
||||
? 'temporaryDate'
|
||||
: 'cycleDate',
|
||||
params: {
|
||||
info: JSON.stringify({ ...info.value, type: 'fingerprint' })
|
||||
},
|
||||
events: {
|
||||
refresh() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
getFingerprintRequest({
|
||||
fingerprintId: info.value.fingerprintId
|
||||
}).then(res => {
|
||||
info.value = res.data
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const toRecordList = async () => {
|
||||
$basic.routeJump({
|
||||
name: 'typeRecordList',
|
||||
|
||||
@ -353,6 +353,12 @@
|
||||
events: {
|
||||
delete() {
|
||||
deleteItem({ ...item, back: true })
|
||||
},
|
||||
refresherList() {
|
||||
pageNo.value = 1
|
||||
getList({
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -5,30 +5,54 @@
|
||||
<view class="item-title">掌静脉号</view>
|
||||
<view class="item-content">{{ info.palmVeinNumber }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item" style="margin-top: 2rpx" @click="() => $refs.modalInput.open()">
|
||||
<view class="item-title">姓名</view>
|
||||
<view class="item-content">{{ info.palmVeinName }}</view>
|
||||
<view class="flex items-center">
|
||||
<view class="item-content mr-2">{{ info.palmVeinName }}</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item" style="margin-top: 2rpx" @click="updateTime">
|
||||
<view class="item-title">有效期</view>
|
||||
<view v-if="info.palmVeinType === 1">永久</view>
|
||||
<view v-else-if="info.palmVeinType === 2">
|
||||
<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>
|
||||
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd') }}</view>
|
||||
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd') }}</view>
|
||||
<view class="flex items-center">
|
||||
<view v-if="info.palmVeinType === 1" class="mr-2">永久</view>
|
||||
<view v-else-if="info.palmVeinType === 2" class="mr-2 w-400 text-right">
|
||||
<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 class="item" style="margin-top: 2rpx" v-if="info.palmVeinType === 4">
|
||||
<view
|
||||
class="item"
|
||||
style="margin-top: 2rpx"
|
||||
v-if="info.palmVeinType === 4"
|
||||
@click="updateTime"
|
||||
>
|
||||
<view class="item-title">有效日</view>
|
||||
<view class="item-content">{{ $lock.convertWeekDaysToChineseString(info.weekDay) }}</view>
|
||||
<view class="flex items-center">
|
||||
<view class="item-content mr-2">{{
|
||||
$lock.convertWeekDaysToChineseString(info.weekDay)
|
||||
}}</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx" v-if="info.palmVeinType === 4">
|
||||
<view
|
||||
class="item"
|
||||
style="margin-top: 2rpx"
|
||||
v-if="info.palmVeinType === 4"
|
||||
@click="updateTime"
|
||||
>
|
||||
<view class="item-title">有效时间</view>
|
||||
<view class="item-content">
|
||||
{{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
|
||||
<view class="flex items-center">
|
||||
<view class="item-content mr-2">
|
||||
{{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
|
||||
</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 20rpx">
|
||||
@ -39,11 +63,40 @@
|
||||
<view class="item-title">添加时间</view>
|
||||
<view class="item-content">{{ timeFormat(info.createDate, 'yyyy-mm-dd h:M') }}</view>
|
||||
</view>
|
||||
|
||||
<view class="item !py-2" style="margin-top: 20rpx">
|
||||
<view class="item-title">胁迫掌静脉</view>
|
||||
<switch
|
||||
:checked="info.isCoerced === 2"
|
||||
class="transform-scale-90"
|
||||
@click="changeCoerced"
|
||||
:disabled="true"
|
||||
color="#002ce5"
|
||||
/>
|
||||
</view>
|
||||
<view class="item !py-2" style="margin-top: 2rpx">
|
||||
<view class="item-title">是否为管理员</view>
|
||||
<switch
|
||||
@click="disabled"
|
||||
:checked="info.palmVeinRight"
|
||||
class="transform-scale-90"
|
||||
:disabled="true"
|
||||
color="#002ce5"
|
||||
/>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 20rpx" @click="toRecordList">
|
||||
<view class="item-title">操作记录</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
<view class="button" @click="deletePassword">删除</view>
|
||||
<ModalInput
|
||||
ref="modalInput"
|
||||
title="请输入姓名"
|
||||
:autoClose="false"
|
||||
placeholder="请输入姓名"
|
||||
:value="info.palmVeinName"
|
||||
@confirm="changeName"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@ -54,15 +107,142 @@
|
||||
import { timeFormat } from 'uview-plus'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { getPalmVeinRequest, updatePalmVeinRequest } from '@/api/palmVein'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
|
||||
const $lock = useLockStore()
|
||||
const $basic = useBasicStore()
|
||||
const $user = useUserStore()
|
||||
const $bluetooth = useBluetoothStore()
|
||||
|
||||
const info = ref(null)
|
||||
|
||||
const modalInput = ref(null)
|
||||
|
||||
const pending = ref(false)
|
||||
|
||||
const changeCoerced = async () => {
|
||||
if (pending.value) return
|
||||
pending.value = true
|
||||
uni.showLoading({
|
||||
title: '更新中'
|
||||
})
|
||||
const { code } = await $bluetooth.registerAuthentication({
|
||||
type: 'palmVein',
|
||||
operate: 1,
|
||||
isAdmin: info.value.isAdmin,
|
||||
isForce: info.value.isCoerced === 2 ? 0 : 1,
|
||||
isRound: info.value.palmVeinType === 4 ? 1 : 0,
|
||||
weekDays: info.value.weekDay,
|
||||
no: info.value.palmVeinNumber,
|
||||
userCountLimit: 0xffff,
|
||||
keyId: $bluetooth.keyId.toString(),
|
||||
uid: $user.userInfo.uid.toString(),
|
||||
startDate: info.value.startDate,
|
||||
endDate: info.value.endDate,
|
||||
startTime: info.value.palmVeinType === 4 ? timeFormat(info.value.startDate, 'h:M') : '00:00',
|
||||
endTime: info.value.palmVeinType === 4 ? timeFormat(info.value.endDate, 'h:M') : '00:00'
|
||||
})
|
||||
if (code === 0) {
|
||||
const { code, message } = await updatePalmVeinRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
palmVeinId: info.value.palmVeinId,
|
||||
palmVeinType: info.value.palmVeinType,
|
||||
isCoerced: info.value.isCoerced === 2 ? 1 : 2,
|
||||
changeType: 1
|
||||
})
|
||||
pending.value = false
|
||||
uni.hideLoading()
|
||||
if (code === 0) {
|
||||
info.value.isCoerced = info.value.isCoerced === 2 ? 1 : 2
|
||||
eventChannel.emit('refresherList', {})
|
||||
uni.showToast({
|
||||
title: '更新成功',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
pending.value = false
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '操作失败,请重试',
|
||||
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 updatePalmVeinRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
palmVeinId: info.value.palmVeinId,
|
||||
palmVeinType: info.value.palmVeinType,
|
||||
palmVeinName: name,
|
||||
changeType: 1
|
||||
})
|
||||
pending.value = false
|
||||
if (code === 0) {
|
||||
modalInput.value.close()
|
||||
eventChannel.emit('refresherList', {})
|
||||
info.value.palmVeinName = name
|
||||
uni.showToast({
|
||||
title: '更新成功',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const updateTime = () => {
|
||||
$basic.routeJump({
|
||||
name:
|
||||
info.value.palmVeinType === 1 || info.value.palmVeinType === 2
|
||||
? 'temporaryDate'
|
||||
: 'cycleDate',
|
||||
params: {
|
||||
info: JSON.stringify({ ...info.value, type: 'palmVein' })
|
||||
},
|
||||
events: {
|
||||
refresh() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
getPalmVeinRequest({
|
||||
palmVeinId: info.value.palmVeinId
|
||||
}).then(res => {
|
||||
info.value = res.data
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const disabled = () => {
|
||||
uni.showToast({
|
||||
title: '暂不支持修改',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
onLoad(options => {
|
||||
if (options.info) {
|
||||
info.value = JSON.parse(options.info)
|
||||
|
||||
@ -358,6 +358,12 @@
|
||||
events: {
|
||||
delete() {
|
||||
deleteItem({ ...item, back: true })
|
||||
},
|
||||
refresherList() {
|
||||
pageNo.value = 1
|
||||
getList({
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -5,30 +5,44 @@
|
||||
<view class="item-title">遥控号</view>
|
||||
<view class="item-content">{{ info.remoteNumber }}</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item" style="margin-top: 2rpx" @click="() => $refs.modalInput.open()">
|
||||
<view class="item-title">姓名</view>
|
||||
<view class="item-content">{{ info.remoteName }}</view>
|
||||
<view class="flex items-center">
|
||||
<view class="item-content mr-2">{{ info.remoteName }}</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx">
|
||||
<view class="item" style="margin-top: 2rpx" @click="updateTime">
|
||||
<view class="item-title">有效期</view>
|
||||
<view v-if="info.remoteType === 1">永久</view>
|
||||
<view v-else-if="info.remoteType === 2">
|
||||
<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>
|
||||
<view class="item-content">{{ timeFormat(info.startDate, 'yyyy-mm-dd') }}</view>
|
||||
<view class="item-content">{{ timeFormat(info.endDate, 'yyyy-mm-dd') }}</view>
|
||||
<view class="flex items-center">
|
||||
<view v-if="info.remoteType === 1" class="mr-2">永久</view>
|
||||
<view v-else-if="info.remoteType === 2" class="mr-2 w-400 text-right">
|
||||
<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 class="item" style="margin-top: 2rpx" v-if="info.remoteType === 4">
|
||||
<view class="item" style="margin-top: 2rpx" v-if="info.remoteType === 4" @click="updateTime">
|
||||
<view class="item-title">有效日</view>
|
||||
<view class="item-content">{{ $lock.convertWeekDaysToChineseString(info.weekDay) }}</view>
|
||||
<view class="flex items-center">
|
||||
<view class="item-content mr-2">{{
|
||||
$lock.convertWeekDaysToChineseString(info.weekDay)
|
||||
}}</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 2rpx" v-if="info.remoteType === 4">
|
||||
<view class="item" style="margin-top: 2rpx" v-if="info.remoteType === 4" @click="updateTime">
|
||||
<view class="item-title">有效时间</view>
|
||||
<view class="item-content">
|
||||
{{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
|
||||
<view class="flex items-center">
|
||||
<view class="item-content mr-2">
|
||||
{{ timeFormat(info.startDate, 'h:M') }} - {{ timeFormat(info.endDate, 'h:M') }}
|
||||
</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" style="margin-top: 20rpx">
|
||||
@ -44,6 +58,14 @@
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
<view class="button" @click="deletePassword">删除</view>
|
||||
<ModalInput
|
||||
ref="modalInput"
|
||||
title="请输入姓名"
|
||||
:autoClose="false"
|
||||
placeholder="请输入姓名"
|
||||
:value="info.remoteName"
|
||||
@confirm="changeName"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@ -54,15 +76,76 @@
|
||||
import { timeFormat } from 'uview-plus'
|
||||
import { useLockStore } from '@/stores/lock'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||
import { getRemoteRequest, updateRemoteRequest } from '@/api/remote'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
|
||||
const $lock = useLockStore()
|
||||
const $basic = useBasicStore()
|
||||
const $bluetooth = useBluetoothStore()
|
||||
|
||||
const info = ref(null)
|
||||
|
||||
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 updateRemoteRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
remoteId: info.value.remoteId,
|
||||
remoteType: info.value.remoteType,
|
||||
remoteName: name,
|
||||
changeType: 1
|
||||
})
|
||||
pending.value = false
|
||||
if (code === 0) {
|
||||
modalInput.value.close()
|
||||
eventChannel.emit('refresherList', {})
|
||||
info.value.remoteName = name
|
||||
uni.showToast({
|
||||
title: '更新成功',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const updateTime = () => {
|
||||
$basic.routeJump({
|
||||
name:
|
||||
info.value.remoteType === 1 || info.value.remoteType === 2 ? 'temporaryDate' : 'cycleDate',
|
||||
params: {
|
||||
info: JSON.stringify({ ...info.value, type: 'remote' })
|
||||
},
|
||||
events: {
|
||||
refresh() {
|
||||
eventChannel.emit('refresherList', {})
|
||||
getRemoteRequest({
|
||||
remoteId: info.value.remoteId
|
||||
}).then(res => {
|
||||
info.value = res.data
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onLoad(options => {
|
||||
if (options.info) {
|
||||
info.value = JSON.parse(options.info)
|
||||
|
||||
@ -356,6 +356,12 @@
|
||||
events: {
|
||||
delete() {
|
||||
deleteItem({ ...item, back: true })
|
||||
},
|
||||
refresherList() {
|
||||
pageNo.value = 1
|
||||
getList({
|
||||
pageNo: pageNo.value
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -74,6 +74,10 @@
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { updateCardRequest } from '@/api/card'
|
||||
import { useBasicStore } from '@/stores/basic'
|
||||
import { updateFingerprintRequest } from '@/api/fingerprint'
|
||||
import { updateRemoteRequest } from '@/api/remote'
|
||||
import { updateFaceRequest } from '@/api/face'
|
||||
import { updatePalmVeinRequest } from '@/api/palmVein'
|
||||
|
||||
const instance = getCurrentInstance().proxy
|
||||
const eventChannel = instance.getOpenerEventChannel()
|
||||
@ -93,6 +97,8 @@
|
||||
const defaultStartDate = ref(0)
|
||||
const defaultEndDate = ref(0)
|
||||
|
||||
const pending = ref(false)
|
||||
|
||||
const canSubmit = computed(() => {
|
||||
return startDate.value && endDate.value
|
||||
})
|
||||
@ -123,6 +129,12 @@
|
||||
return
|
||||
}
|
||||
|
||||
if (pending.value) {
|
||||
return
|
||||
}
|
||||
|
||||
pending.value = true
|
||||
|
||||
uni.showLoading({
|
||||
title: '更新中'
|
||||
})
|
||||
@ -142,16 +154,56 @@
|
||||
endDate: endDate.value
|
||||
})
|
||||
if (code === 0) {
|
||||
const { code, message } = await updateCardRequest({
|
||||
lockId: $bluetooth.currentLockInfo.lockId,
|
||||
cardId: info.value.cardId,
|
||||
cardType: 2,
|
||||
startDate: startDate.value,
|
||||
endDate: endDate.value,
|
||||
changeType: 1
|
||||
})
|
||||
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()
|
||||
if (code === 0) {
|
||||
pending.value = false
|
||||
if (data.code === 0) {
|
||||
eventChannel.emit('refresh', {})
|
||||
$basic.backAndToast('更新成功')
|
||||
uni.showToast({
|
||||
@ -160,11 +212,12 @@
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
title: data.message,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
pending.value = false
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '操作失败,请重试',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user