| | |
| | | var admin = layui.admin; |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#docType', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/docType/list/auth', |
| | | page: true, |
| | | limit: 15, |
| | | limits: [15, 30, 50, 100, 200, 500], |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | height: 'full-120', |
| | | cols: [[ |
| | | var getCols = function() { |
| | | return [[ |
| | | {type: 'checkbox'} |
| | | ,{field: 'docId', align: 'center',title: '类型编号'} |
| | | ,{field: 'docName', align: 'center',title: '类型名称'} |
| | | ,{field: 'pakin', align: 'center',title: '入库', templet: '#pakinTpl', width: 120, unresize: true} |
| | | ,{field: 'pakout', align: 'center',title: '出库', templet: '#pakoutTpl', width: 120, unresize: true} |
| | | ,{field: 'status$', align: 'center',title: '状态'} |
| | | ,{field: 'docId', align: 'center',title: I18n.t('doc_id')} |
| | | ,{field: 'docName', align: 'center',title: I18n.t('doc_name')} |
| | | ,{field: 'pakin', align: 'center',title: I18n.t('pakin'), templet: '#pakinTpl', width: 120, unresize: true} |
| | | ,{field: 'pakout', align: 'center',title: I18n.t('pakout'), templet: '#pakoutTpl', width: 120, unresize: true} |
| | | ,{field: 'status$', align: 'center',title: I18n.t('status')} |
| | | // ,{field: 'createBy$', align: 'center',title: '添加人员'} |
| | | // ,{field: 'createTime$', align: 'center',title: '添加时间'} |
| | | ,{field: 'updateBy$', align: 'center',title: '修改人员'} |
| | | ,{field: 'updateTime$', align: 'center',title: '修改时间'} |
| | | ,{field: 'memo', align: 'center',title: '备注', hide: true} |
| | | ,{field: 'updateBy$', align: 'center',title: I18n.t('modifier')} |
| | | ,{field: 'updateTime$', align: 'center',title: I18n.t('update_time')} |
| | | ,{field: 'memo', align: 'center',title: I18n.t('memo'), hide: true} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | ,{fixed: 'right', title: I18n.t('operation'), align: 'center', toolbar: '#operate', width:120} |
| | | ]]; |
| | | }; |
| | | |
| | | var initTable = function() { |
| | | tableIns = table.render({ |
| | | elem: '#docType', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/docType/list/auth', |
| | | page: true, |
| | | limit: 15, |
| | | limits: [15, 30, 50, 100, 200, 500], |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | height: 'full-120', |
| | | 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+"/"; |
| | | } |
| | | tableData = table.cache.docType; |
| | | pageCurr=curr; |
| | | I18n.updatePage(); |
| | | setTimeout(function() { |
| | | I18n.updateLayuiPagination(); |
| | | }, 100); |
| | | limit(); |
| | | } |
| | | }, |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | done: function(res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | tableData = table.cache.docType; |
| | | pageCurr=curr; |
| | | limit(); |
| | | }); |
| | | }; |
| | | |
| | | if (typeof I18n !== 'undefined' && I18n.isReady()) { |
| | | initTable(); |
| | | } else { |
| | | $(document).on('i18n:ready', initTable); |
| | | } |
| | | |
| | | $(document).on('i18n:languageChanged', function() { |
| | | if (tableIns) { |
| | | tableIns.reload({ |
| | | cols: getCols() |
| | | }); |
| | | } |
| | | }); |
| | | |
| | |
| | | break; |
| | | case 'deleteData': |
| | | if (checkStatus.length === 0) { |
| | | layer.msg('请选择要删除的数据', {icon: 2}); |
| | | layer.msg(I18n.t('please_select_delete_data'), {icon: 2}); |
| | | return; |
| | | } |
| | | del(checkStatus.map(function (d) { |
| | |
| | | })); |
| | | break; |
| | | case 'exportData': |
| | | admin.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | admin.confirm(I18n.t('confirm_export_excel'), {shadeClose: true}, function(){ |
| | | var titles=[]; |
| | | var fields=[]; |
| | | obj.config.cols[0].map(function (col) { |
| | |
| | | admin.open({ |
| | | type: 1, |
| | | area: '600px', |
| | | title: (mData ? '修改' : '添加') + '订单状态', |
| | | title: (mData ? I18n.t('edit') : I18n.t('add')) + ' ' + I18n.t('doc_type_management'), |
| | | content: $('#editDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | layDateRender(mData); |
| | |
| | | |
| | | /* 删除 */ |
| | | function del(ids) { |
| | | layer.confirm('确定要删除选中数据吗?', { |
| | | layer.confirm(I18n.t('confirm_delete_data'), { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | | }, function (i) { |