| | |
| | | var form = layui.form; |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#adjDetl', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/adjDetl/list/auth', |
| | | page: true, |
| | | limit: 16, |
| | | limits: [16, 30, 50, 100, 200, 500], |
| | | even: true, |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | cols: [[ |
| | | var tableIns; |
| | | var dateIns = layDate.render({ |
| | | elem: '#modi_time' |
| | | ,type: 'datetime' |
| | | ,range: true |
| | | ,lang: typeof I18n !== 'undefined' && I18n.getLanguage().toLowerCase() === 'zh-cn' ? 'cn' : 'en' |
| | | }); |
| | | |
| | | function getCols() { |
| | | return [ |
| | | // {type: 'checkbox'} |
| | | // ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80} |
| | | // {field: 'adjId', align: 'center',title: '序号'} |
| | | {field: 'locNo', align: 'center',title: '库位号'} |
| | | ,{field: 'matnrOld', align: 'center',title: '原品号'} |
| | | ,{field: 'matnr', align: 'center',title: '当前品号'} |
| | | ,{field: 'batch', align: 'center',title: '批号'} |
| | | {field: 'locNo', align: 'center',title: I18n.t('location_no')} |
| | | ,{field: 'matnrOld', align: 'center',title: I18n.t('original_item_no')} |
| | | ,{field: 'matnr', align: 'center',title: I18n.t('current_item_no')} |
| | | ,{field: 'batch', align: 'center',title: I18n.t('batch')} |
| | | // ,{field: 'oriCtns', align: 'center',title: '原箱数'} |
| | | ,{field: 'oriQty', align: 'center',title: '原数量'} |
| | | ,{field: 'oriQty', align: 'center',title: I18n.t('original_qty')} |
| | | // ,{field: 'oriWt', align: 'center',title: '原重量'} |
| | | // ,{field: 'adjCtns', align: 'center',title: '变更箱数'} |
| | | ,{field: 'adjQty', align: 'center',title: '变更数量'} |
| | | ,{field: 'adjQty', align: 'center',title: I18n.t('change_qty')} |
| | | // ,{field: 'adjWt', align: 'center',title: '变更重量'} |
| | | ,{field: 'memo', align: 'center',title: '备注',hide:true} |
| | | ,{field: 'modiUser$', align: 'center',title: '修改人员'} |
| | | ,{field: 'modiTime$', align: 'center',title: '修改时间'} |
| | | ,{field: 'memo', align: 'center',title: I18n.t('remark'),hide:true} |
| | | ,{field: 'modiUser$', align: 'center',title: I18n.t('modifier')} |
| | | ,{field: 'modiTime$', align: 'center',title: I18n.t('modify_time')} |
| | | // ,{field: 'appeUser', align: 'center',title: '创建者'} |
| | | // ,{field: 'appeTime$', align: 'center',title: '添加时间'} |
| | | |
| | | // ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:100} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | } |
| | | }, |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | done: function(res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | limit(); |
| | | form.on('checkbox(tableCheckbox)', function (data) { |
| | | var _index = $(data.elem).attr('table-index')||0; |
| | | if(data.elem.checked){ |
| | | res.data[_index][data.value] = 'Y'; |
| | | }else{ |
| | | res.data[_index][data.value] = 'N'; |
| | | ]; |
| | | } |
| | | |
| | | function initTable() { |
| | | tableIns = table.render({ |
| | | elem: '#adjDetl', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/adjDetl/list/auth', |
| | | page: true, |
| | | limit: 16, |
| | | limits: [16, 30, 50, 100, 200, 500], |
| | | even: true, |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | cols: [getCols()], |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | } |
| | | }, |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | done: function(res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | I18n.updatePage(); |
| | | I18n.updateLayuiPagination(); |
| | | limit(); |
| | | form.on('checkbox(tableCheckbox)', function (data) { |
| | | var _index = $(data.elem).attr('table-index')||0; |
| | | if(data.elem.checked){ |
| | | res.data[_index][data.value] = 'Y'; |
| | | }else{ |
| | | res.data[_index][data.value] = 'N'; |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // Initialize table when I18n is ready |
| | | if (typeof I18n !== 'undefined' && I18n.isReady()) { |
| | | initTable(); |
| | | } else { |
| | | $(document).on('i18n:ready', function() { |
| | | initTable(); |
| | | }); |
| | | } |
| | | |
| | | $(document).on('i18n:languageChanged', function() { |
| | | if (tableIns) { |
| | | tableIns.reload({ |
| | | cols: [getCols()] |
| | | }); |
| | | } else { |
| | | initTable(); |
| | | } |
| | | $('[data-i18n-placeholder]').each(function() { |
| | | var key = $(this).attr('data-i18n-placeholder'); |
| | | $(this).attr('placeholder', I18n.t(key)); |
| | | }); |
| | | // Reload date component |
| | | if (typeof dateIns !== 'undefined') { |
| | | // Completely remove and recreate the input element to force laydate reset |
| | | var $input = $('#modi_time'); |
| | | var parent = $input.parent(); |
| | | var inputHtml = $input.prop("outerHTML"); |
| | | $input.remove(); |
| | | parent.append(inputHtml); |
| | | $('#modi_time').removeAttr('lay-key'); // Ensure no key remains |
| | | $('#modi_time').attr('placeholder', I18n.t('start_end_time')); |
| | | |
| | | dateIns = layDate.render({ |
| | | elem: '#modi_time' |
| | | ,type: 'datetime' |
| | | ,range: true |
| | | ,lang: I18n.getLanguage().toLowerCase() === 'zh-cn' ? 'cn' : 'en' |
| | | }); |
| | | } |
| | | I18n.updatePage(); |
| | | }); |
| | | |
| | | // 监听排序事件 |
| | |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | I18n.updatePage(); |
| | | I18n.updateLayuiPagination(); |
| | | limit(); |
| | | } |
| | | }); |
| | |
| | | case 'deleteData': |
| | | var data = checkStatus.data; |
| | | if (data.length === 0){ |
| | | layer.msg('请选择数据'); |
| | | layer.msg(I18n.t('please_select_data')); |
| | | } else { |
| | | layer.confirm('确定删除'+(data.length===1?'此':data.length)+'条数据吗', function(){ |
| | | layer.confirm(I18n.t('confirm_delete_prefix')+(data.length===1?I18n.t('this'):data.length)+I18n.t('confirm_delete_suffix'), function(){ |
| | | $.ajax({ |
| | | url: baseUrl+"/adjDetl/delete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | |
| | | } |
| | | break; |
| | | case 'exportData': |
| | | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | layer.confirm(I18n.t('confirm_export_excel'), {shadeClose: true}, function(){ |
| | | var titles=[]; |
| | | var fields=[]; |
| | | obj.config.cols[0].map(function (col) { |
| | |
| | | case 'detail': |
| | | layer.open({ |
| | | type: 2, |
| | | title: '详情', |
| | | title: I18n.t('detail'), |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: true, |
| | |
| | | case 'edit': |
| | | layer.open({ |
| | | type: 2, |
| | | title: '修改', |
| | | title: I18n.t('edit'), |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | content: 'adjDetl_detail.html', |
| | |
| | | elem: '#appeTime\\$', |
| | | type: 'datetime' |
| | | }); |
| | | layDate.render({ |
| | | elem: '.layui-laydate-range' |
| | | ,type: 'datetime' |
| | | ,range: true |
| | | }); |
| | | // Removed duplicate render for .layui-laydate-range to avoid conflict with dateIns |
| | | |
| | | |
| | | }); |
| | | |
| | |
| | | page: { |
| | | curr: pageCurr |
| | | }, |
| | | done: function (res, curr, count) { |
| | | done: function (res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | I18n.updatePage(); |
| | | setTimeout(function() { |
| | | I18n.updateLayuiPagination(); |
| | | }, 100); |
| | | if (res.data.length === 0 && count !== 0) { |
| | | tableIns.reload({ |
| | | where: searchData, |