This commit is contained in:
cwchen 2024-11-11 15:04:57 +08:00
parent 87357dd5cc
commit 528a9fecce
6 changed files with 124 additions and 113 deletions

View File

@ -1,12 +1,12 @@
let objParam = JSON.stringify(decodeURIComponent(getUrlParam('obj')));
let form, table, element,tableIns,layer;
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();
});
layui.use(["form", "table", 'element', 'layer'], function () {
form = layui.form;
table = layui.table;
element = layui.element;
initTable();
});
// 查询/重置
function queryTable(type) {
@ -50,7 +50,7 @@ function initTable() {
headers: {
authorization: sessionStorage.getItem("gz-token"),
},
height: "full-140",
// height: "full-140",
url: dataUrl + "backstage/planOut/getPorInfoDetail2",
where: {
encryptedData: JSON.stringify({
@ -78,8 +78,8 @@ function initTable() {
title: "序号",
align: "center",
templet: function (d) {
let color= d.needType === '2' ? '#f56c6c':'#262626';
return '<span style="color:'+color+'">'+d.LAY_NUM+'</span>'
let color = d.needType === '2' ? '#f56c6c' : '#262626';
return '<span style="color:' + color + '">' + d.LAY_NUM + '</span>'
},
},
{
@ -89,9 +89,9 @@ function initTable() {
unresize: true,
align: "center",
templet: function (d) {
let color= d.needType === '2' ? '#f56c6c':'#262626';
return '<span style="color:'+color+'">'+d.typeName+'</span>'
},
let color = d.needType === '2' ? '#f56c6c' : '#262626';
return '<span style="color:' + color + '">' + d.typeName + '</span>'
},
},
{
field: "type",
@ -100,8 +100,8 @@ function initTable() {
unresize: true,
align: "center",
templet: function (d) {
let color= d.needType === '2' ? '#f56c6c':'#262626';
return '<span style="color:'+color+'">'+d.type+'</span>'
let color = d.needType === '2' ? '#f56c6c' : '#262626';
return '<span style="color:' + color + '">' + d.type + '</span>'
},
},
{
@ -111,8 +111,8 @@ function initTable() {
unresize: true,
align: "center",
templet: function (d) {
let color= d.needType === '2' ? '#f56c6c':'#262626';
return '<span style="color:'+color+'">'+d.name+'</span>'
let color = d.needType === '2' ? '#f56c6c' : '#262626';
return '<span style="color:' + color + '">' + d.name + '</span>'
},
},
{
@ -122,8 +122,8 @@ function initTable() {
unresize: true,
align: "center",
templet: function (d) {
let color= d.needType === '2' ? '#f56c6c':'#262626';
return '<span style="color:'+color+'">'+d.module+'</span>'
let color = d.needType === '2' ? '#f56c6c' : '#262626';
return '<span style="color:' + color + '">' + d.module + '</span>'
},
},
{
@ -133,8 +133,8 @@ function initTable() {
unresize: true,
align: "center",
templet: function (d) {
let color= d.needType === '2' ? '#f56c6c':'#262626';
return '<span style="color:'+color+'">'+d.unit+'</span>'
let color = d.needType === '2' ? '#f56c6c' : '#262626';
return '<span style="color:' + color + '">' + d.unit + '</span>'
},
},
{
@ -143,7 +143,7 @@ function initTable() {
width: '13%',
unresize: true,
align: "center",
templet:schedule,
templet: schedule,
},
{
field: "needNum",
@ -152,7 +152,7 @@ function initTable() {
unresize: true,
align: "center",
templet: function (d) {
return setNumColor(d.needNum,1,d.needType);
return setNumColor(d.needNum, 1, d.needType);
},
},
{
@ -162,7 +162,7 @@ function initTable() {
unresize: true,
align: "center",
templet: function (d) {
return setNumColor(d.fhNum,2,d.needType);
return setNumColor(d.fhNum, 2, d.needType);
},
},
{
@ -172,7 +172,7 @@ function initTable() {
unresize: true,
align: "center",
templet: function (d) {
return setNumColor(d.diff,3,d.needType);
return setNumColor(d.diff, 3, d.needType);
},
},
{
@ -182,7 +182,7 @@ function initTable() {
unresize: true,
align: "center",
templet: function (d) {
return setNumColor(d.tzNum,4,d.needType);
return setNumColor(d.tzNum, 4, d.needType);
},
},
{
@ -210,59 +210,60 @@ function setFontBold(value) {
return '<span style="font-weight:bold">' + value + "</span>";
}
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';
}
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 '<span style="color:' + color + ';font-weight:bold;">' + value + "</span>";
}
return '<span style="color:' + color + ';font-weight:bold;">' + value + "</span>";
}
// 设置进度值
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 (
'<div class="layui-progress layui-progress-big" lay-showpercent="true" id="' +d.filter +'" lay-filter="progress' +d.filter +'">' +
'<div class="layui-progress-bar ' +color +'" lay-percent="' +d.progress +'%">' +
"</div></div>"
);
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 (
'<div class="layui-progress layui-progress-big" lay-showpercent="true" id="' + d.filter + '" lay-filter="progress' + d.filter + '">' +
'<div class="layui-progress-bar ' + color + '" lay-percent="' + d.progress + '%">' +
"</div></div>"
);
}
// 导出
function exportExcel() {
let encryptedData = JSON.stringify({
'proName': $('#proName').val(),
'status': $('#status').val()
});
let url = dataUrl + "backstage/planOut/exportExcel?encryptedData=" + encryptedData;
exportExcelUtil(url, '机具公司发货数据');
let params = {
'name': $('#name').val(),
'module': $('#module').val(),
'proId': objParam.proId
}
let url = dataUrl + "backstage/export/exportAllFhList";
exportExcelUtil(url, '发货详情-全部', JSON.stringify(params));
}
// 打印
function print() {
Print('#body', {
Print('#table-box', {
onStart: function () {
console.log('onStart', new Date())
},

View File

@ -1,5 +1,6 @@
let objParam = JSON.parse(JSON.parse(decodeURIComponent(getUrlParam('obj'))));
let id = getUrlParam('id'); // 批次ID
let time = getUrlParam('time'); // 批次日期
let form, table, element, tableIns, layer;
let pageNum = 1;
layui.use(["form", "table", 'element', 'layer'], function () {
@ -16,7 +17,7 @@ function getOutDetails() {
let params = {
encryptedData: JSON.stringify({
'proId': objParam.proId,
'id':id
'id': id
})
};
let url = dataUrl + 'backstage/planOut/getOutDetails';
@ -26,7 +27,7 @@ function getOutDetails() {
if (result.code === 200) {
setBasicValue(result.data);
setFileTable(result.data.fileList);
}else{
} else {
setBasicValue(null);
setFileTable(null);
}
@ -36,9 +37,9 @@ function getOutDetails() {
}
function setBasicValue(obj) {
if(obj){
if (obj) {
$('#userName').html(obj.userName); parseInt();
$('#createDay').html(obj.createDay + '<a style="margin:0 5px;color:#409EFF;cursor: pointer;" onclick=\'viewGs('+JSON.stringify(obj)+')\'>查看概述</a>');
$('#createDay').html(obj.createDay + '<a style="margin:0 5px;color:#409EFF;cursor: pointer;" onclick=\'viewGs(' + JSON.stringify(obj) + ')\'>查看概述</a>');
$('#remark').html(obj.remarks);
}
}
@ -53,8 +54,8 @@ function setFileTable(fileList) {
'<td>' + handleFileType(item.fileName) + item.fileName + '</td>' +
'<td><img src="../../../images/user_head_icon.png" width="20px" height="20px">' + item.createName + '</td>' +
'<td>' + item.createTime + '</td>' +
'<td><a style="margin:0 5px;color:#409EFF;cursor: pointer;" onclick=\'viewFile('+JSON.stringify(item)+')\'>预览</a>' +
'<a style="margin:0 5px;color:#409EFF;cursor: pointer;" onclick=\'downLoadFile('+JSON.stringify(item)+')\'>下载</a>' +
'<td><a style="margin:0 5px;color:#409EFF;cursor: pointer;" onclick=\'viewFile(' + JSON.stringify(item) + ')\'>预览</a>' +
'<a style="margin:0 5px;color:#409EFF;cursor: pointer;" onclick=\'downLoadFile(' + JSON.stringify(item) + ')\'>下载</a>' +
'</td>' +
'</tr>';
})
@ -108,7 +109,7 @@ function reloadTable(pageNum) {
'name': $('#name').val(),
'module': $('#module').val(),
'proId': objParam.proId,
'id':id
'id': id
}),
},
},
@ -130,7 +131,7 @@ function initTable() {
'name': $('#name').val(),
'module': $('#module').val(),
'proId': objParam.proId,
'id':id
'id': id
}),
},
request: {
@ -256,12 +257,14 @@ function setNumColor(value, type) { // 1.需要量 2.本次发货量 3.不发货
// 导出
function exportExcel() {
let encryptedData = JSON.stringify({
'proName': $('#proName').val(),
'status': $('#status').val()
});
let url = dataUrl + "backstage/planOut/exportExcel?encryptedData=" + encryptedData;
exportExcelUtil(url, '机具公司发货数据');
let params = {
'name': $('#name').val(),
'module': $('#module').val(),
'proId': objParam.proId,
'id': id
}
let url = dataUrl + "backstage/export/exportPcList";
exportExcelUtil(url, '发货详情-批次-' + time, JSON.stringify(params));
}
// 打印
@ -281,11 +284,11 @@ function viewGs(obj) {
layer.open({
type: 1,
shade: false, // 不显示遮罩
content: '<div style="padding: 1%;">'+obj.details+'</div>',
title:'<h3 style="color: #F56C6C;">'+obj.createDay+'发货概述:</h3>',
content: '<div style="padding: 1%;">' + obj.details + '</div>',
title: '<h3 style="color: #F56C6C;">' + obj.createDay + '发货概述:</h3>',
btn: ['复制文字', '关闭'],
area: ['60%', '50%'],
move:false,
move: false,
btnAlign: 'c', // 按钮居中显示
btn1: function () {
exeCommandCopyText(obj.gs);
@ -293,7 +296,7 @@ function viewGs(obj) {
btn2: function () {
layer.close();
},
});
});
}
// 复制文字
@ -306,31 +309,31 @@ function exeCommandCopyText(text) {
t.select()
document.execCommand('copy');
document.body.removeChild(t)
layer.msg('复制成功',{icon:1});
layer.msg('复制成功', { icon: 1 });
} catch (e) {
console.log(e)
layer.msg('复制失败',{icon:2});
layer.msg('复制失败', { icon: 2 });
}
}
// 预览文件
function viewFile(obj) {
let fileName = obj.fileName.toLowerCase();
if(fileName.indexOf('png') || fileName.indexOf('jpg')|| fileName.indexOf('jpeg')){
if (fileName.indexOf('png') || fileName.indexOf('jpg') || fileName.indexOf('jpeg')) {
layer.photos({
shade:0.5,
shade: 0.5,
photos: {
"title": "图片预览",
"start": 0,
"data": [
{
"alt": "layer",
"pid": 1,
"src": "../../../images/captcha.jpg",
}
]
"title": "图片预览",
"start": 0,
"data": [
{
"alt": "layer",
"pid": 1,
"src": "../../../images/captcha.jpg",
}
]
}
});
});
}
}

View File

@ -10,11 +10,13 @@ function setParams(obj) {
element = layui.element;
// tab 切换事件
element.on('tab(demo-filter-tab)', function (data) {
console.log(data);
let value = $(this).attr('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)) + '&id=' + value);
let time = $(this).attr('tiem');
$('#indexIframe').attr('src', 'delivery_batch_list.html?obj=' + encodeURIComponent(JSON.stringify(obj)) + '&id=' + value + '&time=' + time);
} else if (value === '0') {
$('#indexIframe').attr('src', 'delivery_not_send_list.html?obj=' + encodeURIComponent(JSON.stringify(obj)));
}
@ -43,7 +45,7 @@ function getShipmentBatch(list) {
} else if (item.name === '全部') {
html += '<li value="' + this.id + '"><span class="li-span">' + this.name + '</span></li>';
} else {
html += '<li value="' + this.id + '"><span>' + item.name + '</span><span>' + item.tiem + '</span></li>';
html += '<li value="' + this.id + '" tiem="'+item.tiem+'"><span>' + item.name + '</span><span>' + item.tiem + '</span></li>';
}
})
$('.layui-tab-title').empty().append(html);

View File

@ -177,12 +177,13 @@ function setNumColor(value, type) { // 1.需要量 2.本次发货量 3.不发货
// 导出
function exportExcel() {
let encryptedData = JSON.stringify({
'proName': $('#proName').val(),
'status': $('#status').val()
});
let url = dataUrl + "backstage/planOut/exportExcel?encryptedData=" + encryptedData;
exportExcelUtil(url, '机具公司发货数据');
let params = {
'name': $('#name').val(),
'module': $('#module').val(),
'proId': objParam.proId
}
let url = dataUrl + "backstage/export/exportDfhList";
exportExcelUtil(url, '发货详情-待发货', JSON.stringify(params));
}
// 打印

View File

@ -72,7 +72,7 @@ function exportExcelUtil(url, fileName,params) {
var a = document.createElement("a");
var url = window.URL.createObjectURL(blob);
a.href = url;
a.download = fileName + getNowDate() + ".xlsx"; // 文件名
a.download = fileName + ".xlsx"; // 文件名
} else {
layer.msg("数据发生异常,请稍后重试", { icon: 16, scrollbar: false, time: 2000 });
}

View File

@ -15,10 +15,14 @@
padding: 0;
height: 100%;
}
.layuimini-container {
height: auto;
}
</style>
<body>
<div class="layuimini-container">
<div class="layuimini-container" id="layuimini-container">
<div class="layuimini-main">
<fieldset class="table-search-fieldset">
<legend>搜索信息</legend>
@ -27,14 +31,14 @@
<div class="layui-form-item">
<div class="layui-inline">
<div class="layui-input-inline" style="width: 300px;">
<input type="text" name="name" id="name" autocomplete="off"
class="layui-input" lay-affix="clear" placeholder="输入物机名称" maxlength="30">
<input type="text" name="name" id="name" autocomplete="off" class="layui-input"
lay-affix="clear" placeholder="输入物机名称" maxlength="30">
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline" style="width: 300px;">
<input type="text" name="module" id="module" autocomplete="off"
class="layui-input" lay-affix="clear" placeholder="输入规格" maxlength="30">
<input type="text" name="module" id="module" autocomplete="off" class="layui-input"
lay-affix="clear" placeholder="输入规格" maxlength="30">
</div>
</div>
<div class="layui-inline">
@ -51,7 +55,7 @@
</form>
</div>
</fieldset>
<div class="table-box" table-responsive style="z-index: 1;">
<div class="table-box" id="table-box" table-responsive style="z-index: 1;">
<table class="layui-hide" id="currentTableId" lay-filter="currentTableId2"></table>
</div>
</div>