Register.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.oa.officialDocument.receiveODManagement.Register', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'oa.officialDocument.receiveODManagement.Register','core.form.Panel','core.form.FileField',
  8. 'core.button.Save','core.button.Close','core.button.Over','core.button.Submit',
  9. 'core.button.Update','core.button.Delete','core.button.Distribute2','core.button.Transmit','core.button.File',
  10. 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger'
  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('rod_id').value);
  33. alert('提交成功');
  34. var main = parent.Ext.getCmp("content-panel");
  35. main.getActiveTab().close();
  36. }
  37. },
  38. 'erpDeleteButton': {
  39. click: function(btn){
  40. me.FormUtil.onDelete(Ext.getCmp('rod_id').value);
  41. }
  42. },
  43. 'erpOverButton': {
  44. click: function(btn){
  45. Ext.getCmp('rod_status').setValue('已结束');
  46. Ext.getCmp('rod_statuscode').setValue('OVERED');
  47. this.FormUtil.onUpdate(this);
  48. alert('提交成功');
  49. var main = parent.Ext.getCmp("content-panel");
  50. main.getActiveTab().close();
  51. }
  52. },
  53. 'htmleditor[id=rod_context]': {
  54. afterrender: function(f){
  55. f.setHeight(400);
  56. },
  57. render: function(f){
  58. var id = getUrlParam('id');
  59. if(id != null){
  60. me.getSODDetail(id);
  61. f.setReadOnly(true);
  62. }
  63. }
  64. }
  65. });
  66. },
  67. getForm: function(btn){
  68. return btn.ownerCt.ownerCt;
  69. },
  70. getSODDetail: function(id){
  71. var me = this;
  72. // parent.Ext.getCmp("content-panel").getActiveTab().setLoading(true);//loading...
  73. Ext.Ajax.request({//拿到grid的columns
  74. url : basePath + "oa/officialDocument/getSODDetail2.action",
  75. params: {
  76. id: id
  77. },
  78. method : 'post',
  79. async: false,
  80. callback : function(options, success, response){
  81. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  82. console.log(response);
  83. var res = new Ext.decode(response.responseText);
  84. if(res.exceptionInfo){
  85. showError(res.exceptionInfo);return;
  86. }
  87. if(!res.sod){
  88. return;
  89. } else {
  90. Ext.getCmp('rod_context').setValue(res.sod.sod_context);
  91. // me.attach = res.sod.sod_attach;
  92. Ext.getCmp('rod_attach').setValue(res.sod.sod_attach);
  93. }
  94. }
  95. });
  96. }
  97. });