配件退回

This commit is contained in:
cwchen 2024-11-15 13:54:18 +08:00
parent f6638db4b4
commit 8ca5691202
5 changed files with 26 additions and 31 deletions

View File

@ -20,7 +20,7 @@ function setParams(obj) {
form.on('submit(formData)', function (data) {
submitApply(data);
});
form.on('select(createId)', function (data) {
form.on('select(creator)', function (data) {
if (checkUserId && data.value !== checkUserId) {
// 清空退料配件明细数据
jjDataArr.splice(0, jjDataArr.length);
@ -85,11 +85,11 @@ function getUserList() {
// 退料人下拉选赋值
function setSelectData(list) {
let html = '<option value="1">张三</option>';
let html = '';
$.each(list, function (index, item) {
html += '<option value="' + item.id + '">' + item.name + '</option>'
html += '<option value="' + item.userId + '">' + item.userName + '</option>'
})
$('#createId').empty().append(html);
$('#creator').empty().append(html);
layui.form.render();
}
@ -160,12 +160,12 @@ function submitApply(data) {
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].backNum === 0) {
return layer.msg('退料配件明细,第' + (i + 1) + '行,未填写本次退回量', { icon: 7 });
}
}
data.field.detailsVoList = list;
data.field.userName = $('#createId').find('option:checked').text();
data.field.userName = $('#creator').find('option:checked').text();
let formData = new FormData();
//遍历最终文件集合
for (let i = 0; i < fileList.length; i++) {
@ -220,7 +220,7 @@ function getBaseTableData() {
// 选择退回配件类型
function chooseFitType() {
let userId = $('#createId').val()
let userId = $('#creator').val()
if (!userId) {
return layer.msg('请选择退料人', { icon: 7 });
}
@ -329,7 +329,7 @@ function setTableData(results) {
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 lyNum='" + l.lyNum + "'>" + setFormInput(l.ghNum, 1) + "</td>";
html += "<td>" + setFormInput(l.remark, 2) + "</td>";
html += "</tr>";
}
@ -395,7 +395,7 @@ function delFitType() {
layer.close(layerIndex);
for (let i = 0; i < delIdArr.length; i++) {
for (let j = 0; j < jjDataArr.length; j++) {
let id = jjDataArr[j].id;
let id = jjDataArr[j].partId;
if (delIdArr[i] == id) {
jjDataArr.splice(j, 1);
break;

View File

@ -223,7 +223,6 @@ function initTable() {
page: true,
done: function (res, curr, count) {
pageNum = tableIns.config.page.curr;
element.render();
table.resize("currentTableId");
},
});

View File

@ -95,7 +95,7 @@ function initTable() {
[
{ type: 'checkbox', width: '5%' },
{
width: '6%',
width: '5.9%',
title: "序号",
align: "center",
templet: function (d) {

View File

@ -1,4 +1,4 @@
let objParam, userpartId;
let objParam, userId;
let form, table, tableIns, layer, util;
let pageNum = 1;
let quanju = new Array();//全局
@ -7,7 +7,7 @@ let huancunObj = new Array();//缓存2
let jjDetailArr = []; // 退料配件类型数据
function setParams(obj) {
objParam = JSON.parse(obj);
userpartId = objParam.userpartId;
userId = objParam.userId;
console.log(objParam);
layui.use(["form", "table", 'layer', 'util'], function () {
form = layui.form;
@ -33,7 +33,7 @@ function queryTable(type) {
// 重载表格
function reloadTable(pageNum) {
table.reload("currentTablepartId", {
table.reload("currentTableId", {
page: {
curr: pageNum ? pageNum : 1,
},
@ -42,7 +42,7 @@ function reloadTable(pageNum) {
'partType': $('#partType').val(),
'partName': $('#partName').val(),
'partModel': $('#partModel').val(),
'userpartId': userpartId
'userId': userId
}),
},
},
@ -53,8 +53,8 @@ function reloadTable(pageNum) {
// 表格数据
function initTable() {
tableIns = table.render({
elem: "#currentTablepartId",
partId: 'currentTablepartId',
elem: "#currentTableId",
id: 'currentTableId',
height: "full-200",
headers: {
authorization: sessionStorage.getItem("gz-token"),
@ -65,7 +65,7 @@ function initTable() {
'partType': $('#partType').val(),
'partName': $('#partName').val(),
'partModel': $('#partModel').val(),
'userpartId': userpartId
'userId': userId
}),
},
request: {
@ -161,7 +161,8 @@ function initTable() {
limit: 10,
page: true,
done: function (res, curr, count) {
table.resize("currentTablepartId");
console.log(res);
table.resize("currentTableId");
pageNum = tableIns.config.page.curr;
//设置全部数据到全局变量
quanju = res.data;
@ -187,7 +188,7 @@ function initTable() {
}
},
});
table.on('edit(currentTablepartId2)', function (obj) {
table.on('edit(currentTableId2)', function (obj) {
var field = obj.field; // 得到修改的字段
var value = obj.value // 得到修改后的值
if (field === 'ghNum') { // 本次退回量
@ -199,7 +200,8 @@ function initTable() {
}
// 获取累计领料数量
let lyNum = obj.data.lyNum ? obj.data.lyNum : 0;
if(value > lyNum){
if (value > lyNum) {
obj.reedit();
return layer.msg('本次退回量不能超过累计领料数量', { icon: 7 })
}
}
@ -217,7 +219,7 @@ function initTable() {
updateOrAddObject(partId, obj.data);
});
//复选框选中监听,将选中的partId 设置到缓存数组,或者删除缓存数组
table.on('checkbox(currentTablepartId2)', function (obj) {
table.on('checkbox(currentTableId2)', function (obj) {
if (obj.checked === true) {
if (obj.type === 'one' && huancun.indexOf(obj.data.partId) === -1) {
huancun.push(obj.data.partId);
@ -318,17 +320,11 @@ function saveData2(params) {
}
}
// 配件类型
function addFitTypeData() {
openIframeByParamObj2("add_fit_type_data", "配件类型", "../../../page/basic/fit_type_list.html", "92%", "95%", {});
}
function closePage(type, params) {
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
parent.layer.close(index); // 再执行关闭
if (type == 1) {
window.parent.addFitDatas(params, userpartId);
window.parent.addFitDatas(params, userId);
}
}

View File

@ -19,7 +19,7 @@
<div class="layui-inline">
<label class="layui-form-label required" style="width: 100px !important;">退料人</label>
<div class="layui-input-inline">
<select class="layui-select" name="createId" id="createId" lay-filter="createId">
<select class="layui-select" name="creator" id="creator" lay-filter="creator">
</select>
</div>
</div>