Draft.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.oa.officialDocument.sendODManagement.Draft', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'oa.officialDocument.sendODManagement.Draft','core.form.Panel','core.form.WordSizeField','core.form.FileField',
  8. 'core.button.Add','core.button.Save','core.button.Close','core.button.File','core.button.Transmit',
  9. 'core.button.Update','core.button.Delete','core.button.Submit','core.button.Over',
  10. 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger','core.trigger.MultiDbfindTrigger'
  11. ],
  12. init:function(){
  13. var me = this;
  14. this.control({
  15. 'erpSaveButton': {
  16. click: function(btn){
  17. this.FormUtil.beforeSave(this);
  18. }
  19. },
  20. 'erpCloseButton': {
  21. click: function(btn){
  22. this.FormUtil.onClose(this);
  23. }
  24. },
  25. 'erpUpdateButton': {
  26. click: function(btn){
  27. this.FormUtil.onUpdate(this);
  28. }
  29. },
  30. 'erpSubmitButton': {
  31. click: function(btn){
  32. this.FormUtil.onSubmit(Ext.getCmp('sod_id').value);
  33. alert('提交成功');
  34. var main = parent.Ext.getCmp("content-panel");
  35. main.getActiveTab().close();
  36. }
  37. },
  38. 'erpOverButton': {
  39. click: function(btn){
  40. Ext.getCmp('sod_status').setValue('已结束');
  41. Ext.getCmp('sod_statuscode').setValue('OVERED');
  42. this.FormUtil.onUpdate(this);
  43. alert('提交成功');
  44. var main = parent.Ext.getCmp("content-panel");
  45. main.getActiveTab().close();
  46. }
  47. },
  48. 'erpDeleteButton': {
  49. click: function(btn){
  50. me.FormUtil.onDelete(Ext.getCmp('sod_id').value);
  51. }
  52. },
  53. 'textfield[id=sod_cs_organ]': {
  54. render: function(field){
  55. Ext.Ajax.request({//拿到grid的columns
  56. url : basePath + "hr/employee/getHrOrg.action",
  57. params: {
  58. em_id: em_uu
  59. },
  60. method : 'post',
  61. async: false,
  62. callback : function(options, success, response){
  63. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  64. var res = new Ext.decode(response.responseText);
  65. if(res.exceptionInfo){
  66. showError(res.exceptionInfo);return;
  67. }
  68. if(res.hrOrg){
  69. field.setValue(res.hrOrg.or_name);
  70. field.setReadOnly(true);
  71. }
  72. }
  73. });
  74. }
  75. },
  76. 'htmleditor[id=sod_context]': {
  77. afterrender: function(f){
  78. f.setHeight(400);
  79. },
  80. render: function(f){
  81. var id = getUrlParam('id');
  82. if(id != null){
  83. me.getRODDetail(id);
  84. f.setReadOnly(true);
  85. }
  86. }
  87. }
  88. });
  89. },
  90. getForm: function(btn){
  91. return btn.ownerCt.ownerCt;
  92. },
  93. getRODDetail: function(id){
  94. Ext.Ajax.request({//拿到grid的columns
  95. url : basePath + "oa/officialDocument/getRODDetail2.action",
  96. params: {
  97. id: id
  98. },
  99. method : 'post',
  100. async: false,
  101. callback : function(options, success, response){
  102. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  103. console.log(response);
  104. var res = new Ext.decode(response.responseText);
  105. if(res.exceptionInfo){
  106. showError(res.exceptionInfo);return;
  107. }
  108. if(!res.rod){
  109. return;
  110. } else {
  111. Ext.getCmp('sod_context').setValue(res.rod.rod_context);
  112. Ext.getCmp('sod_attach').setValue(res.rod.rod_attach);
  113. }
  114. }
  115. });
  116. }
  117. });