From c679b85139ecb4e990b178276609faf274f28717 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Fri, 5 Aug 2022 14:34:59 +0800 Subject: [PATCH] * Code for showimport. --- module/port/control.php | 2 +- module/port/model.php | 36 ++++++++++++++++++++++++---- module/port/view/footer.html.php | 2 -- module/port/view/showimport.html.php | 25 ++++--------------- module/port/view/tfoot.html.php | 3 --- module/port/view/thead.html.php | 19 +++++++++++++++ 6 files changed, 56 insertions(+), 31 deletions(-) create mode 100644 module/port/view/thead.html.php diff --git a/module/port/control.php b/module/port/control.php index d30963f48a..d3b1b1cae9 100644 --- a/module/port/control.php +++ b/module/port/control.php @@ -147,7 +147,7 @@ class port extends control $formatDatas = $this->port->format($model); $datas = $this->port->getPageDatas($formatDatas, $pagerID); - $html = $this->port->buildNextList($datas->datas, $lastID, $fields, $pagerID); + $html = $this->port->buildNextList($datas->datas, $lastID, $fields, $pagerID, $model); die($html); } diff --git a/module/port/model.php b/module/port/model.php index c989099458..a8de3d4f0b 100644 --- a/module/port/model.php +++ b/module/port/model.php @@ -957,6 +957,7 @@ class portModel extends model $datas = array_slice($datas, ($pagerID - 1) * $maxImport, $maxImport, true); } + if(!$maxImport) $this->maxImport = $result->allCount; $result->maxImport = $maxImport; $result->isEndPage = $pagerID >= $result->allPager; $result->datas = $datas; @@ -1280,13 +1281,16 @@ class portModel extends model * @param array $list * @param int $lastID * @param string $fields + * @param int $pagerID + * @param string $model * @access public * @return void */ - public function buildNextList($list = array(), $lastID = 0, $fields = '', $pagerID = 1) + public function buildNextList($list = array(), $lastID = 0, $fields = '', $pagerID = 1, $model = '') { - $html = ''; - $key = key($list); + $html = ''; + $key = key($list); + $addID = 1; $appendFields = $this->session->appendFields; $showImportCount = $this->config->port->lazyLoading ? $this->config->port->showImportCount : $this->maxImport; @@ -1310,9 +1314,10 @@ class portModel extends model } else { - $html .= $addID++ . " {$lang->port->new}"; + $sub = " {$this->lang->port->new}"; + if($model == 'task') $sub = (strpos($object->name, '>') === 0) ? " {$this->lang->task->children}" : $sub; + $html .= $addID++ . $sub; } - $html .= html::hidden("id[$row]", $object->id); $html .= ""; foreach($fields as $field => $value) @@ -1346,6 +1351,27 @@ class portModel extends model $stepDesc = $this->process4Testcase($field, $tmpList, $row); if($stepDesc) $html .= '' . $stepDesc . ''; } + elseif($field == 'estimate') + { + $html .= ''; + if(is_array($object->estimate)) + { + $html .= ""; + foreach($object->estimate as $account => $estimate) + { + $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; + } + $html .= "
' . html::select("team[$row][]", $members, $account, "class='form-control chosen'") . '' . html::input("estimate[$row][]", $estimate, "class='form-control' autocomplete='off'") . '
"; + } + else + { + $html .= html::input("estimate[$row]", !empty($object->estimate) ? $object->estimate : '', "class='form-control'"); + } + $html .= ''; + } else $html .= '' . html::input("$name", $selected, "class='form-control autocomplete='off'") . ''; } diff --git a/module/port/view/footer.html.php b/module/port/view/footer.html.php index dd8ea9fc30..4333b8f27f 100644 --- a/module/port/view/footer.html.php +++ b/module/port/view/footer.html.php @@ -5,7 +5,6 @@ $.get(createLink('port', 'ajaxGetTbody','model=&lastID=0&pag $('#showData > tbody').append(data); if($('#showData tbody').find('tr').hasClass('showmore') === false) $('#showData tfoot').removeClass('hidden'); $('#showData tbody').find('.picker-select').picker({chosenMode: true}); - $("input[name^='product']").val(); }) window.addEventListener('scroll', this.handleScroll); @@ -35,7 +34,6 @@ function loadData($showmore) $showmore.after(data); if($('#showData tbody').find('tr').hasClass('showmore') === false) $('#showData tfoot').removeClass('hidden'); $('#showData tbody').find('.picker-select').picker({chosenMode: true}).removeClass('nopicker'); - $("input[name^='product']").val(); }) } function throttle(fn, threshhold) diff --git a/module/port/view/showimport.html.php b/module/port/view/showimport.html.php index d0db0da6da..e91aef2988 100644 --- a/module/port/view/showimport.html.php +++ b/module/port/view/showimport.html.php @@ -7,30 +7,15 @@ - - $value):?> - - - - - show) continue; - - $width = ($field->width && $field->width != 'auto' ? $field->width . 'px' : 'auto'); - $required = strpos(",$field->rules,", ",$notEmptyRule->id,") !== false ? 'required' : ''; - echo ""; - } - } - ?> + getModuleRoot() . 'port/view/thead.html.php';?> + - getModuleRoot() . 'port/view/tfoot.html.php';?> + + getModuleRoot() . 'port/view/tfoot.html.php';?> +
port->id?> $field->name
getModuleRoot() . 'common/view/noticeimport.html.php';?> diff --git a/module/port/view/tfoot.html.php b/module/port/view/tfoot.html.php index 092d5145c4..fee5826cb2 100644 --- a/module/port/view/tfoot.html.php +++ b/module/port/view/tfoot.html.php @@ -1,4 +1,3 @@ - - - diff --git a/module/port/view/thead.html.php b/module/port/view/thead.html.php new file mode 100644 index 0000000000..1099ef1652 --- /dev/null +++ b/module/port/view/thead.html.php @@ -0,0 +1,19 @@ + port->id?> + $value):?> + + + + +show) continue; + + $width = ($field->width && $field->width != 'auto' ? $field->width . 'px' : 'auto'); + $required = strpos(",$field->rules,", ",$notEmptyRule->id,") !== false ? 'required' : ''; + echo "$field->name"; + } +} +?>