Delete.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.oa.mail.Delete', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. views:[
  6. 'oa.mail.Delete','oa.mail.DeleteGroupGrid','oa.mail.MailPaging'
  7. ],
  8. init:function(){
  9. var me = this;
  10. this.control({
  11. 'erpGroupGrid': {
  12. select: function(selModel, record){
  13. var id = record.data['ma_id'];
  14. if(id != null && id != ''){
  15. var panel = Ext.getCmp("mail" + id);
  16. var main = parent.Ext.getCmp("content-panel");
  17. if(!panel){
  18. var title = "";
  19. var from = record.data['ma_from'];
  20. if (from.toString().length>4) {
  21. title = from.toString().substring(0, 4);
  22. } else {
  23. title = from;
  24. }
  25. panel = {
  26. title : title,
  27. tag : 'iframe',
  28. tabConfig:{tooltip: record.data['ma_subject']},
  29. frame : true,
  30. border : false,
  31. layout : 'fit',
  32. iconCls : 'x-tree-icon-tab-tab1',
  33. html : '<iframe id="iframe_mail_' + id + '" src="' + basePath + "jsps/oa/mail/mailDetail.jsp?id=" + id + '" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>',
  34. closable : true,
  35. listeners : {
  36. close : function(){
  37. main.setActiveTab(main.getActiveTab().id);
  38. }
  39. }
  40. };
  41. me.FormUtil.openTab(panel, "mail" + id);
  42. }else{
  43. main.setActiveTab(panel);
  44. }
  45. }
  46. }
  47. },
  48. 'button[id=restore]': {
  49. click: function(btn){
  50. var grid = btn.ownerCt.ownerCt;
  51. var records = grid.selModel.getSelection();
  52. var id = new Array();
  53. Ext.each(records, function(record){
  54. id.push(record.data['ma_id']);
  55. });
  56. me.upadteMailStatus(id, 2);
  57. }
  58. }
  59. });
  60. },
  61. upadteMailStatus: function(id, status){
  62. Ext.Ajax.request({
  63. url : basePath + 'oa/mail/updateMailStatus.action',
  64. params: {
  65. id: id,
  66. status: status
  67. },
  68. method : 'post',
  69. async: false,
  70. callback : function(options, success, response){
  71. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  72. var res = new Ext.decode(response.responseText);
  73. if(res.exceptionInfo){
  74. showError(res.exceptionInfo);return;
  75. }
  76. Ext.getCmp('grid').getGroupData();
  77. }
  78. });
  79. }
  80. });