Query.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.oa.officialDocument.Query', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. GridUtil: Ext.create('erp.util.GridUtil'),
  6. BaseUtil: Ext.create('erp.util.BaseUtil'),
  7. views:[
  8. 'oa.officialDocument.query.Viewport','oa.officialDocument.query.GridPanel','oa.officialDocument.query.Form',
  9. 'core.trigger.DbfindTrigger','core.form.FtField'
  10. ],
  11. init:function(){
  12. this.control({
  13. 'erpQueryGridPanel': {
  14. itemclick: this.onGridItemClick
  15. },
  16. 'erpQueryFormPanel button[name=confirm]': {
  17. click: function(btn){
  18. }
  19. }
  20. });
  21. },
  22. onGridItemClick: function(selModel, record){//grid行选择
  23. var me = this;
  24. var title = '';
  25. var value = 0;
  26. if (me.FormUtil.contains(caller, "Receive", true)) {
  27. url=basePath+"jsps/oa/officialDocument/receiveODManagement/register.jsp";
  28. title = "收文";
  29. keyField = "rod_id";
  30. } else if (me.FormUtil.contains(caller, "Send", true)){
  31. url=basePath+"jsps/oa/officialDocument/sendODManagement/draft.jsp";
  32. title = "发文";
  33. keyField = "sod_id";
  34. }
  35. value = record.data[keyField];
  36. // alert(value);
  37. var panel = Ext.getCmp(keyField + "=" + value);
  38. var main = parent.Ext.getCmp("content-panel");
  39. if (!panel) {
  40. panel = {
  41. //title : main.getActiveTab().title+'('+title+')',
  42. title: title + '('+value+')',
  43. tag : 'iframe',
  44. tabConfig:{tooltip: title + '('+value+')'},
  45. frame : true,
  46. border : false,
  47. layout : 'fit',
  48. iconCls : 'x-tree-icon-tab-tab',
  49. html : '<iframe id="iframe_maindetail_'+caller+"_"+value+'" src="'+url+'?formCondition=' + keyField + 'IS'+value+'" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>',
  50. closable : true,
  51. listeners : {
  52. close : function(){
  53. main.setActiveTab(main.getActiveTab().id);
  54. }
  55. }
  56. };
  57. me.openTab(panel,keyField + "=" + value);
  58. } else {
  59. main.setActiveTab(panel);
  60. }
  61. },
  62. openTab : function (panel,id){
  63. // var me = this;
  64. var o = (typeof panel == "string" ? panel : id || panel.id);
  65. var main = parent.Ext.getCmp("content-panel");
  66. var tab = main.getComponent(o);
  67. if (tab) {
  68. main.setActiveTab(tab);
  69. } else if(typeof panel!="string"){
  70. panel.id = o;
  71. var p = main.add(panel);
  72. main.setActiveTab(p);
  73. }
  74. }
  75. });