Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
2b96bfad84
|
|
@ -1,6 +1,8 @@
|
|||
let form, table, laydate;
|
||||
let tableIns;
|
||||
let pageNum = 1; // 定义分页
|
||||
let selectedData = []; // 存储选中的数据
|
||||
|
||||
layui.use(["form", "table", 'laydate'], function () {
|
||||
form = layui.form;
|
||||
table = layui.table;
|
||||
|
|
@ -10,6 +12,16 @@ layui.use(["form", "table", 'laydate'], function () {
|
|||
range: ['#startDay', '#endDay'],
|
||||
rangeLinked: true
|
||||
});
|
||||
|
||||
// 监听复选框选择
|
||||
table.on('checkbox(currentTableId2)', function(obj){
|
||||
let checkStatus = table.checkStatus('currentTableId');
|
||||
selectedData = checkStatus.data;
|
||||
|
||||
// 根据选中状态显示/隐藏批量审核按钮
|
||||
updateBatchAuditButton();
|
||||
});
|
||||
|
||||
initTable();
|
||||
});
|
||||
|
||||
|
|
@ -44,6 +56,8 @@ function reloadData() {
|
|||
|
||||
// 重载表格
|
||||
function reloadTable(pageNum) {
|
||||
selectedData = []; // 清空选中数据
|
||||
$('#batchAuditBtn').hide(); // 隐藏批量审核按钮
|
||||
table.reload("currentTableId", {
|
||||
page: {
|
||||
curr: pageNum ? pageNum : 1,
|
||||
|
|
@ -95,6 +109,11 @@ function initTable() {
|
|||
},
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
type: 'checkbox',
|
||||
width: '4%',
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
width: '4%',
|
||||
title: "序号",
|
||||
|
|
@ -253,3 +272,117 @@ function accessoryOutBoundDetail(obj, type) {
|
|||
// 1.工器具 0.设备
|
||||
openIframeByParamObj("accessory_out_bound_detail", "配件出库记录", "../accessory/child/accessory_out_bound_detail.html", "92%", "95%", obj);
|
||||
}
|
||||
|
||||
// 更新批量审核按钮状态
|
||||
function updateBatchAuditButton() {
|
||||
let pendingAuditData = selectedData.filter(item => item.status === '1'); // 只有待审核状态的才能批量审核
|
||||
if (pendingAuditData.length > 0) {
|
||||
$('#batchAuditBtn').show();
|
||||
} else {
|
||||
$('#batchAuditBtn').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// 批量审核
|
||||
function batchAudit() {
|
||||
let pendingAuditData = selectedData.filter(item => item.status === '1');
|
||||
|
||||
if (pendingAuditData.length === 0) {
|
||||
return layer.msg('请选择待审核状态的数据', {icon: 2});
|
||||
}
|
||||
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '批量审核 (' + pendingAuditData.length + '条)',
|
||||
area: ['500px', '300px'],
|
||||
content: getBatchAuditFormHtml(),
|
||||
btn: ['确定', '取消'],
|
||||
success: function(layero) {
|
||||
// 重新渲染表单
|
||||
form.render();
|
||||
|
||||
// 监听审核结果变化
|
||||
form.on('radio(batchAuditResult)', function(data) {
|
||||
if (data.value === '2') { // 通过
|
||||
$('textarea[name="batchAuditRemarks"]').val('批量审核通过');
|
||||
} else if (data.value === '3') { // 不通过
|
||||
$('textarea[name="batchAuditRemarks"]').val('');
|
||||
}
|
||||
});
|
||||
},
|
||||
yes: function(index) {
|
||||
submitBatchAudit(pendingAuditData, index);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 获取批量审核表单HTML
|
||||
function getBatchAuditFormHtml() {
|
||||
return `
|
||||
<div style="padding: 20px;">
|
||||
<form class="layui-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label" style="width: 80px;">审核结果</label>
|
||||
<div class="layui-input-block" style="margin-left: 110px;">
|
||||
<input type="radio" name="batchAuditStatus" value="2" title="通过" lay-filter="batchAuditResult" checked>
|
||||
<input type="radio" name="batchAuditStatus" value="3" title="不通过" lay-filter="batchAuditResult">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label" style="width: 80px;">审核意见</label>
|
||||
<div class="layui-input-block" style="margin-left: 110px;">
|
||||
<textarea placeholder="不通过必须填写审核意见" name="batchAuditRemarks" class="layui-textarea" maxLength="200" style="height: 80px;">批量审核通过</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
// 提交批量审核
|
||||
function submitBatchAudit(dataList, layerIndex) {
|
||||
let auditStatus = $('input[name="batchAuditStatus"]:checked').val();
|
||||
let auditRemarks = $('textarea[name="batchAuditRemarks"]').val();
|
||||
|
||||
if (auditStatus === '3' && (!auditRemarks || auditRemarks.trim() === '')) {
|
||||
return layer.msg('驳回时必须填写审核意见', {icon: 2});
|
||||
}
|
||||
|
||||
let loadingMsg = layer.msg('正在批量审核,请稍等...', {
|
||||
icon: 16,
|
||||
shade: 0.3,
|
||||
time: 0
|
||||
});
|
||||
|
||||
let idList = dataList.map(item => item.id);
|
||||
let params = {
|
||||
encryptedData: JSON.stringify({
|
||||
idList: idList,
|
||||
status: auditStatus,
|
||||
remark: auditRemarks.trim()
|
||||
})
|
||||
};
|
||||
|
||||
ajaxRequest(dataUrl + "backstage/partApply/batchAudit", "POST", params, true,
|
||||
function() {
|
||||
// 请求前处理
|
||||
},
|
||||
function(result) {
|
||||
layer.close(loadingMsg);
|
||||
if (result.code === 200) {
|
||||
layer.close(layerIndex);
|
||||
layer.msg('批量审核成功', {icon: 1});
|
||||
selectedData = [];
|
||||
$('#batchAuditBtn').hide();
|
||||
reloadData();
|
||||
} else {
|
||||
layer.msg(result.msg || '批量审核失败', {icon: 2});
|
||||
}
|
||||
},
|
||||
function(xhr, status, error) {
|
||||
layer.close(loadingMsg);
|
||||
layer.msg('服务异常,请稍后重试', {icon: 2});
|
||||
errorFn(xhr, status, error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,9 +104,9 @@ $(document).on("click", ".file-iteme .handle", function (event) {
|
|||
function submitApply() {
|
||||
// 校验出库附件是否上传
|
||||
let length = $('.file-iteme').length;
|
||||
if (length === 0) {
|
||||
return layer.msg('请上传附件证明', { icon: 7 });
|
||||
}
|
||||
// if (length === 0) {
|
||||
// return layer.msg('请上传附件证明', { icon: 7 });
|
||||
// }
|
||||
let formData = new FormData();
|
||||
//遍历最终文件集合
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
|
|
@ -160,18 +160,22 @@ function getPartDetails() {
|
|||
$('#applyNum').html(obj.applyNum);
|
||||
$('#remark').html(obj.remark);
|
||||
let suffix = "data:image/jpeg;base64,"
|
||||
if(obj.lyUrl){
|
||||
$('#lyUrl').html('<img src="' + (suffix + obj.lyUrl) + '" width="120px" height="50px">');
|
||||
}
|
||||
if(obj.zdUrl){
|
||||
$('#zdUrl').html('<img src="' + (suffix + obj.zdUrl) + '" width="120px" height="50px">');
|
||||
}
|
||||
if(obj.ckUrl){
|
||||
$('#ckUrl').html('<img src="' + (suffix + obj.ckUrl) + '" width="120px" height="50px">');
|
||||
}
|
||||
if(obj.shUrl){
|
||||
$('#shUrl').html('<img src="' + (suffix + obj.shUrl) + '" width="120px" height="50px">');
|
||||
}
|
||||
// if(obj.lyUrl){
|
||||
// $('#lyUrl').html('<img src="' + (suffix + obj.lyUrl) + '" width="120px" height="50px">');
|
||||
// }
|
||||
// if(obj.zdUrl){
|
||||
// $('#zdUrl').html('<img src="' + (suffix + obj.zdUrl) + '" width="120px" height="50px">');
|
||||
// }
|
||||
// if(obj.ckUrl){
|
||||
// $('#ckUrl').html('<img src="' + (suffix + obj.ckUrl) + '" width="120px" height="50px">');
|
||||
// }
|
||||
// if(obj.shUrl){
|
||||
// $('#shUrl').html('<img src="' + (suffix + obj.shUrl) + '" width="120px" height="50px">');
|
||||
// }
|
||||
$('#lyUrl').html(obj.userName)
|
||||
$('#zdUrl').html(obj.zdUser)
|
||||
$('#ckUrl').html(obj.ckUser)
|
||||
$('#shUrl').html(obj.fzUser)
|
||||
setFileTable(obj.fileList);
|
||||
if (objParam.type === '0') { // 设备
|
||||
let html = '';
|
||||
|
|
|
|||
|
|
@ -400,7 +400,8 @@ function checkValue(that, type) {
|
|||
function closePage(type) {
|
||||
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
|
||||
if (type == 1) {
|
||||
window.parent.reloadData();
|
||||
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
|
||||
parent.layer.close(index); // 再执行关闭window.parent.closePage();
|
||||
}
|
||||
parent.layer.close(index); // 再执行关闭
|
||||
|
||||
|
|
|
|||
|
|
@ -499,7 +499,8 @@ function checkValue(that, type) {
|
|||
function closePage(type) {
|
||||
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
|
||||
if (type == 1) {
|
||||
window.parent.reloadData();
|
||||
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
|
||||
parent.layer.close(index); // 再执行关闭
|
||||
}
|
||||
parent.layer.close(index); // 再执行关闭
|
||||
}
|
||||
|
|
@ -130,11 +130,11 @@ function submitApply(data) {
|
|||
if (list.length === 0) {
|
||||
return layer.msg('未添加盘点明细数据', { icon: 7 });
|
||||
}
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].checkNum === 0 || list[i].checkNum === '0') {
|
||||
return layer.msg('盘点明细,第' + (i + 1) + '行,未填写本次盘点量', { icon: 7 });
|
||||
}
|
||||
}
|
||||
// for (let i = 0; i < list.length; i++) {
|
||||
// if (list[i].checkNum === 0 || list[i].checkNum === '0') {
|
||||
// return layer.msg('盘点明细,第' + (i + 1) + '行,未填写本次盘点量', { icon: 7 });
|
||||
// }
|
||||
// }
|
||||
data.field.detailList = list;
|
||||
let formData = new FormData();
|
||||
//遍历最终文件集合
|
||||
|
|
|
|||
|
|
@ -0,0 +1,169 @@
|
|||
let form, table, laydate;
|
||||
let tableIns;
|
||||
let pageNum = 1; // 定义分页
|
||||
|
||||
|
||||
function setParams(params) {
|
||||
objParam = JSON.parse(params);
|
||||
layui.use(["form", "table", 'upload', 'layer', 'laydate'], function () {
|
||||
form = layui.form;
|
||||
table = layui.table;
|
||||
laydate = layui.laydate;
|
||||
laydate.render({
|
||||
elem: '#ID-laydate-rangeLinked',
|
||||
range: ['#startDay', '#endDay'],
|
||||
rangeLinked: true
|
||||
});
|
||||
initTable();
|
||||
});
|
||||
}
|
||||
|
||||
// 查询/重置
|
||||
function queryTable(type) {
|
||||
if (type === 1) {
|
||||
let keyWord = $('#keyWord').val();
|
||||
let flag = checkValue(keyWord);
|
||||
if (flag) {
|
||||
$('#keyWord').val('');
|
||||
return layer.msg('关键字查询包含特殊字符,请重新输入', { icon: 2 });
|
||||
}
|
||||
reloadTable(1);
|
||||
} else if (type === 2) {
|
||||
$('#keyWord').val('');
|
||||
$('#startDay').val('');
|
||||
$('#endDay').val('');
|
||||
layui.form.render();
|
||||
reloadTable(1);
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新页面数据
|
||||
function reloadData() {
|
||||
reloadTable(pageNum);
|
||||
}
|
||||
|
||||
// 重载表格
|
||||
function reloadTable(pageNum) {
|
||||
table.reload("currentTableId", {
|
||||
page: {
|
||||
curr: pageNum ? pageNum : 1,
|
||||
},
|
||||
where: {
|
||||
encryptedData: JSON.stringify({
|
||||
'keyWord': $('#keyWord').val(),
|
||||
'deviceId': objParam.deviceId,
|
||||
'proId': objParam.proId,
|
||||
'startDay': $('#startDay').val(),
|
||||
'endDay': $('#endDay').val()
|
||||
}),
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
tableIns = table.render({
|
||||
elem: "#currentTableId",
|
||||
id: 'currentTableId',
|
||||
headers: {
|
||||
authorization: sessionStorage.getItem("gz-token"),
|
||||
},
|
||||
height: "full-170",
|
||||
url: dataUrl + "backstage/statistic/getPartList",
|
||||
where: {
|
||||
encryptedData: JSON.stringify({
|
||||
'keyWord': $('#keyWord').val(),
|
||||
'deviceId': objParam.deviceId,
|
||||
'proId': objParam.proId,
|
||||
'startDay': $('#startDay').val(),
|
||||
'endDay': $('#endDay').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;
|
||||
},
|
||||
},
|
||||
{
|
||||
width: '15%',
|
||||
title: "配件领用设备",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
templet: function (d) {
|
||||
return objParam.module;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "proName",
|
||||
width: '15%',
|
||||
title: "领用工程",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
field: "code",
|
||||
width: '14%',
|
||||
title: "领料单编号",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
field: "partName",
|
||||
width: '15%',
|
||||
title: "配件名称",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
field: "partModel",
|
||||
width: '12%',
|
||||
title: "配件规格",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
field: "applyNum",
|
||||
width: '8%',
|
||||
title: "领用数量",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
field: "createTime",
|
||||
width: '15%',
|
||||
title: "申请时间",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
],
|
||||
],
|
||||
limits: [10, 15, 20, 25, 50, 100],
|
||||
limit: 10,
|
||||
page: true,
|
||||
done: function (res, curr, count) {
|
||||
pageNum = tableIns.config.page.curr;
|
||||
table.resize("currentTableId");
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
let form, table;
|
||||
let tableIns;
|
||||
let pageNum = 1; // 定义分页
|
||||
|
||||
|
||||
function setParams(params) {
|
||||
objParam = JSON.parse(params);
|
||||
layui.use(["form", "table", 'upload', 'layer'], function () {
|
||||
form = layui.form;
|
||||
table = layui.table;
|
||||
initTable();
|
||||
});
|
||||
}
|
||||
|
||||
// 查询/重置
|
||||
function queryTable(type) {
|
||||
if (type === 1) {
|
||||
let keyWord = $('#keyWord').val();
|
||||
let flag = checkValue(keyWord);
|
||||
if (flag) {
|
||||
$('#keyWord').val('');
|
||||
return layer.msg('关键字查询包含特殊字符,请重新输入', { icon: 2 });
|
||||
}
|
||||
reloadTable(1);
|
||||
} else if (type === 2) {
|
||||
$('#keyWord').val('');
|
||||
// $('#proStatus').val('');
|
||||
layui.form.render();
|
||||
reloadTable(1);
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新页面数据
|
||||
function reloadData() {
|
||||
reloadTable(pageNum);
|
||||
}
|
||||
|
||||
// 重载表格
|
||||
function reloadTable(pageNum) {
|
||||
table.reload("currentTableId", {
|
||||
page: {
|
||||
curr: pageNum ? pageNum : 1,
|
||||
},
|
||||
where: {
|
||||
encryptedData: JSON.stringify({
|
||||
'keyWord': $('#keyWord').val(),
|
||||
'id': objParam.id
|
||||
}),
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
tableIns = table.render({
|
||||
elem: "#currentTableId",
|
||||
id: 'currentTableId',
|
||||
headers: {
|
||||
authorization: sessionStorage.getItem("gz-token"),
|
||||
},
|
||||
height: "full-170",
|
||||
url: dataUrl + "backstage/statistic/getListDetails",
|
||||
where: {
|
||||
encryptedData: JSON.stringify({
|
||||
'keyWord': $('#keyWord').val(),
|
||||
'id': objParam.id
|
||||
}),
|
||||
},
|
||||
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: '20%',
|
||||
title: "序号",
|
||||
align: "center",
|
||||
templet: function (d) {
|
||||
return d.LAY_NUM;
|
||||
},
|
||||
},
|
||||
{
|
||||
width: '30%',
|
||||
title: "配件领用设备",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
templet: function (d) {
|
||||
return objParam.module;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "proName",
|
||||
width: '30%',
|
||||
title: "领用工程",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "领用配件详情",
|
||||
width: '20%',
|
||||
align: "center",
|
||||
unresize: true,
|
||||
templet: function (d) {
|
||||
let html = "";
|
||||
d.module=objParam.module;
|
||||
html += "<a onclick='partDetail(" + JSON.stringify(d) + ")'>查看领用配件</a>";
|
||||
return html;
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
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 partDetail(obj) {
|
||||
openIframeByParamObj("part_detail", "配件详情", "./part_detail.html", "92%", "95%", obj);
|
||||
}
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
let form, table;
|
||||
let tableIns;
|
||||
let pageNum = 1; // 定义分页
|
||||
layui.use(["form", "table"], function () {
|
||||
form = layui.form;
|
||||
table = layui.table;
|
||||
initTable();
|
||||
});
|
||||
|
||||
// 查询/重置
|
||||
function queryTable(type) {
|
||||
if (type === 1) {
|
||||
let keyWord = $('#keyWord').val();
|
||||
let flag = checkValue(keyWord);
|
||||
if (flag) {
|
||||
$('#keyWord').val('');
|
||||
return layer.msg('关键字查询包含特殊字符,请重新输入', { icon: 2 });
|
||||
}
|
||||
reloadTable(1);
|
||||
} else if (type === 2) {
|
||||
$('#keyWord').val('');
|
||||
// $('#proStatus').val('');
|
||||
layui.form.render();
|
||||
reloadTable(1);
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新页面数据
|
||||
function reloadData() {
|
||||
reloadTable(pageNum);
|
||||
}
|
||||
|
||||
// 重载表格
|
||||
function reloadTable(pageNum) {
|
||||
table.reload("currentTableId", {
|
||||
page: {
|
||||
curr: pageNum ? pageNum : 1,
|
||||
},
|
||||
where: {
|
||||
encryptedData: JSON.stringify({
|
||||
'keyWord': $('#keyWord').val(),
|
||||
// 'proStatus': $('#proStatus').val()
|
||||
}),
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
tableIns = table.render({
|
||||
elem: "#currentTableId",
|
||||
id: 'currentTableId',
|
||||
headers: {
|
||||
authorization: sessionStorage.getItem("gz-token"),
|
||||
},
|
||||
height: "full-170",
|
||||
url: dataUrl + "backstage/statistic/findListByPage",
|
||||
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: '15%',
|
||||
title: "序号",
|
||||
align: "center",
|
||||
templet: function (d) {
|
||||
return d.LAY_NUM;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "module",
|
||||
width: '24.5%',
|
||||
title: "配件领用设备",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
sort:true,
|
||||
},
|
||||
{
|
||||
field: "deviceCode",
|
||||
width: '20%',
|
||||
title: "设备编号",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
field: "remark",
|
||||
width: '20%',
|
||||
title: "备注",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "领用工程",
|
||||
width: '20%',
|
||||
align: "center",
|
||||
unresize: true,
|
||||
templet: function (d) {
|
||||
let html = "";
|
||||
html += "<a onclick='proCountDetail(" + JSON.stringify(d) + ")'>" + d.num + "</a>";
|
||||
return html;
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
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 exportExcel() {
|
||||
let params = {
|
||||
'keyWord': $('#keyWord').val(),
|
||||
}
|
||||
let url = dataUrl + "backstage/statistic/exportProListPage";
|
||||
exportExcelUtil(url, '工程统计', JSON.stringify(params));
|
||||
}
|
||||
|
||||
// 配件退料详情
|
||||
function proCountDetail(obj) {
|
||||
openIframeByParamObj("pro_part_detail", "工程详情", "./child/pro_part_detail.html", "92%", "95%", obj);
|
||||
}
|
||||
|
||||
// 工程状态
|
||||
function setProStatus(status) {
|
||||
if (status === '1') {
|
||||
return "<span style='color:#19BE6B;margin:0 5px 0 5px;font-size:16px'>●</span>在建";
|
||||
} else if (status === '2') {
|
||||
return "<span style='color:#999;margin:0 5px 0 5px;font-size:16px;'>●</span>完工";
|
||||
} else {
|
||||
return '/';
|
||||
}
|
||||
}
|
||||
|
|
@ -95,7 +95,9 @@ function getDTreeData() {
|
|||
}, function (result) {
|
||||
if (result.code === 200) {
|
||||
if (result.data && result.data.length > 0) {
|
||||
$.each(result.data, function (index, item) {
|
||||
// 对数据进行排序处理
|
||||
var sortedData = sortDataByChildName(result.data);
|
||||
$.each(sortedData, function (index, item) {
|
||||
item.title = item.name;
|
||||
list.push(item);
|
||||
})
|
||||
|
|
@ -107,6 +109,143 @@ function getDTreeData() {
|
|||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对数据进行排序,2级level层级根据其子层3级的name编号排序
|
||||
* @param {Array} data 原始数据数组
|
||||
* @returns {Array} 排序后的数据数组
|
||||
*/
|
||||
function sortDataByChildName(data) {
|
||||
try {
|
||||
// 如果数据为空或无效,直接返回
|
||||
if (!data || data.length === 0) {
|
||||
return data;
|
||||
}
|
||||
|
||||
// 按level分组
|
||||
var level0Items = [];
|
||||
var level1Items = [];
|
||||
var level2Items = [];
|
||||
var level3Items = [];
|
||||
var otherItems = [];
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var item = data[i];
|
||||
if (!item || typeof item.level === 'undefined') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.level === 0) {
|
||||
level0Items.push(item);
|
||||
} else if (item.level === 1) {
|
||||
level1Items.push(item);
|
||||
} else if (item.level === 2) {
|
||||
level2Items.push(item);
|
||||
} else if (item.level === 3) {
|
||||
level3Items.push(item);
|
||||
} else if (item.level > 3) {
|
||||
otherItems.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有2级或3级数据,直接返回原始数据
|
||||
if (level2Items.length === 0) {
|
||||
return data;
|
||||
}
|
||||
|
||||
// 为每个2级项目找到其最小的3级子项name编号
|
||||
var level2WithMinChildName = [];
|
||||
for (var j = 0; j < level2Items.length; j++) {
|
||||
var level2Item = level2Items[j];
|
||||
|
||||
// 找到属于这个2级项目的所有3级子项
|
||||
var childItems = [];
|
||||
for (var k = 0; k < level3Items.length; k++) {
|
||||
if (level3Items[k].parentId === level2Item.id) {
|
||||
childItems.push(level3Items[k]);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果有子项,找到最小的name编号
|
||||
var minChildName = null;
|
||||
if (childItems.length > 0) {
|
||||
var childNames = [];
|
||||
for (var l = 0; l < childItems.length; l++) {
|
||||
var childName = childItems[l].name;
|
||||
if (childName) {
|
||||
var match = childName.match(/\d+/);
|
||||
var num = match ? parseInt(match[0]) : 999999; // 如果没有数字,给一个很大的数
|
||||
childNames.push(num);
|
||||
}
|
||||
}
|
||||
if (childNames.length > 0) {
|
||||
minChildName = Math.min.apply(Math, childNames);
|
||||
}
|
||||
}
|
||||
|
||||
// 创建新对象包含排序信息
|
||||
var itemWithSort = {};
|
||||
for (var prop in level2Item) {
|
||||
if (level2Item.hasOwnProperty(prop)) {
|
||||
itemWithSort[prop] = level2Item[prop];
|
||||
}
|
||||
}
|
||||
itemWithSort.minChildName = minChildName;
|
||||
itemWithSort.childCount = childItems.length;
|
||||
level2WithMinChildName.push(itemWithSort);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 对2级项目按最小子项name编号排序
|
||||
level2WithMinChildName.sort(function(a, b) {
|
||||
// 如果都有子项编号,按编号排序
|
||||
if (a.minChildName !== null && b.minChildName !== null) {
|
||||
return a.minChildName - b.minChildName;
|
||||
}
|
||||
// 如果只有一个有子项编号,有编号的排在前面
|
||||
if (a.minChildName !== null && b.minChildName === null) {
|
||||
return -1;
|
||||
}
|
||||
if (a.minChildName === null && b.minChildName !== null) {
|
||||
return 1;
|
||||
}
|
||||
// 如果都没有子项编号,按原始name排序
|
||||
if (a.name && b.name) {
|
||||
return a.name.localeCompare ? a.name.localeCompare(b.name) : (a.name > b.name ? 1 : -1);
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
// 移除临时添加的属性
|
||||
var sortedLevel2Items = [];
|
||||
for (var m = 0; m < level2WithMinChildName.length; m++) {
|
||||
var originalItem = {};
|
||||
for (var prop in level2WithMinChildName[m]) {
|
||||
if (level2WithMinChildName[m].hasOwnProperty(prop) &&
|
||||
prop !== 'minChildName' && prop !== 'childCount') {
|
||||
originalItem[prop] = level2WithMinChildName[m][prop];
|
||||
}
|
||||
}
|
||||
sortedLevel2Items.push(originalItem);
|
||||
}
|
||||
|
||||
// 重新组合所有数据,保持其他level的原始顺序
|
||||
var result = [];
|
||||
result = result.concat(level0Items);
|
||||
result = result.concat(level1Items);
|
||||
result = result.concat(sortedLevel2Items);
|
||||
result = result.concat(level3Items);
|
||||
result = result.concat(otherItems);
|
||||
|
||||
return result;
|
||||
|
||||
} catch (error) {
|
||||
console.error("排序函数出错:", error);
|
||||
// 如果排序失败,返回原始数据
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// 查询、重置
|
||||
function queryDtree(type) {
|
||||
if (type === 1) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>领料出库</title>
|
||||
<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">
|
||||
|
|
@ -58,6 +58,8 @@
|
|||
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>
|
||||
<button class="layui-btn layui-bg-orange" id="batchAuditBtn" onclick="batchAudit()" style="display: none;"><i
|
||||
class="layui-icon layui-icon-ok"></i> 批量审核</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
<!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">
|
||||
</head>
|
||||
|
||||
<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: 300px;">
|
||||
<input type="text" name="keyWord" id="keyWord" autocomplete="off"
|
||||
class="layui-input" lay-affix="clear" placeholder="输入关键字" maxlength="30">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline" style="margin-bottom: 0;">
|
||||
<div class="layui-inline" id="ID-laydate-rangeLinked">
|
||||
<div class="layui-input-inline" style="width: 140px;">
|
||||
<input type="text" autocomplete="off" id="startDay" class="layui-input" readonly
|
||||
placeholder="开始日期">
|
||||
</div>
|
||||
<div class="layui-form-mid">-</div>
|
||||
<div class="layui-input-inline" style="width: 140px;">
|
||||
<input type="text" autocomplete="off" id="endDay" class="layui-input" readonly
|
||||
placeholder="结束日期">
|
||||
</div>
|
||||
</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>
|
||||
</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.4.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/accessory/child/part_detail.js"></script>
|
||||
<script src="../../../js/openIframe.js" charset="utf-8"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<!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">
|
||||
</head>
|
||||
|
||||
<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: 300px;">
|
||||
<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)"><i
|
||||
class="layui-icon layui-icon-refresh"></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.4.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/accessory/child/pro_part_detail.js"></script>
|
||||
<script src="../../../js/openIframe.js" charset="utf-8"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<!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">
|
||||
</head>
|
||||
|
||||
<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: 300px;">
|
||||
<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)"><i
|
||||
class="layui-icon layui-icon-refresh"></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.4.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/accessory/device_pro_list.js" charset="utf-8"></script>
|
||||
<script src="../../js/openIframe.js" charset="utf-8"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Loading…
Reference in New Issue