JProcessDeploy.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.common.JProcessDeploy', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'core.form.Panel','common.JProcessDeploy.Viewport','core.grid.Panel','core.button.Add','core.button.Submit','core.button.Audit',
  8. 'core.button.Save','core.button.Close','core.button.Print','core.button.Upload','core.button.Update','core.button.Delete',
  9. 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger','common.JProcessDeploy.JprocessSysViewport'
  10. ],
  11. init:function(){
  12. var me = this;
  13. /*formCondition = this.BaseUtil.getUrlParam('formCondition');
  14. */
  15. this.control({
  16. 'erpSaveButton': {
  17. click: function(btn){
  18. this.saveEmployee(btn);
  19. }
  20. },
  21. 'erpUpdateButton': {
  22. click: function(btn){
  23. me.FormUtil.onUpdate(me.getForm(btn), 'hr/employee/update.action', []); // 后台未写……
  24. }
  25. },
  26. 'erpDeleteButton': {
  27. click: function(btn){
  28. var params = {
  29. //pr_id: Number(Ext.getCmp('pr_id').value)
  30. };
  31. me.FormUtil.onUpdate('hr/employee/delete.action', params); // 后台未写……
  32. }
  33. },
  34. 'erpAddButton': {
  35. click: function(btn){
  36. me.FormUtil.onAdd('addEmployee', '新增员工', 'jsps/hr/employee/employee.jsp');
  37. }
  38. },
  39. 'erpCloseButton': {
  40. click: function(btn){
  41. var s = me.FormUtil.checkFormDirty(me.getForm(btn));
  42. if(s == ''){
  43. me.FormUtil.onClose();
  44. } else {
  45. if(!formCondition){//单据新增界面哦
  46. //关闭前保存新增的数据
  47. Ext.MessageBox.show({//关闭前保存修改的数据
  48. title:'保存新添加的数据?',
  49. msg: '详细:<br/>' + s + '<br/>离开前要保存吗?',
  50. buttons: Ext.Msg.YESNOCANCEL,
  51. icon: Ext.Msg.WARNING,
  52. fn: function(btn){
  53. if(btn == 'yes'){
  54. me.saveProduct(btn);
  55. } else if(btn == 'no'){
  56. me.FormUtil.onClose();
  57. } else {
  58. return;
  59. }
  60. }
  61. });
  62. } else {//单据查看界面哦
  63. Ext.MessageBox.show({
  64. title:'保存修改?',
  65. msg: '该单据已被修改:<br/>' + s + '<br/>离开前要保存吗?',
  66. buttons: Ext.Msg.YESNOCANCEL,
  67. icon: Ext.Msg.WARNING,
  68. fn: function(btn){
  69. if(btn == 'yes'){
  70. me.FormUtil.onUpdate(me.getForm(btn), 'scm/product/update.action', []);
  71. } else if(btn == 'no'){
  72. me.FormUtil.onClose();
  73. } else {
  74. return;
  75. }
  76. }
  77. });
  78. }
  79. }
  80. }
  81. }
  82. });
  83. },
  84. getForm: function(btn){
  85. return btn.ownerCt.ownerCt;
  86. },
  87. saveEmployee: function(btn){
  88. var me = this;
  89. if(Ext.getCmp('em_code').value == null || Ext.getCmp('em_code').value == ''){
  90. Ext.getCmp('em_code').setValue(me.BaseUtil.getRandomNumber(em_uu));
  91. }
  92. me.FormUtil.onSave(me.getForm(btn), 'hr/employee/save.action', []);
  93. }
  94. });