CallBack.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * 商机收回
  3. */
  4. Ext.define('erp.view.core.button.CallBack',{
  5. extend: 'Ext.Button',
  6. alias: 'widget.erpCallBackButton',
  7. iconCls: 'x-button-icon-check',
  8. cls: 'x-btn-gray',
  9. id: 'callbackbtn',
  10. text: $I18N.common.button.erpCallBackButton,
  11. style: {
  12. marginLeft: '10px'
  13. },
  14. width: 100,
  15. initComponent : function(){
  16. this.callParent(arguments);
  17. },
  18. handler: function(){
  19. var grid = Ext.getCmp('batchDealGridPanel');
  20. var items = grid.selModel.getSelection();
  21. Ext.each(items, function(item, index){
  22. if(this.data[grid.keyField] != null && this.data[grid.keyField] != ''
  23. && this.data[grid.keyField] != '0' && this.data[grid.keyField] != 0){
  24. var bool = true;
  25. Ext.each(grid.multiselected, function(){
  26. if(this.data[grid.keyField] == item.data[grid.keyField]){
  27. bool = false;
  28. }
  29. });
  30. if(bool){
  31. grid.multiselected.push(item);
  32. }
  33. }
  34. });
  35. var records = grid.multiselected;
  36. if(records.length > 0){
  37. var id = new Array();
  38. Ext.each(records, function(record, index){
  39. id.push(record.data['bc_id']);
  40. });
  41. grid.setLoading(true);
  42. Ext.Ajax.request({
  43. url : basePath + 'crm/chance/callBack.action',
  44. params: {
  45. ids: id.join(","),
  46. caller:caller
  47. },
  48. method : 'post',
  49. callback : function(options,success,response){
  50. grid.setLoading(false);
  51. var localJson = new Ext.decode(response.responseText);
  52. if(localJson.exceptionInfo){
  53. showError(localJson.exceptionInfo);
  54. } else {
  55. if(localJson.success){
  56. grid.multiselected = new Array();
  57. Ext.getCmp('dealform').onQuery(true);
  58. }
  59. }
  60. }
  61. });
  62. } else {
  63. showError("请勾选需要的明细!");
  64. }
  65. }
  66. });