From 260da3dbefc6bb0af4ed4e8441fbff4e122215a0 Mon Sep 17 00:00:00 2001 From: qixinzhi Date: Mon, 9 Dec 2024 08:55:44 +0000 Subject: [PATCH] * [story#69800,0.5h] finish search form. --- module/doc/control.php | 2 +- module/doc/ui/zentaolist.html.php | 3 +-- module/doc/ui/zentaolist.productcase.html.php | 12 ++++++++---- module/doc/zen.php | 11 ++++++++++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 2309dbca54..0173939684 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -87,7 +87,7 @@ class doc extends control { array_splice($_POST['andor'], $index + 1, 0, 'and'); array_splice($_POST['field'], $index + 1, 0, ''); - array_splice($_POST['operator'], $index + 1, 0, 'include'); + array_splice($_POST['operator'], $index + 1, 0, ''); array_splice($_POST['value'], $index + 1, 0, ''); } elseif($action === 'remove') diff --git a/module/doc/ui/zentaolist.html.php b/module/doc/ui/zentaolist.html.php index 1774b5176c..6db9653ee9 100644 --- a/module/doc/ui/zentaolist.html.php +++ b/module/doc/ui/zentaolist.html.php @@ -12,8 +12,8 @@ namespace zin; set::zui(); $lowerType = strtolower($type); -include "zentaolist.{$lowerType}.html.php"; include "zentaolist.customsearch.html.php"; +include "zentaolist.{$lowerType}.html.php"; $isSetting = $view == 'setting'; @@ -39,7 +39,6 @@ formPanel ) ), $fnGenerateFormRows(), - $fnGenerateCustomSearch(), to::footer ( setClass('form-actions'), diff --git a/module/doc/ui/zentaolist.productcase.html.php b/module/doc/ui/zentaolist.productcase.html.php index cb3506817c..b46cd0b3fa 100644 --- a/module/doc/ui/zentaolist.productcase.html.php +++ b/module/doc/ui/zentaolist.productcase.html.php @@ -3,12 +3,15 @@ declare(strict_types=1); namespace zin; -$fnGenerateFormRows = function () use ($lang, $settings) +$fnGenerateFormRows = function () use ($lang, $settings, $fnGenerateCustomSearch) { $productList = $this->loadModel('product')->getPairs(); - $this->app->loadLang('testcase'); + $product = isset($settings['product']) ? $settings['product'] : 0; + $this->loadModel('testcase'); $conditions = array_filter($lang->testcase->featureBar['browse'], fn($value) => $value !== '-'); $conditions['customSearch'] = $lang->doc->customSearch; + + $searchConfig = $this->testcase->buildSearchConfig((int)$product); return array ( formRow @@ -21,7 +24,7 @@ $fnGenerateFormRows = function () use ($lang, $settings) set::required(), set::control(array('contorl' => 'picker', 'required' => false, 'maxItemsCount' => 50)), set::items($productList), - set::value(isset($settings['product']) ? $settings['product'] : ''), + set::value($product), span ( setClass('error-tip text-danger hidden'), @@ -46,6 +49,7 @@ $fnGenerateFormRows = function () use ($lang, $settings) $lang->doc->emptyError ) ) - ) + ), + $fnGenerateCustomSearch($searchConfig) ); }; diff --git a/module/doc/zen.php b/module/doc/zen.php index 2d36e21c0d..0671eb24f9 100644 --- a/module/doc/zen.php +++ b/module/doc/zen.php @@ -1022,7 +1022,7 @@ class docZen extends doc { $session['andor'] = array('and'); $session['field'] = array(''); - $session['operator'] = array('include'); + $session['operator'] = array(''); $session['value'] = array(''); } @@ -1283,6 +1283,15 @@ class docZen extends doc if($action === 'preview' && $view === 'setting') { $data = $this->loadModel('testcase')->getTestCases((int)$settings['product'], '', $settings['condition'], 0, 0); + if($settings['condition'] == 'customSearch') + { + $where = ''; + foreach($settings['field'] as $index => $field) + { + $where = $this->loadModel('search')->setWhere($where, $field, $settings['operator'][$index], $settings['value'][$index], $settings['andor'][$index]); + } + a($where); + } } elseif($view === 'list') {