| | |
| | | cols.push({fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:65}) |
| | | return cols; |
| | | } |
| | | |
| | | layui.use(['table','laydate', 'form'], function() { |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).extend({ |
| | | notice: 'notice/notice', |
| | | }).use(['table','laydate', 'form', 'notice'], function() { |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var form = layui.form; |
| | | var notice = layui.notice; |
| | | |
| | | tableIns = table.render({ |
| | | elem: '#chooseData', |
| | |
| | | switch (obj.event) { |
| | | case 'createDoc': |
| | | if (data.length === 0){ |
| | | layer.msg('请添加物料'); |
| | | notice.error({ |
| | | title: '消息通知', |
| | | message: '请添加物料' |
| | | }); |
| | | } else { |
| | | var success = true; |
| | | for (var i=0;i<matData.length;i++) { |
| | | if (matData[i].count <= 0) { |
| | | layer.msg(matData[i].matnr + '物料数量必须大于零!', {icon: 2}) |
| | | notice.error({ |
| | | title: '消息通知', |
| | | message: matData[i].matnr + '物料数量必须大于零!' |
| | | }); |
| | | success = false; |
| | | return false; |
| | | } |
| | |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | layer.msg(res.msg, {icon: 1}); |
| | | notice.success({ |
| | | title: '消息通知', |
| | | message: res.msg |
| | | }); |
| | | top.layui.layer.close(top.popupRight); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | notice.error({ |
| | | title: '消息通知', |
| | | message: res.msg |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | |
| | | |
| | | function updateMatData(locNo, matnr, count) { |
| | | if (isNaN(count)) { |
| | | layer.msg("请输入数字"); |
| | | notice.error({ |
| | | title: '消息通知', |
| | | message: '请输入数字' |
| | | }); |
| | | } else { |
| | | if (count > 0) { |
| | | for (var i=0;i<matData.length;i++){ |
| | | if (matData[i]["matnr"] === matnr){ |
| | | // if (count > locDetlData[i]["anfme"]) { |
| | | // layer.msg("不能超过原数量"); |
| | | // } else { |
| | | matData[i]["count"] = count; |
| | | // } |
| | | matData[i]["count"] = count; |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | layer.msg("数量必须大于零"); |
| | | notice.error({ |
| | | title: '消息通知', |
| | | message: '数量必须大于零' |
| | | }); |
| | | } |
| | | } |
| | | tableIns.reload({data: matData,done:function (res) { |
| | |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | notice.error({ |
| | | title: '消息通知', |
| | | message: res.msg |
| | | }); |
| | | } |
| | | } |
| | | }); |