From f0cfc28b8f4197086a650c909f156a4eae678acf Mon Sep 17 00:00:00 2001 From: qixinzhi Date: Tue, 9 Jul 2024 06:13:34 +0000 Subject: [PATCH] * [story#52416,0.5h] fix max chart check. --- module/chart/js/preview.ui.js | 37 ++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/module/chart/js/preview.ui.js b/module/chart/js/preview.ui.js index fa6566bee2..7344a26c4b 100644 --- a/module/chart/js/preview.ui.js +++ b/module/chart/js/preview.ui.js @@ -8,26 +8,31 @@ function previewCharts() { const checkedList = $('#moduleMenu menu').zui('tree').$.getChecks(); - if(checkedList.length > 0) - { - if(checkedList.length > maxPreviewCount) + + const checkedCharts = []; + checkedList.forEach((itemKey, index) => { + if(itemKey.includes(':') && itemKey.includes('_')) { - zui.Modal.alert(maxPreviewTips); - return false; + const keys = itemKey.split(':')[1].split('_'); + checkedCharts.push({index, keys}); } + }); - const form = new FormData(); - checkedList.forEach((itemKey, index) => { - if(itemKey.includes(':') && itemKey.includes('_')) - { - const keys = itemKey.split(':')[1].split('_'); - form.append('charts[' + index + '][groupID]', keys[0]); - form.append('charts[' + index + '][chartID]', keys[1]); - } - }); - - postAndLoadPage(previewUrl, form, '#chartPanel'); + if(checkedCharts.length == 0) return; + if(checkedCharts.length > maxPreviewCount) + { + zui.Modal.alert(maxPreviewTips); + return false; } + + const form = new FormData(); + checkedCharts.forEach(chart => { + const {index, keys} = chart; + form.append('charts[' + index + '][groupID]', keys[0]); + form.append('charts[' + index + '][chartID]', keys[1]); + }); + + postAndLoadPage(previewUrl, form, '#chartPanel'); } /**