| | |
| | | } |
| | | }); |
| | | break; |
| | | case 'refreshData': |
| | | tableIns.reload({ |
| | | page: { |
| | | curr: pageCurr |
| | | } |
| | | }); |
| | | limit(); |
| | | break; |
| | | case 'deleteData': |
| | | var data = checkStatus.data; |
| | | if (data.length === 0){ |
| | |
| | | break; |
| | | // 导出 |
| | | case 'exportData': |
| | | layer.confirm('确定导出Excel吗', {shadeClose: true,}, function(){ |
| | | var titles=[]; |
| | | var fields=[]; |
| | | obj.config.cols[0].map(function (col) { |
| | | if (col.type === 'normal' && col.hide === false && col.toolbar == null) { |
| | | titles.push(col.title); |
| | | fields.push(col.field); |
| | | } |
| | | }); |
| | | var exportData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | exportData[this.name] = this.value; |
| | | }); |
| | | var param = { |
| | | 'matCode': exportData, |
| | | 'fields': fields |
| | | }; |
| | | $.ajax({ |
| | | url: baseUrl+"/matCode/export/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | // dataType:'json', |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | // layer.closeAll(); |
| | | // if (res.code === 200) { |
| | | // table.exportFile(titles,res.data,'xls'); |
| | | // } else if (res.code === 403) { |
| | | // top.location.href = baseUrl; |
| | | // } else { |
| | | // layer.msg(res.msg) |
| | | // } |
| | | } |
| | | }); |
| | | }); |
| | | layer.open({ |
| | | type: 1, |
| | | title: '数据导出', |
| | | shadeClose: true, |
| | | content: $('#exportDataDiv'), |
| | | success: function(layero, index){ |
| | | |
| | | }, |
| | | end: function () { |
| | | $("#exportFileName").val(""); |
| | | $("#exportRowCount").val(""); |
| | | } |
| | | }) |
| | | break; |
| | | // 导入 |
| | | case 'intoData': |
| | |
| | | } |
| | | }); |
| | | break; |
| | | // 批量打印 |
| | | case "btnPrintBatch": |
| | | layer.open({ |
| | | type: 1, |
| | | title: '批量打印', |
| | | shadeClose: true, |
| | | content: $('#printDataDiv'), |
| | | success: function(layero, index){ |
| | | |
| | | }, |
| | | end: function () { |
| | | } |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 导出excel |
| | | form.on('submit(exportDo)', function(data) { |
| | | layer.closeAll(); |
| | | layer.load(1, {shade: [0.1,'#fff']}); |
| | | location.href = baseUrl + "/matCode/export/auth?fileName="+$("#exportFileName").val()+"&rowCount="+$("#exportRowCount").val(); |
| | | layer.closeAll('loading'); |
| | | return false; |
| | | }); |
| | | |
| | | // 导入excel |
| | |
| | | title: '详情', |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: false, |
| | | shadeClose: true, |
| | | content: 'matCode_detail.html', |
| | | success: function(layero, index){ |
| | | setFormVal(layer.getChildFrame('#detail', index), data, true); |
| | |
| | | }); |
| | | } |
| | | break; |
| | | // 打印 |
| | | case "btnPrint": |
| | | layer.open({ |
| | | type: 1, |
| | | title: '打印', |
| | | shadeClose: true, |
| | | content: $('#printDataDiv'), |
| | | success: function(layero, index){ |
| | | |
| | | }, |
| | | end: function () { |
| | | } |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | | |