配件退回
This commit is contained in:
parent
814bf38433
commit
757fa3958f
|
|
@ -155,17 +155,17 @@ function submitApply(data) {
|
|||
if (fileList.length === 0) {
|
||||
return layer.msg('请上传附件证明', { icon: 7 });
|
||||
}
|
||||
// 校验配件入库数量
|
||||
// 校验配件退回数量
|
||||
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 });
|
||||
}
|
||||
}
|
||||
data.field.details = list;
|
||||
data.field.detailsVoList = list;
|
||||
data.field.userName = $('#createId').find('option:checked').text();
|
||||
let formData = new FormData();
|
||||
//遍历最终文件集合
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
|
|
@ -175,7 +175,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/partBack/backInfo';
|
||||
ajaxRequestByUploadFile(url, formData, function () {
|
||||
$('.save').addClass("layui-btn-disabled").attr("disabled", true);
|
||||
$('.cancel').addClass("layui-btn-disabled").attr("disabled", true);
|
||||
|
|
@ -203,19 +203,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 ghNum = $(this).find('td').eq(7).find('input[name="ghNum"]').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(),
|
||||
backNum: ghNum ? ghNum : 0,
|
||||
remark: $(this).find('td').eq(8).find('input[name="remark"]').val(),
|
||||
})
|
||||
})
|
||||
return tableData;
|
||||
|
|
@ -234,44 +230,44 @@ function chooseFitType() {
|
|||
|
||||
// 查询
|
||||
function search() {
|
||||
let keyWord = $('#type').val();
|
||||
let keyWord2 = $('#name').val();
|
||||
let keyWord3 = $('#model').val();
|
||||
let keyWord = $('#partType').val();
|
||||
let keyWord2 = $('#partName').val();
|
||||
let keyWord3 = $('#partModel').val();
|
||||
if (!keyWord && !keyWord2 && !keyWord3) {
|
||||
setTableData(jjDataArr);
|
||||
} else if (keyWord && !keyWord2 && !keyWord3) {
|
||||
let dataList = jjDataArr.filter(item => {
|
||||
return item.type.indexOf(keyWord) > -1;
|
||||
return item.partType.indexOf(keyWord) > -1;
|
||||
})
|
||||
setTableData(dataList);
|
||||
} else if (!keyWord && keyWord2 && !keyWord3) {
|
||||
let dataList = jjDataArr.filter(item => {
|
||||
return item.name.indexOf(keyWord2) > -1;
|
||||
return item.partName.indexOf(keyWord2) > -1;
|
||||
})
|
||||
setTableData(dataList);
|
||||
} else if (!keyWord && !keyWord2 && keyWord3) {
|
||||
let dataList = jjDataArr.filter(item => {
|
||||
return item.model.indexOf(keyWord3) > -1;
|
||||
return item.partModel.indexOf(keyWord3) > -1;
|
||||
})
|
||||
setTableData(dataList);
|
||||
} else if (keyWord && keyWord2 && !keyWord3) {
|
||||
let dataList = jjDataArr.filter(item => {
|
||||
return item.type.indexOf(keyWord) > -1 && item.name.indexOf(keyWord2) > -1;
|
||||
return item.partType.indexOf(keyWord) > -1 && item.partName.indexOf(keyWord2) > -1;
|
||||
})
|
||||
setTableData(dataList);
|
||||
} else if (keyWord && !keyWord2 && keyWord3) {
|
||||
let dataList = jjDataArr.filter(item => {
|
||||
return item.type.indexOf(keyWord) > -1 && item.model.indexOf(keyWord3) > -1;
|
||||
return item.partType.indexOf(keyWord) > -1 && item.partModel.indexOf(keyWord3) > -1;
|
||||
})
|
||||
setTableData(dataList);
|
||||
} else if (!keyWord && keyWord2 && keyWord3) {
|
||||
let dataList = jjDataArr.filter(item => {
|
||||
return item.name.indexOf(keyWord2) > -1 && item.model.indexOf(keyWord3) > -1;
|
||||
return item.partName.indexOf(keyWord2) > -1 && item.partModel.indexOf(keyWord3) > -1;
|
||||
})
|
||||
setTableData(dataList);
|
||||
} else if (keyWord && keyWord2 && keyWord3) {
|
||||
let dataList = jjDataArr.filter(item => {
|
||||
return item.type.indexOf(keyWord) > -1 && item.name.indexOf(keyWord2) > -1 && item.model.indexOf(keyWord3) > -1;
|
||||
return item.partType.indexOf(keyWord) > -1 && item.partName.indexOf(keyWord2) > -1 && item.partModel.indexOf(keyWord3) > -1;
|
||||
})
|
||||
setTableData(dataList);
|
||||
}
|
||||
|
|
@ -279,9 +275,9 @@ function search() {
|
|||
|
||||
// 重置
|
||||
function resetSearch() {
|
||||
$('#type').val('');
|
||||
$('#name').val('');
|
||||
$('#model').val('');
|
||||
$('#partType').val('');
|
||||
$('#partName').val('');
|
||||
$('#partModel').val('');
|
||||
setTableData(jjDataArr);
|
||||
}
|
||||
|
||||
|
|
@ -328,16 +324,17 @@ function setTableData(results) {
|
|||
html += '<td><input onclick="sel(this.checked,this,' + l.id + ')" name="check" type="checkbox"></td>';
|
||||
html += "<td style='vertical-align:middle;' class='center hidden-480'>"
|
||||
+ (i + 1) + "</td>";
|
||||
html += "<td>" + l.type + "</td>";
|
||||
html += "<td>" + l.name + "</td>";
|
||||
html += "<td>" + l.model + "</td>";
|
||||
html += "<td>" + l.unit + "</td>";
|
||||
html += "<td>" + setFormInput(l.num, 1) + "</td>";
|
||||
html += "<td>" + setFormInput(l.remarks, 2) + "</td>";
|
||||
html += "<td>" + l.partType + "</td>";
|
||||
html += "<td>" + l.partName + "</td>";
|
||||
html += "<td>" + l.partModel + "</td>";
|
||||
html += "<td>" + l.partUnit + "</td>";
|
||||
html += "<td>" + l.lyNum + "</td>";
|
||||
html += "<td lyNum='" + l.lyNum + "'>" + setFormInput(l.num, 1) + "</td>";
|
||||
html += "<td>" + setFormInput(l.remark, 2) + "</td>";
|
||||
html += "</tr>";
|
||||
}
|
||||
} else {
|
||||
html += "<tr><td colspan='10' class='center'>没有相关数据</td></tr>";
|
||||
html += "<tr><td colspan='9' class='center'>没有相关数据</td></tr>";
|
||||
}
|
||||
$("#baseTable tbody").empty().append(html);
|
||||
layui.form.render();
|
||||
|
|
@ -346,9 +343,9 @@ 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="num" onblur="checkValue(this,1)" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9" lay-affix="clear">';
|
||||
html += '<input class="layui-input" name="ghNum" onblur="checkValue(this,1)" value="' + setNullValue(value) + '" autocomplete="off" lay-verify="required" maxlength="9" lay-affix="clear">';
|
||||
} else if (type === 2) { // 备注
|
||||
html += '<input class="layui-input" placeholder="请输入备注" id="remarks" name="remarks" value="' + setNullValue(value) + '" maxLength="255" lay-affix="clear"></input>';
|
||||
html += '<input class="layui-input" placeholder="请输入备注" id="remark" name="remark" value="' + setNullValue(value) + '" maxLength="255" lay-affix="clear"></input>';
|
||||
}
|
||||
html += '</div></form>';
|
||||
return html;
|
||||
|
|
@ -419,11 +416,16 @@ function delFitType() {
|
|||
// 校验数据
|
||||
function checkValue(that, type) {
|
||||
let value = $(that).val();
|
||||
let lyNum = $(that).parents('td').attr('lyNum');
|
||||
console.log('领用数量:' + lyNum);
|
||||
if (type === 1) { // 本次退回量
|
||||
const regex = /^(0|[1-9]\d{0,6})$/;
|
||||
if (!regex.test(value) && value) {
|
||||
layer.msg(' 本次退回量输入不合法,请重新输入!', { icon: 5 })
|
||||
$(that).val('');
|
||||
$(that).val(0);
|
||||
return layer.msg('本次退回量输入不合法,请重新输入!', { icon: 5 })
|
||||
} else if (value && value > lyNum) {
|
||||
$(that).val(0);
|
||||
return layer.msg('本次退回量不能超过累计领料数量,请重新输入!', { icon: 5 })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ function setParams(obj) {
|
|||
bindAction: '#hideUpload', //绑定的按钮
|
||||
choose: function (obj) {
|
||||
let length = $('.file-iteme').length;
|
||||
if(length >= 5){
|
||||
if (length >= 5) {
|
||||
return layer.msg('最多上传5个附件证明', { icon: 7 });
|
||||
}
|
||||
uploadObj.config.elem.next()[0].value = '';
|
||||
|
|
@ -419,14 +419,15 @@ function checkValue(that, type) {
|
|||
if (type === 1) { // 入库量
|
||||
const regex = /^(0|[1-9]\d{0,6})$/;
|
||||
if (!regex.test(value) && value) {
|
||||
layer.msg('入库量输入不合法,请重新输入!', { icon: 5 })
|
||||
$(that).val('');
|
||||
$(that).val(0);
|
||||
return layer.msg('入库量输入不合法,请重新输入!', { icon: 5 })
|
||||
|
||||
}
|
||||
} else if (type === 2) { // 单价
|
||||
const regex = /^(?:1(?:\d{0,8}|[0-9]*\.\d{1,2})|(?:[1-9]\d{0,7}|[1-9]\d{0,6}\.\d{1,2}|[1-9]\d{1,7}\.\d{2}|100000000(?:\.00)?))$/;
|
||||
if (!regex.test(value) && value) {
|
||||
layer.msg('单价输入不合法,请重新输入!', { icon: 5 })
|
||||
$(that).val('');
|
||||
$(that).val(0);
|
||||
return layer.msg('单价输入不合法,请重新输入!', { icon: 5 })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,10 +77,8 @@ function initTable() {
|
|||
$.each(res.list, function (index, item) {
|
||||
$.each(jjDetailArr, function (index2, item2) {
|
||||
if (item.id === item2.id) {
|
||||
item.num = item2.num;
|
||||
item.price = item2.price;
|
||||
item.remarks = item2.remarks;
|
||||
item.manufacturer = item2.manufacturer;
|
||||
item.ghNum = item2.ghNum;
|
||||
item.remark = item2.remark;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -192,21 +190,20 @@ function initTable() {
|
|||
table.on('edit(currentTableId2)', function (obj) {
|
||||
var field = obj.field; // 得到修改的字段
|
||||
var value = obj.value // 得到修改后的值
|
||||
if (field === 'num') { // 本次入库量
|
||||
if (field === 'ghNum') { // 本次退回量
|
||||
if (value) {
|
||||
const regex = /^(0|[1-9]\d{0,6})$/;
|
||||
if (!regex.test(value)) {
|
||||
obj.reedit();
|
||||
return layer.msg('格式不正确,最大输入6位数,且为正整数!', { icon: 7 })
|
||||
}
|
||||
// 获取累计领料数量
|
||||
let lyNum = obj.data.lyNum ? obj.data.lyNum : 0;
|
||||
if(value > lyNum){
|
||||
return layer.msg('本次退回量不能超过累计领料数量', { icon: 7 })
|
||||
}
|
||||
} else if (field === 'price') {
|
||||
const regex = /^(?:1(?:\d{0,8}|[0-9]*\.\d{1,2})|(?:[1-9]\d{0,7}|[1-9]\d{0,6}\.\d{1,2}|[1-9]\d{1,7}\.\d{2}|100000000(?:\.00)?))$/;
|
||||
if (!regex.test(value)) {
|
||||
obj.reedit();
|
||||
return layer.msg('单价格式不正确!', { icon: 7 })
|
||||
}
|
||||
} else if (field === 'remarks') { // 备注
|
||||
} else if (field === 'remark') { // 备注
|
||||
if (value) {
|
||||
if (value.length > 255) {
|
||||
obj.reedit();
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
<p style="font-size: 16px;font-weight: bold;">您还没选择退料配件类型</p>
|
||||
<p style="color: #999999;">需要添加配件类型后才能执行退料入库操作</p>
|
||||
<p style="color: #999999;">只可退回选择的维修人员已经领用过的配件类型</p>
|
||||
<button class="layui-btn layui-bg-blue" onclick="chooseFitType()">选择盘点配件类型</button>
|
||||
<button class="layui-btn layui-bg-blue" onclick="chooseFitType()">选择退回配件类型</button>
|
||||
</div>
|
||||
<fieldset class="table-search-fieldset" id="search-info" style="display: none;">
|
||||
<legend>搜索信息</legend>
|
||||
|
|
@ -72,19 +72,19 @@
|
|||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline" style="width: 200px;">
|
||||
<input type="text" name="type" id="type" autocomplete="off" class="layui-input"
|
||||
<input type="text" name="partType" id="partType" autocomplete="off" class="layui-input"
|
||||
lay-affix="clear" placeholder="输入配件类型" maxlength="30">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline" style="width: 200px;">
|
||||
<input type="text" name="name" id="name" autocomplete="off" class="layui-input"
|
||||
<input type="text" name="partName" id="partName" autocomplete="off" class="layui-input"
|
||||
lay-affix="clear" placeholder="输入配件名称" maxlength="30">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline" style="width: 200px;">
|
||||
<input type="text" name="model" id="model" autocomplete="off" class="layui-input"
|
||||
<input type="text" name="partModel" id="partModel" autocomplete="off" class="layui-input"
|
||||
lay-affix="clear" placeholder="输入规格型号" maxlength="30">
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -110,9 +110,10 @@
|
|||
<th style="width: 10%" class="center">序号</th>
|
||||
<th style="width: 15%" class="center">配件类型</th>
|
||||
<th style="width: 15%" class="center">配件名称</th>
|
||||
<th style="width: 15%" class="center">规格型号</th>
|
||||
<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: 10%" class="center">累计领料数量</th>
|
||||
<th style="width: 10%" class="center"><span style="color: red;">*</span> 本次退回量</th>
|
||||
<th style="width: 15%" class="center">备注</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
|||
Loading…
Reference in New Issue