index.ejs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <% include ../tender/tender_sub_menu.ejs %>
  2. <div class="panel-content">
  3. <div class="panel-title">
  4. <div class="title-main d-flex">
  5. <% include ../tender/tender_sub_mini_menu.ejs %>
  6. <div>
  7. <div class="d-inline-block">
  8. <div class="dropdown">
  9. <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="btnCurrentStage" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
  10. <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" id="optionSelectableStages"></div>
  11. </div>
  12. </div>
  13. <div class="d-inline-block">
  14. <ul class="nav nav-pills m-0">
  15. <li class="nav-item mr-1"><a href="#man-c" data-toggle="modal" data-target="#man-c" class=" btn btn-outline-primary btn-sm"><i class="fa fa-cog"></i> 通用报表</a></li>
  16. <li class="nav-item"><a href="#add-c" data-toggle="modal" data-target="#add-c" class=" btn btn-outline-primary btn-sm"><i class="fa fa-plus"></i> 定制报表</a></li>
  17. </ul>
  18. </div>
  19. </div>
  20. <div>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="content-wrap">
  25. <div class="c-header p-0"></div>
  26. <div class="c-body">
  27. <div class="row">
  28. <div class="col-auto pr-0" id="tree-view" style="width: 17%">
  29. <div class="sjs-height-1">
  30. <div class="text-center"></div>
  31. <ul id="rptTplTree" class="ztree"></ul>
  32. </div>
  33. </div>
  34. <div class="col-auto" id="main-view" style="width: 83%">
  35. <div class="resize-x" id="right-spr" r-Type="width" div1="#tree-view" div2="#main-view" title="调整大小" a-type="percent"><!--调整左右高度条--></div>
  36. <div class="toolsbar-f d-flex justify-content-between">
  37. <div class="print-toolsbar">
  38. <div class="panel">
  39. <div class="panel-body" id="print_div">
  40. <button class="btn btn-outline-primary btn-sm" type="button" onclick="rptPrintHelper.preview()">
  41. <i class="fa fa-print"></i><br>
  42. 打印 <span id="checkCountPrint" class="badge badge-primary">0</span>
  43. </button>
  44. </div>
  45. </div>
  46. <div class="panel">
  47. <div class="panel-body" id="export_div">
  48. <div class="btn-group" role="group" aria-label="Button group with nested dropdown">
  49. <button type="button" class="btn btn-outline-primary btn-sm" onclick="rptControlObj.checkAndGetExcel()"><i class="fa fa-file-excel-o"></i> Excel <span class="badge badge-secondary">0</span></button>
  50. <button type="button" class="btn btn-outline-primary btn-sm" id="show_excel_output_cfg" data-toggle="modal" data-target="#export_excel" style="display:none"></button>
  51. <button type="button" class="btn btn-outline-primary btn-sm" onclick="rptControlObj.getPDFEx()"><i class="fa fa-file-pdf-o"></i> PDF <span class="badge badge-primary">0</span></button>
  52. </div>
  53. </div>
  54. <div class="panel-foot text-muted">
  55. 导出报表
  56. </div>
  57. </div>
  58. <div class="panel">
  59. <div class="panel-body">
  60. <div class="btn-group" role="group" aria-label="Button group with nested dropdown">
  61. <div class="btn-group" role="group">
  62. <button id="btnRptOrientation" type="button" class="btn btn-outline-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">纵向</button>
  63. <div class="dropdown-menu" aria-labelledby="btnGroupDrop1">
  64. <a class="dropdown-item" id="hrefRptOrientation" style="cursor:pointer" onclick="zTreeOprObj.changeOrientation(this)">横向</a>
  65. </div>
  66. </div>
  67. <div class="btn-group" role="group">
  68. <button id="btnRptPageSize" type="button" class="btn btn-outline-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">A4</button>
  69. <div class="dropdown-menu" aria-labelledby="btnGroupDrop1">
  70. <a class="dropdown-item" id="hrefRptPageSize" style="cursor:pointer" onclick="zTreeOprObj.changePageSize(this)">A3</a>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <div class="panel-foot text-muted">
  76. 预览设置
  77. </div>
  78. </div>
  79. <!--
  80. <div class="panel">
  81. <div class="panel-body">
  82. <div class="btn-group" role="group">
  83. <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="缩小" onclick="zTreeOprObj.scaleReport(-0.25)">-</button>
  84. <button id="btnNormalScale" class="btn btn-outline-primary btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="重置默认大小" onclick="zTreeOprObj.scaleReport(0)">100%</button>
  85. <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="放大" onclick="zTreeOprObj.scaleReport(0.25)">+</button>
  86. </div>
  87. </div>
  88. <div class="panel-foot text-muted">
  89. 缩放
  90. </div>
  91. </div>
  92. -->
  93. <div class="panel">
  94. <div class="panel-body">
  95. <div class="btn-group" role="group" aria-label="Button group with nested dropdown">
  96. <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="modal" data-target="#paper" onclick="zTreeOprObj.renderRptCfg(CUST_CFG)"><i class="fa fa-file-o"></i> 纸张</button>
  97. <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="modal" data-target="#format" onclick="zTreeOprObj.renderRptCfg(CUST_CFG)"><i class="fa fa-bold"></i> 格式</button>
  98. </div>
  99. </div>
  100. <div class="panel-foot text-muted">
  101. 报表设置
  102. </div>
  103. </div>
  104. <div class="panel" id="pnl_eSignature">
  105. <div class="panel-body">
  106. <button class="btn btn-outline-primary btn-sm" type="button" data-toggle="modal" data-target="#eSignature" onclick="rptSignatureHelper.resetESignature(zTreeOprObj.currentRptPageRst)">
  107. <i class="fa fa-pencil"></i><br>
  108. 电子签名
  109. </button>
  110. </div>
  111. </div>
  112. <div class="panel">
  113. <div class="panel-body">
  114. <div class="input-group input-group-sm">
  115. <div class="input-group-prepend">
  116. <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="上一页" onclick="rptControlObj.prePage(this)"><i class="fa fa-chevron-left"></i></button>
  117. </div>
  118. <input class="form-control form-control-sm" id="rpt_page_num" value="1/10" onKeydown="rptControlObj.onKeydown(event, this)" style="width:60px" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="输入页码按回车键,快速跳转">
  119. <div class="input-group-append">
  120. <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="下一页" onclick="rptControlObj.nextPage(this)"><i class="fa fa-chevron-right"></i></button>
  121. </div>
  122. </div>
  123. </div>
  124. <div class="panel-foot text-muted">
  125. 翻页
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. <div class="baobiao-close-side">
  131. <a href="javascript:void(0)" title="收起侧栏" onclick="collapseRptTreeMenu(this)"><i class="fa fa-chevron-left"></i></a>
  132. <!-- <a href="#" title="展开侧栏"><i class="fa fa-chevron-right"></i></a> -->
  133. </div>
  134. <div class="sjs-height-4">
  135. <div class="print-view form-view">
  136. <div class="pageContainer">
  137. <canvas id="rptCanvas" height="820" width="920"></canvas>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. <script src="/public/js/sub_menu.js"></script>
  147. <script src="/public/js/div_resizer.js"></script>
  148. <script>
  149. $.subMenu({
  150. menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
  151. toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
  152. key: 'menu.1.0.0',
  153. miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
  154. callback: function (info) {
  155. if (info.mini) {
  156. $('.panel-title').addClass('fluid');
  157. $('#sub-menu').removeClass('panel-sidebar');
  158. } else {
  159. $('.panel-title').removeClass('fluid');
  160. $('#sub-menu').addClass('panel-sidebar');
  161. }
  162. autoFlashHeight();
  163. }
  164. });
  165. $.divResizer({
  166. select: '#right-spr',
  167. callback: function () {
  168. autoFlashHeight();
  169. }
  170. });
  171. </script>
  172. <script type="text/javascript"> autoFlashHeight();</script>
  173. <script type="text/javascript" src="/public/jspdf/jspdf.min.js"></script>
  174. <script src="/public/js/datepicker/datepicker.min.js"></script>
  175. <script src="/public/js/datepicker/datepicker.zh.js"></script>
  176. <!-- zTree -->
  177. <script type="text/javascript" src="/public/js/ztree/jquery.ztree.core.js"></script>
  178. <script type="text/javascript" src="/public/js/ztree/jquery.ztree.excheck.js"></script>
  179. <!--
  180. -->
  181. <script type="text/javascript" src="/public/js/rpt_tpl_def.js"></script>
  182. <script type="text/javascript" src="/public/js/common_ajax.js"></script>
  183. <script type="text/javascript" src="/public/js/treeDataHelper.js"></script>
  184. <script type="text/javascript" src="/public/js/string_util_light.js"></script>
  185. <script type="text/javascript" src="/public/js/ztree_common.js"></script>
  186. <script type="text/javascript" src="/public/js/storageUtil.js"></script>
  187. <script type="text/javascript" src="/public/report/js/rpt_main.js"></script>
  188. <script type="text/javascript" src="/public/report/js/rpt_cfg_const.js"></script>
  189. <script type="text/javascript" src="/public/report/js/jpc_output_value_define.js"></script>
  190. <script type="text/javascript" src="/public/report/js/jpc_output.js"></script>
  191. <script type="text/javascript" src="/public/report/js/rpt_print.js"></script>
  192. <script type="text/javascript" src="/public/report/js/rpt_signature.js"></script>
  193. <script type="text/javascript" src="/public/report/js/rpt_jspdf.js"></script>
  194. <script type="text/javascript">
  195. const TOP_TREE_NODES = <%- rpt_tpl_data %>;
  196. let CUST_CFG = <%- cust_cfg %>;
  197. CUST_CFG = JSON.parse(CUST_CFG[0].cfg_content);
  198. const PROJECT_ID = <%- project_id %>;
  199. const TENDER_ID = <%- tender_id %>;
  200. const TENDER_NAME = '<%- tender_name %>';
  201. const STAGE_ID = <%- stg_id %>;
  202. const STAGE_ORDER = <%- stg_order %>;
  203. const CUR_ORDER = <%- cur_order %>;
  204. const STAGE_TIMES = <%- stg_times %>;
  205. const STAGE_LIST = <%- stage_list %>;
  206. const PRJ_ACCOUNT_LIST = <%- prj_account_list %>;
  207. const ROLE_LIST = <%- role_list %>;
  208. const STAGE_STATUS = <%- stg_status %>;
  209. let STAGE_AUDIT = [];
  210. let ROLE_REL_LIST = [];
  211. let CURRENT_ROLE_REL_ID = -1;
  212. let current_stage_order = -1;
  213. let current_stage_id = -1;
  214. let current_stage_times = -1;
  215. let current_stage_status = -1;
  216. if (STAGE_ORDER > 0) {
  217. current_stage_order = STAGE_ORDER;
  218. current_stage_id = STAGE_ID;
  219. current_stage_times = STAGE_TIMES;
  220. current_stage_status = STAGE_STATUS;
  221. } else if (STAGE_LIST.length > 0) {
  222. current_stage_order = STAGE_LIST[STAGE_LIST.length - 1].order;
  223. current_stage_id = STAGE_LIST[STAGE_LIST.length - 1].id;
  224. current_stage_times = STAGE_LIST[STAGE_LIST.length - 1].times;
  225. current_stage_status = STAGE_LIST[STAGE_LIST.length - 1].status;
  226. }
  227. buildStageSelection();
  228. setupSignature();
  229. const ORG_TOP_TREE_NODES = JSON.parse(JSON.stringify(TOP_TREE_NODES));
  230. for (let item of TOP_TREE_NODES) {
  231. item.items = JSON.parse(item.items);
  232. if (item.items && item.items.length > 0) {
  233. for (let dtlItem of item.items) {
  234. chkAndSetNode(dtlItem);
  235. }
  236. }
  237. }
  238. for (let item of ORG_TOP_TREE_NODES) {
  239. item.items = JSON.parse(item.items);
  240. if (item.items && item.items.length > 0) {
  241. for (let dtlItem of item.items) {
  242. chkAndSetNode(dtlItem);
  243. }
  244. }
  245. }
  246. buildTplTree();
  247. function chkAndSetNode(parentItem) {
  248. if (parentItem.nodeType === 1) {
  249. parentItem.isParent = true;
  250. }
  251. if (parentItem.items) {
  252. for (let dtlItem of parentItem.items) {
  253. chkAndSetNode(dtlItem);
  254. }
  255. }
  256. }
  257. const SCREEN_DPI = [];
  258. function getScreenDPI() {
  259. if (SCREEN_DPI.length === 0) {
  260. if (window.screen.deviceXDPI != undefined) {
  261. SCREEN_DPI.push(window.screen.deviceXDPI);
  262. SCREEN_DPI.push(window.screen.deviceYDPI);
  263. } else {
  264. let tmpNode = document.createElement("DIV");
  265. tmpNode.style.cssText = "width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden";
  266. document.body.appendChild(tmpNode);
  267. SCREEN_DPI.push(parseInt(tmpNode.offsetWidth));
  268. SCREEN_DPI.push(parseInt(tmpNode.offsetHeight));
  269. tmpNode.parentNode.removeChild(tmpNode);
  270. }
  271. }
  272. return SCREEN_DPI;
  273. }
  274. function buildTplTree() {
  275. if (TOP_TREE_NODES.length > 0) {
  276. //1. 整理模板树
  277. const individualNode = {id: 99999, name: '定制报表', pid: -1, rpt_type: 0, items: [], isParent: true};
  278. for (let tnIdx = TOP_TREE_NODES.length - 1; tnIdx >= 0; tnIdx--) {
  279. if (TOP_TREE_NODES[tnIdx].pid !== -1) {
  280. TOP_TREE_NODES[tnIdx].isParent = true;
  281. TOP_TREE_NODES[tnIdx].nodeType = 1;
  282. individualNode.items.push(TOP_TREE_NODES[tnIdx]);
  283. TOP_TREE_NODES.splice(tnIdx, 1);
  284. }
  285. }
  286. TOP_TREE_NODES.push(individualNode);
  287. //2. 原始的模板树(恢复用)
  288. const individualNodeOrg = {id: 99999, name: '定制报表', pid: -1, rpt_type: 0, items: [], isParent: true};
  289. for (let tnIdx = ORG_TOP_TREE_NODES.length - 1; tnIdx >= 0; tnIdx--) {
  290. if (ORG_TOP_TREE_NODES[tnIdx].pid !== -1) {
  291. ORG_TOP_TREE_NODES[tnIdx].isParent = true;
  292. ORG_TOP_TREE_NODES[tnIdx].nodeType = 1;
  293. individualNodeOrg.items.push(ORG_TOP_TREE_NODES[tnIdx]);
  294. ORG_TOP_TREE_NODES.splice(tnIdx, 1);
  295. }
  296. }
  297. ORG_TOP_TREE_NODES.push(individualNode);
  298. }
  299. }
  300. function buildStageSelection() {
  301. if (STAGE_LIST.length === 0) {
  302. $("#optionSelectableStages")[0].style.display = 'none';
  303. } else {
  304. $("#optionSelectableStages")[0].style.display = '';
  305. $("#btnCurrentStage")[0].innerText = '第' + current_stage_order + '期';
  306. $("#optionSelectableStages").empty();
  307. if (STAGE_LIST.length > 0) {
  308. for (let i = STAGE_LIST.length; i > 0; i--) {
  309. if (parseInt(STAGE_LIST[i - 1].order) !== current_stage_order) {
  310. const str = '<a class="dropdown-item" style="cursor:pointer" onclick="changeCurrentStage(this)" stg_id = "' + STAGE_LIST[i - 1].id + '" stg_order="' + STAGE_LIST[i - 1].order + '">第' + STAGE_LIST[i - 1].order + '期</a>';
  311. $("#optionSelectableStages").append(str);
  312. }
  313. }
  314. }
  315. }
  316. }
  317. function changeCurrentStage(ele) {
  318. // alert('you are selecting: ' + ele.innerText);
  319. current_stage_order = parseInt(ele.attributes.stg_order.value);
  320. current_stage_id = parseInt(ele.attributes.stg_id.value);
  321. // 调整当前stage times
  322. for (let i = STAGE_LIST.length; i > 0; i--) {
  323. if (parseInt(STAGE_LIST[i - 1].order) === current_stage_order) {
  324. current_stage_times = STAGE_LIST[i - 1].times;
  325. current_stage_status = STAGE_LIST[i - 1].status;
  326. break;
  327. }
  328. }
  329. buildStageSelection();
  330. setupSignature();
  331. //还有必要触发报表刷新!
  332. zTreeOprObj.onClick(null, null, zTreeOprObj.currentNode);
  333. }
  334. function setupSignature() {
  335. if (current_stage_status === 3) {
  336. $('#pnl_eSignature')[0].style.display = '';
  337. } else {
  338. $('#pnl_eSignature')[0].style.display = 'none';
  339. }
  340. }
  341. function setupDateFormat() {
  342. Date.prototype.Format = function (fmt) {
  343. let o = {
  344. "M+": this.getMonth() + 1, //月份
  345. "d+": this.getDate(), //日
  346. "h+": this.getHours(), //小时
  347. "m+": this.getMinutes(), //分
  348. "s+": this.getSeconds(), //秒
  349. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  350. "S": this.getMilliseconds() //毫秒
  351. };
  352. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  353. for (let k in o)
  354. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  355. return fmt;
  356. };
  357. }
  358. function collapseRptTreeMenu(dom) {
  359. const parentDom = $(dom).parent().parent();
  360. const brotherDom = parentDom.prev();
  361. const nextDom = $(dom).children();
  362. const left = $('#tree-view'), right = $('#main-view'), parent = left.parent();
  363. if (dom.title === '收起侧栏') {
  364. dom.title = '展开侧栏';
  365. brotherDom[0].style = 'display:none';
  366. left.hide();
  367. right.css('width', '100%');
  368. nextDom[0].className = 'fa fa-chevron-right';
  369. } else {
  370. dom.title = '收起侧栏';
  371. left.show();
  372. const percent = 100 - left.outerWidth() /parent.width() * 100;
  373. right.css('width', percent + '%');
  374. brotherDom[0].style = 'display:';
  375. nextDom[0].className = 'fa fa-chevron-left';
  376. }
  377. }
  378. setupDateFormat();
  379. rptTplObj.iniPage();
  380. </script>