配件退回
This commit is contained in:
parent
bc16bf5632
commit
719243bf62
|
|
@ -160,7 +160,7 @@ function submitApply(data) {
|
|||
return layer.msg('未添加配件退回数据', { icon: 7 });
|
||||
}
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].backNum === 0) {
|
||||
if (list[i].backNum === 0 || list[i].backNum === '0') {
|
||||
return layer.msg('退料配件明细,第' + (i + 1) + '行,未填写本次退回量', { icon: 7 });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,15 +117,15 @@ function submitApply(data) {
|
|||
}
|
||||
// 校验配件入库数量
|
||||
if (list.length === 0) {
|
||||
return layer.msg('未填写配件入库数量', { icon: 7 });
|
||||
return layer.msg('未添加报废配件明细数据', { icon: 7 });
|
||||
}
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
|
||||
if (!list[i].inputNum || list[i].inputNum === '0') {
|
||||
return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写配件入库数量', { icon: 7 });
|
||||
if (list[i].scrapNum === 0 || list[i].scrapNum === '0') {
|
||||
return layer.msg('报废配件明细,第' + (i + 1) + '行,未填写报废数量', { icon: 7 });
|
||||
}
|
||||
}
|
||||
data.field.details = list;
|
||||
data.field.detailList = list;
|
||||
let formData = new FormData();
|
||||
//遍历最终文件集合
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
|
|
@ -135,7 +135,7 @@ function submitApply(data) {
|
|||
console.log(JSON.stringify(data.field));
|
||||
let loadingMsg = layer.msg('正在提交保存,请稍等...', { icon: 16, shade: 0.01, time: '0' });
|
||||
console.log(JSON.stringify(data.field));
|
||||
let url = dataUrl + 'backstage/partInput/addInputData';
|
||||
let url = dataUrl + 'backstage/partScrap/insertScarpData';
|
||||
ajaxRequestByUploadFile(url, formData, function () {
|
||||
$('.save').addClass("layui-btn-disabled").attr("disabled", true);
|
||||
$('.cancel').addClass("layui-btn-disabled").attr("disabled", true);
|
||||
|
|
@ -163,19 +163,15 @@ function submitApply(data) {
|
|||
function getBaseTableData() {
|
||||
let tableData = [];
|
||||
$('#baseTable tbody tr').each(function (index, item) {
|
||||
let price = $(this).find('td').eq(7).find('input[name="price"]').val();
|
||||
let num = $(this).find('td').eq(6).find('input[name="num"]').val();
|
||||
let scrapNum = $(this).find('td').eq(8).find('input[name="scrapNum"]').val();
|
||||
tableData.push({
|
||||
partId: $(this).attr('id'),
|
||||
partType: $(this).find('td').eq(2).html(),
|
||||
partName: $(this).find('td').eq(3).html(),
|
||||
partModel: $(this).find('td').eq(4).html(),
|
||||
partUnit: $(this).find('td').eq(5).html(),
|
||||
inputNum: num ? num : 0,
|
||||
partPrice: price ? price : 0,
|
||||
vendId: $(this).find('td').eq(8).find('select[name="manufacturer"]').val(),
|
||||
vendName: $(this).find('td').eq(8).find('select[name="manufacturer"]').find('option:checked').text(),
|
||||
remark: $(this).find('td').eq(9).find('input[name="remarks"]').val(),
|
||||
scrapNum: scrapNum ? scrapNum : 0,
|
||||
remark: $(this).find('td').eq(10).find('input[name="remarks"]').val(),
|
||||
})
|
||||
})
|
||||
return tableData;
|
||||
|
|
@ -297,7 +293,7 @@ function setTableData(results) {
|
|||
html += "</tr>";
|
||||
}
|
||||
} else {
|
||||
html += "<tr><td colspan='10' class='center'>没有相关数据</td></tr>";
|
||||
html += "<tr><td colspan='11' class='center'>没有相关数据</td></tr>";
|
||||
}
|
||||
$("#baseTable tbody").empty().append(html);
|
||||
layui.form.render();
|
||||
|
|
@ -306,7 +302,7 @@ function setTableData(results) {
|
|||
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="scrapNum" onblur="checkValue(this,1)" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9" lay-affix="clear">';
|
||||
html += '<input class="layui-input" name="scrapNum" onblur="checkValue(this,1)" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9">';
|
||||
} else if (type === 2) { // 备注
|
||||
html += '<input class="layui-input" placeholder="请输入备注" id="remarks" name="remarks" value="' + setNullValue(value) + '" maxLength="255" lay-affix="clear"></input>';
|
||||
}
|
||||
|
|
@ -315,19 +311,6 @@ function setFormInput(value, type) {
|
|||
|
||||
}
|
||||
|
||||
function setSelectData(value) {
|
||||
let html = '';
|
||||
$.each(cjList, function (index, item) {
|
||||
if (item.id === value) {
|
||||
html += '<option value="' + item.id + '" selected>' + item.name + '</option>'
|
||||
} else {
|
||||
html += '<option value="' + item.id + '">' + item.name + '</option>'
|
||||
}
|
||||
|
||||
})
|
||||
return html;
|
||||
}
|
||||
|
||||
// 复选框全选
|
||||
function selectAll(selectStatus) {//传入参数(全选框的选中状态)
|
||||
if (selectStatus) {
|
||||
|
|
@ -396,7 +379,11 @@ function checkValue(that, type) {
|
|||
const regex = /^(0|[1-9]\d{0,6})$/;
|
||||
if (!regex.test(value) && value) {
|
||||
$(that).val(0);
|
||||
return layer.msg('报废数量输入不合法,请重新输入!', { icon: 5 })
|
||||
$(that).parents('td').next().html(0);
|
||||
return layer.msg('报废数量输入不合法,最大输入6位数,且为正整数,请重新输入!', { icon: 5 })
|
||||
} else if (value) {
|
||||
let price = $(that).parents('td').prev().prev().html(); // 单价
|
||||
$(that).parents('td').next().html(parseInt(value) * parseFloat(price));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ function submitApply(data) {
|
|||
}
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
|
||||
if (!list[i].inputNum || list[i].inputNum === '0') {
|
||||
if (list[i].inputNum === 0 || list[i].inputNum === '0') {
|
||||
return layer.msg('入库配件明细,第' + (i + 1) + '行,未填写配件入库数量', { icon: 7 });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ function submitApply(data) {
|
|||
return layer.msg('未添加盘点明细数据', { icon: 7 });
|
||||
}
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].checkNum === 0) {
|
||||
if (list[i].checkNum === 0 || list[i].checkNum === '0') {
|
||||
return layer.msg('盘点明细,第' + (i + 1) + '行,未填写本次盘点量', { icon: 7 });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue