|
|
@@ -321,6 +321,7 @@ Ext.define('saas.view.core.report.ReportPanel', {
|
|
|
|
|
|
if(c.xtype == 'datecolumn') {
|
|
|
Ext.applyIf(c, {
|
|
|
+ // 这两个都要写上,才能控制到不同类型的导出格式,原因不明- -!
|
|
|
format: 'Y-m-d',
|
|
|
exportStyle: [{
|
|
|
type: 'csv',
|
|
|
@@ -343,20 +344,14 @@ Ext.define('saas.view.core.report.ReportPanel', {
|
|
|
var format = '0.' + xr.join();
|
|
|
return Ext.util.Format.number(v, format);
|
|
|
},
|
|
|
- exportRenderer: function (value) {
|
|
|
- return value || 0;
|
|
|
- },
|
|
|
- // 下面这个方法不写会造成求和数据错误,原因不明- -!
|
|
|
- exportSummaryRenderer: function(v) {
|
|
|
- return v || 0;
|
|
|
- }
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if(c.summaryType) {
|
|
|
+ me.initSummaryType(c);
|
|
|
summarys.push({
|
|
|
field: c.dataIndex,
|
|
|
- operation: c.summaryType,
|
|
|
+ operation: c.summaryTypeName,
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
@@ -366,6 +361,19 @@ Ext.define('saas.view.core.report.ReportPanel', {
|
|
|
return columns;
|
|
|
},
|
|
|
|
|
|
+ initSummaryType: function(column) {
|
|
|
+ var summaryType = column.summaryType;
|
|
|
+ if(Ext.isString(summaryType)) {
|
|
|
+ column.summaryTypeName = summaryType;
|
|
|
+ }
|
|
|
+ if(summaryType == 'sum') {
|
|
|
+ // 原生的求和方法使用的是Store.sum,在数据存在null时计算结果为NaN,这里重写一下
|
|
|
+ column.summaryType = function(records, values) {
|
|
|
+ return Ext.Array.sum(values);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
initSearchItems: function() {
|
|
|
var me = this,
|
|
|
items = me.searchItems,
|