This commit is contained in:
cwchen 2024-11-13 18:42:18 +08:00
parent a277dab32b
commit c5973f1874
7 changed files with 562 additions and 5 deletions

View File

@ -253,7 +253,7 @@ function viewGs(obj) {
move: false, move: false,
btnAlign: 'c', // 按钮居中显示 btnAlign: 'c', // 按钮居中显示
btn1: function () { btn1: function () {
exeCommandCopyText(obj.gs); exeCommandCopyText(obj.info);
}, },
btn2: function () { btn2: function () {
layer.close(); layer.close();

View File

@ -267,7 +267,7 @@ function viewGs(obj) {
move: false, move: false,
btnAlign: 'c', // 按钮居中显示 btnAlign: 'c', // 按钮居中显示
btn1: function () { btn1: function () {
exeCommandCopyText(obj.gs); exeCommandCopyText(obj.info);
}, },
btn2: function () { btn2: function () {
layer.close(); layer.close();

View File

@ -0,0 +1,395 @@
let objParam;
let form, table, upload, tableIns, layer;
let pageNum = 1;
function setParams(params) {
objParam = JSON.parse(params);
$('#code').html(objParam.code);
$('#titleName').html(objParam.inputDay + '配件盘点记录');
layui.use(["form", "table", 'upload', 'layer'], function () {
form = layui.form;
table = layui.table;
upload = layui.upload;
layer = layui.layer;
getInputDetails();
initTable();
});
}
// 获取配件到货入库详情
function getInputDetails() {
let params = {
encryptedData: JSON.stringify({
'id': objParam.id
})
};
let url = dataUrl + 'backstage/partInput/getInputDetails';
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
console.error(result);
if (result.code === 200) {
setTableData(result.data);
} else {
}
}, function (xhr, status, error) {
errorFn(xhr, status, error)
}, null);
// 基本数据表格赋值
function setTableData(obj) {
$('#codeValue').html(obj.code + '<a style="margin:0 5px;color:#409EFF;cursor: pointer;" onclick=\'viewGs(' + JSON.stringify(obj) + ')\'>查看概述</a>');
$('#inputNum').html(obj.inputNum + '<a style="margin:0 5px;color:#409EFF;cursor: pointer;" onclick=\'viewGs2(' + JSON.stringify(obj) + ')\'>查看概述</a>');
$('#allPrice').html(obj.allPrice);
$('#inputUser').html(obj.inputUser);
$('#inputDay').html(obj.inputDay);
$('#remark').html(obj.remark);
setFileTable(obj.fileList);
}
}
// 附件文档赋值
function setFileTable(fileList) {
$('#file-table tbody tr:not(:first)').remove();
let html = '';
if (fileList && fileList.length > 0) {
$.each(fileList, function (index, item) {
html += '<tr>' +
'<td>' + handleFileType(item.fileName) + item.fileName + '</td>' +
'<td>' + (item.suffix.replace('.', '')) + '</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>' +
'</tr>';
})
} else {
html = '<tr><td colspan="5" style="text-align: center;">暂无数据</td></tr>';
}
$('#file-table tbody').after(html);
}
// 处理文件类型
function handleFileType(value) {
value = value.toLowerCase();
let src = '';
if (value.indexOf('docx') > -1 || value.indexOf('doc') > -1) {
src = '../../../images/docx.png'
} else if (value.indexOf('xls') > -1 || value.indexOf('xlsx') > -1) {
src = '../../../images/xlsx.png'
} else if (value.indexOf('pdf') > -1) {
src = '../../../images/pdf.png'
} else if (value.indexOf('png') > -1 || value.indexOf('jpg') > -1 || value.indexOf('jpeg') > -1) {
src = '../../../images/img_icon.png'
}
return '<img width="20px" height="20px" src = "' + src + '" style="margin:0 5px;">'
}
// 查询/重置
function queryTable(type) {
if (type === 1) {
reloadTable(1);
} else if (type === 2) {
$('#type').val('');
$('#name').val('');
$('#model').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({
'type': $('#type').val(),
'name': $('#name').val(),
'model': $('#model').val(),
'id': objParam.id
}),
},
},
);
}
// 初始化表格
function initTable() {
tableIns = table.render({
elem: "#currentTableId",
id: 'currentTableId',
headers: {
authorization: sessionStorage.getItem("gz-token"),
},
height: "full",
url: dataUrl + "backstage/partInput/getInputDetailListByPage",
where: {
encryptedData: JSON.stringify({
'type': $('#type').val(),
'name': $('#name').val(),
'model': $('#model').val(),
'id': objParam.id
}),
},
request: {
pageName: 'pageNum',
limitName: 'pageSize'
},
parseData: function (res) { // res 即为原始返回的数据
return {
"code": 0, // 解析接口状态
"msg": '获取成功', // 解析提示文本
"count": res.total, // 解析数据长度
"data": res.list // 解析数据列表
};
},
cols: [
[
{
width: '7.9%',
title: "序号",
align: "center",
templet: function (d) {
return d.LAY_NUM;
},
},
{
field: "partType",
width: '8%',
title: "配件类型",
unresize: true,
align: "center",
},
{
field: "partName",
width: '8%',
title: "配件名称",
unresize: true,
align: "center",
},
{
field: "partModel",
title: "规格型号",
width: '8%',
unresize: true,
align: "center",
},
{
field: "partUnit",
title: "平均单价(元)",
width: '10%',
unresize: true,
align: "center",
},
{
field: "partUnit",
title: "单位",
width: '8%',
unresize: true,
align: "center",
},
{
field: "vendName",
width: '10%',
title: "库存量",
unresize: true,
align: "center",
templet: function (d) {
return setNumColor(1,1);
},
},
{
field: "vendName",
width: '10%',
title: "本次盘点量",
unresize: true,
align: "center",
templet: function (d) {
return setNumColor(2,2);
},
},
{
field: "vendName",
width: '10%',
title: "盘盈量",
unresize: true,
align: "center",
templet: function (d) {
return setNumColor(3,3);
},
},
{
field: "vendName",
width: '10%',
title: "盘亏量",
unresize: true,
align: "center",
templet: function (d) {
return setNumColor(4,4);
},
},
{
field: "remark",
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;
table.resize("currentTableId");
},
});
}
// 发货状态颜色
function setNumColor(value, type) {
value = value ? parseInt(value) : 0;
let color = "#19be6b";
let name = ''
if (type === 1) {
color = "#19be6b";
} else if (type === 2) {
color = "#409eff";
} else if (type === 3) {
color = "#19be6b";
} else if (type === 4) {
color = "#f56c6c";
}
return '<span style="color:' + color + ';font-weight:bold;">' + value + "</span>";
}
// 导出
function exportExcel() {
let params = {
'name': $('#name').val(),
'module': $('#module').val(),
'proId': objParam.proId,
'id': id,
'curryDay': time
}
let url = dataUrl + "backstage/export/exportPcList";
exportExcelUtil(url, '发货详情-批次-' + time, JSON.stringify(params));
}
// 打印
function print() {
Print('#table-box', {
onStart: function () {
console.log('onStart', new Date())
},
onEnd: function () {
console.log('onEnd', new Date())
}
})
}
// 查看概述
function viewGs(obj) {
layer.open({
type: 1,
shade: false, // 不显示遮罩
content: '<div style="padding: 1%;">' + obj.info + '</div>',
title: '<h3 style="color: #F56C6C;">' + obj.inputDay + '盘点概述:</h3>',
btn: ['复制文字', '关闭'],
area: ['60%', '50%'],
move: false,
btnAlign: 'c', // 按钮居中显示
btn1: function () {
exeCommandCopyText(obj.info);
},
btn2: function () {
layer.close();
},
});
}
function viewGs2(obj) {
layer.open({
type: 1,
shade: false, // 不显示遮罩
content: '<div style="padding: 1%;">盘盈喷漆165=>180 防撞条210=>280 晾衣杆12=>18 挡水胶7=>80洗菜盆2=>10 主控楼隔板10=>18 不锈钢踢脚板3=>18喷漆165=>180 喷漆165=>180 防撞条210=>280 晾衣杆12=>18 挡水胶7=>80洗菜盆2=>10 主控楼隔板10=>18 不锈钢踢脚板3=>18 。<br>盘亏喷漆165=>100 防撞条210=>200 晾衣杆12=>10 挡水胶7=>1洗菜盆2=>0 主控楼隔板10=>8 不锈钢踢脚板3=>1喷漆165=>120 喷漆165=>110 防撞条210=>180 晾衣杆12=>11 挡水胶7=>2洗菜盆2=>1 主控楼隔板10=>3 不锈钢踢脚板3=>1 。</div>',
title: '<h3 style="color: #F56C6C;">' + obj.inputDay + '盘点概述:</h3>',
btn: ['复制文字', '关闭'],
area: ['60%', '50%'],
move: false,
btnAlign: 'c', // 按钮居中显示
btn1: function () {
exeCommandCopyText(obj.info);
},
btn2: function () {
layer.close();
},
});
}
// 复制文字
function exeCommandCopyText(text) {
try {
const t = document.createElement('textarea')
t.nodeValue = text
t.value = text
document.body.appendChild(t)
t.select()
document.execCommand('copy');
document.body.removeChild(t)
layer.msg('复制成功', { icon: 1 });
} catch (e) {
console.log(e)
layer.msg('复制失败', { icon: 2 });
}
}
// 预览文件
function viewFile(obj) {
let fileName = obj.fileName.toLowerCase();
if (fileName.indexOf('png') || fileName.indexOf('jpg') || fileName.indexOf('jpeg')) {
layer.photos({
shade: 0.5,
photos: {
"title": "图片预览",
"start": 0,
"data": [
{
"alt": "layer",
"pid": 1,
"src": fileUrl + obj.fileUrl + '?token=' + sessionStorage.getItem("gz-token"),
}
]
}
});
} else {
// 调用公司的预览文件的服务
}
}
// 下载文件
function downLoadFile(obj) {
console.log(obj);
let url = dataUrl + "backstage/export/download?fileId=" + obj.id;
downLoadFileUtil(url, obj.fileName, null);
}
// 打印
function print() {
Print('#body', {
onStart: function () {
console.log('onStart', new Date())
},
onEnd: function () {
console.log('onEnd', new Date())
}
})
}

View File

@ -4,10 +4,18 @@ function setParams(obj) {
objParam = JSON.parse(obj); objParam = JSON.parse(obj);
console.log(objParam); console.log(objParam);
if (objParam.type === 2) { // 修改 if (objParam.type === 2) { // 修改
if (objParam.level === '4') {
$('#unit').attr('lay-verify', 'required');
$('#unitLabel').addClass('required');
}
$('#id').val(objParam.nodeId); $('#id').val(objParam.nodeId);
$('#parentId').val(objParam.parentId); $('#parentId').val(objParam.parentId);
getDetailById(); getDetailById();
} else if (objParam.type === 1) { // 新增 } else if (objParam.type === 1) { // 新增
if (objParam.level === '3') {
$('#unit').attr('lay-verify', 'required');
$('#unitLabel').addClass('required');
}
$('#parentName').val(objParam.context); $('#parentName').val(objParam.context);
$('#parentId').val(objParam.nodeId); $('#parentId').val(objParam.nodeId);
} }

View File

@ -309,7 +309,7 @@ function viewGs(obj) {
move: false, move: false,
btnAlign: 'c', // 按钮居中显示 btnAlign: 'c', // 按钮居中显示
btn1: function () { btn1: function () {
exeCommandCopyText(obj.gs); exeCommandCopyText(obj.details);
}, },
btn2: function () { btn2: function () {
layer.close(); layer.close();

View File

@ -0,0 +1,154 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>库存盘点详情</title>
<link rel="stylesheet" href="../../../lib/layui-v2.9.18/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../../css/font.css" media="all">
<link rel="stylesheet" href="../../../css/public.css" media="all">
<link rel="stylesheet" href="../../../css/demandPlan/delivery_batch_list.css" media="all">
</head>
<style>
.layuimini-container {
height: auto;
}
#detail-box {
width: 100%;
height: 70px;
justify-content: space-between;
}
#detail-box>div {
margin: 0 20px;
}
#detail-box img {
width: 50px;
height: 50pz;
}
</style>
<body id="body">
<div id="main-box">
<div class="layout" id="detail-box">
<div class="layout">
<img src="../../../images/svg/u418.svg">
<div class="layout" style="flex-direction: column;align-items: start;margin-left: 10px;">
<p style="font-size: 18px;font-weight: bold;" id="titleName"></p>
<p id="code"></p>
</div>
</div>
<div>
<button type="button" class="layui-btn layui-bg-blue" onclick="print()">打印</button>
</div>
</div>
<div id="basic-box">
<div class="title layout">
<span style="font-weight:700;text-decoration:none;color:#409EFF;"></span>
<p>基本信息</p>
</div>
<div id="basic-table">
<table class="classTable">
<tr>
<th>盘点编号(系统自动生成)</th>
<th>盘点变化量</th>
<th>盘点人</th>
<th>盘点开始日期</th>
<th>盘点结束日期</th>
</tr>
<tr>
<td id="codeValue"></td>
<td id="inputNum"></td>
<td id="allPrice"></td>
<td id="inputUser"></td>
<td id="inputUser2"></td>
</tr>
<tr>
<th colspan="5">备注</th>
</tr>
<tr>
<td colspan="5" id="remark"></td>
</tr>
</table>
</div>
</div>
<div id="file-box">
<div class="title layout">
<span style="font-weight:700;text-decoration:none;color:#409EFF;"></span>
<p>附件文档</p>
</div>
<div id="file-table-box">
<table class="classTable" id="file-table">
<tr>
<th style="width: 30%;">文件名</th>
<th style="width: 10%;">文件类型</th>
<th>上传人员</th>
<th>上传时间</th>
<th>操作</th>
</tr>
</table>
</div>
</div>
<div id="fhjj-box">
<div class="title layout">
<span style="font-weight:700;text-decoration:none;color:#409EFF;"></span>
<p>盘点明细</p>
</div>
<div class="layuimini-container">
<div class="layuimini-main">
<fieldset class="table-search-fieldset">
<legend>搜索信息</legend>
<div style="margin: 10px 10px 10px 10px">
<form class="layui-form layui-form-pane" action="#" onsubmit="return false;">
<div class="layui-form-item">
<div class="layui-inline">
<div class="layui-input-inline" style="width: 300px;">
<input type="text" name="type" id="type" 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="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="model" id="model" autocomplete="off"
class="layui-input" lay-affix="clear" placeholder="输入规格型号"
maxlength="30">
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layui-bg-blue" onclick="queryTable(1)"><i
class="layui-icon"></i> 搜 索</button>
<button class="layui-btn layui-btn-primary" onclick="queryTable(2)"><i
class="layui-icon layui-icon-refresh"></i> 重 置</button>
<button class="layui-btn layui-btn-primary" onclick="exportExcel()"><i
class="layui-icon layui-icon-download-circle"></i> 下 载</button>
</div>
</div>
</form>
</div>
</fieldset>
<div class="table-box" table-responsive style="z-index: 1;" id="table-box">
<table class="layui-hide" id="currentTableId" lay-filter="currentTableId2"></table>
</div>
</div>
</div>
</div>
</div>
</body>
<script src="../../../lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<script src="../../../js/public.js" charset="utf-8"></script>
<script src="../../../js/Print.js" charset="utf-8"></script>
<script src="../../../lib/layui-v2.9.18/layui/layui.js" charset="utf-8"></script>
<script src="../../../js/accessory/child/inventory_count_detail.js" charset="utf-8"></script>
</html>

View File

@ -42,10 +42,10 @@
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label required" style="width: 100px !important;">计量单位</label> <label class="layui-form-label" id="unitLabel" style="width: 100px !important;">计量单位</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input class="layui-input" name="unit" id="unit" autocomplete="off" placeholder="请输入内容" <input class="layui-input" name="unit" id="unit" autocomplete="off" placeholder="请输入内容"
lay-verify="required" maxlength="30" lay-affix="clear"> maxlength="30" lay-affix="clear">
</div> </div>
</div> </div>
</div> </div>