From 120f753db27a1260be028cab971c77da80cdfadc Mon Sep 17 00:00:00 2001 From: a0049873 <79py69t9wb@privaterelay.appleid.com> Date: Thu, 30 Jun 2022 15:40:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=91=84=E5=83=8F=E5=A4=B4=E6=9C=80=E5=A4=9A?= =?UTF-8?q?=E9=80=8910=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/views/home/infrastructurePage.vue | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/front/src/views/home/infrastructurePage.vue b/front/src/views/home/infrastructurePage.vue index a68f92a0..970ada79 100644 --- a/front/src/views/home/infrastructurePage.vue +++ b/front/src/views/home/infrastructurePage.vue @@ -402,8 +402,12 @@ const onSelectChange = (record, selected, selectedRows, nativeEvent) => { console.log('hahhahah', record, selected, selectedRows, nativeEvent) if (selected) { - selectedList.value.push(record) - selectedRowKeys.value.push(record.channelCode) + 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(