* Add function for pivot workAssignSummary and workSummary.

This commit is contained in:
songchenxuan
2023-12-23 14:43:24 +08:00
parent cc40ab00f9
commit 1f435a233c
8 changed files with 97 additions and 24 deletions
+1 -1
View File
@@ -96,7 +96,7 @@ function buildTable(resp)
for(var field in resp.fields)
{
var fieldName = field;
if(dataview && checkObjProp(dataview, fieldSettings)) fieldName = dataview.fieldSettings[field].name || field;
if(dataview && checkObjProp(dataview, 'fieldSettings')) fieldName = dataview.fieldSettings[field].name || field;
if(dataview && checkObjProp(dataview, langs) && dataview.langs != '')
{
var langs = JSON.parse(dataview.langs);
+1
View File
@@ -3,6 +3,7 @@ $config->pivot = new stdclass();
$config->pivot->widthInput = 128;
$config->pivot->widthDate = 248;
$config->pivot->recPerPage = 50;
$config->pivot->recPerPageList = array(1,5,10,15,20,25,30,35,40,45,50,100,200,500,1000,2000);
$config->pivot->fileType = array('xlsx' => 'xlsx', 'xls' => 'xls', 'html' => 'html', 'mht' => 'mht');
+15
View File
@@ -318,4 +318,19 @@ class pivot extends control
$this->pivot->buildPivotTable($data, $configs, $page);
}
/**
* Set pager param to this->view.
*
* @access public
* @return void
*/
public function setPagerParam2View($pager)
{
$this->view->recTotal = $pager->recTotal;
$this->view->recPerPage = $pager->recPerPage;
$this->view->page = $pager->pageID;
$this->view->leftPage = $pager->pageID - 1;
$this->view->rightPage = $pager->pageID + 1;
$this->view->pageTotal = ceil($pager->recTotal / $pager->recPerPage);
}
}
+1
View File
@@ -77,6 +77,7 @@ $lang->pivot->showOrigin = 'Show Origin Data';
$lang->pivot->showOriginItem = 'Show origin item';
$lang->pivot->recTotalTip = '<strong> %s </strong> items in total';
$lang->pivot->recPerPageTip = " <strong>%s</strong> per page";
$lang->pivot->showOriginPlaceholder = new stdclass();
$lang->pivot->showOriginPlaceholder->slice = 'No need to configure';
+1
View File
@@ -77,6 +77,7 @@ $lang->pivot->showOrigin = 'Show Origin Data';
$lang->pivot->showOriginItem = 'Show origin item';
$lang->pivot->recTotalTip = '<strong> %s </strong> items in total';
$lang->pivot->recPerPageTip = " <strong>%s</strong> per page";
$lang->pivot->showOriginPlaceholder = new stdclass();
$lang->pivot->showOriginPlaceholder->slice = 'No need to configure';
+1
View File
@@ -77,6 +77,7 @@ $lang->pivot->showOrigin = 'Show Origin Data';
$lang->pivot->showOriginItem = 'Show origin item';
$lang->pivot->recTotalTip = '<strong> %s </strong> items in total';
$lang->pivot->recPerPageTip = " <strong>%s</strong> per page";
$lang->pivot->showOriginPlaceholder = new stdclass();
$lang->pivot->showOriginPlaceholder->slice = 'No need to configure';
+1
View File
@@ -77,6 +77,7 @@ $lang->pivot->showOrigin = '查看原始数据';
$lang->pivot->showOriginItem = '展示原始条目';
$lang->pivot->recTotalTip = '共 <strong> %s </strong> 项';
$lang->pivot->recPerPageTip = "每页 <strong>%s</strong> 项";
$lang->pivot->showOriginPlaceholder = new stdclass();
$lang->pivot->showOriginPlaceholder->slice = '展示原始条目后无需配置切片';
+76 -23
View File
@@ -2406,37 +2406,90 @@ class pivotModel extends model
if($page)
{
$recTotal = $end - $start + 1;
$itemCountTip = sprintf($this->lang->pivot->recTotalTip, $itemCount);
$recTotal = $end - $start + 1;
$leftPage = $page - 1;
$rightPage = $page + 1;
$leftPageClass = $page == 1 ? 'disabled' : '';
$rightPageClass = $page == $pageTotal ? 'disabled' : '';
if($recTotal) $table .= "<div class='table-footer'>
<ul class='pager'>
<li><div class='pager-label recTotal'>{$itemCountTip}</div></li>
<li class='pager-item-left first-page $leftPageClass' onclick='queryPivotByPager(this)'>
<a class='pager-item' data-page='1' href='javascript:;'><i class='icon icon-first-page'></i></a>
</li>
<li class='pager-item-left left-page $leftPageClass' onclick='queryPivotByPager(this)'>
<a class='pager-item' data-page='{$leftPage}' href='javascript:;'><i class='icon icon-angle-left'></i></a>
</li>
<li><div class='pager-label page-number'><strong>{$page}/{$pageTotal}</strong></div></li>
<li class='pager-item-right right-page $rightPageClass' onclick='queryPivotByPager(this)'>
<a class='pager-item' data-page='{$rightPage}' href='javascript:;'><i class='icon icon-angle-right'></i></a>
</li>
<li class='pager-item-right last-page $rightPageClass' onclick='queryPivotByPager(this)'>
<a class='pager-item' data-page='{$pageTotal}' href='javascript:;'><i class='icon icon-last-page'></i></a>
</li>
</ul>
</div>";
if($recTotal) $table .= $this->getTablePager($itemCount, $leftPage, $rightPage, $page, $pageTotal);
}
echo $table;
}
public function getTablePager($itemCount, $leftPage, $rightPage, $page, $pageTotal)
{
$itemCountTip = sprintf($this->lang->pivot->recTotalTip, $itemCount);
$leftPageClass = $page == 1 ? 'disabled' : '';
$rightPageClass = $page == $pageTotal ? 'disabled' : '';
$pager = "
<div class='table-footer'>
<ul class='pager'>
<li><div class='pager-label recTotal'>{$itemCountTip}</div></li>
<li class='pager-item-left first-page $leftPageClass' onclick='queryPivotByPager(this)'>
<a class='pager-item' data-page='1' href='javascript:;'><i class='icon icon-first-page'></i></a>
</li>
<li class='pager-item-left left-page $leftPageClass' onclick='queryPivotByPager(this)'>
<a class='pager-item' data-page='{$leftPage}' href='javascript:;'><i class='icon icon-angle-left'></i></a>
</li>
<li><div class='pager-label page-number'><strong>{$page}/{$pageTotal}</strong></div></li>
<li class='pager-item-right right-page $rightPageClass' onclick='queryPivotByPager(this)'>
<a class='pager-item' data-page='{$rightPage}' href='javascript:;'><i class='icon icon-angle-right'></i></a>
</li>
<li class='pager-item-right last-page $rightPageClass' onclick='queryPivotByPager(this)'>
<a class='pager-item' data-page='{$pageTotal}' href='javascript:;'><i class='icon icon-last-page'></i></a>
</li>
</ul>
</div>";
return $pager;
}
public function getFullTablePager($recTotal, $recPerPage, $page, $leftPage, $rightPage, $pageTotal, $onclick = 'queryPivotByPager(this)')
{
$recTotalTip = sprintf($this->lang->pivot->recTotalTip, $recTotal);
$recPerPageTip = sprintf($this->lang->pivot->recPerPageTip, $recPerPage);
$leftPageClass = $page == 1 ? 'disabled' : '';
$rightPageClass = $page == $pageTotal ? 'disabled' : '';
$dropdownMenu = '';
foreach($this->config->pivot->recPerPageList as $perPage)
{
$active = $perPage == $recPerPage ? 'active' : '';
$dropdownMenu .= "<li class='recPerPage {$active}' onclick='{$onclick}'><a href='javascript:;' data-size='{$perPage}'>{$perPage}</a></li>";
}
$pager = "
<div class='table-footer'>
<ul class='pager'>
<li class='hidden current-page' data-page='{$page}'></li>
<li class='hidden current-recperpage' data-recperpage='{$recPerPage}'></li>
<li><div class='pager-label recTotal'>{$recTotalTip}</div></li>
<li>
<div class='btn-group pager-size-menu dropup'>
<button type='button' class='btn dropdown-toggle' data-toggle='dropdown' style='border-radius: 4px;'>{$recPerPageTip}<span class='caret'></span></button>
<ul class='dropdown-menu'>{$dropdownMenu}</ul>
</div>
</li>
<li class='pager-item-left first-page $leftPageClass' onclick='{$onclick}'>
<a class='pager-item' data-page='1' href='javascript:;'><i class='icon icon-first-page'></i></a>
</li>
<li class='pager-item-left left-page $leftPageClass' onclick='{$onclick}'>
<a class='pager-item' data-page='{$leftPage}' href='javascript:;'><i class='icon icon-angle-left'></i></a>
</li>
<li><div class='pager-label page-number'><strong>{$page}/{$pageTotal}</strong></div></li>
<li class='pager-item-right right-page $rightPageClass' onclick='{$onclick}'>
<a class='pager-item' data-page='{$rightPage}' href='javascript:;'><i class='icon icon-angle-right'></i></a>
</li>
<li class='pager-item-right last-page $rightPageClass' onclick='{$onclick}'>
<a class='pager-item' data-page='{$pageTotal}' href='javascript:;'><i class='icon icon-last-page'></i></a>
</li>
</ul>
</div>";
return $pager;
}
/**
* replace defined table names.
*