* Code for showimport.

This commit is contained in:
tanghucheng
2022-08-05 14:34:59 +08:00
parent 3bfdc7d342
commit c679b85139
6 changed files with 56 additions and 31 deletions
+1 -1
View File
@@ -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);
}
+31 -5
View File
@@ -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++ . " <sub style='vertical-align:sub;color:gray'>{$lang->port->new}</sub>";
$sub = " <sub style='vertical-align:sub;color:gray'>{$this->lang->port->new}</sub>";
if($model == 'task') $sub = (strpos($object->name, '>') === 0) ? " <sub style='vertical-align:sub;color:red'>{$this->lang->task->children}</sub>" : $sub;
$html .= $addID++ . $sub;
}
$html .= html::hidden("id[$row]", $object->id);
$html .= "</td>";
foreach($fields as $field => $value)
@@ -1346,6 +1351,27 @@ class portModel extends model
$stepDesc = $this->process4Testcase($field, $tmpList, $row);
if($stepDesc) $html .= '<td>' . $stepDesc . '</td>';
}
elseif($field == 'estimate')
{
$html .= '<td>';
if(is_array($object->estimate))
{
$html .= "<table class='table-borderless'>";
foreach($object->estimate as $account => $estimate)
{
$html .= '<tr>';
$html .= '<td class="c-team">' . html::select("team[$row][]", $members, $account, "class='form-control chosen'") . '</td>';
$html .= '<td class="c-estimate-1">' . html::input("estimate[$row][]", $estimate, "class='form-control' autocomplete='off'") . '</td>';
$html .= '</tr>';
}
$html .= "</table>";
}
else
{
$html .= html::input("estimate[$row]", !empty($object->estimate) ? $object->estimate : '', "class='form-control'");
}
$html .= '</td>';
}
else $html .= '<td>' . html::input("$name", $selected, "class='form-control autocomplete='off'") . '</td>';
}
-2
View File
@@ -5,7 +5,6 @@ $.get(createLink('port', 'ajaxGetTbody','model=<?php echo $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(<?php echo $productID?>);
})
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(<?php echo $productID?>);
})
}
function throttle(fn, threshhold)
+5 -20
View File
@@ -7,30 +7,15 @@
<table class='table table-form' id='showData'>
<thead>
<tr>
<th class='w-70px'> <?php echo $lang->port->id?></th>
<?php foreach($fields as $key => $value):?>
<?php if($value['control'] != 'hidden'):?>
<th class='c-<?php echo $key?>' id='<?php echo $key;?>'> <?php echo $value['title'];?></th>
<?php endif;?>
<?php endforeach;?>
<?php
if(!empty($appendFields))
{
foreach($appendFields as $field)
{
if(!$field->show) continue;
$width = ($field->width && $field->width != 'auto' ? $field->width . 'px' : 'auto');
$required = strpos(",$field->rules,", ",$notEmptyRule->id,") !== false ? 'required' : '';
echo "<th class='$required' style='width: $width'>$field->name</th>";
}
}
?>
<?php include $app->getModuleRoot() . 'port/view/thead.html.php';?>
</tr>
</thead>
<tbody>
</tbody>
<?php include $app->getModuleRoot() . 'port/view/tfoot.html.php';?>
<tfoot class='hidden'>
<?php include $app->getModuleRoot() . 'port/view/tfoot.html.php';?>
</tfoot>
</table>
<?php if(!$insert and $dataInsert === '') include $app->getModuleRoot() . 'common/view/noticeimport.html.php';?>
</form>
-3
View File
@@ -1,4 +1,3 @@
<tfoot class='hidden'>
<tr>
<td colspan='10' class='text-center form-actions'>
<?php
@@ -20,5 +19,3 @@
?>
</td>
</tr>
</tfoot>
+19
View File
@@ -0,0 +1,19 @@
<th class='w-70px'> <?php echo $lang->port->id?></th>
<?php foreach($fields as $key => $value):?>
<?php if($value['control'] != 'hidden'):?>
<th class='c-<?php echo $key?>' id='<?php echo $key;?>'> <?php echo $value['title'];?></th>
<?php endif;?>
<?php endforeach;?>
<?php
if(!empty($appendFields))
{
foreach($appendFields as $field)
{
if(!$field->show) continue;
$width = ($field->width && $field->width != 'auto' ? $field->width . 'px' : 'auto');
$required = strpos(",$field->rules,", ",$notEmptyRule->id,") !== false ? 'required' : '';
echo "<th class='$required' style='width: $width'>$field->name</th>";
}
}
?>