ConfirmVendor.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. Ext.define('erp.view.core.button.ConfirmVendor',{
  2. extend: 'Ext.Button',
  3. alias: 'widget.erpConfirmVendorButton',
  4. param: [],
  5. id:'confirmvendorbutton',
  6. text: $I18N.common.button.erpConfirmVendorButton,
  7. iconCls: 'x-button-icon-save',
  8. cls: 'x-btn-gray',
  9. width: 120,
  10. style: {
  11. marginLeft: '10px'
  12. },
  13. handler: function(){
  14. var grid = Ext.getCmp('batchDealGridPanel');
  15. var items = grid.selModel.getSelection();
  16. Ext.each(items, function(item, index){
  17. if(this.data[grid.keyField] != null && this.data[grid.keyField] != ''
  18. && this.data[grid.keyField] != '0' && this.data[grid.keyField] != 0){
  19. var bool = true;
  20. Ext.each(grid.multiselected, function(){
  21. if(this.data[grid.keyField] == item.data[grid.keyField]){
  22. bool = false;
  23. }
  24. });
  25. if(bool){
  26. grid.multiselected.push(item);
  27. }
  28. }
  29. });
  30. var records = grid.multiselected;
  31. if(records.length > 0){
  32. if(records.length > 500) {
  33. showMessage('提示', '勾选行数必须小于500条!');
  34. return;
  35. }
  36. var id = new Array();
  37. Ext.each(records, function(record, index){
  38. id.push(record.data['pfd_id']);
  39. });
  40. grid.setLoading(true);
  41. Ext.Ajax.request({
  42. url : basePath + 'scm/purchaseforecast/confirmVendor.action',
  43. params: {
  44. id: id
  45. },
  46. method : 'post',
  47. callback : function(options,success,response){
  48. grid.setLoading(false);
  49. var localJson = new Ext.decode(response.responseText);
  50. if(localJson.exceptionInfo){
  51. showError(localJson.exceptionInfo);
  52. } else {
  53. if(localJson.success){
  54. grid.multiselected = new Array();
  55. Ext.getCmp('dealform').onQuery(true);
  56. }
  57. }
  58. }
  59. });
  60. }
  61. },
  62. initComponent : function(){
  63. this.callParent(arguments);
  64. }
  65. });