From efda9efb2e01ddb5bbdb3380b0257805083c54dc Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 5 Dec 2024 08:50:37 +0800 Subject: [PATCH] * [task#133225,doing,0.4h] change picker to taskAssignedTo control for batch create tasks. --- module/task/js/batchcreate.ui.js | 8 ++++++++ module/task/js/edit.ui.js | 10 ++++------ module/task/ui/batchcreate.html.php | 2 +- module/task/zen.php | 4 ++++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/module/task/js/batchcreate.ui.js b/module/task/js/batchcreate.ui.js index e10fa4922f..b2b109875a 100644 --- a/module/task/js/batchcreate.ui.js +++ b/module/task/js/batchcreate.ui.js @@ -273,6 +273,14 @@ window.handleRenderRow = function($row, index) $row.find('.form-batch-col-actions').addClass('is-pinned'); if($prevRow.length && $prevRow.attr('data-level') >= level) $prevRow.find('input[data-name="estimate"]').prop('readonly', false); // 如果没有子任务,重置预计字段的可编辑状态。 if(edition == 'open' && (level > 0 || parentID)) $row.find('button[data-type=addSub]').attr('disabled', 'disabled'); + + /* 复制上一行的人员下拉。*/ + $row.find('[data-name=assignedTo]').find('.picker-box').on('inited', function(e, info) + { + const $assignedTo = info[0]; + const $preAssignedTo = $prevRow.find('input[name^=assignedTo]').zui('picker'); + if($preAssignedTo != undefined) $assignedTo.render({items: $preAssignedTo.options.items}); + }) }; $(function() diff --git a/module/task/js/edit.ui.js b/module/task/js/edit.ui.js index 3356a48d7b..4116d75965 100644 --- a/module/task/js/edit.ui.js +++ b/module/task/js/edit.ui.js @@ -273,14 +273,12 @@ window.renderRowData = function($row, index, row) $row.attr('data-consumed', row ? row.teamConsumed : 0); $row.attr('data-left', row ? row.teamLeft : 0); + /* 复制上一行的人员下拉。*/ $row.find('[data-name=team]').find('.picker-box').on('inited', function(e, info) { - const $team = info[0]; - const getAssignedToLink = $.createLink('execution', 'ajaxGetMembers', 'objectID=' + objectID); - $.getJSON(getAssignedToLink, function(data) - { - $team.render({items: data}); - }) + const $team = info[0]; + const $preTeam = $row.prev().find('input[name^=team]').zui('picker'); + if($preTeam != undefined) $team.render({items: $preTeam.options.items}); }) if(row && row.memberDisabled) diff --git a/module/task/ui/batchcreate.html.php b/module/task/ui/batchcreate.html.php index a21e455daf..6fdcd0780f 100644 --- a/module/task/ui/batchcreate.html.php +++ b/module/task/ui/batchcreate.html.php @@ -210,7 +210,7 @@ formBatchPanel ( set::name('assignedTo'), set::label($lang->task->assignedTo), - set::control('picker'), + set::control(array('control' => 'taskAssignedTo', 'manageLink' => ($manageLink ? $manageLink : ''))), set::items($members), set::width('128px'), set::ditto(true) diff --git a/module/task/zen.php b/module/task/zen.php index 898957eb84..c6ddecd91f 100644 --- a/module/task/zen.php +++ b/module/task/zen.php @@ -425,6 +425,9 @@ class taskZen extends task $this->config->task->batchcreate->requiredFields = $this->config->task->create->requiredFields; + if($execution->multiple) $manageLink = common::hasPriv('execution', 'manageMembers') ? $this->createLink('execution', 'manageMembers', "execution={$execution->id}") : ''; + if(!$execution->multiple) $manageLink = common::hasPriv('project', 'manageMembers') ? $this->createLink('project', 'manageMembers', "projectID={$execution->project}") : ''; + $this->view->title = $this->lang->task->batchCreate; $this->view->execution = $execution; $this->view->modules = $modules; @@ -440,6 +443,7 @@ class taskZen extends task $this->view->checkedFields = $checkedFields; $this->view->hideStory = $this->task->isNoStoryExecution($execution); $this->view->showFields = $showFields; + $this->view->manageLink = $manageLink; $this->display(); }