GetVendor.js 1.9 KB

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