diff --git a/js/car_demand_plan/child/apply_plan_detail.js b/js/car_demand_plan/child/apply_plan_detail.js index dc714b0..d537666 100644 --- a/js/car_demand_plan/child/apply_plan_detail.js +++ b/js/car_demand_plan/child/apply_plan_detail.js @@ -584,63 +584,8 @@ function check() { openIframeByParamObj("check", "审核", "./audit_form.html", "40%", "50%", objParam, 1); } -// 关闭页面 -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'); +function closePage() { + let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引 + window.parent.queryTable(1); + parent.layer.close(index); // 再执行关闭 } diff --git a/js/car_demand_plan/child/dispatch_car_detail.js b/js/car_demand_plan/child/dispatch_car_detail.js index 62b3f16..1a36cf3 100644 --- a/js/car_demand_plan/child/dispatch_car_detail.js +++ b/js/car_demand_plan/child/dispatch_car_detail.js @@ -40,7 +40,6 @@ window.addEventListener("DOMContentLoaded", () => { function setParams(params) { objParam = JSON.parse(params); - console.log(params) $('#titleName').html(objParam.proName); $('#code').html(objParam.code); layui.use(["form", "table", 'upload', 'layer', 'element'], function () { @@ -123,9 +122,9 @@ function getAllOutList() { // 设置新的滚动位置 scrollableElement.scrollLeft += delta; }); - if (objParam.type === 1) { + if (objParam.type == 1) { $('#print').before(''); - } else if (objParam.type === 2) { + } else if (objParam.type == 2) { $('#print').before(''); } checkNowValue = id; @@ -530,64 +529,82 @@ function reloadAuditData() { getAllOutList(); } -// 关闭页面 +// 关闭页面 - PC/App 双兼容版 function closePage(type) { + // 第一步:判断运行环境(PC 还是 App/移动端) + function isMobileApp() { + const userAgent = navigator.userAgent.toLowerCase(); + // 匹配常见 App 浏览器特征(可根据你的实际 App 补充) + return /android|iphone|ipad|ipod|webos|mobile|micromessenger|qqbrowser|ucbrowser/.test(userAgent) + && !/windows nt|macintosh/.test(userAgent); // 排除 PC 端的移动端模拟 + } + + const isApp = isMobileApp(); try { - // 1️⃣ Layui iframe 弹窗关闭 - if (window.parent && window.parent.layer && window.name) { + // ========== PC 端逻辑(完全保留你原有代码,不改动) ========== + if (!isApp) { + if (token) { + window.open('', '_self'); + window.close(); + return; + } 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; + if (type == 1) { + let frameId = parent.document.getElementById('dispatchCarProDetail').getElementsByTagName("iframe")[0]; + frameId.contentWindow.refreshAllData(); } - } - - // 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(); + parent.layer.close(index); return; } - // 3️⃣ 普通浏览器关闭 - window.open('', '_self'); - window.close(); + // ========== App/移动端逻辑(适配策略) ========== + // 1. 优先尝试 layer 关闭(如果是 App 内 iframe 场景) + let index = -1; + try { + index = parent && parent.layer ? parent.layer.getFrameIndex(window.name) : -1; + } catch (e) { + index = -1; + } - // 4️⃣ 如果关闭失败,返回上一页 - setTimeout(function () { - history.back(); - }, 100); + if (index > 0) { + // App 内 iframe 刷新逻辑(容错) + if (type == 1) { + try { + let frameContainer = parent.document.getElementById('dispatchCarProDetail'); + if (frameContainer && frameContainer.getElementsByTagName("iframe")[0]) { + frameContainer.getElementsByTagName("iframe")[0].contentWindow.refreshAllData(); + } + } catch (refreshErr) { + console.log('App端刷新父页面失败:', refreshErr); + } + } + parent.layer.close(index); + return; + } - } catch (e) { - console.error("关闭页面失败:", e); + // 2. App 独立窗口场景(放弃 window.close(),改用返回上一页) + if (!token) { + // 无 token 时:优先返回上一页(App 不支持 close()) + if (history.length > 1) { + history.back(); + // 可选:App 内提示(如果有 layer 则用,无则用原生) + (layui && layui.layer ? layui.layer : parent.layer).msg('已返回上一页', {time: 1000}); + } else { + // 无历史记录:提示手动关闭 + (layui && layui.layer ? layui.layer : parent.layer).msg('请手动关闭页面', {icon: 2, time: 2000}); + } + return; + } + + // 3. 有 token 时:直接返回上一页 history.back(); + + } catch (globalErr) { + // 全局容错:所有方式失败时,强制返回上一页 + console.error('关闭页面失败:', globalErr); + setTimeout(() => { + history.back(); + }, 500); } } - -// 判断是否 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 0e99a23..ba0ca6f 100644 --- a/page/car_demand_plan/child/apply_plan_detail.html +++ b/page/car_demand_plan/child/apply_plan_detail.html @@ -9,169 +9,6 @@ - diff --git a/page/car_demand_plan/child/dispatch_car_detail.html b/page/car_demand_plan/child/dispatch_car_detail.html index eec6423..7b9a162 100644 --- a/page/car_demand_plan/child/dispatch_car_detail.html +++ b/page/car_demand_plan/child/dispatch_car_detail.html @@ -86,169 +86,6 @@ 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; - } - } - diff --git a/page/car_demand_plan/child/dispatch_car_detail_app.html b/page/car_demand_plan/child/dispatch_car_detail_app.html new file mode 100644 index 0000000..7842b73 --- /dev/null +++ b/page/car_demand_plan/child/dispatch_car_detail_app.html @@ -0,0 +1,550 @@ + + + + + + + 派车录入详情-app + + + + + + + + +
+
+
+ +
+

+

+
+
+
+ + +
+
+
+ +
+
+
+ +

需求计划申请明细

+
+
+ + + + + + + + + + + +
序号类型名称规格单位需用量需用天数备注
+
+
+
+
+ +

派车资料

+
+
+ + + + + + + + + + + + + + + + + +
需求计划编号经办人派车日期
备注
+
+
+
+
+ +

附件文档

+
+
+ + + + + + + + +
文件名文件类型上传人员上传时间操作
+
+
+
+
+ +

供货供应商信息

+
+
+ + + + + + +
供应商名称派车数量预估金额
+
+
+
+
+ +

派车明细

+
+
+ + + + + + + + + + + + + + + + +
类型车型型号车牌吨位货物名称起运地目的地公里数单价
(元/吨*公里)
预估金额行驶证/挂靠协议
驾驶证/身份证/导航图
供应商
+ + + + + + + + + + + + + +
类型车型型号车牌使用地计划使用天数租赁单价预估金额操作证/
身份证/导航图
供应商
+
+
+ +
+
+ +

操作记录

+
+
+
+ +
+

8月18日

+
+
+
+ +
+
+
+ 王天峰(13787220576)项目管理中心 +
+
+ 完结-审核确认通过,共耗时:21小时16分钟 原因备注:无 +
+
+
+ 2020-12-23 22:31 +
+
+
+
+
+
+
+
+ + + + + + + + + +