PagingDetail.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.oa.info.PagingDetail', {
  3. extend: 'Ext.app.Controller',
  4. BaseUtil: Ext.create('erp.util.BaseUtil'),
  5. FormUtil: Ext.create('erp.util.FormUtil'),
  6. views:[
  7. 'oa.info.PagingDetail','oa.info.PagingDetailForm','core.form.FileField'
  8. ],
  9. init:function(){
  10. var me = this;
  11. this.control({
  12. 'button[id=close]': {
  13. click: function(){
  14. me.FormUtil.onClose();
  15. }
  16. },
  17. 'button[id=post]': {
  18. click: function(){
  19. var form = Ext.getCmp('form');
  20. var v = Ext.getCmp('pr_context_r').value;
  21. if(v != null && v.toString().trim() != ''){
  22. var o = new Object();
  23. o.pr_context = v;
  24. o.pr_releaser = form.down('#prd_recipient').value;
  25. o.pr_releaserid = form.down('#prd_recipientid').value;
  26. o.prd_recipient = form.down('#pr_releaser').value;
  27. o.prd_recipientid = form.down('#pr_releaserid').value;
  28. me.FormUtil.save(o, []);
  29. }
  30. }
  31. },
  32. 'button[id=draft]': {
  33. click: function(btn){
  34. if(Ext.getCmp('prd_status').value != 0){//修改状态为保留
  35. me.updateStatus(Ext.getCmp('prd_id').value, 0);
  36. }
  37. }
  38. },
  39. 'field[name=prd_status]': {
  40. change: function(f){
  41. if(f.value == -1){//修改状态为已阅
  42. me.updateStatus(Ext.getCmp('prd_id').value, 1);
  43. }
  44. }
  45. },
  46. 'button[id=delete]': {
  47. click: function(btn){
  48. me.FormUtil.onDelete(Ext.getCmp('prd_id').value);
  49. }
  50. }
  51. });
  52. },
  53. /**
  54. * @param id 明细ID
  55. * @param status 待修改状态
  56. */
  57. updateStatus: function(id, status){
  58. Ext.Ajax.request({
  59. url : basePath + 'oa/info/updateStatus.action',
  60. params: {
  61. id: id,
  62. status: status
  63. },
  64. method : 'post',
  65. callback : function(options,success,response){
  66. var localJson = new Ext.decode(response.responseText);
  67. if(localJson.exceptionInfo){
  68. showError(localJson.exceptionInfo);return null;
  69. }
  70. }
  71. });
  72. }
  73. });