From cca2edbd0389e1775b7fbf1719f7a8f37e6ce318 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Wed, 13 Dec 2023 02:06:37 -0500 Subject: [PATCH] * Finish task #107891. --- module/testtask/js/cases.ui.js | 24 ++++++++++++++++++++++++ module/testtask/ui/cases.html.php | 4 +++- module/testtask/zen.php | 3 ++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/module/testtask/js/cases.ui.js b/module/testtask/js/cases.ui.js index 01498837fd..76bf5ba257 100644 --- a/module/testtask/js/cases.ui.js +++ b/module/testtask/js/cases.ui.js @@ -52,3 +52,27 @@ $(document).off('click', '.batch-btn').on('click', '.batch-btn', function() } } }); + +/** + * 标题列显示额外的内容。 + * Display extra content in the title column. + * + * @param object result + * @param object info + * @access public + * @return object + */ +window.onRenderCell = function(result, {row, col}) +{ + if(result) + { + if(col.name == 'title') + { + const data = row.data; + const module = this.options.customData.modules[data.module]; + if(module) result.unshift({html: '' + module + ''}); // 添加模块标签 + } + } + + return result; +} diff --git a/module/testtask/ui/cases.html.php b/module/testtask/ui/cases.html.php index 554da640f3..2ed5c3a9d4 100644 --- a/module/testtask/ui/cases.html.php +++ b/module/testtask/ui/cases.html.php @@ -162,7 +162,9 @@ dtable set::checkable($canBatchAction), set::fixedLeftWidth('44%'), set::footToolbar($footToolbar), - set::footPager(usePager()) + set::footPager(usePager()), + set::onRenderCell(jsRaw('window.onRenderCell')), + set::customData(array('modules' => $modulePairs)) ); render(); diff --git a/module/testtask/zen.php b/module/testtask/zen.php index b0f1af7453..07de0b4db2 100644 --- a/module/testtask/zen.php +++ b/module/testtask/zen.php @@ -292,6 +292,7 @@ class testtaskZen extends testtask } $this->setDropMenu($product->id, $testtask); + $showModule = $this->config->testtask->cases->showModule; $this->view->title = $product->name . $this->lang->colon . $this->lang->testtask->cases; $this->view->runs = $this->loadModel('testcase')->appendData($runs, 'run'); @@ -310,8 +311,8 @@ class testtaskZen extends testtask $this->view->param = $param; $this->view->orderBy = $orderBy; $this->view->pager = $pager; - $this->view->setModule = false; $this->view->branch = $testtask->branch; + $this->view->modulePairs = $showModule ? $this->tree->getModulePairs($product->id, 'case', $showModule) : array(); } /**