From d007690aa1e189f2d2f2cacd700737214927cd83 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Sat, 12 Oct 2024 17:14:11 +0800 Subject: [PATCH] + [task#130251,doing,0.5h] add beforeSubmit for batchEdit. --- module/task/ui/batchedit.html.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/module/task/ui/batchedit.html.php b/module/task/ui/batchedit.html.php index e291617473..33d59fc328 100644 --- a/module/task/ui/batchedit.html.php +++ b/module/task/ui/batchedit.html.php @@ -24,6 +24,26 @@ $nonStoryChildTasks = json_encode($nonStoryChildTasks); $tasksJsVar = json_encode($tasks); if(!empty($nonStoryChildTasks)) { + $beforeSubmit = jsRaw("() => + { + const \$taskBatchForm = $('#taskBatchEditForm{$executionID}'); + const childTasks = $childTasks; + const nonStoryChildTasks = $nonStoryChildTasks; + const \$taskBatchFormTrs = \$taskBatchForm.find('tbody tr'); + const tasks = $tasksJsVar; + + var confirmID = ''; + var tipAll = true; + for(let i = 0; i < \$taskBatchFormTrs.length; i++) + { + const \$currentTr = $(\$taskBatchFormTrs[i]); + const taskID = \$currentTr.find('.form-batch-control[data-name=id]').find('input[name^=id]').val(); + const storyID = \$currentTr.find('.form-batch-control[data-name=story]').find('input[name^=story]').val(); + if(tasks[taskID].story == storyID) continue; + if(!storyID && tasks[taskID].parent <= 0) continue; + } + return false; + }"); } /* ====== Define the page structure with zin widgets ====== */