CustomerDistr.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.crm.chance.CustomerDistr', {
  3. extend : 'Ext.app.Controller',
  4. FormUtil : Ext.create('erp.util.FormUtil'),
  5. GridUtil : Ext.create('erp.util.GridUtil'),
  6. BaseUtil : Ext.create('erp.util.BaseUtil'),
  7. views : [ 'crm.chance.CustomerDistr', 'core.form.Panel',
  8. 'core.grid.Panel2', 'core.toolbar.Toolbar', 'core.grid.YnColumn',
  9. 'core.button.Add','core.button.Sync',
  10. 'core.button.Save', 'core.button.Close',
  11. 'core.button.Upload', 'core.button.Update',
  12. 'core.button.Delete',
  13. 'core.trigger.DbfindTrigger',
  14. 'core.form.YnField', 'core.button.DeleteDetail',
  15. 'core.button.Upload', 'core.form.FileField',
  16. 'core.trigger.MultiDbfindTrigger' ],
  17. init : function() {
  18. var me = this;
  19. this.control({
  20. 'erpGridPanel2' : {
  21. itemclick : this.onGridItemClick
  22. },
  23. 'erpSaveButton' : {
  24. click : function(btn) {
  25. me.GridUtil.onSave(Ext.getCmp('grid'));
  26. }
  27. },
  28. 'field[name=cu_id]' : {
  29. change : function(f) {
  30. if (f.value != null && f.value != '') {
  31. window.location.href = window.location.href
  32. .toString().split('?')[0]
  33. + '?formCondition=cu_id='
  34. + f.value
  35. + '&gridCondition=cd_cuid=' + f.value;
  36. } else {
  37. Ext.getCmp('deletebutton').hide();
  38. Ext.getCmp('updatebutton').hide();
  39. }
  40. }
  41. },
  42. 'erpAddButton' : {
  43. click : function(btn) {
  44. me.FormUtil.onAdd('addAsign', '新增客户分配',
  45. 'jsps/crm/chance/customerDistr.jsp');
  46. }
  47. },
  48. 'erpCloseButton' : {
  49. click : function(btn) {
  50. me.FormUtil.beforeClose(me);
  51. }
  52. },
  53. 'erpUpdateButton' : {
  54. afterrender : function(btn) {
  55. if (Ext.getCmp('cu_id').value != null
  56. && Ext.getCmp('cu_id').value != '') {
  57. btn.show();
  58. } else {
  59. btn.hide();
  60. }
  61. },
  62. click : function(btn) {
  63. this.FormUtil.onUpdate(this);
  64. }
  65. },
  66. 'erpDeleteButton' : {
  67. afterrender : function(btn) {
  68. if (Ext.getCmp('cu_id').value != null
  69. && Ext.getCmp('cu_id').value != '') {
  70. btn.show();
  71. } else {
  72. btn.hide();
  73. }
  74. },
  75. click : function(btn) {
  76. me.FormUtil.onDelete(Ext.getCmp('cu_id').value);
  77. }
  78. }
  79. });
  80. },
  81. onGridItemClick : function(selModel, record) {//grid行选择
  82. this.GridUtil.onGridItemClick(selModel, record);
  83. },
  84. getForm : function(btn) {
  85. return btn.ownerCt.ownerCt;
  86. }
  87. });