|
|
@ -17,13 +17,14 @@ |
|
|
<script id="toolbarDemo" type="text/html"> |
|
|
<script id="toolbarDemo" type="text/html"> |
|
|
<div class="layui-btn-container"> |
|
|
<div class="layui-btn-container"> |
|
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="delete">删除</button> |
|
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="delete">删除</button> |
|
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="applicationOut">出库</button> |
|
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="applicationOut">出库 |
|
|
|
|
|
</button> |
|
|
</div> |
|
|
</div> |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table> |
|
|
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table> |
|
|
<script id="currentTableBar" type="text/html"> |
|
|
<script id="currentTableBar" type="text/html"> |
|
|
<a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut" >出库</a> |
|
|
<a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut">出库</a> |
|
|
</script> |
|
|
</script> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
@ -53,10 +54,10 @@ |
|
|
}, |
|
|
}, |
|
|
response: { |
|
|
response: { |
|
|
statusName: 'status' //规定数据状态的字段名称,默认:code |
|
|
statusName: 'status' //规定数据状态的字段名称,默认:code |
|
|
,statusCode: 200 //规定成功的状态码,默认:0 |
|
|
, statusCode: 200 //规定成功的状态码,默认:0 |
|
|
,msgName: 'message' //规定状态信息的字段名称,默认:msg |
|
|
, msgName: 'message' //规定状态信息的字段名称,默认:msg |
|
|
,countName: 'count' //规定数据总数的字段名称,默认:count |
|
|
, countName: 'count' //规定数据总数的字段名称,默认:count |
|
|
,dataName: 'data' //规定数据列表的字段名称,默认:data |
|
|
, dataName: 'data' //规定数据列表的字段名称,默认:data |
|
|
}, |
|
|
}, |
|
|
toolbar: '#toolbarDemo', |
|
|
toolbar: '#toolbarDemo', |
|
|
cols: [ |
|
|
cols: [ |
|
|
@ -65,11 +66,11 @@ |
|
|
{field: 'gname', width: 150, title: '组合名称'}, |
|
|
{field: 'gname', width: 150, title: '组合名称'}, |
|
|
{field: 'code', width: 150, title: '组合编码'}, |
|
|
{field: 'code', width: 150, title: '组合编码'}, |
|
|
{title: '拥有物料', width: 700, align: "center"}, |
|
|
{title: '拥有物料', width: 700, align: "center"}, |
|
|
{field: 'quantity', width: 200, title: '数量',edit:'quantity'}, |
|
|
{field: 'quantity', width: 200, title: '数量', edit: 'quantity'}, |
|
|
{title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center"}, |
|
|
{title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center"}, |
|
|
] |
|
|
] |
|
|
], |
|
|
], |
|
|
limits: [10, 15, 20, 25, 50,100], |
|
|
limits: [10, 15, 20, 25, 50, 100], |
|
|
limit: 10, |
|
|
limit: 10, |
|
|
page: true, |
|
|
page: true, |
|
|
skin: 'line', |
|
|
skin: 'line', |
|
|
@ -78,10 +79,10 @@ |
|
|
let materialSimple = j["materialSimple"]; |
|
|
let materialSimple = j["materialSimple"]; |
|
|
let gid = j["id"]; |
|
|
let gid = j["id"]; |
|
|
let keys = Object.keys(materialSimple); |
|
|
let keys = Object.keys(materialSimple); |
|
|
var materialItem = $("[lay-id='currentTableId'] tr:eq(" + (i+1) + ")").children()[3]; |
|
|
var materialItem = $("[lay-id='currentTableId'] tr:eq(" + (i + 1) + ")").children()[3]; |
|
|
var aItem = materialItem.childNodes[0]; |
|
|
var aItem = materialItem.childNodes[0]; |
|
|
for (let k = 0; k < keys.length; k++) { |
|
|
for (let k = 0; k < keys.length; k++) { |
|
|
$(aItem).append('<button id='+ gid+' class="layui-btn layui-btn-primary layui-btn-xs" value='+materialSimple[keys[k]]+'>'+keys[k]+'</button>') |
|
|
$(aItem).append('<button id=' + gid + ' class="layui-btn layui-btn-primary layui-btn-xs" value=' + materialSimple[keys[k]] + '>' + keys[k] + '</button>') |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
@ -92,7 +93,7 @@ |
|
|
console.log(obj) |
|
|
console.log(obj) |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
table.on('edit(currentTableFilter)', function(obj){ //注:edit是固定事件名,test是table原始容器的属性 lay-filter="对应的值" |
|
|
table.on('edit(currentTableFilter)', function (obj) { //注:edit是固定事件名,test是table原始容器的属性 lay-filter="对应的值" |
|
|
|
|
|
|
|
|
var req = {}; |
|
|
var req = {}; |
|
|
req.gid = obj.data.id; |
|
|
req.gid = obj.data.id; |
|
|
@ -107,7 +108,7 @@ |
|
|
var flag = res.data; |
|
|
var flag = res.data; |
|
|
if (!flag) { // 如果当前数目不合适 |
|
|
if (!flag) { // 如果当前数目不合适 |
|
|
layer.msg("当前组合中有物料库存数量不足", {icon: 0, time: 500}, function () { |
|
|
layer.msg("当前组合中有物料库存数量不足", {icon: 0, time: 500}, function () { |
|
|
obj.update({quantity:1}) |
|
|
obj.update({quantity: 1}) |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
@ -130,8 +131,8 @@ |
|
|
req.gids[i] = data[i].id; |
|
|
req.gids[i] = data[i].id; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(obj.event==='delete'){ |
|
|
if (obj.event === 'delete') { |
|
|
if(req.gids.length > 0) { |
|
|
if (req.gids.length > 0) { |
|
|
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { |
|
|
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { |
|
|
$.ajax({ |
|
|
$.ajax({ |
|
|
url: "/group/deleteApplicationToRedis", |
|
|
url: "/group/deleteApplicationToRedis", |
|
|
@ -162,40 +163,39 @@ |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}else{ |
|
|
} else { |
|
|
layer.msg("未选中记录,请确认!"); |
|
|
layer.msg("未选中记录,请确认!"); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} else if (obj.event === 'applicationOut') { |
|
|
else if(obj.event === 'applicationOut'){ |
|
|
if (req.gids.length > 0) { |
|
|
req.type = "more"; |
|
|
req.type = "more"; |
|
|
$.ajax({ |
|
|
$.ajax({ |
|
|
url:"/group/createMultiApplication", |
|
|
url: "/group/createMultiApplication", |
|
|
type:"post", |
|
|
type: "post", |
|
|
data:JSON.stringify(req), |
|
|
data: JSON.stringify(req), |
|
|
dataType: "json", |
|
|
dataType: "json", |
|
|
contentType: "application/json;charset=utf-8", |
|
|
contentType: "application/json;charset=utf-8", |
|
|
success: function (d) { |
|
|
success: function (d) { |
|
|
layer.close(this.layerIndex); |
|
|
layer.close(this.layerIndex); |
|
|
if (d.status >= 300) { |
|
|
if (d.status >= 300) { |
|
|
layer.msg(d.statusInfo.message,{ |
|
|
layer.msg(d.statusInfo.message, { |
|
|
icon:0, |
|
|
icon: 0, |
|
|
time:1000 |
|
|
time: 1000 |
|
|
});//失败的表情 |
|
|
});//失败的表情 |
|
|
return; |
|
|
return; |
|
|
}else if(d.status === 1234){ |
|
|
} else if (d.status === 1234) { |
|
|
layer.msg(d.data,{ |
|
|
layer.msg(d.data, { |
|
|
icon:0, |
|
|
icon: 0, |
|
|
time:1000 |
|
|
time: 1000 |
|
|
}) |
|
|
}) |
|
|
return |
|
|
return |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
layer.msg("申请成功!", { |
|
|
layer.msg("申请成功!", { |
|
|
icon: 6,//成功的表情 |
|
|
icon: 6,//成功的表情 |
|
|
time: 1000 |
|
|
time: 1000 |
|
|
}, //1秒关闭(如果不配置,默认是3秒) |
|
|
}, //1秒关闭(如果不配置,默认是3秒) |
|
|
function(){ |
|
|
function () { |
|
|
//do something |
|
|
//do something |
|
|
table.reload('currentTableId', { |
|
|
table.reload('currentTableId', { |
|
|
url: '/group/applicant_multi_create', |
|
|
url: '/group/applicant_multi_create', |
|
|
@ -209,27 +209,28 @@ |
|
|
}); |
|
|
}); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
table.on('tool(currentTableFilter)', function (obj) { |
|
|
table.on('tool(currentTableFilter)', function (obj) { |
|
|
let data = obj.data; |
|
|
let data = obj.data; |
|
|
if(obj.event === 'applicationOut'){ |
|
|
if (obj.event === 'applicationOut') { |
|
|
// 出库申请 |
|
|
// 出库申请 |
|
|
var req = data; |
|
|
var req = data; |
|
|
req.type = "one"; |
|
|
req.type = "one"; |
|
|
$.ajax({ |
|
|
$.ajax({ |
|
|
url:"/group/createMultiApplication", |
|
|
url: "/group/createMultiApplication", |
|
|
type:"post", |
|
|
type: "post", |
|
|
data:JSON.stringify(req), |
|
|
data: JSON.stringify(req), |
|
|
dataType: "json", |
|
|
dataType: "json", |
|
|
contentType: "application/json;charset=utf-8", |
|
|
contentType: "application/json;charset=utf-8", |
|
|
success: function (d) { |
|
|
success: function (d) { |
|
|
layer.close(this.layerIndex); |
|
|
layer.close(this.layerIndex); |
|
|
if (d.status >= 300) { |
|
|
if (d.status >= 300) { |
|
|
layer.msg(d.statusInfo.message,{ |
|
|
layer.msg(d.statusInfo.message, { |
|
|
icon:0, |
|
|
icon: 0, |
|
|
time:1000 |
|
|
time: 1000 |
|
|
});//失败的表情 |
|
|
});//失败的表情 |
|
|
return; |
|
|
return; |
|
|
} else { |
|
|
} else { |
|
|
@ -237,7 +238,7 @@ |
|
|
icon: 6,//成功的表情 |
|
|
icon: 6,//成功的表情 |
|
|
time: 1000 |
|
|
time: 1000 |
|
|
}, //1秒关闭(如果不配置,默认是3秒) |
|
|
}, //1秒关闭(如果不配置,默认是3秒) |
|
|
function(){ |
|
|
function () { |
|
|
//do something |
|
|
//do something |
|
|
table.reload('currentTableId', { |
|
|
table.reload('currentTableId', { |
|
|
url: '/group/applicant_multi_create', |
|
|
url: '/group/applicant_multi_create', |
|
|
|