* Change execution name output use render cell.

This commit is contained in:
caoyanyi
2023-07-04 09:47:00 +08:00
parent 88fd761423
commit f5fedf9ffd
4 changed files with 30 additions and 12 deletions
+8 -9
View File
@@ -11,15 +11,14 @@ $config->execution->dtable->fieldList['rawID']['checkbox'] = true;
$config->execution->dtable->fieldList['rawID']['width'] = '80';
$config->execution->dtable->fieldList['rawID']['required'] = true;
$config->execution->dtable->fieldList['name']['title'] = $lang->execution->name;
$config->execution->dtable->fieldList['name']['name'] = 'name';
$config->execution->dtable->fieldList['name']['fixed'] = 'left';
$config->execution->dtable->fieldList['name']['flex'] = 1;
$config->execution->dtable->fieldList['name']['type'] = 'html';
$config->execution->dtable->fieldList['name']['nestedToggle'] = true;
$config->execution->dtable->fieldList['name']['sortType'] = true;
$config->execution->dtable->fieldList['name']['minWidth'] = '356';
$config->execution->dtable->fieldList['name']['required'] = true;
$config->execution->dtable->fieldList['name']['title'] = $lang->execution->name;
$config->execution->dtable->fieldList['name']['name'] = 'name';
$config->execution->dtable->fieldList['name']['fixed'] = 'left';
$config->execution->dtable->fieldList['name']['flex'] = 1;
$config->execution->dtable->fieldList['name']['type'] = 'nestedTitle';
$config->execution->dtable->fieldList['name']['sortType'] = true;
$config->execution->dtable->fieldList['name']['minWidth'] = '356';
$config->execution->dtable->fieldList['name']['required'] = true;
if(isset($config->setCode) and $config->setCode == 1)
{
+17
View File
@@ -24,3 +24,20 @@ $(document).off('click','.batch-btn').on('click', '.batch-btn', function()
$.cookie.set('checkedItem', checkedList);
});
const today = zui.formatDate(new Date(), 'yyyy-MM-dd');
window.onRenderCell = function(result, {col, row})
{
if(col.name == 'name')
{
const executionLink = $.createLink('execution', 'task', `executionID=${row.data.rawID}`);
const executionType = typeList[row.data.type];
let executionName = `<span class='label secondary-pale'>${executionType}</span> `;
executionName += (!row.data.isParent) ? `<a href="${executionLink}" class="text-primary">${row.data.name}</a>` : row.data.name;
executionName += (today > row.data.end) ? `<span class="label danger-pale ml-1">${delayed}</span>` : '';
result[0] = {html: executionName};
return result;
}
return result;
}
+1 -3
View File
@@ -5379,15 +5379,13 @@ class executionModel extends model
*/
public function generateRow(array $executions, array $users, array $avatarList): array
{
$today = helper::today();
$rows = array();
$rows = array();
foreach($executions as $execution)
{
$link = $execution->type == 'kanban' ? helper::createLink('execution', 'kanban', "id=$execution->id") : helper::createLink('execution', 'task', "id=$execution->id");
$execution->rawID = $execution->id;
$execution->isExecution = 1;
$execution->id = 'pid' . (string)$execution->id;
$execution->name = "<span class='label secondary-pale'>{$this->lang->execution->typeList[$execution->type]}</span> " . (empty($execution->isParent) ? html::a($link, $execution->name, '_self', 'class="text-primary"') : $execution->name) . (strtotime($today) > strtotime($execution->end) ? '<span class="label danger-pale">' . $this->lang->execution->delayed . '</span>' : '');
$execution->project = $execution->projectName;
$execution->parent = ($execution->parent and $execution->grade > 1) ? 'pid' . (string)$execution->parent : '';
$execution->isParent = !empty($execution->isParent) or !empty($execution->tasks);
+4
View File
@@ -12,6 +12,9 @@ declare(strict_types=1);
namespace zin;
jsVar('typeList', $lang->execution->typeList);
jsVar('delayed', $lang->execution->delayed);
$footToolbar = array();
$canBatchEdit = common::hasPriv('execution', 'batchEdit');
$canBatchChangeStatus = common::hasPriv('execution', 'batchChangeStatus');
@@ -86,6 +89,7 @@ dtable
set::fixedLeftWidth('44%'),
set::customCols(true),
set::footToolbar($footToolbar),
set::onRenderCell(jsRaw('window.onRenderCell')),
set::footPager(
usePager(),
set::recPerPage($recPerPage),