NewDocumentRoom.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.oa.officialDocument.fileManagement.NewDocumentRoom', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'oa.officialDocument.fileManagement.documentRoom.NewDocumentRoom','core.form.Panel',
  8. 'core.button.Save','core.button.Close','core.button.Update','core.button.Delete',
  9. 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger','core.trigger.MultiDbfindTrigger'
  10. ],
  11. init:function(){
  12. var me = this;
  13. this.control({
  14. 'erpSaveButton': {
  15. click: function(btn){
  16. this.FormUtil.beforeSave(this);
  17. // parent.window.location.href = parent.window.location.href;
  18. }
  19. },
  20. 'erpUpdateButton': {
  21. click: function(btn){
  22. this.FormUtil.onUpdate(this);
  23. // parent.window.location.href = parent.window.location.href;
  24. }
  25. },
  26. 'erpDeleteButton': {
  27. click: function(btn){
  28. me.onDelete((Ext.getCmp('dr_id').value));
  29. // me.FormUtil.onDelete((Ext.getCmp('dr_id').value));
  30. // parent.window.location.href = parent.window.location.href;
  31. }
  32. },
  33. 'erpCloseButton': {
  34. click: function(btn){
  35. parent.window.location.href = parent.window.location.href;
  36. this.FormUtil.onClose(this);
  37. // window.close();
  38. }
  39. }
  40. });
  41. },
  42. getForm: function(btn){
  43. return btn.ownerCt.ownerCt;
  44. },
  45. openTab : function (panel,id){
  46. var o = (typeof panel == "string" ? panel : id || panel.id);
  47. var main = parent.Ext.getCmp("content-panel");
  48. var tab = main.getComponent(o);
  49. if (tab) {
  50. main.setActiveTab(tab);
  51. } else if(typeof panel!="string"){
  52. panel.id = o;
  53. var p = main.add(panel);
  54. main.setActiveTab(p);
  55. }
  56. },
  57. onDelete: function(id){
  58. var me = this;
  59. warnMsg($I18N.common.msg.ask_del_main, function(btn){
  60. if(btn == 'yes'){
  61. var form = Ext.getCmp('form');
  62. if(!contains(form.deleteUrl, '?caller=', true)){
  63. form.deleteUrl = form.deleteUrl + "?caller=" + caller;
  64. }
  65. // me.getActiveTab().setLoading(true);//loading...
  66. Ext.Ajax.request({
  67. url : basePath + form.deleteUrl,
  68. params: {
  69. id: id
  70. },
  71. method : 'post',
  72. callback : function(options,success,response){
  73. // me.getActiveTab().setLoading(false);
  74. var localJson = new Ext.decode(response.responseText);
  75. if(localJson.exceptionInfo){
  76. showError(localJson.exceptionInfo);return;
  77. }
  78. if(localJson.success){
  79. delSuccess(function(){
  80. parent.window.location.href = parent.window.location.href;
  81. me.FormUtil.onClose();
  82. });//@i18n/i18n.js
  83. } else {
  84. delFailure();
  85. }
  86. }
  87. });
  88. }
  89. });
  90. }
  91. });