From 7e275acee90c914685ca53f04ec6a4b74e46abbf Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 22 四月 2024 15:41:50 +0800 Subject: [PATCH] 112 --- Terra.YaoGan.Web/Terra.YaoGan.Web/checkbox.html | 68 ++++++++++++++++++++++++++------- 1 files changed, 53 insertions(+), 15 deletions(-) diff --git a/Terra.YaoGan.Web/Terra.YaoGan.Web/checkbox.html b/Terra.YaoGan.Web/Terra.YaoGan.Web/checkbox.html index d26cd5d..0622a96 100644 --- a/Terra.YaoGan.Web/Terra.YaoGan.Web/checkbox.html +++ b/Terra.YaoGan.Web/Terra.YaoGan.Web/checkbox.html @@ -17,6 +17,7 @@ padding: 0; width: 100%; height: 100%; + overflow: hidden; } </style> <script> @@ -30,37 +31,74 @@ } window.onload = function () { + init(); + } + + function init() { + var groups = ["2m褰卞儚", "16m褰卞儚", "妞嶈瑕嗙洊搴�"]; + var select = document.getElementById("select"); + + for (var i in groups) { + var groupName = groups[i]; + var item = SGWorld.ProjectTree.FindItem(groupName); + if (!item) continue; + SGWorld.ProjectTree.SetVisibility(item, false); + + var names = getLayers(groupName); + if (names.length) { + for (var i in names) { + var op = document.createElement("option"); + op.text = groupName + "\\" + names[i]; + if (0 == i) op.selected = true; + select.add(op); + } + } + } + + select.onchange = selectChanged; setImageLayer(); + } + + function getLayers(groupName) { + var item = SGWorld.ProjectTree.FindItem(groupName); + if (!item) return []; + + var names = []; + var id = SGWorld.ProjectTree.GetNextItem(item, 11); // 11-CHILD + while (id) { + var name = SGWorld.ProjectTree.GetItemName(id); + names.push(name); + + id = SGWorld.ProjectTree.GetNextItem(id, 13); // 13-NEXT + } + + return names; } function selectChanged(e) { setImageLayer(); } - function setImageLayer() { - var select = document.getElementById("select"); - var text = select.options[select.selectedIndex].text.replace("骞�", ""); + var lastItem = null; - var item = SGWorld.ProjectTree.FindItem("澶氭湡鏁版嵁"); - if (item) { - SGWorld.ProjectTree.SetVisibility(item, false); + function setImageLayer() { + if (lastItem) { + SGWorld.ProjectTree.SetVisibility(lastItem, false); + lastItem = null; } - item = SGWorld.ProjectTree.FindItem("澶氭湡鏁版嵁\\" + text); + var select = document.getElementById("select"); + var text = select.options[select.selectedIndex].text; + + var item = SGWorld.ProjectTree.FindItem(text); if (item) { SGWorld.ProjectTree.SetVisibility(item, true); + lastItem = item; } } </script> </head> <body> - <select id="select" style="width: 120px; text-align: center;" onchange="selectChanged(this);"> - <option selected="selected">2024骞�</option> - <option>2023骞�</option> - <option>2019骞�</option> - <option>2015骞�</option> - <option>2010骞�</option> - </select> - <object id="SGWorld" classid="CLSID:3a4f9199-65a8-11d5-85c1-0001023952c1"></object> + <select id="select" style="width: 170px; text-align: center;"></select><object id="SGWorld" classid="CLSID:3a4f9199-65a8-11d5-85c1-0001023952c1"></object> </body> </html> \ No newline at end of file -- Gitblit v1.9.3