| | |
| | | var form = layui.form; |
| | | |
| | | |
| | | // Define columns function |
| | | function getCols() { |
| | | return [[ |
| | | {field: 'ymd', align: 'center', title: typeof I18n !== 'undefined' ? I18n.t('date') : '日期'} |
| | | ,{field: 'source_sta_no', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('source_station') : '站点'} |
| | | ,{field: 'sto_qty', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('inbound_count') : '入库次数'} |
| | | ,{field: 'ret_qty', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('outbound_count') : '出库次数'} |
| | | ,{field: 'total_qty', align: 'center',title: typeof I18n !== 'undefined' ? I18n.t('total_count') : '入出总数'} |
| | | ]]; |
| | | } |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#inOut', |
| | |
| | | limit: 10, |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | cols: [[ |
| | | // {type: 'checkbox'} |
| | | {field: 'ymd', align: 'center', title: '日期'} |
| | | ,{field: 'source_sta_no', align: 'center',title: '站点'} |
| | | ,{field: 'sto_qty', align: 'center',title: '入库次数'} |
| | | ,{field: 'ret_qty', align: 'center',title: '出库次数'} |
| | | ,{field: 'total_qty', align: 'center',title: '入出总数'} |
| | | ]], |
| | | text: { |
| | | none: typeof I18n !== 'undefined' ? I18n.t('no_data') : '暂无相关数据' |
| | | }, |
| | | cols: getCols(), |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | |
| | | } |
| | | pageCurr=curr; |
| | | limit(); |
| | | if (typeof I18n !== 'undefined') { |
| | | I18n.updateLayuiPagination(); |
| | | I18n.updatePage(); |
| | | $('#btn-export').text(I18n.t('export')); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // Listen for language change |
| | | $(document).on('i18n:languageChanged', function() { |
| | | tableIns.reload({ |
| | | cols: getCols(), |
| | | text: { |
| | | none: I18n.t('no_data') |
| | | }, |
| | | done: function(res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | limit(); |
| | | I18n.updateLayuiPagination(); |
| | | I18n.updatePage(); |
| | | $('#btn-export').text(I18n.t('export')); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // 监听排序事件 |
| | |
| | | var checkStatus = table.checkStatus(obj.config.id); |
| | | switch(obj.event) { |
| | | case 'exportData': |
| | | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | layer.confirm(typeof I18n !== 'undefined' ? I18n.t('confirm_export') : '确定导出Excel吗', {shadeClose: true}, function(){ |
| | | var titles=[]; |
| | | var fields=[]; |
| | | obj.config.cols[0].map(function (col) { |