From 84661fc970eaa5cce4e33eccc591424d71c6300a Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 12 Jun 2024 15:15:25 +0800 Subject: [PATCH] * [refac,0.1h,0h] optimize code. --- module/project/config/dtable.php | 2 +- module/project/js/testtask.ui.js | 16 ++++++++++------ module/testtask/model.php | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/module/project/config/dtable.php b/module/project/config/dtable.php index f3046340e9..756a763de5 100755 --- a/module/project/config/dtable.php +++ b/module/project/config/dtable.php @@ -401,7 +401,7 @@ $config->project->dtable->testtask->fieldList['product']['title'] = $lang->testt $config->project->dtable->testtask->fieldList['product']['type'] = 'text'; $config->project->dtable->testtask->fieldList['product']['group'] = '1'; -$config->project->dtable->testtask->fieldList['id']['name'] = 'idAB'; +$config->project->dtable->testtask->fieldList['id']['name'] = 'idName'; $config->project->dtable->testtask->fieldList['id']['title'] = $lang->idAB; $config->project->dtable->testtask->fieldList['id']['type'] = 'id'; $config->project->dtable->testtask->fieldList['id']['checkbox'] = true; diff --git a/module/project/js/testtask.ui.js b/module/project/js/testtask.ui.js index efdc8a516a..ebaaa798bf 100644 --- a/module/project/js/testtask.ui.js +++ b/module/project/js/testtask.ui.js @@ -32,7 +32,7 @@ window.getCellSpan = function(cell) { return {rowSpan: cell.row.data.rowspan}; } - if(cell.col.name == 'idAB' && cell.row.data.colspan) + if(cell.col.name == 'idName' && cell.row.data.colspan) { return {colSpan: cell.row.data.colspan}; } @@ -61,7 +61,7 @@ window.onRenderCell = function(result, {row, col}) result.push({outer: false, style: {alignItems: 'start', 'padding-top': '8px'}}) } } - if(result && col.name == 'idAB' && row.data.hidden) + if(result && col.name == 'idName' && row.data.hidden) { result.push({outer: false, style: {alignItems: 'center', justifyContent: 'start'}}) } @@ -108,7 +108,7 @@ window.deformation = function(event) { if(data && data.product == product) { - options.data[index].idAB = {html: '' + allTasks + ' ' + '' + data.rowspan + ''}; + options.data[index].idName = {html: '' + allTasks + ' ' + '' + data.rowspan + ''}; options.data[index].rowspan = 1; options.data[index].colspan = 10; options.data[index].hidden = 1; @@ -179,14 +179,18 @@ window.setStatistics = function(element, checkedIDList) * * @param string rowID * @access public - * @return object + * @return bool */ window.canRowCheckable = function(rowID) { let checkable = true; $.each(this.options.data, function(index, data) + { + if(data.id == rowID) { - if(data.id == rowID && data.hidden == 1) checkable = false; - }); + if(data.hidden == 1) checkable = false; + return false; + } + }); return checkable; } diff --git a/module/testtask/model.php b/module/testtask/model.php index f30cb77235..03c610a12c 100755 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -152,7 +152,7 @@ class testtaskModel extends model */ public function getProjectTasks(int $projectID, string $orderBy = 'id_desc', object $pager = null): array { - $tasks = $this->dao->select('t1.*, t1.id as idAB, t5.multiple, IF(t4.shadow = 1, t5.name, t4.name) AS productName, t3.name AS executionName, t2.name AS buildName, t2.branch AS branch, t5.name AS projectName, t4.order as productOrder') + $tasks = $this->dao->select('t1.*, t1.id as idName, t5.multiple, IF(t4.shadow = 1, t5.name, t4.name) AS productName, t3.name AS executionName, t2.name AS buildName, t2.branch AS branch, t5.name AS projectName, t4.order as productOrder') ->from(TABLE_TESTTASK)->alias('t1') ->leftJoin(TABLE_BUILD)->alias('t2')->on('t1.build = t2.id') ->leftJoin(TABLE_EXECUTION)->alias('t3')->on('t1.execution = t3.id')