* Fixed an error in batch edit task to be processed.

This commit is contained in:
tianshujie
2023-10-18 13:57:50 +08:00
parent 0c09693f01
commit 74bb6d7ea1
3 changed files with 33 additions and 7 deletions
+14 -3
View File
@@ -23,9 +23,9 @@ window.renderRowData = function($row, index, row)
taskMembers = members;
}
const taskUsers = [];
let disabled = false;
let $assignedTo = $row.find('.form-batch-input[data-name="assignedTo"]').empty();
const taskUsers = [];
let disabled = false;
let $assignedTo = $row.find('.form-batch-input[data-name="assignedTo"]').empty();
if(teams[row.id] != undefined && ((row.assignedTo != currentUser && row.mode == 'linear') || taskMembers[currentUser] == undefined))
{
disabled = true;
@@ -46,4 +46,15 @@ window.renderRowData = function($row, index, row)
$row.find('.form-batch-input[data-name="consumed"]').attr('disabled', 'disabled');
$row.find('.form-batch-input[data-name="left"]').attr('disabled', 'disabled');
}
if(moduleGroup[executionID] != undefined)
{
$row.find('[data-name="module"]').find('.picker-box').on('inited', function(e, info)
{
let $module = info[0];
let modules = moduleGroup[executionID];
$module.render({items: modules});
$module.$.setValue(row.module);
});
}
}
+1
View File
@@ -16,6 +16,7 @@ jsVar('executionTeams', $executionTeams);
jsVar('users', $users);
jsVar('teams', $teams);
jsVar('currentUser', $app->user->account);
jsVar('moduleGroup', $moduleGroup);
/* ====== Define the page structure with zin widgets ====== */
formBatchPanel
+18 -4
View File
@@ -169,6 +169,8 @@ class taskZen extends task
*/
protected function assignBatchEditVars(int $executionID): void
{
$this->loadModel('tree');
/* Set menu and related variables. */
if($executionID)
{
@@ -184,8 +186,9 @@ class taskZen extends task
$this->loadModel('my');
$this->lang->my->menu->work['subModule'] = 'task';
$this->view->title = $this->lang->task->batchEdit;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->title = $this->lang->task->batchEdit;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->modules = array();
}
/* Check if the request data size exceeds the PHP limit. */
@@ -207,14 +210,25 @@ class taskZen extends task
$executionTeamList = $this->execution->getMembersByIdList($executionIdList);
foreach($executionIdList as $id) $executionTeams[$id] = array_column($executionTeamList[$id], 'account');
$moduleGroup = array();
if(!$executionID)
{
foreach($tasks as $task)
{
if(isset($moduleGroup[$task->execution])) continue;
$executionInfo = $this->execution->getByID($task->execution);
$executionModules = $this->tree->getTaskOptionMenu($task->execution, 0, 'allModule');
foreach($executionModules as $moduleID => $moduleName) $moduleGroup[$task->execution][] = array('text' => $executionInfo->name. $moduleName, 'value' => $moduleID);
}
}
/* Assign. */
$this->view->executionID = $executionID;
$this->view->tasks = $tasks;
$this->view->teams = $this->task->getTeamMembersByIdList($this->post->taskIdList);
$this->view->executionTeams = $executionTeams;
$this->view->executionName = zget($execution, 'name', '');
$this->view->executionType = zget($execution, 'type', '');
$this->view->users = $this->loadModel('user')->getPairs('nodeleted');
$this->view->moduleGroup = $moduleGroup;
$this->display();
}