diff --git a/js/car_demand_plan/child/apply_plan_detail.js b/js/car_demand_plan/child/apply_plan_detail.js index d537666..dc714b0 100644 --- a/js/car_demand_plan/child/apply_plan_detail.js +++ b/js/car_demand_plan/child/apply_plan_detail.js @@ -584,8 +584,63 @@ function check() { openIframeByParamObj("check", "审核", "./audit_form.html", "40%", "50%", objParam, 1); } -function closePage() { - let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引 - window.parent.queryTable(1); - parent.layer.close(index); // 再执行关闭 +// 关闭页面 +function closePage(type) { + + try { + // 1️⃣ Layui iframe 弹窗关闭 + if (window.parent && window.parent.layer && window.name) { + let index = parent.layer.getFrameIndex(window.name); + if (index) { + if (type == 1) { + try { + let frame = parent.document.getElementById('dispatchCarProDetail') + ?.getElementsByTagName("iframe")[0]; + if (frame && frame.contentWindow && frame.contentWindow.refreshAllData) { + frame.contentWindow.refreshAllData(); + } + } catch (e) { + } + } + parent.layer.close(index); + return; + } + } + + // 2️⃣ App WebView 关闭(优先) + if (isAppWebView()) { + // 安卓 App + if (window.android && window.android.closePage) { + window.android.closePage(); + return; + } + // iOS App + if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.closePage) { + window.webkit.messageHandlers.closePage.postMessage(null); + return; + } + // 兜底:返回上一页 + history.back(); + return; + } + + // 3️⃣ 普通浏览器关闭 + window.open('', '_self'); + window.close(); + + // 4️⃣ 如果关闭失败,返回上一页 + setTimeout(function () { + history.back(); + }, 100); + + } catch (e) { + console.error("关闭页面失败:", e); + history.back(); + } +} + +// 判断是否 App WebView +function isAppWebView() { + var ua = navigator.userAgent.toLowerCase(); + return ua.includes('wv') || ua.includes('webview') || ua.includes('android') || ua.includes('iphone'); } diff --git a/js/car_demand_plan/child/dispatch_car_detail.js b/js/car_demand_plan/child/dispatch_car_detail.js index b4bf619..62b3f16 100644 --- a/js/car_demand_plan/child/dispatch_car_detail.js +++ b/js/car_demand_plan/child/dispatch_car_detail.js @@ -533,16 +533,61 @@ function reloadAuditData() { // 关闭页面 function closePage(type) { - if (token) { - // 如果没有 token,直接关闭整个窗口 + try { + // 1️⃣ Layui iframe 弹窗关闭 + if (window.parent && window.parent.layer && window.name) { + let index = parent.layer.getFrameIndex(window.name); + if (index) { + if (type == 1) { + try { + let frame = parent.document.getElementById('dispatchCarProDetail') + ?.getElementsByTagName("iframe")[0]; + if (frame && frame.contentWindow && frame.contentWindow.refreshAllData) { + frame.contentWindow.refreshAllData(); + } + } catch (e) { + } + } + parent.layer.close(index); + return; + } + } + + // 2️⃣ App WebView 关闭(优先) + if (isAppWebView()) { + // 安卓 App + if (window.android && window.android.closePage) { + window.android.closePage(); + return; + } + // iOS App + if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.closePage) { + window.webkit.messageHandlers.closePage.postMessage(null); + return; + } + // 兜底:返回上一页 + history.back(); + return; + } + + // 3️⃣ 普通浏览器关闭 window.open('', '_self'); window.close(); - return; + + // 4️⃣ 如果关闭失败,返回上一页 + setTimeout(function () { + history.back(); + }, 100); + + } catch (e) { + console.error("关闭页面失败:", e); + history.back(); } - let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引 - if (type == 1) { - let frameId = parent.document.getElementById('dispatchCarProDetail').getElementsByTagName("iframe")[0]; - frameId.contentWindow.refreshAllData(); - } - parent.layer.close(index); // 再执行关闭 } + +// 判断是否 App WebView +function isAppWebView() { + var ua = navigator.userAgent.toLowerCase(); + return ua.includes('wv') || ua.includes('webview') || ua.includes('android') || ua.includes('iphone'); +} + diff --git a/page/car_demand_plan/child/apply_plan_detail.html b/page/car_demand_plan/child/apply_plan_detail.html index ba0ca6f..0e99a23 100644 --- a/page/car_demand_plan/child/apply_plan_detail.html +++ b/page/car_demand_plan/child/apply_plan_detail.html @@ -9,6 +9,169 @@ + diff --git a/page/car_demand_plan/child/dispatch_car_detail.html b/page/car_demand_plan/child/dispatch_car_detail.html index 7b9a162..eec6423 100644 --- a/page/car_demand_plan/child/dispatch_car_detail.html +++ b/page/car_demand_plan/child/dispatch_car_detail.html @@ -86,6 +86,169 @@ padding: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* 可选阴影 */ } + + + /* ================== 极致手机适配(不影响PC) ================== */ + @media screen and (max-width: 768px) { + + /* ===== 基础体验优化 ===== */ + body { + font-size: 13px; + background: #f7f8fa; + } + + #main-box { + padding: 0 6px; + } + + /* ===== 顶部固定区域优化 ===== */ + .fixed-header { + padding: 6px 8px; + background: #fff; + border-bottom: 1px solid #eee; + } + + #detail-box { + height: auto; + flex-wrap: wrap; + gap: 6px; + } + + #detail-box img { + width: 34px; + height: 34px; + } + + #titleName { + font-size: 15px !important; + line-height: 18px; + } + + #code { + font-size: 12px; + color: #888; + } + + #detail-box button { + height: 28px; + padding: 0 10px; + font-size: 12px; + border-radius: 4px; + } + + /* fixed-header 占位 */ + #layui-tab-brief { + margin-top: 95px; + } + + /* ===== Tab 更像手机 APP ===== */ + .layui-tab-brief { + height: 42px; + border-radius: 6px; + overflow-x: auto; + box-shadow: 0 1px 3px rgba(0,0,0,0.04); + } + + .layui-tab-title { + height: 42px !important; + } + + .layui-tab-title li { + font-size: 13px; + padding: 0 12px; + line-height: 42px; + } + + /* ===== 区块卡片化(只改视觉,不改结构) ===== */ + #plan-box, + #basic-box, + #file-box, + #supplier-box, + #dispatch-car-box, + #oper-record-box { + background: #fff; + border-radius: 8px; + margin: 10px 0; + padding: 8px; + box-shadow: 0 1px 4px rgba(0,0,0,0.05); + } + + .title p { + font-size: 14px; + font-weight: 600; + } + + /* ===== 表格体验优化(核心) ===== */ + #plan-table-box, + #basic-table, + #file-table-box, + #supplier-table-box, + #dispatch-car-table-box { + overflow-x: auto; + -webkit-overflow-scrolling: touch; + border-radius: 6px; + } + + table.classTable { + min-width: 680px; /* 横向滑动更舒服 */ + font-size: 12px; + border-collapse: collapse; + } + + table.classTable th, + table.classTable td { + padding: 6px 6px; + white-space: nowrap; + line-height: 1.4; + } + + table.classTable th { + background: #f5f7fa; + font-weight: 600; + } + + /* 第二张派车表稍微缩小 */ + #dispatch-car-table2 { + min-width: 650px; + } + + /* ===== 操作记录适配 ===== */ + .oper-info { + flex-direction: column; + gap: 6px; + } + + .oper-info img { + width: 26px; + height: 26px; + } + + .user-oper span { + font-size: 12px; + color: #555; + } + + .layui-timeline-title { + font-size: 13px; + } + + /* ===== 图片 & 附件适配 ===== */ + img { + max-width: 100%; + height: auto; + } + + /* ===== 滚动条优化(更像手机) ===== */ + ::-webkit-scrollbar { + height: 4px; + } + + ::-webkit-scrollbar-thumb { + background: rgba(0,0,0,0.15); + border-radius: 2px; + } + } +