| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <html>
- <head>
- <style>
- html,
- body,
- #objInfoApp {
- height: 100%;
- }
- #objInfoApp {
- overflow: hidden;
- }
- </style>
- </head>
- <body>
- <%-- 查看页统一使用新UI选项卡。Lin --%>
- <tab.ss name="baseInfo,child"/>
- <jsp.ss file="/ss/tabState.jsp"/>
- <%-- 页脚 initVue.js 会统一挂载 #app;查看页组件必须使用独立根节点,避免重复挂载后丢失页签事件。 --%>
- <div id="app" style="display:none"></div>
- <div id="objInfoApp">
- <div class="project-edit-container">
- <ss-sub-tab
- :menu-list="tabConfig"
- :active-menu="initialActiveMenu"
- @menu-change="handleMenuChange"
- :left-display="leftDisplay"
- :footer-buttons="footerButtons"
- />
- </div>
- </div>
- <script type="text/javascript">
- window.objInfoTabItems = [];
- <rpt.ss name="${tabList}" id="item">
- window.objInfoTabItems.push({
- url: "<varServ.ss name='${item.servName}' dest='${item.dest}' parm='${item.parm}'/>",
- title: "${item.desc}",
- name: "${item.name}",
- width: "${item.width}",
- height: "${item.height}",
- minHeight: "${item.minHeight}",
- maxHeight: "${item.maxHeight}",
- iconName: "${item.iconName}",
- pobj: "${item.pobj}",
- cobj: "${item.cobj}"
- });
- </rpt.ss>
- window.objInfoNextTabIndex = Number("<txt.ss val='${ssNextTabNo}'/>");
- window.objInfoTabHeight = <txt.ss val="${tabHeight}"/> || {};
- function objInfoFitDialogToViewport() {
- if (!wd || !wd.display || typeof wd.display.getwdDialogWindows !== "function")
- return;
- const dialog = wd.display.getwdDialogWindows();
- if (!dialog || typeof dialog.getDimension !== "function")
- return;
- const dimension = dialog.getDimension();
- const maxWidth = Math.max(320, wd.topWindow.innerWidth - 20);
- const maxHeight = Math.max(320, wd.topWindow.innerHeight - 20);
- const width = Math.min(dimension[0], maxWidth);
- const height = Math.min(dimension[1], maxHeight);
- if (width === dimension[0] && height === dimension[1])
- return;
- dialog.setDimension(width, height);
- dialog.keepInViewport(true);
- dialog.center();
- }
- function objInfoFitHeight() {
- const iframe = document.querySelector("#sub-tab-iframe");
- const param = window.objInfoTabHeight || {};
- let fit = "";
- if (param.minHeight)
- fit += "min:" + param.minHeight + ",";
- if (param.maxHeight)
- fit += "max:" + param.maxHeight + ",";
- if (iframe && fit)
- iframe.setAttribute("ssFith", fit.slice(0, -1));
- if (typeof window.initWdFitHeight === "function")
- window.initWdFitHeight(33);
- }
- </script>
- <script type="text/javascript">var wdRecordValue='${wdRecordValue}';</script>
- <script type="text/javascript" src="/ss/js/wdRecord.js"></script>
- <script type="text/javascript">(function(){wdRecord("objInfo");})();</script>
- <script type="text/javascript" src="/ss/js/wdFitHeight.js"></script>
- <script type="text/javascript">initWdFitHeight(33)</script>
- <script type="text/javascript">initWdFitHeightFunction=function(){initWdFitHeight(33);};</script>
- <script type="text/javascript">
- tokenCleanser("<varServ.ss name='clearPageToken'/>", {
- tokenList: "<%= pageContext.getAttribute(ss.page.PageC.PAGE_tokenList)%>"
- });
- </script>
- <script type="module">
- const tabConfig = window.objInfoTabItems.map(tab => ({
- ...tab,
- cgxList: false
- }));
- const requestedIndex = Number(window.objInfoNextTabIndex);
- const initialActiveMenu = Number.isInteger(requestedIndex) && requestedIndex > 0
- ? (tabConfig[requestedIndex - 1] || {}).title || ""
- : "";
- const data = {
- tabConfig,
- initialActiveMenu,
- leftDisplay: true,
- footerButtons: [
- {
- iconName: "icon-close",
- text: "关闭",
- onclick: function () {
- wd.display.closeDialog();
- }
- }
- ]
- };
- SS.ready(function () {
- const app = window.SS.dom.initializeFormApp({
- el: "#objInfoApp",
- data() {
- return data;
- },
- methods: {
- handleMenuChange(menu) {
- setTimeout(objInfoFitHeight, 0);
- },
- async showTagState(url) {
- const tokenList = this.tabConfig.map(tab => {
- const match = /(?:[?&])ssToken=([^&]+)/.exec(tab.url);
- return match ? match[1] : null;
- });
- try {
- const response = await $.post(url, {
- tokenList: JSON.stringify(tokenList)
- });
- const result = typeof response === "string"
- ? JSON.parse(response)
- : response;
- this.tabConfig = this.tabConfig.map((tab, index) => {
- if (!result || !result[index])
- return tab;
- return {
- ...tab,
- cgxList: result[index].cgxList === true
- };
- });
- } catch (error) {
- console.error("获取标签状态失败", error);
- }
- }
- },
- mounted() {
- setTimeout(objInfoFitDialogToViewport, 0);
- setTimeout(objInfoFitHeight, 0);
- this.showTagState("<varServ.ss name='wrTabState' parm='{ssObjName:\"${ssObjName}\",ssObjId:\"${ssObjId}\",\"${ssObjIdName}\":\"${ssObjId}\",dataType:\"${dataType}\"}'/>");
- }
- });
- window.SS.dom.currentApp = app;
- (function enableObjInfoMenuModeButton() {
- try {
- if (wd && wd.display && wd.display.enableSsSubTabMenuModeButton
- && wd.display.enableSsSubTabMenuModeButton()) {
- return;
- }
- } catch (error) {
- console.log(error);
- }
- setTimeout(enableObjInfoMenuModeButton, 200);
- })();
- setTimeout(objInfoFitHeight, 200);
- setTimeout(objInfoFitHeight, 800);
- setTimeout(objInfoFitDialogToViewport, 200);
- setTimeout(objInfoFitDialogToViewport, 800);
- });
- </script>
- </body>
- </html>
|