Manage.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.oa.officialDocument.fileManagement.agency.Manage', {
  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.fileManagement.agency.Viewport','common.datalist.GridPanel','common.datalist.Toolbar',
  9. 'oa.officialDocument.fileManagement.agency.Form',
  10. 'core.trigger.DbfindTrigger','core.form.ConDateField','core.form.WordSizeField','oa.mail.MailPaging'
  11. ],
  12. init:function(){
  13. var me = this;
  14. this.control({
  15. 'erpDatalistGridPanel': {
  16. afterrender: function(grid){
  17. grid.onGridItemClick = function(){//改为点击button进入详细界面
  18. me.onGridItemClick(grid.selModel.lastSelected);
  19. };
  20. }
  21. },
  22. 'button[id=delete]': {
  23. click: function(){
  24. me.vastDelete();
  25. }
  26. },
  27. 'button[id=add]': {
  28. click: function(){
  29. me.newAgency();
  30. }
  31. }
  32. });
  33. },
  34. newAgency: function(){
  35. var win = new Ext.window.Window({
  36. id : 'win',
  37. title: "机构问题",
  38. height: "50%",
  39. width: "50%",
  40. maximizable : false,
  41. buttonAlign : 'left',
  42. layout : 'anchor',
  43. items: [{
  44. tag : 'iframe',
  45. frame : true,
  46. anchor : '100% 100%',
  47. layout : 'fit',
  48. html : '<iframe id="iframe_' + new Date() + '" src="' + basePath + 'jsps/oa/officialDocument/fileManagement/agency/new.jsp" height="100%" width="100%" frameborder="0" scrolling="yes"></iframe>'
  49. }]
  50. });
  51. win.show();
  52. },
  53. onGridItemClick: function(record){//grid行选择
  54. console.log(record);
  55. var me = this;
  56. if(record.data.rod_statuscode == 'OVERED'){
  57. var id = record.data.rod_id;
  58. var panel = Ext.getCmp("mrod" + id);
  59. var main = parent.Ext.getCmp("content-panel");
  60. if(!panel){
  61. var title = "收文分发";
  62. panel = {
  63. title : title,
  64. tag : 'iframe',
  65. tabConfig:{tooltip: record.data['rod_title']},
  66. frame : true,
  67. border : false,
  68. layout : 'fit',
  69. iconCls : 'x-tree-icon-tab-tab1',
  70. html : '<iframe id="iframe_' + id + '" src="' + basePath + "jsps/oa/officialDocument/receiveODManagement/rodDetail.jsp?flag=manage&id=" + id + '" height="100%" width="100%" frameborder="0" scrolling="yes"></iframe>',
  71. closable : true,
  72. listeners : {
  73. close : function(){
  74. main.setActiveTab(main.getActiveTab().id);
  75. }
  76. }
  77. };
  78. me.FormUtil.openTab(panel, "mrod" + id);
  79. }else{
  80. main.setActiveTab(panel);
  81. }
  82. } else {
  83. return;
  84. }
  85. },
  86. vastDelete: function(){
  87. var grid = Ext.getCmp('grid');
  88. var records = grid.selModel.getSelection();
  89. if(records.length > 0){
  90. var id = new Array();
  91. Ext.each(records, function(record, index){
  92. id[index] = record.data[keyField];
  93. });
  94. var main = parent.Ext.getCmp("content-panel");
  95. main.getActiveTab().setLoading(true);//loading...
  96. Ext.Ajax.request({
  97. url : basePath + 'common/vastDelete.action',
  98. params: {
  99. caller: caller,
  100. id: id
  101. },
  102. method : 'post',
  103. callback : function(options,success,response){
  104. main.getActiveTab().setLoading(false);
  105. var localJson = new Ext.decode(response.responseText);
  106. if(localJson.exceptionInfo){
  107. showError(localJson.exceptionInfo);
  108. return "";
  109. }
  110. if(localJson.success){
  111. Ext.Msg.alert("提示", "删除成功!", function(){
  112. window.location.href = window.location.href;
  113. });
  114. }
  115. }
  116. });
  117. }
  118. }
  119. });