| | |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | |
| | | var doneCallback = function(res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | limit(); |
| | | if (typeof I18n !== 'undefined') { |
| | | I18n.updatePage($('.layui-table-view')); |
| | | I18n.updateLayuiPagination(); |
| | | } |
| | | }; |
| | | |
| | | $(document).on('i18n:languageChanged', function() { |
| | | tableIns.reload({ |
| | | cols: getCol(), |
| | | done: doneCallback |
| | | }); |
| | | }); |
| | | |
| | | function getCol() { |
| | | return [[ |
| | | {type: 'checkbox', fixed: 'left'} |
| | | // ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80} |
| | | ,{field: 'ioType', align: 'center',sort:true,title: I18n.t('io_type_code')} |
| | | // ,{field: 'ioPri', align: 'center',title: '主要'} |
| | | ,{field: 'ioDesc', align: 'center',title: I18n.t('io_type_desc'), templet: function(d) { |
| | | var key = 'io_type_' + d.ioType; |
| | | var text = I18n.t(key); |
| | | return text === key ? d.ioDesc : text; |
| | | }} |
| | | ,{field: 'modiUser$', align: 'center',title: I18n.t('modifier')} |
| | | ,{field: 'modiTime$', align: 'center',title: I18n.t('modify_time')} |
| | | // ,{field: 'appeUser$', align: 'center',title: '创建者',event: 'appeUser', style: 'text-decoration: underline;cursor:pointer'} |
| | | // ,{field: 'appeTime$', align: 'center',title: '添加时间'} |
| | | |
| | | ,{fixed: 'right', title: I18n.t('operation'), align: 'center', toolbar: '#operate', width:150} |
| | | ]]; |
| | | } |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#basWrkIotype', |
| | |
| | | even: true, |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | cols: [[ |
| | | {type: 'checkbox', fixed: 'left'} |
| | | // ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80} |
| | | ,{field: 'ioType', align: 'center',sort:true,title: '入出类型代号'} |
| | | // ,{field: 'ioPri', align: 'center',title: '主要'} |
| | | ,{field: 'ioDesc', align: 'center',title: '入出类型描述'} |
| | | ,{field: 'modiUser$', align: 'center',title: '修改人员'} |
| | | ,{field: 'modiTime$', align: 'center',title: '修改时间'} |
| | | // ,{field: 'appeUser$', align: 'center',title: '创建者',event: 'appeUser', style: 'text-decoration: underline;cursor:pointer'} |
| | | // ,{field: 'appeTime$', align: 'center',title: '添加时间'} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} |
| | | ]], |
| | | cols: getCol(), |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | done: function(res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | limit(); |
| | | } |
| | | done: doneCallback |
| | | }); |
| | | |
| | | // 监听排序事件 |
| | |
| | | page: { |
| | | curr: 1 |
| | | }, |
| | | done: function (res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | limit(); |
| | | } |
| | | done: doneCallback |
| | | }); |
| | | }); |
| | | |
| | |
| | | case 'addData': |
| | | layer.open({ |
| | | type: 2, |
| | | title: '新增', |
| | | title: I18n.t('add'), |
| | | maxmin: true, |
| | | area: ['500px', top.detailHeight], |
| | | shadeClose: false, |
| | |
| | | tableIns.reload({ |
| | | page: { |
| | | curr: pageCurr |
| | | } |
| | | }, |
| | | done: doneCallback |
| | | }); |
| | | limit(); |
| | | break; |
| | | 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(){ |
| | | var msg = I18n.t('confirm_delete_prefix') + (data.length===1?I18n.t('this'):data.length) + I18n.t('confirm_delete_suffix'); |
| | | layer.confirm(msg, function(){ |
| | | $.ajax({ |
| | | url: baseUrl+"/basWrkIotype/delete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | |
| | | } |
| | | break; |
| | | case 'exportData': |
| | | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | layer.confirm(I18n.t('confirm_export'), {shadeClose: true}, function(){ |
| | | var titles=[]; |
| | | var fields=[]; |
| | | obj.config.cols[0].map(function (col) { |