diff --git a/css/demandPlan/delivery_detail_list.css b/css/demandPlan/delivery_detail_list.css index ada4cba..125c321 100644 --- a/css/demandPlan/delivery_detail_list.css +++ b/css/demandPlan/delivery_detail_list.css @@ -28,7 +28,7 @@ width: 100%; box-sizing: border-box; background-color: #fff; - height: calc(100% - 150px); + height: calc(100% - 125px); } .layui-tab-brief { diff --git a/js/demandPlan/child/delivery_all_list.js b/js/demandPlan/child/delivery_all_list.js index e69de29..fa2a628 100644 --- a/js/demandPlan/child/delivery_all_list.js +++ b/js/demandPlan/child/delivery_all_list.js @@ -0,0 +1,272 @@ +let objParam = JSON.stringify(decodeURIComponent(getUrlParam('obj'))); +let form, table, element,tableIns,layer; +let pageNum = 1; +layui.use(["form", "table", 'element','layer'], function () { + form = layui.form; + table = layui.table; + element = layui.element; + initTable(); + }); + +// 查询/重置 +function queryTable(type) { + if (type === 1) { + reloadTable(1); + } else if (type === 2) { + $('#name').val(''); + $('#module').val(''); + layui.form.render(); + reloadTable(1); + } +} + +// 刷新页面数据 +function reloadData() { + reloadData(pageNum); +} + +// 重载表格 +function reloadTable(pageNum) { + table.reload("currentTableId", { + page: { + curr: pageNum ? pageNum : 1, + }, + where: { + encryptedData: JSON.stringify({ + 'name': $('#name').val(), + 'module': $('#module').val(), + 'proId': objParam.proId + }), + }, + }, + ); +} + +// 初始化表格 +function initTable() { + tableIns = table.render({ + elem: "#currentTableId", + id: 'currentTableId', + headers: { + authorization: sessionStorage.getItem("gz-token"), + }, + height: "full-140", + url: dataUrl + "backstage/planOut/getPorInfoDetail2", + where: { + encryptedData: JSON.stringify({ + 'name': $('#name').val(), + 'module': $('#module').val(), + 'proId': objParam.proId + }), + }, + request: { + pageName: 'pageNum', + limitName: 'pageSize' + }, + parseData: function (res) { // res 即为原始返回的数据 + return { + "code": 0, // 解析接口状态 + "msg": '获取成功', // 解析提示文本 + "count": res.total, // 解析数据长度 + "data": res.list // 解析数据列表 + }; + }, + cols: [ + [ + { + width: '5%', + title: "序号", + align: "center", + templet: function (d) { + let color= d.needType === '2' ? '#f56c6c':'#262626'; + return ''+d.LAY_NUM+'' + }, + }, + { + field: "typeName", + width: '7.9%', + title: "计划内/计划外 ", + unresize: true, + align: "center", + templet: function (d) { + let color= d.needType === '2' ? '#f56c6c':'#262626'; + return ''+d.typeName+'' + }, + }, + { + field: "type", + width: '7%', + title: "物机类型", + unresize: true, + align: "center", + templet: function (d) { + let color= d.needType === '2' ? '#f56c6c':'#262626'; + return ''+d.type+'' + }, + }, + { + field: "name", + width: '9%', + title: "物机名称 ", + unresize: true, + align: "center", + templet: function (d) { + let color= d.needType === '2' ? '#f56c6c':'#262626'; + return ''+d.name+'' + }, + }, + { + field: "module", + title: "规格", + width: '8%', + unresize: true, + align: "center", + templet: function (d) { + let color= d.needType === '2' ? '#f56c6c':'#262626'; + return ''+d.module+'' + }, + }, + { + field: "unit", + title: "单位", + width: '8%', + unresize: true, + align: "center", + templet: function (d) { + let color= d.needType === '2' ? '#f56c6c':'#262626'; + return ''+d.unit+'' + }, + }, + { + field: "status", + title: "进度", + width: '13%', + unresize: true, + align: "center", + templet:schedule, + }, + { + field: "needNum", + title: "需要量", + width: '8%', + unresize: true, + align: "center", + templet: function (d) { + return setNumColor(d.needNum,1,d.needType); + }, + }, + { + field: "fhNum", + width: '8%', + title: "已发货量", + unresize: true, + align: "center", + templet: function (d) { + return setNumColor(d.fhNum,2,d.needType); + }, + }, + { + field: "diff", + width: '8%', + title: "待发货量", + unresize: true, + align: "center", + templet: function (d) { + return setNumColor(d.diff,3,d.needType); + }, + }, + { + field: "tzNum", + width: '8%', + title: "调整量", + unresize: true, + align: "center", + templet: function (d) { + return setNumColor(d.tzNum,4,d.needType); + }, + }, + { + title: "备注", + width: '10%', + align: "center", + unresize: true, + }, + ], + ], + limits: [10, 15, 20, 25, 50, 100], + limit: 10, + page: true, + done: function (res, curr, count) { + pageNum = tableIns.config.page.curr; + element.render(); + table.resize("currentTableId"); + }, + }); +} + +// 设置字体加粗 +function setFontBold(value) { + return '' + value + ""; +} + +function setNumColor(value, type,needType) { // 1.需要量 2.已发货量 3.待发货量 4.调整量 + let color = '#66b1ff'; + if (type === 1 && needType == '2') { + color = '#66b1ff'; + value = '/'; + } else if (type === 2) { + color = '#19be6b'; + } else if (type === 3) { + color = '#f56c6c'; + }else if(type === 4){ + if(value > 0){ + color = '#d9001b'; + }else{ + color = '#ccc'; + } + } + return '' + value + ""; + } + +// 设置进度值 +function schedule(d) { + d.progress = parseFloat(d.progress) + d.filter == undefined ? (d.filter = d.LAY_NUM) : d.filter; + d.progress == undefined ? (d.progress = 100) : d.progress; + var color = "layui-bg-orange"; + if (d.progress < 100) { + color = "layui-bg-orange"; + } else if (d.progress === 100) { + color = "layui-bg-primary"; + } else if (d.progress > 100) { + color = "layui-bg-blue"; + } + //设置页面进度条 + return ( + '
' + + '
' + + "
" + ); + } + +// 导出 +function exportExcel() { + let encryptedData = JSON.stringify({ + 'proName': $('#proName').val(), + 'status': $('#status').val() + }); + let url = dataUrl + "backstage/planOut/exportExcel?encryptedData=" + encryptedData; + exportExcelUtil(url, '机具公司发货数据'); +} + +// 打印 +function print() { + Print('#body', { + onStart: function () { + console.log('onStart', new Date()) + }, + onEnd: function () { + console.log('onEnd', new Date()) + } + }) +} diff --git a/js/demandPlan/child/delivery_batch_list.js b/js/demandPlan/child/delivery_batch_list.js index e69de29..40a4dcf 100644 --- a/js/demandPlan/child/delivery_batch_list.js +++ b/js/demandPlan/child/delivery_batch_list.js @@ -0,0 +1 @@ +console.log(decodeURIComponent(getUrlParam('obj'))); \ No newline at end of file diff --git a/js/demandPlan/child/delivery_detail_list.js b/js/demandPlan/child/delivery_detail_list.js index ed7cec0..7d5ecf4 100644 --- a/js/demandPlan/child/delivery_detail_list.js +++ b/js/demandPlan/child/delivery_detail_list.js @@ -2,8 +2,8 @@ let layer, element; let objParam; function setParams(obj) { objParam = JSON.parse(obj); - console.log(obj); $('#proName').html(objParam.proName); + $('#planNum').html(objParam.planNum); setStatusColor(objParam.status); layui.use(["layer", 'element'], function () { form = layui.form; @@ -12,50 +12,54 @@ function setParams(obj) { // tab 切换事件 element.on('tab(demo-filter-tab)', function (data) { let value = $(this).attr('value'); - if(value === ''){ // 全部 + if (value === '') { // 全部 $('#indexIframe').attr('src', 'delivery_all_list.html?obj=' + encodeURIComponent(JSON.stringify(obj))); - }else if(value !== '0'){ - $('#indexIframe').attr('src', 'delivery_batch_list.html?obj=' + encodeURIComponent(JSON.stringify(obj))); - }else if(value === '0'){ + } else if (value !== '0') { + $('#indexIframe').attr('src', 'delivery_batch_list.html?obj=' + encodeURIComponent(JSON.stringify(obj)) + '&id=' + value); + } else if (value === '0') { $('#indexIframe').attr('src', 'delivery_not_send_list.html?obj=' + encodeURIComponent(JSON.stringify(obj))); } }); - getShipmentBatch(); + getOutTimes(); }); } // 发货批次 -function getShipmentBatch() { +function getShipmentBatch(list) { + let dataList = []; let html = ''; - let list = [{ name: '全部', value: '' }, { name: '第1批', value: '1' }, { name: '第2批', value: '2' }, { name: '第3批', value: '3' }, { name: '第4批', value: '4' }, - { name: '第5批', value: '5' }, { name: '第6批', value: '6' }, { name: '第7批', value: '7' }, { name: '第8批', value: '8' }, { name: '第9批', value: '9' }, - { name: '第10批', value: '10' }, { name: '第11批', value: '11' }, { name: '第12批', value: '12' }, { name: '第13批', value: '13' }, { name: '第14批', value: '14' }, - { name: '第15批', value: '15' }, { name: '第16批', value: '16' }, { name: '第17批', value: '17' }, { name: '第18批', value: '18' }, { name: '待发货', value: '0' } - ]; - $.each(list, function (index, item) { + if (list && list.length > 0) { + dataList.push({ name: '全部', id: '' }) + $.each(list, function (index, item) { + dataList.push({ name: '第' +numToChinese(index + 1)+ '批', id: item.id, tiem: item.createDay }) + }); + dataList.push({ name: '待发货', id: '' }) + } else { + dataList.push({ name: '全部', id: '' }) + dataList.push({ name: '待发货', id: '' }) + } + $.each(dataList, function (index, item) { if (item.name === '待发货') { - html += '
  • ' + this.name + '
  • '; - }else if(item.name === '全部'){ - html += '
  • ' + this.name + '
  • '; + html += '
  • ' + this.name + '
  • '; + } else if (item.name === '全部') { + html += '
  • ' + this.name + '
  • '; } else { - html += '
  • '+item.name+'2024-11-01
  • '; + html += '
  • ' + item.name + ''+item.tiem+'
  • '; } }) $('.layui-tab-title').empty().append(html); $('.layui-tab-title 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', 'delivery_all_list.html?obj=' + encodeURIComponent(JSON.stringify(objParam))); } function setStatusColor(value) { @@ -73,4 +77,83 @@ function setStatusColor(value) { } let html = '' + name + ""; $('#status').html(html); +} + +// 查询批次数量 +function getOutTimes() { + let params = { + encryptedData: JSON.stringify({ + 'proId': objParam.proId + }) + }; + let url = dataUrl + 'backstage/planOut/getOutTimes'; + ajaxRequest(url, "POST", params, true, function () { + }, function (result) { + console.log(result); + if (result.code === 200) { + getShipmentBatch(result.data); + } + }, function (xhr, status, error) { + errorFn(xhr, status, error) + }, null); +} + +// 数字转大写 +function numToChinese(num) { + const chineseNumbers = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十']; + if (num >= 1 && num <= 10) { + return chineseNumbers[num - 1]; + } else if (num === 11) { + return '十一'; + } else if (num === 12) { + return '十二'; + } else if (num === 13) { + return '十三'; + } else if (num === 14) { + return '十四'; + } else if (num === 15) { + return '十五'; + } else if (num === 16) { + return '十六'; + } else if (num === 17) { + return '十七'; + } else if (num === 18) { + return '十八'; + } else if (num === 19) { + return '十九'; + } else if (num === 20) { + return '二十'; + } else if (num === 21) { + return '二十一'; + } else if (num === 22) { + return '二十二'; + } else if (num === 23) { + return '二十三'; + } else if (num === 24) { + return '二十四'; + } else if (num === 25) { + return '二十五'; + }else if (num === 26) { + return '二十六'; + } else if (num === 27) { + return '二十七'; + } else if (num === 28) { + return '二十八'; + } else if (num === 29) { + return '二十九'; + } else if (num === 30) { + return '三十'; + } else if (num === 31) { + return '三十一'; + } else if (num === 32) { + return '三十二'; + } else if (num === 33) { + return '三十三'; + } else if (num === 34) { + return '三十四'; + } else if (num === 35) { + return '三十五'; + } else if (num === 36) { + return '三十六'; + } } \ No newline at end of file diff --git a/js/demandPlan/child/delivery_not_send_list.js b/js/demandPlan/child/delivery_not_send_list.js index e69de29..40a4dcf 100644 --- a/js/demandPlan/child/delivery_not_send_list.js +++ b/js/demandPlan/child/delivery_not_send_list.js @@ -0,0 +1 @@ +console.log(decodeURIComponent(getUrlParam('obj'))); \ No newline at end of file diff --git a/js/public.js b/js/public.js index eb409bc..679b7df 100644 --- a/js/public.js +++ b/js/public.js @@ -14,10 +14,10 @@ function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, conte async: async, beforeSend: beforeFn, contentType: contentType || "application/x-www-form-urlencoded; charset=utf-8", - success: function (data){ + success: function (data) { successFn(data); }, - error:function (error) { + error: function (error) { errorFn(error) } }); @@ -37,10 +37,10 @@ function ajaxRequestByUploadFile(url, data, beforeFn, successFn, errorFn) { contentType: false, data: data, beforeSend: beforeFn, - success: function (data){ + success: function (data) { successFn(data); }, - error:function (error) { + error: function (error) { errorFn(error) } }); @@ -58,28 +58,28 @@ function errorFn(xhr, status, error) { } // 公共导出excel -function exportExcelUtil(url,fileName) { +function exportExcelUtil(url, fileName) { let loadingMsg = layer.msg("数据导出中,请稍候...", { icon: 16, scrollbar: false, time: 0, }); let xhr = new XMLHttpRequest(); xhr.open("get", url, true); xhr.responseType = "blob"; // 转换流 - xhr.setRequestHeader("encauthorizationypt",sessionStorage.getItem("gz-token")); + xhr.setRequestHeader("encauthorizationypt", sessionStorage.getItem("gz-token")); xhr.onload = function () { - layer.close(loadingMsg); - if (this.status === 200) { - let blob = this.response; - var a = document.createElement("a"); - var url = window.URL.createObjectURL(blob); - a.href = url; - a.download = "机具公司发货" + getNowDate() + ".xlsx"; // 文件名 - } else { - layer.msg("数据发生异常,请稍后重试", { icon: 16, scrollbar: false, time: 2000 }); - } - a.click(); - window.URL.revokeObjectURL(url); + layer.close(loadingMsg); + if (this.status === 200) { + let blob = this.response; + var a = document.createElement("a"); + var url = window.URL.createObjectURL(blob); + a.href = url; + a.download = "机具公司发货" + getNowDate() + ".xlsx"; // 文件名 + } else { + layer.msg("数据发生异常,请稍后重试", { icon: 16, scrollbar: false, time: 2000 }); + } + a.click(); + window.URL.revokeObjectURL(url); }; xhr.send(); - } +} // 格式化日对象 const getNowDate = () => { @@ -112,9 +112,27 @@ const getNowDate = () => { return year + "-" + month + "-" + day + "-" + hour + sign2 + minutes + sign2 + seconds; } // 空值赋值 -function setNullValue(value){ - if(!value){ +function setNullValue(value) { + if (value === 0) { + return 0; + } else if (!value) { return ''; } return value; -} \ No newline at end of file +} + +function getUrlParam(key) { + var href = window.location.href; + var url = href.split("?"); + if(url.length <= 1){ + return ""; + } + var params = url[1].split("&"); + + for(var i=0; i + -
    -
    -
    -

    -

    +
    +
    +
    + 搜索信息 +
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    + + + + +
    +
    +
    +
    +
    +
    +
    -
    -

    计划数量

    -

    0

    -
    -
    -
    -
      -
    -
    -
    -
    + diff --git a/page/demandPlan/child/delivery_batch_list.html b/page/demandPlan/child/delivery_batch_list.html index a7190b6..ac1c826 100644 --- a/page/demandPlan/child/delivery_batch_list.html +++ b/page/demandPlan/child/delivery_batch_list.html @@ -13,24 +13,7 @@
    -
    -
    -

    -

    -
    -
    -

    计划数量

    -

    0

    -
    -
    -
    -
      -
    -
    -
    - -
    + 发货详情-批次
    diff --git a/page/demandPlan/child/delivery_detail_list.html b/page/demandPlan/child/delivery_detail_list.html index 537b42e..ed8acb9 100644 --- a/page/demandPlan/child/delivery_detail_list.html +++ b/page/demandPlan/child/delivery_detail_list.html @@ -10,7 +10,11 @@ - +
    @@ -20,7 +24,7 @@

    计划数量

    -

    0

    +

    0

    diff --git a/page/demandPlan/child/delivery_not_send_list.html b/page/demandPlan/child/delivery_not_send_list.html index 7cde9cc..be28a64 100644 --- a/page/demandPlan/child/delivery_not_send_list.html +++ b/page/demandPlan/child/delivery_not_send_list.html @@ -13,24 +13,7 @@
    -
    -
    -

    -

    -
    -
    -

    计划数量

    -

    0

    -
    -
    -
    -
      -
    -
    -
    - -
    +

    待发货