安全工器具台账
This commit is contained in:
parent
cfe36aab74
commit
185ecf4430
|
|
@ -73,6 +73,12 @@
|
||||||
"icon": "fa fa-th",
|
"icon": "fa fa-th",
|
||||||
"target": "_self",
|
"target": "_self",
|
||||||
"child": [
|
"child": [
|
||||||
|
{
|
||||||
|
"title": "安全工器具台账",
|
||||||
|
"href": "page/aq_inventory/safety_tools_ledger.html",
|
||||||
|
"icon": "fa fa-th-large",
|
||||||
|
"target": "_self"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"title": "工程领退台账",
|
"title": "工程领退台账",
|
||||||
"href": "page/aq_inventory/project_material_statistics.html",
|
"href": "page/aq_inventory/project_material_statistics.html",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,229 @@
|
||||||
|
let form, table;
|
||||||
|
let tableIns;
|
||||||
|
let pageNum = 1; // 定义分页
|
||||||
|
layui.use(["form", "table"], function () {
|
||||||
|
form = layui.form;
|
||||||
|
table = layui.table;
|
||||||
|
initTable();
|
||||||
|
getStatistics();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// 数据概览
|
||||||
|
function getStatistics() {
|
||||||
|
let encryptedData = {};
|
||||||
|
let url = dataUrl + 'backstage/projectMaterial/getStatistics?encryptedData=' + encodeURIComponent(JSON.stringify(encryptedData));
|
||||||
|
ajaxRequest(url, "GET", null, true, function () {
|
||||||
|
}, function (result) {
|
||||||
|
if (result.code === 200) {
|
||||||
|
setNum(result.data);
|
||||||
|
}
|
||||||
|
}, function (xhr, status, error) {
|
||||||
|
errorFn(xhr, status, error)
|
||||||
|
}, null);
|
||||||
|
|
||||||
|
// 数据概览赋值
|
||||||
|
function setNum(obj) {
|
||||||
|
$('#num').html(parseInt(obj.projectCount || 0));
|
||||||
|
$('#num2').html(parseInt(obj.totalPurchaseCount || 0));
|
||||||
|
$('#num3').html(parseInt(obj.totalOutCount || 0));
|
||||||
|
$('#num4').html(parseInt(obj.totalShortageCount || 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询/重置
|
||||||
|
function queryTable(type) {
|
||||||
|
if (type === 1) {
|
||||||
|
let keyWord = $('#keyWord').val();
|
||||||
|
let flag = checkValue(keyWord);
|
||||||
|
if (flag) {
|
||||||
|
$('#keyWord').val('');
|
||||||
|
return layer.msg('关键字查询包含特殊字符,请重新输入', { icon: 2 });
|
||||||
|
}
|
||||||
|
let useUnit = $('#useUnit').val();
|
||||||
|
let flag2 = checkValue(useUnit);
|
||||||
|
if (flag2) {
|
||||||
|
$('#useUnit').val('');
|
||||||
|
return layer.msg('领用单位查询包含特殊字符,请重新输入', { icon: 2 });
|
||||||
|
}
|
||||||
|
reloadTable(1);
|
||||||
|
} else if (type === 2) {
|
||||||
|
$('#keyWord').val('');
|
||||||
|
$('#useUnit').val('');
|
||||||
|
$('#isShortage').val('');
|
||||||
|
layui.form.render();
|
||||||
|
reloadTable(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新页面数据
|
||||||
|
function reloadData() {
|
||||||
|
reloadTable(1);
|
||||||
|
getStatistics();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重载表格
|
||||||
|
function reloadTable(pageNum) {
|
||||||
|
table.reload("currentTableId", {
|
||||||
|
where: {
|
||||||
|
encryptedData: JSON.stringify({
|
||||||
|
'keyWord': $('#keyWord').val(),
|
||||||
|
'isShortage': $('#isShortage').val()
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化表格
|
||||||
|
function initTable() {
|
||||||
|
tableIns = table.render({
|
||||||
|
elem: "#currentTableId",
|
||||||
|
id: 'currentTableId',
|
||||||
|
headers: {
|
||||||
|
authorization: sessionStorage.getItem("gz-token"),
|
||||||
|
},
|
||||||
|
// height: "full-300",
|
||||||
|
url: dataUrl + "backstage/inventoryCount/getSafetyToolsLedger",
|
||||||
|
where: {
|
||||||
|
encryptedData: JSON.stringify({
|
||||||
|
'keyWord': $('#keyWord').val()
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
request: {
|
||||||
|
pageName: 'pageNum',
|
||||||
|
limitName: 'pageSize'
|
||||||
|
},
|
||||||
|
parseData: function (res) { // res 即为原始返回的数据
|
||||||
|
if(res.code === 401){
|
||||||
|
closeWindowOpen();
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
"code": 0, // 解析接口状态
|
||||||
|
"msg": '获取成功', // 解析提示文本
|
||||||
|
"count": res.total, // 解析数据长度
|
||||||
|
"data": res.list // 解析数据列表
|
||||||
|
};
|
||||||
|
},
|
||||||
|
cols: [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
width: '5%',
|
||||||
|
title: "序号",
|
||||||
|
align: "center",
|
||||||
|
templet: function (d) {
|
||||||
|
return d.LAY_NUM;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "type",
|
||||||
|
width: '15%',
|
||||||
|
title: "物资类型",
|
||||||
|
unresize: true,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "name",
|
||||||
|
width: '15%',
|
||||||
|
title: "物资名称",
|
||||||
|
unresize: true,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "model",
|
||||||
|
width: '18%',
|
||||||
|
title: "规格型号",
|
||||||
|
unresize: true,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "storageNum",
|
||||||
|
width: '16%',
|
||||||
|
title: "库存量",
|
||||||
|
unresize: true,
|
||||||
|
align: "center",
|
||||||
|
sort: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "totalCk",
|
||||||
|
width: '16%',
|
||||||
|
title: "出库总量",
|
||||||
|
unresize: true,
|
||||||
|
align: "center",
|
||||||
|
sort: true,
|
||||||
|
templet: function (d) {
|
||||||
|
return d.totalCk || 0;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "totalBack",
|
||||||
|
width: '15%',
|
||||||
|
title: "退还数量",
|
||||||
|
unresize: true,
|
||||||
|
align: "center",
|
||||||
|
sort: true,
|
||||||
|
templet: function (d) {
|
||||||
|
return d.totalBack || 0;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
limits: [10, 20, 30, 50, 100],
|
||||||
|
limit: 50,
|
||||||
|
page: false,
|
||||||
|
done: function (res, curr, count) {
|
||||||
|
pageNum = tableIns.config.page.curr;
|
||||||
|
table.resize("currentTableId");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查看详情
|
||||||
|
function viewDetail(id) {
|
||||||
|
layer.msg('查看工程物料详情功能待开发', { icon: 1 });
|
||||||
|
// 这里可以添加查看详情的逻辑,比如打开新窗口或弹窗显示详细信息
|
||||||
|
// openIframe('工程物料详情', 'page/aq_inventory/project_material_detail.html?id=' + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出Excel
|
||||||
|
function exportExcel() {
|
||||||
|
let keyWord = $('#keyWord').val();
|
||||||
|
let isShortage = $('#isShortage').val();
|
||||||
|
|
||||||
|
let params = {
|
||||||
|
'keyWord': keyWord,
|
||||||
|
'isShortage': isShortage
|
||||||
|
};
|
||||||
|
|
||||||
|
let encryptedData = JSON.stringify(params);
|
||||||
|
let url = dataUrl + 'backstage/inventoryCount/exportLedgerListByProjectAndModel?encryptedData=' + encodeURIComponent(encryptedData);
|
||||||
|
|
||||||
|
// 创建隐藏的下载链接
|
||||||
|
let link = document.createElement('a');
|
||||||
|
link.href = url;
|
||||||
|
link.download = '工程物料统计_' + new Date().getTime() + '.xlsx';
|
||||||
|
link.style.display = 'none';
|
||||||
|
|
||||||
|
// 添加授权头并下载
|
||||||
|
fetch(url, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'authorization': sessionStorage.getItem("gz-token")
|
||||||
|
}
|
||||||
|
}).then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.blob();
|
||||||
|
}
|
||||||
|
throw new Error('导出失败');
|
||||||
|
}).then(blob => {
|
||||||
|
let downloadUrl = window.URL.createObjectURL(blob);
|
||||||
|
link.href = downloadUrl;
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
document.body.removeChild(link);
|
||||||
|
window.URL.revokeObjectURL(downloadUrl);
|
||||||
|
layer.msg('导出成功', { icon: 1 });
|
||||||
|
}).catch(error => {
|
||||||
|
layer.msg('导出失败:' + error.message, { icon: 2 });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>工程物料统计</title>
|
||||||
|
<meta name="renderer" content="webkit">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<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_list.css" media="all">
|
||||||
|
</head>
|
||||||
|
<style>
|
||||||
|
#data-overview {
|
||||||
|
width: 100%;
|
||||||
|
height: 80px;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-box {
|
||||||
|
height: calc(100% - 280px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.unit-class {
|
||||||
|
margin: 10px 0 0 10px !important;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<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: 400px;">
|
||||||
|
<input type="text" name="keyWord" id="keyWord" 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)" style="display: none">
|
||||||
|
<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;">
|
||||||
|
<table class="layui-hide" id="currentTableId" lay-filter="currentTableId2"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="../../lib/jquery-3.4.1/jquery-3.7.1.min.js" charset="utf-8"></script>
|
||||||
|
<script src="../../js/public.js" charset="utf-8"></script>
|
||||||
|
<script src="../../lib/layui-v2.9.18/layui/layui.js" charset="utf-8"></script>
|
||||||
|
<script src="../../js/aq_inventory/safety_tools_ledger.js" charset="utf-8"></script>
|
||||||
|
<script src="../../js/openIframe.js" charset="utf-8"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue