| | |
| | | var pageCurr; |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).use(['table','laydate', 'form', 'admin'], function(){ |
| | | }).use(['table','laydate', 'form', 'admin', 'treeTable', 'xmSelect'], function(){ |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | var admin = layui.admin; |
| | | var xmSelect = layui.xmSelect; |
| | | var treeTable = layui.treeTable; |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | |
| | | {type: 'checkbox'} |
| | | ,{field: 'id', align: 'center',title: 'ID', hide:true} |
| | | ,{field: 'hostId', align: 'center',title: '', hide:true} |
| | | ,{field: 'orderId$', align: 'center',title: '订单内码', width: 100} |
| | | ,{field: 'anfme', align: 'center',title: '需入库数量', width: 100} |
| | | ,{field: 'inQty', align: 'center',title: '已入库数量', width: 100} |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', width: 185} |
| | | ,{field: 'anfme', align: 'center',title: '应入库量', width: 100} |
| | | ,{field: 'inQty', align: 'center',title: '已入库量', width: 100} |
| | | ,{field: 'matnr', align: 'center',title: '商品编码'} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称'} |
| | | ,{field: 'state$', align: 'center',title: '订单状态'} |
| | | ,{field: 'name', align: 'center',title: '名称', hide:true} |
| | | ,{field: 'specs', align: 'center',title: '规格', hide:true} |
| | | ,{field: 'model', align: 'center',title: '型号', hide:true} |
| | |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | console.log(res) |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | |
| | | } |
| | | pageCurr=curr; |
| | | limit(); |
| | | } |
| | | }); |
| | | |
| | | var insTb = treeTable.render({ |
| | | elem: '#node', |
| | | url: baseUrl+'/node/tree/auth', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | height: 'full-200', |
| | | tree: { |
| | | iconIndex: 2, // 折叠图标显示在第几列 |
| | | isPidData: true, // 是否是id、pid形式数据 |
| | | idName: 'id', // id字段名称 |
| | | pidName: 'parentId' // pid字段名称 |
| | | }, |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | ,{type: 'numbers'} |
| | | ,{field: 'name', align: 'left',title: '名称', minWidth: 150} |
| | | ,{field: 'type$', align: 'center',title: '类型'} |
| | | ,{field: 'leading', align: 'center',title: '负责人'} |
| | | ,{field: 'sort', align: 'center',title: '排序', hide: true} |
| | | ,{field: 'status$', align: 'center',title: '状态'} |
| | | ,{field: 'updateTime$', align: 'center',title: '修改时间'} |
| | | ,{field: 'updateBy$', align: 'center',title: '修改人员', hide: true} |
| | | ,{field: 'memo', align: 'center',title: '备注', hide: true} |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} |
| | | ]], |
| | | done: function (data) { |
| | | $('.ew-tree-table-box').css('height', '100%'); |
| | | insTb.expandAll(); |
| | | } |
| | | }); |
| | | |
| | |
| | | // showEditModel(data); |
| | | startIn(data); |
| | | break; |
| | | case "renew": |
| | | renew(data); |
| | | break; |
| | | } |
| | | }); |
| | | function startIn(data) { |
| | | |
| | | admin.open({ |
| | | type:1 |
| | | ,area: '600px' |
| | | ,title: '入库' |
| | | ,content: $('#addIn').html() |
| | | ,success: function () { |
| | | ,success: function (layero, dIndex) { |
| | | var remain = data.anfme - data.inQty; |
| | | form.val('inDetail',{ |
| | | "remain": remain |
| | | }); |
| | | |
| | | form.val('inDetail',data); |
| | | form.on('submit(recommendIn)',function (data) { |
| | | console.log(data); |
| | | |
| | | form.on('submit(inLoc)',function (data) { |
| | | var loc = insXmSel.getValue('valueStr'); |
| | | var storeQty =data.field.remain; |
| | | |
| | | if(storeQty> data.field.anfme - data.field.inQty || storeQty<=0){ |
| | | layer.msg("数量不对"); |
| | | return; |
| | | } |
| | | if(loc===""){ |
| | | layer.msg("库位号为空"); |
| | | return; |
| | | } |
| | | |
| | | $.ajax({ |
| | | url: baseUrl+"/receiveDetl/addIn" |
| | | ,headers: {'token':localStorage.getItem('token')} |
| | | ,data: data |
| | | // ,data: data.field |
| | | ,data: JSON.stringify(data.field) |
| | | ,contentType:'application/json;charset=UTF-8' |
| | | ,method: 'POST' |
| | | ,success: function (res) { |
| | | layer.closeAll(); |
| | | if(res.code === 200){ |
| | | layer.msg(res.msg); |
| | | tableReload(); |
| | | } |
| | | if (res.code === 500){ |
| | | layer.msg(res.msg); |
| | | } |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | // 渲染下拉树 |
| | | var insXmSel = xmSelect.render({ |
| | | el: '#nodeSels', |
| | | height: '250px', |
| | | data: insTb.options.data, |
| | | initValue: [], |
| | | model: {label: {type: 'text'}}, |
| | | prop: { |
| | | name: 'name', |
| | | value: 'id' |
| | | }, |
| | | radio: true, |
| | | clickClose: true, |
| | | tree: { |
| | | show: true, |
| | | indent: 15, |
| | | strict: false, |
| | | expandedKeys: true |
| | | } |
| | | }); |
| | | |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | | }) |
| | | } |
| | |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | |
| | | url: baseUrl+"/receiveDetl/delete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {ids: ids}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | function renew(data) { |
| | | console.log(data) |
| | | layer.confirm('确定要撤回全部上架数据吗?', { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | | }, function (i) { |
| | | layer.close(i); |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/receiveDetl/renew/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(data), |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | |
| | | page: {curr: pageCurr} |
| | | }); |
| | | } |
| | | |