摄像头最多选10个

This commit is contained in:
a0049873 2022-06-30 15:40:03 +08:00
parent 0f6b37e52e
commit 120f753db2
1 changed files with 18 additions and 2 deletions

View File

@ -402,8 +402,12 @@
const onSelectChange = (record, selected, selectedRows, nativeEvent) => {
console.log('hahhahah', record, selected, selectedRows, nativeEvent)
if (selected) {
if (selectedRowKeys.value.length == 10) {
message.warning('最多只能添加10个摄像头')
} else {
selectedList.value.push(record)
selectedRowKeys.value.push(record.channelCode)
}
} else {
selectedList.value = selectedList.value.filter(
(item) => item.idtCameraChannel !== record.idtCameraChannel
@ -423,6 +427,18 @@
selectedList.value.push(val)
selectedRowKeys.value.push(val.channelCode)
})
if (selectedRowKeys.value.length > 10) {
message.warning('最多只能添加10个摄像头')
changeRows.map((val) => {
selectedList.value = selectedList.value.filter(
(item) => item.idtCameraChannel !== val.idtCameraChannel
)
selectedRowKeys.value.splice(
selectedRowKeys.value.indexOf(val.channelCode),
1
)
})
}
} else {
changeRows.map((val) => {
selectedList.value = selectedList.value.filter(