1、需求计划申请,需用天数改为退还日期

2、设备发货,取消实际发货量限制
3、设备发货增加时间筛选
This commit is contained in:
hayu 2025-03-10 13:10:54 +08:00
parent 138f679b71
commit e4f085bb32
12 changed files with 117 additions and 55 deletions

View File

@ -182,16 +182,15 @@ function initTable() {
},
},
{
field: "needDay",
field: "backDate",
width: '10%',
title: "需用天数",
title: "退还日期",
unresize: true,
align: "center",
sort:true,
sort: true,
templet: function (d) {
return setNumColor(d.needDay);
},
return d.backDate ? d.backDate : '';
}
},
{
field: "remark",

View File

@ -99,7 +99,7 @@ function getPlanDetailListNoPage() {
$.each(obj, function (index, item) {
let obj = Object.assign({}, item);
obj.unitName = item.unit;
obj.times = item.needDay;
obj.times = item.backDate;
obj.remarks = item.remark;
obj.dataId = item.id;
obj.id = item.modelId;
@ -141,9 +141,9 @@ function submitApply(data) {
if (parseInt(list[i].needNum) === 0) {
return layer.msg('安全工器具明细数据' + (i + 1) + '行,未填写需用量', { icon: 7 });
}
if (parseInt(list[i].needDay) === 0) {
return layer.msg('安全工器具明细数据' + (i + 1) + '行,未填写需用天数', { icon: 7 });
}
// if (parseInt(list[i].needDay) === 0) {
// return layer.msg('安全工器具明细数据' + (i + 1) + '行,未填写需用天数', { icon: 7 });
// }
}
data.field.id = objParam.id;
data.field.jsonData = JSON.stringify(list);
@ -213,7 +213,7 @@ function getBaseTableData() {
model: $(this).find('td').eq(4).html(),
unit: $(this).find('td').eq(5).html(),
needNum: needNum ? needNum : 0,
needDay: times ? times : 0,
backDate: times,
remark: $(this).find('td').eq(8).find('input[name="remarks"]').val(),
})
})
@ -309,7 +309,7 @@ function setTableData(results) {
html += "<td>" + l.model + "</td>";
html += "<td>" + l.unitName + "</td>";
html += "<td>" + setFormInput(l.needNum, 1) + "</td>";
html += "<td>" + setFormInput(l.times == null ? 0 : l.times, 2) + "</td>";
html += "<td>" + setFormInput(l.times == null ? '' : l.times, 2) + "</td>";
html += "<td>" + setFormInput(l.remarks, 3) + "</td>";
html += "</tr>";
}
@ -317,6 +317,13 @@ function setTableData(results) {
html += "<tr><td colspan='9' class='center'>没有相关数据</td></tr>";
}
$("#baseTable tbody").empty().append(html);
// 渲染日期选择器
$('.refund-date').each(function(){
laydate.render({
elem: this, // 指定元素
type: 'date' // 可选,指定为日期类型,默认即是'date'
});
});
layui.form.render();
}
@ -324,8 +331,9 @@ function setFormInput(value, type) {
let html = '<form class="layui-form layuimini-form"><div class="layui-inline">';
if (type === 1) { // 需用量
html += '<input class="layui-input" name="needNum" onblur="checkValue(this,1,\'需用量\')" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9">';
} else if (type === 2) { // 需用天数
html += '<input class="layui-input" name="times" onblur="checkValue(this,2,\'需用天数\')" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9">';
} else if (type === 2) { // 退还日期
// html += '<input class="layui-input" name="times" onblur="checkValue(this,2,\'需用天数\')" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9">';
html += '<input class="layui-input refund-date" name="times" id="refundDate" value="' + setNullValue(value) + '" autocomplete="off">';
} else if (type === 3) { // 备注
html += '<input class="layui-input" placeholder="请输入备注" id="remarks" name="remarks" value="' + setNullValue(value) + '" maxLength="60" lay-affix="clear"></input>';
}

View File

@ -76,9 +76,9 @@ function submitApply(data) {
if (parseInt(list[i].needNum) === 0) {
return layer.msg('安全工器具明细数据' + (i + 1) + '行,未填写需用量', { icon: 7 });
}
if (parseInt(list[i].needDay) === 0) {
return layer.msg('安全工器具明细数据' + (i + 1) + '行,未填写需用天数', { icon: 7 });
}
// if (parseInt(list[i].needDay) === 0) {
// return layer.msg('安全工器具明细数据' + (i + 1) + '行,未填写需用天数', { icon: 7 });
// }
}
data.field.jsonData = JSON.stringify(list);
let loadingMsg = layer.msg('正在提交保存,请稍等...', { icon: 16, shade: 0.01, time: '0' });
@ -121,7 +121,7 @@ function getBaseTableData() {
model: $(this).find('td').eq(4).html(),
unit: $(this).find('td').eq(5).html(),
needNum: needNum ? needNum : 0,
needDay: times ? times : 0,
backDate: times,
remark: $(this).find('td').eq(8).find('input[name="remarks"]').val(),
})
})
@ -215,7 +215,7 @@ function setTableData(results) {
html += "<td>" + l.model + "</td>";
html += "<td>" + l.unitName + "</td>";
html += "<td>" + setFormInput(l.needNum, 1) + "</td>";
html += "<td>" + setFormInput(l.times == null ? 0 : l.times, 2) + "</td>";
html += "<td>" + setFormInput(l.times, 2) + "</td>";
html += "<td>" + setFormInput(l.remarks, 3) + "</td>";
html += "</tr>";
}
@ -223,6 +223,14 @@ function setTableData(results) {
html += "<tr><td colspan='9' class='center'>没有相关数据</td></tr>";
}
$("#baseTable tbody").empty().append(html);
// 渲染日期选择器
$('.refund-date').each(function(){
laydate.render({
elem: this, // 指定元素
type: 'date' // 可选,指定为日期类型,默认即是'date'
});
});
layui.form.render();
}
@ -230,8 +238,8 @@ function setFormInput(value, type) {
let html = '<form class="layui-form layuimini-form"><div class="layui-inline">';
if (type === 1) { // 需用量
html += '<input class="layui-input" name="needNum" onblur="checkValue(this,1,\'需用量\')" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9">';
} else if (type === 2) { // 需用天数
html += '<input class="layui-input" name="times" onblur="checkValue(this,2,\'需用天数\')" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9">';
} else if (type === 2) { // 退还日期
html += '<input class="layui-input refund-date" name="times" id="refundDate" value="' + setNullValue(value) + '" autocomplete="off">';
} else if (type === 3) { // 备注
html += '<input class="layui-input" placeholder="请输入备注" id="remarks" name="remarks" value="' + setNullValue(value) + '" maxLength="60" lay-affix="clear"></input>';
}
@ -352,7 +360,7 @@ function goOnAddData() {
// 校验数据
function checkValue(that, type, name) {
let value = $(that).val();
if (type === 1 || type === 2) { // 需用量 / 需用天数
if (type === 1) { // 需用量 / 需用天数
const regex = /^(0|[1-9]\d{0,6})$/;
if (!regex.test(value) && value) {
layer.msg('' + name + '输入有误,请重新输入!', { icon: 5 })

View File

@ -8,12 +8,13 @@ let cjList = [];
let jjDetailArr = []; // 入库配件类型数据
function setParams(obj) {
objParam = JSON.parse(obj);
layui.use(["form", "table", 'element', 'layer', 'util'], function () {
layui.use(["form", "table", 'element', 'layer', 'util', 'laydate'], function () {
form = layui.form;
table = layui.table;
element = layui.element;
layer = layui.layer;
util = layui.util;
laydate = layui.laydate;
initTable();
});
}
@ -155,12 +156,17 @@ function initTable() {
},
{
field: "times",
width: '15%',
title: "<span style='color:red'> * </span>需用天数",
width: "15%",
title: "退还日期",
unresize: true,
align: "center",
edit: 'text',
style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;',
templet: (d) =>
'<div class="layui-input-inline"><input type="text" class="layui-input date-picker" id="date_' +
d.id +
'" value="' +
(d.times || "") +
'" readonly></div>',
style: "outline: 1px solid #e6e6e6;outline-offset: -5px;",
},
{
field: "remarks",
@ -195,6 +201,22 @@ function initTable() {
}
}
}
// 初始化日期选择器
res.data.forEach((item) => {
laydate.render({
elem: "#date_" + item.id,
done: (value) => {
// 更新数据
const data = {}
data.id = item.id
data.times = value
item.times = data.times
updateOrAddObject(item.id, item)
},
})
})
//设置全选checkbox的选中状态只有改变LAY_CHECKED的值 table.checkStatus才能抓取到选中的状态
let checkStatus = table.checkStatus('currentTableId');//这里的lightTable是指分页中的id
if (checkStatus.isAll) {//是否全选
@ -207,7 +229,7 @@ function initTable() {
table.on('edit(currentTableId2)', function (obj) {
var field = obj.field; // 得到修改的字段
var value = obj.value // 得到修改后的值
if (field === 'needNum' || field === 'times') { // 需用量 / 需用天数
if (field === 'needNum') { // 需用量 / 需用天数
if (value) {
const regex = /^(0|[1-9]\d{0,6})$/;
if (!regex.test(value)) {

View File

@ -229,9 +229,9 @@ function beforeSubmitApply() {
return layer.msg('序号为' + (i + 1) + '的数据,未选择检验日期', { icon: 7 });
}
}
if (parseInt(o.needNum) < (cgNum + lkNum)) { // 采购量 大于需求量
return layer.msg('序号为' + (i + 1) + '的数据,采购量和利库量不能大于需要量', { icon: 7 });
}
// if (parseInt(o.needNum) < (cgNum + lkNum)) { // 采购量 大于需求量
// return layer.msg('序号为' + (i + 1) + '的数据,采购量和利库量不能大于需要量', { icon: 7 });
// }
}
openIframeByParamObj("quickAddForm", "采购发货确认", "./send_out_confirm.html", "92%", "92%", dataList);
}

View File

@ -92,14 +92,14 @@ function checkValue(that, type) {
$(that).val(0);
return layer.msg('采购量输入有误,请重新输入!', { icon: 5 })
}
if (value) {
// 采购量不能大于需要量
let needNum = $(that).parents('td').prev().html();
if (parseInt(value) > parseInt(needNum)) {
$(that).val(0);
return layer.msg('采购量不能大于需要量,请重新输入!', { icon: 5 })
}
}
// if (value) {
// // 采购量不能大于需要量
// let needNum = $(that).parents('td').prev().html();
// if (parseInt(value) > parseInt(needNum)) {
// $(that).val(0);
// return layer.msg('采购量不能大于需要量,请重新输入!', { icon: 5 })
// }
// }
} else if (type === 2) { // 利库量
const regex = /^(0|[1-9]\d{0,6})$/;
if (!regex.test(value) && value) {

View File

@ -160,9 +160,9 @@ function beforeSubmitApply() {
return layer.msg('序号为' + (i + 1) + '的数据,未选择检验日期', { icon: 7 });
}
}
if (parseInt(o.needNum) < (cgNum + lkNum)) { // 采购量 大于需求量
return layer.msg('序号为' + (i + 1) + '的数据,采购量和利库量不能大于需要量', { icon: 7 });
}
// if (parseInt(o.needNum) < (cgNum + lkNum)) { // 采购量 大于需求量
// return layer.msg('序号为' + (i + 1) + '的数据,采购量和利库量不能大于需要量', { icon: 7 });
// }
}
openIframeByParamObj("quickAddForm", "采购发货确认", "./send_out_confirm.html", "92%", "92%", dataList);
}

View File

@ -74,14 +74,14 @@ function checkValue(that, type) {
$(that).val(0);
return layer.msg('采购量输入有误,请重新输入!', { icon: 5 })
}
if (value) {
// 采购量不能大于需要量
let needNum = $(that).parents('td').prev().html();
if (parseInt(value) > parseInt(needNum)) {
$(that).val(0);
return layer.msg('采购量不能大于需要量,请重新输入!', { icon: 5 })
}
}
// if (value) {
// // 采购量不能大于需要量
// let needNum = $(that).parents('td').prev().html();
// if (parseInt(value) > parseInt(needNum)) {
// $(that).val(0);
// return layer.msg('采购量不能大于需要量,请重新输入!', { icon: 5 })
// }
// }
} else if (type === 2) { // 利库量
const regex = /^(0|[1-9]\d{0,6})$/;
if (!regex.test(value) && value) {

View File

@ -5,6 +5,12 @@ layui.use(["form", "table", 'element'], function () {
form = layui.form;
table = layui.table;
element = layui.element;
laydate = layui.laydate;
laydate.render({
elem: '#ID-laydate-rangeLinked',
range: ['#startTime', '#endTime'],
rangeLinked: true
});
/* // 动态插入进度条元素
$("#num-progress").after(`
<div class="layui-progress layui-bg-red" lay-filter="demo-filter-progress" style="margin-top:2%;">
@ -81,6 +87,8 @@ function queryTable(type) {
} else if (type === 2) {
$('#proName').val('');
$('#status').val('');
$('#startTime').val('');
$('#endTime').val('');
layui.form.render();
reloadTable(1);
}
@ -101,7 +109,9 @@ function reloadTable(pageNum) {
where: {
encryptedData: JSON.stringify({
'proName': $('#proName').val(),
'status': $('#status').val()
'status': $('#status').val(),
'startTime': $('#startTime').val(),
'endTime': $('#endTime').val()
}),
},
},
@ -121,7 +131,9 @@ function initTable() {
where: {
encryptedData: JSON.stringify({
'proName': $('#proName').val(),
'status': $('#status').val()
'status': $('#status').val(),
'startTime': $('#startTime').val(),
'endTime': $('#endTime').val()
}),
},
request: {
@ -346,7 +358,9 @@ function schedule(d) {
function exportExcel() {
let params = {
'proName': $('#proName').val(),
'status': $('#status').val()
'status': $('#status').val(),
'startTime': $('#startTime').val(),
'endTime': $('#endTime').val()
}
let url = dataUrl + "backstage/purchase/export";
exportExcelUtil(url, '采购发货', JSON.stringify(params));

View File

@ -114,7 +114,7 @@
<th style="width: 10%" class="center">规格</th>
<th style="width: 10%" class="center">单位</th>
<th style="width: 15%" class="center"><span style="color: red;">*</span>需用量</th>
<th style="width: 15%" class="center"><span style="color: red;">*</span>需用天数</th>
<th style="width: 15%" class="center">退还日期</th>
<th style="width: 15%" class="center">备注</th>
</tr>
</thead>

View File

@ -114,7 +114,7 @@
<th style="width: 10%" class="center">规格</th>
<th style="width: 10%" class="center">单位</th>
<th style="width: 15%" class="center"><span style="color: red;">*</span>需用量</th>
<th style="width: 15%" class="center"><span style="color: red;">*</span>需用天数</th>
<th style="width: 15%" class="center">退还日期</th>
<th style="width: 15%" class="center">备注</th>
</tr>
</thead>

View File

@ -94,6 +94,17 @@
</select>
</div>
</div>
<div class="layui-inline" id="ID-laydate-rangeLinked">
<div class="layui-input-inline">
<input type="text" autocomplete="off" name="startTime" id="startTime" class="layui-input"
placeholder="请选择时间" lay-verify="required" readonly style="cursor: pointer;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" autocomplete="off" name="endTime" id="endTime" class="layui-input"
placeholder="请选择时间" lay-verify="required" readonly style="cursor: pointer;">
</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