VastCancelSubs.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * 我申请的订阅批量取消
  3. */
  4. Ext.define('erp.view.core.button.VastCancelSubs',{
  5. extend: 'Ext.Button',
  6. alias: 'widget.erpVastCancelSubsApplyButton',
  7. iconCls: 'x-button-icon-submit',
  8. cls: 'x-btn-gray',
  9. id: 'erpVastCancelSubsApplyButton',
  10. text: $I18N.common.button.erpVastCancelSubsApplyButton,
  11. style: {
  12. marginLeft: '10px'
  13. },
  14. width: 120,
  15. initComponent : function(){
  16. this.callParent(arguments);
  17. },
  18. handler:function(url){
  19. var grid = Ext.getCmp('batchDealGridPanel');
  20. var items = grid.selModel.getSelection();
  21. Ext.each(items, function(item, index){
  22. if(this.data['isapplied_']==-1){
  23. var bool = true;
  24. Ext.each(grid.multiselected, function(){
  25. if(this.data['num_id'] == item.data['num_id'] && this.data['emp_id'] == item.data['emp_id']){
  26. bool = false;
  27. }
  28. });
  29. if(bool){
  30. grid.multiselected.push(item);
  31. }
  32. }
  33. });
  34. var records = grid.multiselected;
  35. if(records.length > 0){
  36. var data = new Array();
  37. Ext.each(records, function(record, index){
  38. data.push('('+record.data['emp_id']+','+record.data['num_id']+')');
  39. });
  40. grid.setLoading(true);
  41. Ext.Ajax.request({
  42. url : basePath + 'common/charts/vastCancelSubsApply.action',
  43. params: {
  44. datas: data.join(","),
  45. caller:caller
  46. },
  47. method : 'post',
  48. callback : function(options,success,response){
  49. grid.setLoading(false);
  50. var localJson = new Ext.decode(response.responseText);
  51. if(localJson.exceptionInfo){
  52. showError(localJson.exceptionInfo);
  53. } else {
  54. if(localJson.success){
  55. grid.multiselected = new Array();
  56. Ext.getCmp('dealform').onQuery(true);
  57. }
  58. }
  59. }
  60. });
  61. } else {
  62. showError("请勾选已申请的订阅!");
  63. }
  64. }
  65. });