Browse Source

fix(查看页): 恢复公共详情页签与内容

apple 17 hours ago
parent
commit
caaaa252fa
1 changed files with 159 additions and 58 deletions
  1. 159 58
      web/page/env/objInfo.ss.jsp

+ 159 - 58
web/page/env/objInfo.ss.jsp

@@ -1,58 +1,159 @@
-<html>
-<head>
-</head>
-<body>
-
-<%-- 改为 <data@ss name="obj"/>。Lin
-<tab@ss name=""/> --%>
-<%-- <data@ss name="obj"/> 再去掉,好像不需要。Lin --%>
-<tab.ss name="baseInfo,child"/>
-<%-- 改为 <jsp@ss file="/ss/tabState.jsp"/>。Lin
-<tab@ss name="tagState"/> --%>
-<jsp.ss file="/ss/tabState.jsp"/>
-
-<script>
-	function addWdFitHeight(selecter,param){
-		console.log(selecter);
-		console.log(param);
-		var aa="";
-		if(param.minHeight){
-			aa+="min:"+param.minHeight+",";
-		}
-		if(param.maxHeight){
-			aa+="max:"+param.maxHeight+",";
-		}
-		if(param&&aa){
-			aa=aa.substr(0,aa.length-1)
-			var fitTarget=document.querySelector(selecter)||document.querySelector("#sub-tab-iframe");
-			if(fitTarget)
-				fitTarget.setAttribute("ssFith",aa);	// ("wdFitHeight",。Lin
-		}
-	}
-</script>
-	
-<div class="tab-div">
-	<ul ssNormClazz="tab-normal" ssHovClazz="tab-hover" ssSelClazz="tab-selected">
-		<rpt.ss name="${tabList}" id="item">
-			<li name="${item.name}" <%-- wdTabSite="${item.wdTabSite}"。先去掉,用到再弄。好像是 个人选项卡 的东西。Lin --%>
-					_sizeinfo="width:${item.width},height:${item.height},minHeight:${item.minHeight}, maxHeight:${item.maxHeight}"
-					ssTabClick="<varServ.ss name='${item.service}' dest='${item.dest}' parm='${item.param}'/>">
-				${item.desc}
-			</li>
-		</rpt.ss>
-<%--
-<li name="sys_bd" wdTabClick='@service{name:"sq_cx",dest:"sq_cx",param:{dxid:"${dxid}"}}@'>变动</li>
---%>
-	</ul>
-</div>
-<div>
-	<iframe frameborder="none" name="ssTabIframe" width="100%" ></iframe>
-</div>
-
-<script>
-	var tabHeight=<txt.ss val="${tabHeight}"/>;
-	addWdFitHeight("[name=ssTabIframe]",tabHeight);	// ("[name=wdTabFrame]",。Lin
-</script>
-
-</body>
-</html>
+<html>
+<head>
+</head>
+<body>
+
+<%-- 查看页统一使用新UI选项卡。Lin --%>
+<tab.ss name="baseInfo,child"/>
+<jsp.ss file="/ss/tabState.jsp"/>
+
+<%-- 页脚 initVue.js 会统一挂载 #app;查看页组件必须使用独立根节点,避免重复挂载后丢失页签事件。 --%>
+<div id="app"></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 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(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);
+	});
+</script>
+
+</body>
+</html>