| | |
| | | var pageCurr; |
| | | function getCol() { |
| | | var title = '库存数量'; |
| | | if (typeof I18n !== 'undefined') { |
| | | title = I18n.t('inventory_quantity'); |
| | | } |
| | | var cols = [ |
| | | {field: 'anfme', align: 'center',title: '库存数量', style: 'font-weight: bold'} |
| | | {field: 'anfme', align: 'center',title: title, style: 'font-weight: bold'} |
| | | ]; |
| | | arrRemove(detlCols, "field", "anfme") |
| | | arrRemove(detlCols, "field", "zpallet") |
| | | cols.push.apply(cols, detlCols); |
| | | // cols.push({field: 'anfme', align: 'center',title: '数量', style: 'font-weight: bold'} |
| | | // ) |
| | | |
| | | // Use getDetlCols() if available for fresh translations |
| | | var currentDetlCols = []; |
| | | if (typeof getDetlCols === 'function') { |
| | | // Get fresh copy |
| | | currentDetlCols = getDetlCols(); |
| | | } else if (typeof detlCols !== 'undefined') { |
| | | // Fallback to global variable (might be stale or already modified) |
| | | // Clone to avoid affecting the global variable if we are filtering |
| | | currentDetlCols = JSON.parse(JSON.stringify(detlCols)); |
| | | } |
| | | |
| | | // Remove unwanted columns from the copy |
| | | // We use a filter approach to avoid issues with in-place modification of globals |
| | | // and to ensure we can switch languages correctly. |
| | | var filteredCols = []; |
| | | if (currentDetlCols) { |
| | | for(var i=0; i<currentDetlCols.length; i++){ |
| | | var col = currentDetlCols[i]; |
| | | if(col.field !== 'anfme' && col.field !== 'zpallet'){ |
| | | filteredCols.push(col); |
| | | } |
| | | } |
| | | } |
| | | |
| | | cols.push.apply(cols, filteredCols); |
| | | return cols; |
| | | } |
| | | |
| | |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | |
| | | if (typeof I18n !== 'undefined') { |
| | | I18n.updatePage($('.layui-table-tool')); |
| | | setTimeout(function() { |
| | | I18n.updateLayuiPagination(); |
| | | }, 50); |
| | | } |
| | | |
| | | pageCurr=curr; |
| | | limit(); |
| | | form.on('checkbox(tableCheckbox)', function (data) { |
| | |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | $("#countNum").text(res.data + '个'); |
| | | var unit = (typeof I18n !== 'undefined') ? I18n.t('unit_piece') : '个'; |
| | | $("#countNum").text(res.data + unit); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }); |
| | | |
| | | // 监听语言切换事件 |
| | | $(document).on('i18n:languageChanged', function() { |
| | | tableIns.reload({ |
| | | cols: [getCol()], |
| | | text: { |
| | | none: I18n.t('no_data') |
| | | }, |
| | | done: function(res, curr, count) { |
| | | if (typeof I18n !== 'undefined') { |
| | | I18n.updatePage($('.layui-table-tool')); |
| | | setTimeout(function() { |
| | | I18n.updateLayuiPagination(); |
| | | }, 50); |
| | | } |
| | | pageCurr=curr; |
| | | limit(); |
| | | // 重新获取数量以更新翻译 |
| | | $.ajax({ |
| | | url: baseUrl+"/locDetl/count", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | var unit = (typeof I18n !== 'undefined') ? I18n.t('unit_piece') : '个'; |
| | | $("#countNum").text(res.data + unit); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // 监听排序事件 |
| | |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | |
| | | if (typeof I18n !== 'undefined') { |
| | | I18n.updatePage($('.layui-table-tool')); |
| | | setTimeout(function() { |
| | | I18n.updateLayuiPagination(); |
| | | }, 50); |
| | | } |
| | | |
| | | pageCurr=curr; |
| | | limit(); |
| | | } |
| | |
| | | case 'exportAll': |
| | | layer.closeAll(); |
| | | layer.load(1, {shade: [0.1,'#fff']}); |
| | | location.href = baseUrl + "/locDetl/statis/export"; |
| | | var lang = (typeof I18n !== 'undefined') ? I18n.getLanguage() : 'zh-cn'; |
| | | location.href = baseUrl + "/locDetl/statis/export?lang=" + lang; |
| | | layer.closeAll('loading'); |
| | | break; |
| | | case 'exportData': |
| | | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | var confirmMsg = (typeof I18n !== 'undefined') ? I18n.t('confirm_export_excel') : '确定导出Excel吗'; |
| | | layer.confirm(confirmMsg, {shadeClose: true, title: (typeof I18n !== 'undefined') ? I18n.t('prompt') : '提示', btn: [(typeof I18n !== 'undefined') ? I18n.t('confirm') : '确定', (typeof I18n !== 'undefined') ? I18n.t('cancel') : '取消']}, function(index){ |
| | | layer.close(index); // Close the confirm dialog |
| | | var titles=[]; |
| | | var fields=[]; |
| | | obj.config.cols[0].map(function (col) { |
| | |
| | | case 'detail': |
| | | layer.open({ |
| | | type: 2, |
| | | title: '详情', |
| | | title: (typeof I18n !== 'undefined') ? I18n.t('detail') : '详情', |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: false, |
| | |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | |
| | | if (typeof I18n !== 'undefined') { |
| | | I18n.updatePage($('.layui-table-tool')); |
| | | setTimeout(function() { |
| | | I18n.updateLayuiPagination(); |
| | | }, 50); |
| | | } |
| | | |
| | | pageCurr=curr; |
| | | if (res.data.length === 0 && count !== 0) { |
| | | tableIns.reload({ |