2024-07-29 15:24:45 +08:00
|
|
|
<main id="js-page-content" role="main" class="page-content">
|
2024-08-08 17:59:54 +08:00
|
|
|
|
2024-07-29 15:24:45 +08:00
|
|
|
<div class="row">
|
2024-08-08 17:59:54 +08:00
|
|
|
<div class="d-flex mb-2">
|
|
|
|
<h1 class="p-2 mb-0">太陽能管理</h1>
|
|
|
|
<button
|
|
|
|
class="btn btn-info btn-m-s btn-sm"
|
|
|
|
id="backButton"
|
|
|
|
onclick="goback()"
|
|
|
|
>回上一頁</button>
|
|
|
|
</div>
|
|
|
|
<div class="col-sm-12 col-xl-12">
|
2024-07-29 15:24:45 +08:00
|
|
|
<div id="pageIframe" ></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
$(function () {
|
|
|
|
initPage();
|
|
|
|
});
|
|
|
|
|
|
|
|
function initPage() {
|
2024-08-08 17:59:54 +08:00
|
|
|
// 初始載入 iframe
|
|
|
|
$('#pageIframe').html(`
|
|
|
|
<iframe id="solarIframe" src="/ord?file:^Solar/Site.px|view:?fullScreen=true"
|
|
|
|
width="100%"
|
|
|
|
height="800"
|
|
|
|
class="border-0"
|
|
|
|
>
|
|
|
|
</iframe>
|
|
|
|
`);
|
|
|
|
|
|
|
|
$('#solarIframe').on('load', function() {
|
|
|
|
const iframe = this;
|
|
|
|
const currentUrl = iframe.contentWindow.location.href;
|
|
|
|
console.log("currentUrl",currentUrl)
|
2024-07-29 15:24:45 +08:00
|
|
|
|
2024-08-08 17:59:54 +08:00
|
|
|
// 檢查 URL 是否包含 'solarEnergyItem'
|
|
|
|
if (currentUrl.includes('solarEnergyItem')) {
|
|
|
|
// 解析 URL 的查詢參數
|
|
|
|
const queryString = currentUrl.split('?')[1];
|
|
|
|
const urlParams = new URLSearchParams(queryString);
|
|
|
|
const siteId = urlParams.get('siteId');
|
|
|
|
|
|
|
|
if (siteId) {
|
|
|
|
sessionStorage.setItem('siteId', siteId);
|
|
|
|
} else {
|
|
|
|
console.log('未找到 siteId 參數');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
console.log('當前 URL 不包含期望的結構');
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
2024-07-29 15:24:45 +08:00
|
|
|
|
2024-08-08 17:59:54 +08:00
|
|
|
function goback() {
|
|
|
|
sessionStorage.removeItem('siteId');
|
|
|
|
// 回復到初始頁面
|
|
|
|
initPage();
|
|
|
|
}
|
2024-07-29 15:24:45 +08:00
|
|
|
</script>
|