From 9501d7d915bd82d10545dca2b5bf98c0966c9ea1 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Fri, 17 Jan 2025 16:48:43 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/car_demand_plan/child/apply_plan_detail.js | 24 ++- .../child/arrival_confirm_detail.js | 6 +- .../child/dispatch_car_edit_form.js | 3 + .../child/dispatch_input_detail.js | 9 + .../child/dispatch_input_edit_form.js | 11 +- .../child/dispatch_input_form.js | 7 +- .../child/emerg_internal_car_detail.js | 8 + js/welcome/data_datail_dispatch_list.js | 9 +- js/welcome/data_datail_plan_list.js | 27 ++- js/welcome/plan_dispatch_detail.js | 156 ++++++++++++++++++ .../child/apply_plan_detail.html | 2 +- .../child/dispatch_input_form.html | 2 +- page/welcome/plan_dispatch_detail.html | 75 +++++++++ page/welcome/welcome-1.html | 2 +- 14 files changed, 301 insertions(+), 40 deletions(-) create mode 100644 js/welcome/plan_dispatch_detail.js create mode 100644 page/welcome/plan_dispatch_detail.html diff --git a/js/car_demand_plan/child/apply_plan_detail.js b/js/car_demand_plan/child/apply_plan_detail.js index afdf233..aed5f78 100644 --- a/js/car_demand_plan/child/apply_plan_detail.js +++ b/js/car_demand_plan/child/apply_plan_detail.js @@ -1,6 +1,14 @@ let idParam, objParam; let details; let form, layer, table; +let isPage = getUrlParam('isPage'); +if (isPage) { // 首页跳转 + $('#plan-detail-box>div').eq(0).remove(); + $('#plan-detail-box').css({'justify-content':'end','height':'50px'}); + $('body').css('margin', '0'); + let obj = decodeURIComponent(getUrlParam('obj')) + setParams(obj); +} function setParams(obj) { objParam = JSON.parse(obj); if (objParam.checkType === 2) { @@ -142,7 +150,7 @@ function initTable() { title: "类型", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "name", @@ -150,7 +158,7 @@ function initTable() { title: "名称", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "model", @@ -158,7 +166,7 @@ function initTable() { title: "规格", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "unit", @@ -166,7 +174,7 @@ function initTable() { title: "单位", unresize: true, align: "center", - sort:true, + sort: true, templet: function (d) { return setNullValue(d.unit); }, @@ -177,7 +185,7 @@ function initTable() { title: "需用量", unresize: true, align: "center", - sort:true, + sort: true, templet: function (d) { return setNumColor(d.needNum); }, @@ -188,7 +196,7 @@ function initTable() { title: "需用天数", unresize: true, align: "center", - sort:true, + sort: true, templet: function (d) { return setNumColor(d.needDay); }, @@ -198,7 +206,7 @@ function initTable() { field: "remark", width: '15%', title: "备注", - sort:true, + sort: true, unresize: true, align: "center", templet: function (d) { @@ -252,7 +260,7 @@ function setOperRecordInfo(list, obj) { let imgUrl2 = '../../../images/time_icon.png'; $.each(list, function (index, item) { console.error(item); - + let operData = ""; let dept = ''; let minutes = item.minutes; diff --git a/js/car_demand_plan/child/arrival_confirm_detail.js b/js/car_demand_plan/child/arrival_confirm_detail.js index 892b1f9..7832f07 100644 --- a/js/car_demand_plan/child/arrival_confirm_detail.js +++ b/js/car_demand_plan/child/arrival_confirm_detail.js @@ -164,7 +164,7 @@ function getDispatchCarData(id) { imgNum += item.driverUserImage.filter(item => { return item.type !== '6' }).length; imgNum += item.fileList.length; html += "" + - "" + objParam.typeName + "" + + "" + item.type + "" + "" + item.name + "" + "" + item.model + "" + "" + item.carNum + "" + @@ -316,9 +316,5 @@ function reloadAuditData() { // 关闭页面 function closePage(type) { 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); // 再执行关闭 } \ No newline at end of file diff --git a/js/car_demand_plan/child/dispatch_car_edit_form.js b/js/car_demand_plan/child/dispatch_car_edit_form.js index ad62b53..1e754ac 100644 --- a/js/car_demand_plan/child/dispatch_car_edit_form.js +++ b/js/car_demand_plan/child/dispatch_car_edit_form.js @@ -52,6 +52,9 @@ function setParams(obj) { }); form.on('submit(formData)', function (data) { let length = $('.formSubmit2').length; + if(length === 1){ + length = 2; + } for (let i = 0; i <= length - 1; i++) { let layFilterName = $('.formSubmit2').eq(i).attr('lay-filter'); if (i === 0) { diff --git a/js/car_demand_plan/child/dispatch_input_detail.js b/js/car_demand_plan/child/dispatch_input_detail.js index 5cd9c42..2e86a54 100644 --- a/js/car_demand_plan/child/dispatch_input_detail.js +++ b/js/car_demand_plan/child/dispatch_input_detail.js @@ -2,6 +2,15 @@ let objParam, dataObj; let form, table, upload, tableIns, layer, element; let pageNum = 1; let checkNowValue = ''; // 当前选中的批次 +let isPage = getUrlParam('isPage'); +if (isPage) { // 首页跳转 + $('#plan-detail-box>div').eq(0).remove(); + $('#plan-detail-box').css({ 'justify-content': 'end', 'height': '50px' }); + $('body').css('margin', '0'); + $('.cancel').remove(); + let obj = decodeURIComponent(getUrlParam('obj')) + setParams(obj); +} function setParams(params) { objParam = JSON.parse(params); console.error(objParam); diff --git a/js/car_demand_plan/child/dispatch_input_edit_form.js b/js/car_demand_plan/child/dispatch_input_edit_form.js index 9f7859a..e37136e 100644 --- a/js/car_demand_plan/child/dispatch_input_edit_form.js +++ b/js/car_demand_plan/child/dispatch_input_edit_form.js @@ -51,6 +51,9 @@ function setParams(obj) { }); form.on('submit(formData)', function (data) { let length = $('.formSubmit2').length; + if(length === 1){ + length = 2; + } for (let i = 0; i <= length - 1; i++) { let layFilterName = $('.formSubmit2').eq(i).attr('lay-filter'); if (i === 0) { @@ -198,10 +201,10 @@ function getDispatchCarData(id) { // 设置文件类型 function handleFileType(index, file, result) { let html = '', img = ''; - if(file.ext){ + if (file.ext) { file.ext = file.ext.toLowerCase(); } - if(file.name){ + if (file.name) { file.name = file.name.toLowerCase(); } if (file.ext === 'doc' || file.ext === 'docx' || file.name.indexOf('doc') > -1 || file.name.indexOf('docx') > -1) { @@ -438,7 +441,7 @@ function addFitDatas(data) { function addCarFormData(id, num, item) { formNum++; let length = $('.dispatch').length; - let html = '
' + + let html = '
' + '
' + '

' + (length + 1) + '

' + '' + @@ -615,7 +618,7 @@ function removeCarFormData(id) { function addCraneFormData(id, num, isDriverSet, item) { formNum++; let length = $('.dispatch').length; - let html = '
' + + let html = '
' + '
' + '

' + (length + 1) + '

' + '' + diff --git a/js/car_demand_plan/child/dispatch_input_form.js b/js/car_demand_plan/child/dispatch_input_form.js index c7362d6..d50a372 100644 --- a/js/car_demand_plan/child/dispatch_input_form.js +++ b/js/car_demand_plan/child/dispatch_input_form.js @@ -53,6 +53,9 @@ function setParams(obj) { if (length === 0) { submitApply(data); } else { + if (length === 1) { + length = 2; + } for (let i = 0; i <= length - 1; i++) { let layFilterName = $('.formSubmit2').eq(i).attr('lay-filter'); if (i === 0) { @@ -249,10 +252,10 @@ function sel(selectStatus, that, id) { // 设置文件类型 function handleFileType(index, file, result) { let html = '', img = ''; - if(file.ext){ + if (file.ext) { file.ext = file.ext.toLowerCase(); } - if(file.name){ + if (file.name) { file.name = file.name.toLowerCase(); } if (file.ext === 'doc' || file.ext === 'docx') { diff --git a/js/car_demand_plan/child/emerg_internal_car_detail.js b/js/car_demand_plan/child/emerg_internal_car_detail.js index 046df70..583ba5a 100644 --- a/js/car_demand_plan/child/emerg_internal_car_detail.js +++ b/js/car_demand_plan/child/emerg_internal_car_detail.js @@ -1,6 +1,14 @@ let idParam, objParam; let details; let form, layer, table; +let isPage = getUrlParam('isPage'); +if (isPage) { // 首页跳转 + $('#plan-detail-box>div').eq(0).remove(); + $('#plan-detail-box').css({'justify-content':'end','height':'50px'}); + $('body').css('margin', '0'); + let obj = decodeURIComponent(getUrlParam('obj')) + setParams(obj); +} function setParams(obj) { objParam = JSON.parse(obj); idParam = objParam.id; diff --git a/js/welcome/data_datail_dispatch_list.js b/js/welcome/data_datail_dispatch_list.js index 6a4bd01..bb056ec 100644 --- a/js/welcome/data_datail_dispatch_list.js +++ b/js/welcome/data_datail_dispatch_list.js @@ -251,7 +251,10 @@ function exportExcel() { exportExcelUtil(url, '派车详情', JSON.stringify(params)); } -// 工程详情 -function dispatchCarProDetail(obj) { - openIframeByParamObj("dispatchCarProDetail", "工程详情", "./child/dispatch_car_pro_detail.html", "92%", "95%", obj, 1); +// 派车详情 +function openPlanDetail(obj) { + obj.id = obj.planId; + obj.pageType = 1; + obj.typeName = obj.typeName === 1 ? '车辆' : '吊车'; + openIframeByParamObj2("homePlanDetail", "详情", '../welcome/plan_dispatch_detail.html', "92%", "95%", obj); } \ No newline at end of file diff --git a/js/welcome/data_datail_plan_list.js b/js/welcome/data_datail_plan_list.js index 50f4c6d..db5be32 100644 --- a/js/welcome/data_datail_plan_list.js +++ b/js/welcome/data_datail_plan_list.js @@ -118,7 +118,7 @@ function initTable() { width: '10%', title: "需求计划编号", unresize: true, - sort:true, + sort: true, align: "center", templet: function (d) { let html = ""; @@ -132,7 +132,7 @@ function initTable() { title: "工程名称", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "dispatchStatus", @@ -140,7 +140,7 @@ function initTable() { title: "派车状态", unresize: true, align: "center", - sort:true, + sort: true, templet: function (d) { return setStatusColor(d.dispatchStatus); }, @@ -151,7 +151,7 @@ function initTable() { title: "车辆数量", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "craneNum", @@ -159,7 +159,7 @@ function initTable() { title: "吊车数量", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "money", @@ -167,7 +167,7 @@ function initTable() { width: '10%', unresize: true, align: "center", - sort:true, + sort: true, templet: function (d) { return '¥ ' + d.money + '' }, @@ -178,7 +178,7 @@ function initTable() { title: "供应商", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "payStatus", @@ -186,7 +186,7 @@ function initTable() { title: "付款状态", unresize: true, align: "center", - sort:true, + sort: true, }, { field: "companyName", @@ -194,7 +194,7 @@ function initTable() { width: '10%', unresize: true, align: "center", - sort:true, + sort: true, }, ], ], @@ -238,10 +238,7 @@ function exportExcel() { // 需求计划详情 function openPlanDetail(obj) { obj.id = obj.planId; - obj.code = obj.code; - let content = '../car_demand_plan/child/apply_plan_detail.html'; - if (obj.code.indexOf('spec-') > -1) { - content = '../car_demand_plan/child/emerg_internal_car_detail.html'; - } - openIframeByParamObj2("homePlanDetail", "需求计划", content, "92%", "95%", obj); + obj.pageType = 1; + obj.typeName = obj.typeName === 1 ? '车辆' : '吊车'; + openIframeByParamObj2("homePlanDetail", "详情", '../welcome/plan_dispatch_detail.html', "92%", "95%", obj); } \ No newline at end of file diff --git a/js/welcome/plan_dispatch_detail.js b/js/welcome/plan_dispatch_detail.js new file mode 100644 index 0000000..5f22581 --- /dev/null +++ b/js/welcome/plan_dispatch_detail.js @@ -0,0 +1,156 @@ +let objParam, dataObj; +let form, table, upload, tableIns, layer; +let pageNum = 1; +let checkNowValue = ''; +let checkType = ''; +function setParams(params) { + objParam = JSON.parse(params); + console.error(objParam); + $('#titleName').html(objParam.proName); + $('#code').html(objParam.code); + layui.use(["form", "table", 'upload', 'layer'], function () { + form = layui.form; + table = layui.table; + upload = layui.upload; + layer = layui.layer; + layui.use(["layer", 'element'], function () { + layer = layui.layer; + element = layui.element; + // tab 切换事件 + element.on('tab(demo-filter-tab)', function (data) { + let value = $(this).attr('value'); + if (value === '1') { + let src = '../car_demand_plan/child/apply_plan_detail.html'; + if (objParam.code.indexOf('spec-') > -1) { + src = '../car_demand_plan/child/emerg_internal_car_detail.html'; + } + $('#indexIframe').attr('src', src + '?isPage=1' + '&obj=' + encodeURIComponent(JSON.stringify(objParam))); + } else if (value === '2') { + let src = '../car_demand_plan/child/dispatch_input_detail.html'; + $('#indexIframe').attr('src', src + '?isPage=1' + '&obj=' + encodeURIComponent(JSON.stringify(objParam))); + } + }); + }); + if (objParam.pageType === 1) { // 需求计划详情跳转 + $('#layui-tab-title li').eq(0).addClass('layui-this'); + let src = '../car_demand_plan/child/apply_plan_detail.html'; + if (objParam.code.indexOf('spec-') > -1) { + src = '../car_demand_plan/child/emerg_internal_car_detail.html'; + } + $('#indexIframe').attr('src', src + '?isPage=1' + '&obj=' + encodeURIComponent(JSON.stringify(objParam))); + } else if (objParam.pageType === 2) { // 派车详情跳转 + $('#layui-tab-title li').eq(1).addClass('layui-this'); + let src = '../car_demand_plan/child/dispatch_input_detail.html'; + $('#indexIframe').attr('src', src + '?isPage=1' + '&obj=' + encodeURIComponent(JSON.stringify(objParam))); + } + }); +} + +// 查询派车批次 +function getAllOutList() { + let params = { + encryptedData: JSON.stringify({ + 'planId': objParam.id, + }) + }; + let url = dataUrl + 'backstage/supDispatchCar/getAllOutList'; + ajaxRequest(url, "POST", params, true, function () { + }, function (result) { + console.error(result); + if (result.code === 200) { + if (result.data.length === 0) { + parent.layer.msg('暂无派车批次数据', { icon: 7 }); + closePage(); + } else { + setBatchData(result.data); + } + } else { + } + }, function (xhr, status, error) { + errorFn(xhr, status, error) + }, null); + // 派车批次 + function setBatchData(dataList) { + let html = '', id = '', status = '', type = ''; + $.each(dataList, function (index, item) { + if (index === dataList.length - 1) { + id = item.id; + status = item.status; + type = item.type; + } + let batchName = '第' + numToChinese(index + 1) + '批次'; + html += '
  • ' + batchName + '
  • '; + }) + $('#layui-tab-title').empty().append(html); + $('#layui-tab-title li').eq(dataList.length - 1).addClass('layui-this'); + var scrollableElement = document.getElementById('layui-tab-brief'); + // 添加事件监听器来处理滚轮事件 + scrollableElement.addEventListener('wheel', function (event) { + // 阻止默认的滚动行为 + event.preventDefault(); + // 检查滚动的方向 + var delta = event.deltaY > 0 ? -20 : 20; // 根据需要调整滚动的步长 + // 设置新的滚动位置 + scrollableElement.scrollLeft += delta; + }); + checkNowValue = id; + checkType = type; + getUpdateList(id); + } +} + +// 查询每个批次的修改记录 +function getUpdateList(outId) { + let params = { + encryptedData: JSON.stringify({ + planId: objParam.id, + outId: outId + }) + }; + let url = dataUrl + 'backstage/dispatchCar/getUpdateList'; + ajaxRequest(url, "POST", params, true, function () { + }, function (result) { + console.error(result); + if (result.code === 200) { + getShipmentBatch(result.data); + } + }, function (xhr, status, error) { + errorFn(xhr, status, error) + }, null); +} + +// 修改记录次数 +function getShipmentBatch(list) { + let dataList = [], html = ''; + if (list && list.length > 0) { + $.each(list, function (index, item) { + if (index === 0) { + dataList.push({ name: '初始派车数据', id: item.id, color: '', isInit: true }) + } else { + dataList.push({ name: '第' + numToChinese(index) + '次修改', id: item.id, color: '#f56c6c', isInit: false }) + } + }); + } + $.each(dataList, function (index, item) { + html += '
  • ' + this.name + '
  • '; + }) + $('#layui-tab-title2').empty().append(html); + $('#layui-tab-title2 li').eq(0).addClass('layui-this'); + var scrollableElement = document.getElementById('layui-tab-brief'); + // 添加事件监听器来处理滚轮事件 + scrollableElement.addEventListener('wheel', function (event) { + // 阻止默认的滚动行为 + event.preventDefault(); + // 检查滚动的方向 + var delta = event.deltaY > 0 ? -20 : 20; // 根据需要调整滚动的步长 + // 设置新的滚动位置 + scrollableElement.scrollLeft += delta; + }); + $('#indexIframe').attr('src', './dispatch_car_edit_record_detail.html?id=' + dataList[0].id + '&type=' + checkType + '&code=' + objParam.code + '&isInit=' + dataList[0].isInit); +} + +// 关闭页面 +function closePage(type) { + let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引 + parent.layer.close(index); // 再执行关闭 +} \ No newline at end of file diff --git a/page/car_demand_plan/child/apply_plan_detail.html b/page/car_demand_plan/child/apply_plan_detail.html index ec5c396..9db875f 100644 --- a/page/car_demand_plan/child/apply_plan_detail.html +++ b/page/car_demand_plan/child/apply_plan_detail.html @@ -51,7 +51,7 @@ 计划说明 - + diff --git a/page/car_demand_plan/child/dispatch_input_form.html b/page/car_demand_plan/child/dispatch_input_form.html index 2dd2ef4..755eaff 100644 --- a/page/car_demand_plan/child/dispatch_input_form.html +++ b/page/car_demand_plan/child/dispatch_input_form.html @@ -54,7 +54,7 @@

    基本信息填写

    -
    +
    diff --git a/page/welcome/plan_dispatch_detail.html b/page/welcome/plan_dispatch_detail.html new file mode 100644 index 0000000..ba46799 --- /dev/null +++ b/page/welcome/plan_dispatch_detail.html @@ -0,0 +1,75 @@ + + + + + + + 派车分配修改记录 + + + + + + + + +
    +
    +
    + +
    +

    +

    +
    +
    +
    + +
    +
    +
    +
      +
    • 需求计划
    • +
    • 派车详情
    • +
    +
    +
    + +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/page/welcome/welcome-1.html b/page/welcome/welcome-1.html index 318f3b4..81bf843 100644 --- a/page/welcome/welcome-1.html +++ b/page/welcome/welcome-1.html @@ -131,7 +131,7 @@ 工程排名

    工程排名

    - 查看更多> + 查看更多>