1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- /**
- * 明细行导入excel
- */
- Ext.define('erp.view.core.button.ExportDetail',{
- extend: 'Ext.Button',
- alias: 'widget.erpExportDetailButton',
- iconCls: 'x-button-icon-excel',
- cls: 'x-btn-tb',
- disabled: false,
- menu: [{
- iconCls: 'main-msg',
- text: '下载模板',
- cls: ' ',
- scope: this,
- handler: function(btn){
- var grid = btn.parentMenu.floatParent.grid;
- var condition = grid.condition;
- if(!condition){
- var urlCondition = grid.BaseUtil.getUrlParam('gridCondition');
- urlCondition = urlCondition == null || urlCondition == "null" ? "" : urlCondition;
- urlCondition = urlCondition.replace(/IS/g, "=");
- condition = urlCondition;
- }
- condition = grid.gridCondition || condition;
- if(Ext.isEmpty(condition)) {
- grid.BaseUtil.exportGrid(grid);
- } else if(typeof grid.onExport === 'function'){
- grid.onExport(grid.caller||caller, 'detailgrid', grid.gridCondition || condition);
- } else {
- grid.BaseUtil.createExcel(grid.caller||caller, 'detailgrid', grid.gridCondition || condition);
- }
- }
- },{
- text: '导入明细数据',
- scope: this,
- xtype: 'upexcel',
- iconCls: 'main-msg',
- id: 'upexcel',
- cls: ' ',
- height: 23,
- listeners: {
- afterrender: function(btn) {
- var b = btn.ownerCt.floatParent, grid = b.grid;
- if(grid.readOnly)
- btn.hide();
- },
- beforeimport: function(btn){
- var b = btn.ownerCt.floatParent, grid = b.grid;
- if(grid.readOnly) {// 可编辑的情况下,允许导入
- alert('当前单据不允许编辑,无法导入.');
- return false;
- }
- return true;
- }
- }
- }],
- initComponent : function(){
- this.callParent(arguments);
- },
- listeners: {
- afterrender: function(){
- this.grid = this.ownerCt.ownerCt;
- }
- }
- });
|