From c15ecca0baaebe0fb88fafa9469c998e36c0657d Mon Sep 17 00:00:00 2001 From: jiang Date: Wed, 9 Jul 2025 18:58:24 +0800 Subject: [PATCH] 1 --- js/car_demand_plan/child/apply_plan_detail.js | 34 ++++++++- .../child/dispatch_car_detail.js | 74 ++++++++++++++++--- 2 files changed, 96 insertions(+), 12 deletions(-) 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 += "" + "" + objParam.typeName + "" + @@ -273,8 +314,12 @@ function getDispatchCarData(id) { if (list && list.length > 0) { $.each(list, function (index, item) { let imgNum = 0; - imgNum += item.driverUserImage.filter(item => { return item.type === '2' || item.type === '3' }).length; - imgNum += item.operaImage.filter(item => { return item.type === '2' || item.type === '3' || item.type === '6' }).length; + imgNum += item.driverUserImage.filter(item => { + return item.type === '2' || item.type === '3' + }).length; + imgNum += item.operaImage.filter(item => { + return item.type === '2' || item.type === '3' || item.type === '6' + }).length; imgNum += item.fileList.length; html += '' + '' + item.type + '' + @@ -321,7 +366,8 @@ function getDispatchCarData(id) { creator = item.userName; } let remark = setNullValue(item.auditRemark); - let dept = '',operData = '';; // auditType 1.提交 2.审核 auditStatus:1.审核通过 2.审核驳回 + let dept = '', operData = ''; + ; // auditType 1.提交 2.审核 auditStatus:1.审核通过 2.审核驳回 if (parseInt(item.auditType) === 1) { dept = '供应商'; } else if (parseInt(item.auditType) === 2) { @@ -432,13 +478,19 @@ function print() { // 审核派车录入数据 function auditData(id, type) { - let obj = { id: dataObj.id, checkType: '1', planId: dataObj.planId, contractId: dataObj.contractId, supId: dataObj.supId }; - openIframeByParamObj("auditData", "审核", "./audit_form.html", "40%", "50%", obj); + let obj = { + id: dataObj.id, + checkType: '1', + planId: dataObj.planId, + contractId: dataObj.contractId, + supId: dataObj.supId + }; + openIframeByParamObj("auditData", "审核", "./audit_form.html", "40%", "50%", obj,1); } // 修改派车录入数据 function updateData(id, type) { - let obj = { id: id, type: type, proName: objParam.proName, code: objParam.code,supId: objParam.supId}; + let obj = {id: id, type: type, proName: objParam.proName, code: objParam.code, supId: objParam.supId}; openIframeByParamObj2("updateData", "派车信息修改", "../car_demand_plan/child/dispatch_car_edit_form.html", "92%", "95%", obj); } @@ -461,4 +513,4 @@ function closePage(type) { frameId.contentWindow.refreshAllData(); } parent.layer.close(index); // 再执行关闭 -} \ No newline at end of file +}