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(