diff --git a/js/car_demand_plan/child/apply_plan_detail.js b/js/car_demand_plan/child/apply_plan_detail.js index 6efcff2..0ec18d5 100644 --- a/js/car_demand_plan/child/apply_plan_detail.js +++ b/js/car_demand_plan/child/apply_plan_detail.js @@ -10,6 +10,38 @@ if (isPage) { // 首页跳转 setParams(obj); } +// 获取 URL 参数 +function getParamsFromUrl() { + const urlParams = new URLSearchParams(window.location.search); + const result = {}; + for (const [key, value] of urlParams.entries()) { + result[key] = value; + } + return result; +} + + +// 页面加载完成后执行 +window.addEventListener("DOMContentLoaded", () => { + const params = getParamsFromUrl(); + if (!params.token) { + return; + } + sessionStorage.setItem('gz-token', params.token); + let url = dataUrl + `backstage/carPlanAudit/getCarAuditById/${params.id}`; + ajaxRequest(url, "GET",{}, true, function () { + }, function (result) { + if (result.code === 200) { + result.data.checkType =2 + setParams(JSON.stringify(result.data)); + } else { + } + }, function (xhr, status, error) { + errorFn(xhr, status, error) + }, null); + +}); + function setParams(obj) { objParam = JSON.parse(obj); if (objParam.checkType === 2) { @@ -538,7 +570,7 @@ function withdrawData(data) { // 需求计划申请审核 function check() { objParam.checkType = '2'; // 需求计划申请审核 - openIframeByParamObj("check", "审核", "./audit_form.html", "40%", "50%", objParam); + openIframeByParamObj("check", "审核", "./audit_form.html", "40%", "50%", objParam,1); } function closePage() { diff --git a/js/car_demand_plan/child/dispatch_car_detail.js b/js/car_demand_plan/child/dispatch_car_detail.js index 54a0fcc..1f93e93 100644 --- a/js/car_demand_plan/child/dispatch_car_detail.js +++ b/js/car_demand_plan/child/dispatch_car_detail.js @@ -2,8 +2,43 @@ let objParam, dataObj; let form, table, upload, tableIns, layer, element; let pageNum = 1; let checkNowValue = ''; // 当前选中的批次 + +// 获取 URL 参数 +function getParamsFromUrl() { + const urlParams = new URLSearchParams(window.location.search); + const result = {}; + for (const [key, value] of urlParams.entries()) { + result[key] = value; + } + return result; +} + + +// 页面加载完成后执行 +window.addEventListener("DOMContentLoaded", () => { + const params = getParamsFromUrl(); + if (!params.token) { + return; + } + sessionStorage.setItem('gz-token', params.token); + let url = dataUrl + `backstage/dispatchCar/getNeedPlanById/${params.id}`; + ajaxRequest(url, "GET",{}, true, function () { + }, function (result) { + if (result.code === 200) { + result.data.type =2 + setParams(JSON.stringify(result.data)); + } else { + } + }, function (xhr, status, error) { + errorFn(xhr, status, error) + }, null); + +}); + + 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 () { @@ -46,7 +81,7 @@ function getAllOutList() { }, function (result) { if (result.code === 200) { if (result.data.length === 0 && objParam.type === 1) { - parent.layer.msg('暂无派车批次数据', { icon: 7 }); + parent.layer.msg('暂无派车批次数据', {icon: 7}); closePage(); } else if (result.data.length === 0 && objParam.type === 2) { closePage(1); @@ -58,6 +93,7 @@ function getAllOutList() { }, function (xhr, status, error) { errorFn(xhr, status, error) }, null); + // 详情批次数据/待审核批次数据 function setBatchData(dataList) { let html = '', id = '', status = '', type = ''; @@ -155,6 +191,7 @@ function getDispatchCarData(id) { }, function (xhr, status, error) { errorFn(xhr, status, error) }, null); + function setTableData(obj) { $('#planCode').html(objParam.code); @@ -164,7 +201,7 @@ function getDispatchCarData(id) { // 附件文档 setFileTable(obj.fileList); // 供应商信息 - let supInfoList = [{ supName: obj.supName, dispatchNum: obj.dispatchNum, money: obj.money }]; + let supInfoList = [{supName: obj.supName, dispatchNum: obj.dispatchNum, money: obj.money}]; setSubInfos(supInfoList); // 操作记录 setOperRecordInfo(obj.recordList); @@ -241,8 +278,12 @@ function getDispatchCarData(id) { if (list && list.length > 0) { $.each(list, function (index, item) { let imgNum = 0; - imgNum += item.carImage.filter(item => { return item.type !== '6' }).length; - imgNum += item.driverUserImage.filter(item => { return item.type !== '6' }).length; + imgNum += item.carImage.filter(item => { + return item.type !== '6' + }).length; + imgNum += item.driverUserImage.filter(item => { + return item.type !== '6' + }).length; imgNum += item.fileList.length; html += "