* Add metric-view.
This commit is contained in:
@@ -87,4 +87,21 @@ class metric extends control
|
||||
|
||||
$this->metric->insertMetricLib($records);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询度量项详情页。
|
||||
* View a metric.
|
||||
*
|
||||
* @param int $metricID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function view(int $metricID)
|
||||
{
|
||||
$this->view->metric = $this->metric->getByID($metricID);
|
||||
$this->view->legendBasic = $this->metricZen->getBasicInfo($this->view);
|
||||
$this->view->createEditInfo = $this->metricZen->getCreateEditInfo($this->view);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?php
|
||||
$lang->metric->common = "度量项";
|
||||
$lang->metric->name = "度量项名称";
|
||||
$lang->metric->stage = "阶段";
|
||||
$lang->metric->scope = "范围";
|
||||
$lang->metric->object = "对象";
|
||||
$lang->metric->purpose = "目的";
|
||||
$lang->metric->unit = "单位";
|
||||
$lang->metric->code = "代号";
|
||||
$lang->metric->desc = "描述";
|
||||
$lang->metric->definition = "定义";
|
||||
$lang->metric->formula = "计算方式";
|
||||
$lang->metric->when = "收集方式";
|
||||
$lang->metric->createdBy = "创建者";
|
||||
$lang->metric->implementBy = "由谁实现";
|
||||
$lang->metric->removeBy = "由谁下架";
|
||||
$lang->metric->lastEdited = "最后修改";
|
||||
$lang->metric->common = "度量项";
|
||||
$lang->metric->name = "度量项名称";
|
||||
$lang->metric->stage = "阶段";
|
||||
$lang->metric->scope = "范围";
|
||||
$lang->metric->object = "对象";
|
||||
$lang->metric->purpose = "目的";
|
||||
$lang->metric->unit = "单位";
|
||||
$lang->metric->code = "代号";
|
||||
$lang->metric->desc = "描述";
|
||||
$lang->metric->definition = "定义";
|
||||
$lang->metric->formula = "计算方式";
|
||||
$lang->metric->when = "收集方式";
|
||||
$lang->metric->createdBy = "创建者";
|
||||
$lang->metric->implementedBy = "由谁实现";
|
||||
$lang->metric->removedBy = "由谁下架";
|
||||
$lang->metric->lastEdited = "最后修改";
|
||||
|
||||
$lang->metric->legendBasicInfo = '基本信息';
|
||||
$lang->metric->legendCreateInfo = '创建编辑信息';
|
||||
|
||||
+16
-1
@@ -57,12 +57,27 @@ class metricModel extends model
|
||||
* @access public
|
||||
* @return object|false
|
||||
*/
|
||||
public function getByCode($code, $fieldList = '*')
|
||||
public function getByCode(string $code, string|array $fieldList = '*')
|
||||
{
|
||||
if(is_array($fieldList)) $fieldList = implode(',', $fieldList);
|
||||
return $this->dao->select($fieldList)->from(TABLE_METRIC)->where('code')->eq($code)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取度量项信息。
|
||||
* Get metric info by id.
|
||||
*
|
||||
* @param int $metricID
|
||||
* @param string|array $fieldList
|
||||
* @access public
|
||||
* @return object|false
|
||||
*/
|
||||
public function getByID(int $metricID, string|array $fieldList = '*')
|
||||
{
|
||||
if(is_array($fieldList)) $fieldList = implode(',', $fieldList);
|
||||
return $this->dao->select($fieldList)->from(TABLE_METRIC)->where('id')->eq($metricID)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取度量项数据源句柄。
|
||||
* Get data source statement of calculator.
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The view file of metric module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Xin Zhou<zhouxin@easycorp.ltd>
|
||||
* @package metric
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
namespace zin;
|
||||
|
||||
/**
|
||||
* Build content of table data.
|
||||
*
|
||||
* @param array $items
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
$buildItems = function($items): array
|
||||
{
|
||||
$itemList = array();
|
||||
foreach($items as $item)
|
||||
{
|
||||
$itemList[] = item
|
||||
(
|
||||
set::name($item['name']),
|
||||
!empty($item['href']) ? a
|
||||
(
|
||||
set::href($item['href']),
|
||||
!empty($item['attr']) && is_array($item['attr']) ? set($item['attr']) : null,
|
||||
$item['text']
|
||||
) : $item['text'],
|
||||
set::collapse(!empty($item['text'])),
|
||||
);
|
||||
}
|
||||
|
||||
return $itemList;
|
||||
};
|
||||
|
||||
detailHeader
|
||||
(
|
||||
to::title
|
||||
(
|
||||
entityLabel
|
||||
(
|
||||
set::entityID($metric->id),
|
||||
set::level(),
|
||||
set::text($metric->name)
|
||||
)
|
||||
),
|
||||
to::prefix
|
||||
(
|
||||
backBtn
|
||||
(
|
||||
set::icon('back'),
|
||||
set::class('ghost text-white'),
|
||||
$lang->goback
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
detailBody
|
||||
(
|
||||
sectionList
|
||||
(
|
||||
section
|
||||
(
|
||||
set::title($lang->metric->desc),
|
||||
set::content($metric->desc),
|
||||
set::useHtml(true)
|
||||
),
|
||||
section
|
||||
(
|
||||
set::title($lang->metric->formula),
|
||||
set::content($metric->definition),
|
||||
set::useHtml(true)
|
||||
)
|
||||
),
|
||||
history(),
|
||||
detailSide
|
||||
(
|
||||
tabs
|
||||
(
|
||||
set::collapse(true),
|
||||
tabPane
|
||||
(
|
||||
set::key('legendBasicInfo'),
|
||||
set::title($lang->metric->legendBasicInfo),
|
||||
set::active(true),
|
||||
tableData
|
||||
(
|
||||
$buildItems($legendBasic)
|
||||
)
|
||||
),
|
||||
tabPane
|
||||
(
|
||||
set::key('legendCreateInfo'),
|
||||
set::title($lang->metric->legendCreateInfo),
|
||||
tableData
|
||||
(
|
||||
$buildItems($createEditInfo)
|
||||
)
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
render();
|
||||
@@ -91,4 +91,48 @@ class metricZen extends metric
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取度量项的基本信息。
|
||||
* Get the basic information of the metric.
|
||||
*
|
||||
* @param object $view
|
||||
* @access protected
|
||||
* @return array
|
||||
*/
|
||||
protected function getBasicInfo(object $view)
|
||||
{
|
||||
extract((array)$view);
|
||||
|
||||
$legendBasic = array();
|
||||
$legendBasic['scope'] = array('name' => $this->lang->metric->scope, 'text' => zget($this->lang->metric->scopeList, $metric->scope));
|
||||
$legendBasic['object'] = array('name' => $this->lang->metric->object, 'text' => zget($this->lang->metric->objectList, $metric->object));
|
||||
$legendBasic['purpose'] = array('name' => $this->lang->metric->purpose, 'text' => zget($this->lang->metric->purposeList, $metric->purpose));
|
||||
$legendBasic['code'] = array('name' => $this->lang->metric->code, 'text' => $metric->code);
|
||||
$legendBasic['unit'] = array('name' => $this->lang->metric->unit, 'text' => $metric->unit);
|
||||
$legendBasic['stage'] = array('name' => $this->lang->metric->stage, 'text' => zget($this->lang->metric->stageList, $metric->stage));
|
||||
|
||||
return $legendBasic;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取度量项的创建和编辑信息。
|
||||
* Get the create and edit information of the metric.
|
||||
*
|
||||
* @param object $view
|
||||
* @access protected
|
||||
* @return array
|
||||
*/
|
||||
protected function getCreateEditInfo(object $view)
|
||||
{
|
||||
extract((array)$view);
|
||||
|
||||
$createEditInfo = array();
|
||||
$createEditInfo['createdBy'] = array('name' => $this->lang->metric->createdBy, 'text' => zget($users, $metric->createdBy) . ($metric->createdBy ? $this->lang->at . $metric->createdBy : ''));
|
||||
$createEditInfo['implementedBy'] = array('name' => $this->lang->metric->implementedBy, 'text' => zget($users, $metric->implementedBy) . ($metric->implementedBy ? $this->lang->at . $metric->implementedBy : ''));
|
||||
$createEditInfo['removedBy'] = array('name' => $this->lang->metric->removedBy, 'text' => zget($users, $metric->removedBy) . ($metric->removedBy ? $this->lang->at . $metric->removedBy : ''));
|
||||
|
||||
return $createEditInfo;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user