| | |
| | | var pageCurr; |
| | | var locNo; |
| | | var detailLayerIndex; |
| | | |
| | | // Define i18n mapping for auto-complete fields |
| | | window.i18nEnumMap = { |
| | | 'basWhsQueryBywhsType': { |
| | | '1': 'standard_crane_whs', |
| | | '2': 'flat_whs', |
| | | '3': 'shuttle_board', |
| | | '4': 'four_way_vehicle', |
| | | '5': 'agv' |
| | | }, |
| | | 'basLocStsQueryBylocSts': function(id) { |
| | | return 'loc_status_' + id; |
| | | } |
| | | }; |
| | | |
| | | layui.use(['table','laydate', 'form'], function(){ |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | var tableIns, tableIns1; |
| | | |
| | | layDate.render({ |
| | | elem: '.layui-laydate-range' |
| | |
| | | ,range: true |
| | | }); |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#stoQue', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/locMast/list/auth', |
| | | page: true, |
| | | limit: 20, |
| | | limits: [20, 30, 50, 100, 200, 500], |
| | | even: true, |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | cols: [[ |
| | | // 获取主表表头 |
| | | function getCol() { |
| | | var i18n = (typeof I18n !== 'undefined' && I18n.isReady()); |
| | | return [[ |
| | | {type: 'checkbox'} |
| | | ,{field: 'locNo', align: 'center',title: '库位号', hide:false} |
| | | ,{field: 'locSts$', align: 'center',title: '库位状态', width: 180, style: 'color: #8E2323', hide:false} |
| | | ,{field: 'whsType$', align: 'center',title: '库位类型', width: 180, style: 'color: #8E2323', hide:false} |
| | | ,{field: 'crnNo', align: 'center',title: '堆垛机号', sort:true, hide:false} |
| | | ,{field: 'row1', align: 'center',title: '排', sort:true, hide:true} |
| | | ,{field: 'bay1', align: 'center',title: '列', sort:true, hide:true} |
| | | ,{field: 'lev1', align: 'center',title: '层', sort:true, hide:true} |
| | | ,{field: 'gro1', align: 'center',title: '组', sort:true, hide:true} |
| | | ,{field: 'fullPlt', align: 'center',title: '满板', templet:function(row){ |
| | | ,{field: 'locNo', align: 'center',title: i18n ? I18n.t('location_no') : '库位号', hide:false} |
| | | ,{field: 'locSts$', align: 'center',title: i18n ? I18n.t('location_status') : '库位状态', width: 180, style: 'color: #8E2323', hide:false, templet: function(d) { |
| | | if (typeof I18n !== 'undefined' && I18n.isReady() && d.locSts) { |
| | | var key = 'loc_status_' + d.locSts.trim(); |
| | | var text = I18n.t(key); |
| | | if (text !== key) return text; |
| | | } |
| | | return d.locSts$ || d.locSts; |
| | | }} |
| | | ,{field: 'whsType$', align: 'center',title: i18n ? I18n.t('location_type') : '库位类型', width: 180, style: 'color: #8E2323', hide:false, templet: function(d) { |
| | | if (typeof I18n !== 'undefined' && I18n.isReady() && d.whsType) { |
| | | var map = { |
| | | '1': 'standard_crane_whs', |
| | | '2': 'flat_whs', |
| | | '3': 'shuttle_board', |
| | | '4': 'four_way_vehicle', |
| | | '5': 'agv' |
| | | }; |
| | | var key = map[d.whsType]; |
| | | if (key) return I18n.t(key); |
| | | } |
| | | return d.whsType$ || d.whsType; |
| | | }} |
| | | ,{field: 'crnNo', align: 'center',title: i18n ? I18n.t('crane_no') : '堆垛机号', sort:true, hide:false} |
| | | ,{field: 'row1', align: 'center',title: i18n ? I18n.t('row') : '排', sort:true, hide:true} |
| | | ,{field: 'bay1', align: 'center',title: i18n ? I18n.t('bay') : '列', sort:true, hide:true} |
| | | ,{field: 'lev1', align: 'center',title: i18n ? I18n.t('level') : '层', sort:true, hide:true} |
| | | ,{field: 'gro1', align: 'center',title: i18n ? I18n.t('group') : '组', sort:true, hide:true} |
| | | ,{field: 'fullPlt', align: 'center',title: i18n ? I18n.t('full_pallet') : '满盘', templet:function(row){ |
| | | var html = "<input value='fullPlt' type='checkbox' lay-skin='primary' lay-filter='tableCheckbox' table-index='"+row.LAY_TABLE_INDEX+"'"; |
| | | if(row.fullPlt === 'Y'){html += " checked ";} |
| | | html += "disabled='disabled' >"; |
| | | return html; |
| | | },width:80} |
| | | ,{field: 'barcode', align: 'center',title: '条码号', hide:false} |
| | | ,{field: 'locType1$', align: 'center',title: '高低类型', hide:true} |
| | | ,{field: 'locType2$', align: 'center',title: '宽窄类型', hide:true} |
| | | ,{field: 'locType3$', align: 'center',title: '轻重类型', hide:true} |
| | | ,{field: 'modiUser$', align: 'center',title: '修改人员', hide:true} |
| | | ,{field: 'modiTime$', align: 'center',title: '修改时间', width: 180, hide:false} |
| | | ,{ fixed: 'right', title:'操作', align: 'center', toolbar: '#operate'} |
| | | ]], |
| | | 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'; |
| | | ,{field: 'barcode', align: 'center',title: i18n ? I18n.t('barcode') : '托盘条码', hide:false} |
| | | ,{field: 'locType1$', align: 'center',title: i18n ? I18n.t('high_low_type') : '高低位', hide:true} |
| | | ,{field: 'locType2$', align: 'center',title: i18n ? I18n.t('width_type') : '宽窄板', hide:true} |
| | | ,{field: 'locType3$', align: 'center',title: i18n ? I18n.t('weight_type') : '载重', hide:true} |
| | | ,{field: 'modiUser$', align: 'center',title: i18n ? I18n.t('modifier') : '更新者', hide:true} |
| | | ,{field: 'modiTime$', align: 'center',title: i18n ? I18n.t('modify_time') : '更新时间', width: 180, hide:false} |
| | | ,{ fixed: 'right', title: i18n ? I18n.t('operation') : '操作', align: 'center', toolbar: '#operate'} |
| | | ]]; |
| | | } |
| | | |
| | | // 数据渲染 |
| | | window.initTable = function() { |
| | | var i18n = (typeof I18n !== 'undefined' && I18n.isReady()); |
| | | tableIns = table.render({ |
| | | elem: '#stoQue', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/locMast/list/auth', |
| | | page: true, |
| | | limit: 20, |
| | | limits: [20, 30, 50, 100, 200, 500], |
| | | even: true, |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | cols: getCol(), |
| | | text: { |
| | | none: i18n ? I18n.t('no_data') : '无数据' |
| | | }, |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | } |
| | | }); |
| | | if (count === 1){ |
| | | // locDetl(res.data[0][locNo]); |
| | | }, |
| | | 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'; |
| | | } |
| | | }); |
| | | if (count === 1){ |
| | | // locDetl(res.data[0][locNo]); |
| | | } |
| | | if (typeof I18n !== 'undefined') { |
| | | I18n.updatePage(); |
| | | setTimeout(function() { |
| | | I18n.updateLayuiPagination(); |
| | | }, 50); |
| | | // 再次尝试,确保分页被翻译 |
| | | var retryCount = 0; |
| | | var interval = setInterval(function() { |
| | | if ($('.layui-table-page').length > 0) { |
| | | I18n.updateLayuiPagination(); |
| | | retryCount++; |
| | | if (retryCount > 5) clearInterval(interval); |
| | | } else { |
| | | clearInterval(interval); |
| | | } |
| | | }, 100); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | initTable(); |
| | | if (typeof I18n === 'undefined' || !I18n.isReady()) { |
| | | $(document).on('i18n:ready', initTable); |
| | | } |
| | | |
| | | $(document).on('i18n:languageChanged', function() { |
| | | initTable(); |
| | | // Reload detail table if it's visible |
| | | if ($('#detlTable').css('display') !== 'none' && locNo) { |
| | | locDetl(locNo); |
| | | } |
| | | // Update layer title if open |
| | | if (detailLayerIndex && $('#layui-layer' + detailLayerIndex).length > 0) { |
| | | var i18n = (typeof I18n !== 'undefined' && I18n.isReady()); |
| | | layer.title(i18n ? I18n.t('inventory_detail') : '库存明细', detailLayerIndex); |
| | | } |
| | | |
| | | $('[data-i18n-placeholder]').each(function() { |
| | | var key = $(this).attr('data-i18n-placeholder'); |
| | | if (typeof I18n !== 'undefined' && I18n.isReady()) { |
| | | $(this).attr('placeholder', I18n.t(key)); |
| | | } |
| | | }); |
| | | |
| | | I18n.updatePage(); |
| | | form.render('select'); |
| | | }); |
| | | |
| | | // 监听排序事件 |
| | |
| | | alert("还没做"); |
| | | break; |
| | | case 'exportData': |
| | | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | var i18n = (typeof I18n !== 'undefined' && I18n.isReady()); |
| | | layer.confirm(i18n ? I18n.t('confirm_export_excel') : '确定导出Excel吗', {shadeClose: true}, function(){ |
| | | var titles=[]; |
| | | var fields=[]; |
| | | obj.config.cols[0].map(function (col) { |
| | |
| | | || data.locSts.trim() === 'S' |
| | | || data.locSts.trim() === 'D' |
| | | || data.locSts.trim() === 'O') { |
| | | layer.msg("此库位的状态不存在物料"); |
| | | var i18n = (typeof I18n !== 'undefined' && I18n.isReady()); |
| | | layer.msg(i18n ? I18n.t('location_status_no_material') : "此库位的状态不存在物料"); |
| | | return; |
| | | } |
| | | locDetlToLayer(data.locNo); |
| | |
| | | |
| | | // iframe物料详情 |
| | | function locDetlToLayer(val) { |
| | | var i18n = (typeof I18n !== 'undefined' && I18n.isReady()); |
| | | locNo = val; |
| | | layer.open({ |
| | | detailLayerIndex = layer.open({ |
| | | type: 2, |
| | | title: '库存明细', |
| | | title: i18n ? I18n.t('inventory_detail') : '库存明细', |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: true, |
| | |
| | | } |
| | | // div物料详情 |
| | | var pageCur; |
| | | function getDetlCols() { |
| | | var i18n = (typeof I18n !== 'undefined' && I18n.isReady()); |
| | | return [[ |
| | | // {type: 'checkbox'} |
| | | {field: 'locNo$', align: 'center',title: i18n ? I18n.t('location_no') : '库位号'} |
| | | ,{field: 'matnr', align: 'center',title: i18n ? I18n.t('material') : '物料'} |
| | | ,{field: 'lgnum', align: 'center',title: i18n ? I18n.t('warehouse_no') : '仓库号'} |
| | | ,{field: 'tbnum', align: 'center',title: i18n ? I18n.t('transfer_req_no') : '搬运凭证'} |
| | | // ,{field: 'tbpos', align: 'center',title: '行项目'} |
| | | ,{field: 'zmatid', align: 'center',title: i18n ? I18n.t('material_label_id') : '物料标签ID'} |
| | | ,{field: 'maktx', align: 'center',title: i18n ? I18n.t('material_desc') : '物料描述'} |
| | | ,{field: 'werks', align: 'center',title: i18n ? I18n.t('factory') : '工厂'} |
| | | ,{field: 'anfme', align: 'center',title: i18n ? I18n.t('quantity') : '数量'} |
| | | ,{field: 'altme', align: 'center',title: i18n ? I18n.t('unit') : '单位'} |
| | | ,{field: 'zpallet', align: 'center',title: i18n ? I18n.t('pallet_barcode') : '托盘条码'} |
| | | ,{field: 'bname', align: 'center',title: i18n ? I18n.t('user_id') : '用户ID'} |
| | | ]]; |
| | | } |
| | | |
| | | function locDetl(locNo){ |
| | | var i18n = (typeof I18n !== 'undefined' && I18n.isReady()); |
| | | $('#detlTable').css("display", 'block'); |
| | | // 数据渲染 |
| | | tableIns1 = table.render({ |
| | |
| | | where: {loc_no: locNo}, |
| | | even: true, |
| | | cellMinWidth: 50, |
| | | cols: [[ |
| | | // {type: 'checkbox'} |
| | | {field: 'locNo$', align: 'center',title: '库位号'} |
| | | ,{field: 'matnr', align: 'center',title: '物料'} |
| | | ,{field: 'lgnum', align: 'center',title: '仓库号'} |
| | | ,{field: 'tbnum', align: 'center',title: '转储请求编号'} |
| | | // ,{field: 'tbpos', align: 'center',title: '行项目'} |
| | | ,{field: 'zmatid', align: 'center',title: '物料标签ID'} |
| | | ,{field: 'maktx', align: 'center',title: '物料描述'} |
| | | ,{field: 'werks', align: 'center',title: '工厂'} |
| | | ,{field: 'anfme', align: 'center',title: '数量'} |
| | | ,{field: 'altme', align: 'center',title: '单位'} |
| | | ,{field: 'zpallet', align: 'center',title: '托盘条码'} |
| | | ,{field: 'bname', align: 'center',title: '用户ID'} |
| | | ]], |
| | | cols: getDetlCols(), |
| | | text: { |
| | | none: i18n ? I18n.t('no_data') : '无数据' |
| | | }, |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | |
| | | res.data[_index][data.value] = 'N'; |
| | | } |
| | | }); |
| | | if (typeof I18n !== 'undefined') { |
| | | I18n.updatePage($('#detlTable')); |
| | | setTimeout(function() { |
| | | I18n.updateLayuiPagination(); |
| | | }, 50); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | |
| | | pageCurr -= 1; |
| | | } |
| | | limit(child); |
| | | if (typeof I18n !== 'undefined') { |
| | | I18n.updatePage(); |
| | | setTimeout(function() { |
| | | I18n.updateLayuiPagination(); |
| | | }, 50); |
| | | } |
| | | } |
| | | }); |
| | | } |