From a11cb5b3ebd749ce18620c5143d7c50526e611ee Mon Sep 17 00:00:00 2001 From: sunguangming Date: Fri, 2 Jun 2023 11:11:27 +0800 Subject: [PATCH] * Add execution-task list sort, modify recordworkhour ui. --- module/execution/js/task.ui.js | 7 +++ module/execution/ui/task.html.php | 4 +- module/task/ui/recordworkhour.html.php | 81 ++++++++++++++------------ 3 files changed, 54 insertions(+), 38 deletions(-) diff --git a/module/execution/js/task.ui.js b/module/execution/js/task.ui.js index 2a610c4edd..e292bae459 100644 --- a/module/execution/js/task.ui.js +++ b/module/execution/js/task.ui.js @@ -63,3 +63,10 @@ window.setStatistics = function(element, checkedIDList) .replace('%left%', totalLeft.toFixed(1)) }; } + +window.createSortLink = function(col) +{ + var sort = col.name + '_asc'; + if(sort == orderBy) sort = col.name + '_desc'; + return sortLink.replace('{orderBy}', sort); +} diff --git a/module/execution/ui/task.html.php b/module/execution/ui/task.html.php index 3479685e1d..7b60971c2e 100644 --- a/module/execution/ui/task.html.php +++ b/module/execution/ui/task.html.php @@ -175,6 +175,8 @@ if($canBatchAction) if($canBatchAssignTo) $footToolbar['items'][] = array('caret' => 'up', 'text' => $lang->task->assignedTo, 'btnType' => 'primary', 'url' => '#navAssignedTo','data-toggle' => 'dropdown'); } +jsVar('orderBy', $orderBy); +jsVar('sortLink', helper::createLink('execution', 'task', "executionID={$execution->id}&status={$status}¶m={$param}&orderBy={orderBy}&recTotal={$recTotal}&recPerPage={$recPerPage}")); jsVar('taskSummary', $lang->execution->taskSummary); jsVar('pageSummary', $lang->execution->pageSummary); jsVar('checkedSummary', $lang->execution->checkedSummary); @@ -185,7 +187,7 @@ dtable set::cols(array_values($config->task->dtable->fieldList)), set::data($tableData), set::checkable($canBatchAction), - set::sortLink(helper::createLink('execution', 'task', "executionID={$execution->id}&status={$status}¶m={$param}&orderBy={name}_{sortType}&recTotal={$recTotal}&recPerPage={$recPerPage}")), + set::sortLink(jsRaw('createSortLink')), set::footToolbar($footToolbar), set::footPager( usePager(), diff --git a/module/task/ui/recordworkhour.html.php b/module/task/ui/recordworkhour.html.php index 3e738fbe3f..d986f4ccb8 100644 --- a/module/task/ui/recordworkhour.html.php +++ b/module/task/ui/recordworkhour.html.php @@ -9,46 +9,53 @@ declare(strict_types=1); * @link https://www.zentao.net */ namespace zin; + /* zin: Set variables to define picker options for form. */ - -$items = array(); - -$items[] = array -( - 'name' => 'date', - 'label' => $lang->task->date, - 'control' => 'date', - 'width' => '120px', - 'value' => helper::today(), -); - -$items[] = array -( - 'name' => 'work', - 'label' => $lang->task->work, - 'control' => 'input', - 'width' => 'auto', -); - -$items[] = array -( - 'name' => 'consumed', - 'label' => $lang->task->consumed, - 'control' => 'input', - 'width' => '100px', -); - -$items[] = array -( - 'name' => 'left', - 'label' => $lang->task->left, - 'control' => 'input', - 'width' => '100px', -); - formBatch ( - set::items($items), + formBatchItem + ( + set::name('date'), + set::label($lang->task->date), + set::width('120px'), + set::control('date'), + set::value(helper::today()) + ), + formBatchItem + ( + set::name('work'), + set::label($lang->task->work), + set::width('auto'), + set::control('input') + ), + formBatchItem + ( + set::name('consumed'), + set::label($lang->task->consumed), + set::width('80px'), + set::control + ( + array( + 'type' => 'inputControl', + 'suffix' => $lang->task->suffixHour, + 'suffixWidth' => 20 + ) + ) + ), + formBatchItem + ( + set::name('left'), + set::label($lang->task->left), + set::width('80px'), + set::control + ( + array( + 'type' => 'inputControl', + 'suffix' => $lang->task->suffixHour, + 'suffixWidth' => 20 + ) + ) + ) ); /* ====== Render page ====== */