cfd.html.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?php
  2. /**
  3. * The cfd view file of execution module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  5. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  6. * @author Yanyi Cao<caoyanyi@easycorp.ltd>
  7. * @package execution
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. if(!$features['story']) unset($lang->execution->cfdTypeList['story']);
  12. if(!$features['qa']) unset($lang->execution->cfdTypeList['bug']);
  13. jsVar('executionID', $executionID);
  14. jsVar('cfdTip', $lang->execution->charts->cfd->cfdTip);
  15. featureBar
  16. (
  17. (!in_array($execution->status, array('wait,doing')) && hasPriv('execution', 'computeCFD')) ? btn
  18. (
  19. setClass('primary mr-5 refresh-btn ajax-submit'),
  20. set::url(createLink('execution', 'computeCFD', "reload=yes&executionID=$executionID")),
  21. set::icon('refresh'),
  22. $lang->execution->computeCFD
  23. ) : null,
  24. li
  25. (
  26. setClass('nav-item mr-3'),
  27. a
  28. (
  29. set::id('weekend'),
  30. set::href(createLink('execution', 'cfd', "executionID={$executionID}&type={$type}&withWeekend=" . ($withWeekend == 'true' ? 'false' : 'true'))),
  31. setData('app', $app->tab),
  32. $lang->execution->withweekend
  33. )
  34. ),
  35. li
  36. (
  37. setClass('nav-item mr-2 type-selecter'),
  38. control
  39. (
  40. set::type('picker'),
  41. set::name('type'),
  42. set::value($type),
  43. set::items($lang->execution->cfdTypeList),
  44. on::change('changeType'),
  45. set::required(true)
  46. )
  47. ),
  48. li
  49. (
  50. setClass('nav-item ml-3'),
  51. formBase
  52. (
  53. set::actions(array()),
  54. inputGroup
  55. (
  56. datePicker
  57. (
  58. set::name('begin'),
  59. set::value($begin),
  60. set::minDate($minDate),
  61. set::maxDate($maxDate),
  62. set::todayText($lang->execution->charts->cfd->dateRangeTip)
  63. ),
  64. span
  65. (
  66. setClass('input-group-addon'),
  67. $lang->project->to
  68. ),
  69. datePicker
  70. (
  71. set::name('end'),
  72. set::value($end),
  73. set::minDate($minDate),
  74. set::maxDate($maxDate),
  75. set::todayText($lang->execution->charts->cfd->dateRangeTip)
  76. ),
  77. btn
  78. (
  79. setClass('primary ml-4'),
  80. set::btnType('submit'),
  81. $lang->preview
  82. )
  83. )
  84. )
  85. )
  86. );
  87. $index = 0;
  88. $chartColors = array('#33B4DB', '#7ECF69', '#FFC73A', '#FF5A61', '#50C8D0', '#AF5AFF', '#4EA3FF', '#FF8C5A', '#6C73FF', '#B9E78C', '#E58CE7', '#EDE590', '#CFB5FA');
  89. $chartSeries = array();
  90. if(!empty($chartData['line']))
  91. {
  92. foreach($chartData['line'] as $label => $set)
  93. {
  94. $chartSeries[] = array(
  95. 'name' => $label,
  96. 'type' => 'line',
  97. 'stack' => 'Total',
  98. 'data' => array_values($set),
  99. 'color' => $chartColors[$index],
  100. 'areaStyle' => array('color' => $chartColors[$index], 'opacity' => 0.2),
  101. 'itemStyle' => array('normal' => array('lineStyle' => array('width' => 1))),
  102. 'emphasis' => array('focus' => 'series')
  103. );
  104. $index ++;
  105. }
  106. }
  107. $cfdChart = null;
  108. if(isset($chartData['labels']) and count($chartData['labels']) != 1)
  109. {
  110. $cfdChart = echarts
  111. (
  112. set::series($chartSeries),
  113. set::width('100%'),
  114. set::height(500),
  115. set::tooltip(array(
  116. 'trigger' => 'axis',
  117. 'axisPointer' => array('type' => 'cross', 'label' => array('backgroundColor' => '#6a7985')),
  118. 'textStyle' => array('fontWeight' => 100),
  119. 'formatter' => "RAWJS<function(rowDatas){return window.randTipInfo(rowDatas);}>RAWJS"
  120. )),
  121. set::legend(array(
  122. 'data' => array_keys(array_reverse($chartData['line']))
  123. )),
  124. set::grid(array(
  125. 'left' => '3%',
  126. 'right' => '5%',
  127. 'bottom' => '3%',
  128. 'containLabel' => true
  129. )),
  130. set::xAxis(array(array(
  131. 'type' => 'category',
  132. 'boundaryGap' => false,
  133. 'data' => $chartData['labels'],
  134. 'name' => $lang->execution->burnXUnit,
  135. 'axisLine' => array('show' => true, 'lineStyle' =>array('color' => '#999', 'width' =>1))
  136. ))),
  137. set::yAxis(array(array(
  138. 'type' => 'value',
  139. 'name' => $lang->execution->count,
  140. 'minInterval' => 1,
  141. 'nameTextStyle' => array('fontWeight' => 'normal'),
  142. 'axisPointer' => array('label' => array('show' => true, 'precision' => 0)),
  143. 'axisLine' => array('show' => true, 'lineStyle' => array('color' => '#999', 'width' => 1))
  144. )))
  145. );
  146. }
  147. else
  148. {
  149. $cfdChart = div
  150. (
  151. setClass('table-empty-tip text-center'),
  152. span
  153. (
  154. setClass('text-gray'),
  155. $lang->execution->noPrintData
  156. )
  157. );
  158. }
  159. panel
  160. (
  161. set::headingClass('justify-center'),
  162. set::title(
  163. $executionName . ' - ' . zget($lang->execution->cfdTypeList, $type) . $lang->execution->CFD
  164. ),
  165. to::heading
  166. (
  167. icon
  168. (
  169. 'help',
  170. setClass('mt-2 cfd-help'),
  171. set('data-toggle', 'tooltip'),
  172. set('id', 'cfdHover')
  173. )
  174. ),
  175. set::titleClass('text-lg font-bold mt-2'),
  176. $cfdChart
  177. );
  178. render();