reportchart.html.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. /**
  3. * The report view file of story module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2025 禅道软件(青岛)有限公司(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 story
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. h::css(<<<CSS
  12. .module-menu .tree-item > .selected .item-content {color: var(--menu-selected-color) !important; background-color: var(--color-primary-50);}
  13. .module-menu .tree-item .item-content {padding: 4px;}
  14. #mainContainer, #mainContent {min-height: calc(100vh - 3rem);}
  15. CSS
  16. );
  17. $moduleList = array();
  18. foreach($lang->story->report->typeList as $code => $module)
  19. {
  20. $moduleList[$code] = (object)array(
  21. 'key' => $code,
  22. 'id' => $code,
  23. 'name' => $module,
  24. 'parent' => 0,
  25. 'url' => createLink('story', 'report', "productID=$productID&branchID=$branchID&storyType=$storyType&browseType=$browseType&moduleID=$moduleID&chartType=$code&projectID=$projectID"),
  26. );
  27. }
  28. detailHeader(to::title
  29. (
  30. div
  31. (
  32. setClass('clip'),
  33. span
  34. (
  35. setClass('font-bold'),
  36. $lang->story->report->tpl->filter
  37. ),
  38. span
  39. (
  40. set::title($filterDetail),
  41. $filterDetail
  42. )
  43. )
  44. ), hasPriv('report', 'export') ? to::suffix(
  45. btn
  46. (
  47. set(array(
  48. 'type' => 'primary',
  49. 'text' => $lang->export,
  50. 'url' => createLink('story', 'exportchart', array('executionID' => $projectID, 'productID' => $productID, 'browseType' => $browseType, 'moduleID' => $moduleID, 'type' => $chartType)),
  51. 'data-toggle' => 'modal',
  52. 'data-size' => 'sm'
  53. ))
  54. )
  55. ) : null);
  56. $staticData->editCanvasConfig->theme = 'light';
  57. $staticData->editCanvasConfig->previewScaleType = 'top';
  58. $staticDataJson = str_replace(array('&quot;', '&#039;'), array("\\\&quot;", "\&#039;"), json_encode($staticData));
  59. div
  60. (
  61. setClass('flex flex-nowrap'),
  62. setStyle(array('height' => 'calc(100vh - 8rem)')),
  63. cell
  64. (
  65. set::width('200'),
  66. moduleMenu
  67. (
  68. set::moduleName('story'),
  69. set::title($lang->story->report->notice),
  70. set::modules($moduleList),
  71. set::showDisplay(false),
  72. set::toggleSidebar(false),
  73. set::activeKey($chartType),
  74. set::closeLink('')
  75. )
  76. ),
  77. cell
  78. (
  79. setID('chartContainer'),
  80. set::flex('1'),
  81. setClass('ml-4 bg-white px-2 py-2'),
  82. h4
  83. (
  84. setClass('mt-2 ml-1'),
  85. zget($lang->story->report->typeList, $chartType)
  86. ),
  87. h::iframe
  88. (
  89. setID('staticScreen'),
  90. set('width', '100%'),
  91. set('height', '95%'),
  92. set('scrolling', 'no'),
  93. set('frameborder', '0'),
  94. set('marginheight', '0'),
  95. set('src', createLink('screen', 'staticDataOld')),
  96. on::init()->do(<<<JS
  97. const iframe = document.getElementById('staticScreen');
  98. iframe.onload = function()
  99. {
  100. const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
  101. iframe.contentWindow.setStaticData('{$staticDataJson}', {width: iframe.offsetWidth});
  102. const style = document.createElement('style');
  103. style.textContent = 'body {background-color: #fff !important;}';
  104. iframeDoc.head.appendChild(style);
  105. };
  106. JS
  107. )
  108. )
  109. )
  110. );