|
|
@@ -151,6 +151,27 @@ Ext.define('saas.view.core.report.ReportPanel', {
|
|
|
displayInfo: true,
|
|
|
store: store
|
|
|
}],
|
|
|
+ actions: {
|
|
|
+ copy: {
|
|
|
+ iconCls: 'x-fa fa-copy',
|
|
|
+ text: '复制单元格',
|
|
|
+ handler: function() {
|
|
|
+ me.onCopy(me.selectedData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ viewConfig: {
|
|
|
+ deferEmptyText: false,
|
|
|
+ emptyText: '无数据',
|
|
|
+ listeners: {
|
|
|
+ itemcontextmenu: function(view, rec, node, index, e) {
|
|
|
+ e.stopEvent();
|
|
|
+ me.getContextMenu().show().setLocalXY(e.getXY());
|
|
|
+ me.selectedData = e.target.innerText;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
@@ -480,5 +501,31 @@ Ext.define('saas.view.core.report.ReportPanel', {
|
|
|
|
|
|
applyParams: function(p) {
|
|
|
return p;
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
+ getContextMenu: function() {
|
|
|
+ var me = this,
|
|
|
+ grid = me.items.items[1];
|
|
|
+
|
|
|
+ return grid.contextMenu || (grid.contextMenu = grid.add({
|
|
|
+ xtype: 'menu',
|
|
|
+ items: [
|
|
|
+ // Actions can be converted into MenuItems
|
|
|
+ '@copy',
|
|
|
+ ]
|
|
|
+ }));
|
|
|
+ },
|
|
|
+
|
|
|
+ onCopy: function(text) {
|
|
|
+ var target = Ext.DomHelper.append(document.body, {
|
|
|
+ tag: 'textarea',
|
|
|
+ style: 'opacity: 0;position: absolute;top: -10000px;right: 0;',
|
|
|
+ html: text
|
|
|
+ });
|
|
|
+ target.focus();
|
|
|
+ target.select();
|
|
|
+ document.execCommand('Copy');
|
|
|
+ target.blur();
|
|
|
+ document.body.removeChild(target);
|
|
|
+ },
|
|
|
});
|