objInfo.ss.jsp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <html>
  2. <head>
  3. </head>
  4. <body>
  5. <%-- 查看页统一使用新UI选项卡。Lin --%>
  6. <tab.ss name="baseInfo,child"/>
  7. <jsp.ss file="/ss/tabState.jsp"/>
  8. <%-- 页脚 initVue.js 会统一挂载 #app;查看页组件必须使用独立根节点,避免重复挂载后丢失页签事件。 --%>
  9. <div id="app" style="display:none"></div>
  10. <div id="objInfoApp">
  11. <div class="project-edit-container">
  12. <ss-sub-tab
  13. :menu-list="tabConfig"
  14. :active-menu="initialActiveMenu"
  15. @menu-change="handleMenuChange"
  16. :left-display="leftDisplay"
  17. :footer-buttons="footerButtons"
  18. />
  19. </div>
  20. </div>
  21. <script type="text/javascript">
  22. window.objInfoTabItems = [];
  23. <rpt.ss name="${tabList}" id="item">
  24. window.objInfoTabItems.push({
  25. url: "<varServ.ss name='${item.servName}' dest='${item.dest}' parm='${item.parm}'/>",
  26. title: "${item.desc}",
  27. name: "${item.name}",
  28. width: "${item.width}",
  29. height: "${item.height}",
  30. minHeight: "${item.minHeight}",
  31. maxHeight: "${item.maxHeight}",
  32. iconName: "${item.iconName}",
  33. pobj: "${item.pobj}",
  34. cobj: "${item.cobj}"
  35. });
  36. </rpt.ss>
  37. window.objInfoNextTabIndex = Number("<txt.ss val='${ssNextTabNo}'/>");
  38. window.objInfoTabHeight = <txt.ss val="${tabHeight}"/> || {};
  39. function objInfoFitHeight() {
  40. const iframe = document.querySelector("#sub-tab-iframe");
  41. const param = window.objInfoTabHeight || {};
  42. let fit = "";
  43. if (param.minHeight)
  44. fit += "min:" + param.minHeight + ",";
  45. if (param.maxHeight)
  46. fit += "max:" + param.maxHeight + ",";
  47. if (iframe && fit)
  48. iframe.setAttribute("ssFith", fit.slice(0, -1));
  49. if (typeof window.initWdFitHeight === "function")
  50. window.initWdFitHeight(33);
  51. }
  52. </script>
  53. <script type="text/javascript">var wdRecordValue='${wdRecordValue}';</script>
  54. <script type="text/javascript" src="/ss/js/wdRecord.js"></script>
  55. <script type="text/javascript">(function(){wdRecord("objInfo");})();</script>
  56. <script type="text/javascript" src="/ss/js/wdFitHeight.js"></script>
  57. <script type="text/javascript">initWdFitHeight(33)</script>
  58. <script type="text/javascript">initWdFitHeightFunction=function(){initWdFitHeight(33);};</script>
  59. <script type="text/javascript">
  60. tokenCleanser("<varServ.ss name='clearPageToken'/>", {
  61. tokenList: "<%= pageContext.getAttribute(ss.page.PageC.PAGE_tokenList)%>"
  62. });
  63. </script>
  64. <script type="module">
  65. const tabConfig = window.objInfoTabItems.map(tab => ({
  66. ...tab,
  67. cgxList: false
  68. }));
  69. const requestedIndex = Number(window.objInfoNextTabIndex);
  70. const initialActiveMenu = Number.isInteger(requestedIndex) && requestedIndex > 0
  71. ? (tabConfig[requestedIndex - 1] || {}).title || ""
  72. : "";
  73. const data = {
  74. tabConfig,
  75. initialActiveMenu,
  76. leftDisplay: true,
  77. footerButtons: [
  78. {
  79. iconName: "icon-close",
  80. text: "关闭",
  81. onclick: function () {
  82. wd.display.closeDialog();
  83. }
  84. }
  85. ]
  86. };
  87. SS.ready(function () {
  88. const app = window.SS.dom.initializeFormApp({
  89. el: "#objInfoApp",
  90. data() {
  91. return data;
  92. },
  93. methods: {
  94. handleMenuChange(menu) {
  95. setTimeout(objInfoFitHeight, 0);
  96. },
  97. async showTagState(url) {
  98. const tokenList = this.tabConfig.map(tab => {
  99. const match = /(?:[?&])ssToken=([^&]+)/.exec(tab.url);
  100. return match ? match[1] : null;
  101. });
  102. try {
  103. const response = await $.post(url, {
  104. tokenList: JSON.stringify(tokenList)
  105. });
  106. const result = typeof response === "string"
  107. ? JSON.parse(response)
  108. : response;
  109. this.tabConfig = this.tabConfig.map((tab, index) => {
  110. if (!result || !result[index])
  111. return tab;
  112. return {
  113. ...tab,
  114. cgxList: result[index].cgxList === true
  115. };
  116. });
  117. } catch (error) {
  118. console.error("获取标签状态失败", error);
  119. }
  120. }
  121. },
  122. mounted() {
  123. setTimeout(objInfoFitHeight, 0);
  124. this.showTagState("<varServ.ss name='wrTabState' parm='{ssObjName:\"${ssObjName}\",ssObjId:\"${ssObjId}\",\"${ssObjIdName}\":\"${ssObjId}\",dataType:\"${dataType}\"}'/>");
  125. }
  126. });
  127. window.SS.dom.currentApp = app;
  128. (function enableObjInfoMenuModeButton() {
  129. try {
  130. if (wd && wd.display && wd.display.enableSsSubTabMenuModeButton
  131. && wd.display.enableSsSubTabMenuModeButton()) {
  132. return;
  133. }
  134. } catch (error) {
  135. console.log(error);
  136. }
  137. setTimeout(enableObjInfoMenuModeButton, 200);
  138. })();
  139. setTimeout(objInfoFitHeight, 200);
  140. setTimeout(objInfoFitHeight, 800);
  141. });
  142. </script>
  143. </body>
  144. </html>