SearchFormController.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. Ext.define('make.view.make.bomComposite.SearchFormController', {
  2. extend: 'Ext.app.ViewController',
  3. alias: 'controller.make-query-searchform',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. 'dbfindtrigger[name=pr_code]':{
  8. beforerender:function(f){
  9. Ext.apply(f,{
  10. //放大镜赋值设置
  11. dbfinds:[{
  12. from:'pr_code',to:'pr_code'
  13. },{
  14. from:'pr_detail',to:'pr_detail'
  15. },{
  16. from:'pr_spec',to:'pr_spec'
  17. },{
  18. from: 'pr_brand', to: 'pr_brand'
  19. },{
  20. from: 'pr_orispeccode', to: 'pr_orispeccode'
  21. },{
  22. from: 'pr_unit', to: 'pr_unit'
  23. }],
  24. aftertrigger: function (f) {
  25. me.onQuery(1);
  26. },
  27. });
  28. }
  29. }
  30. });
  31. },
  32. onQuery:function(a){
  33. var me = this,
  34. sform = this.getView(),
  35. integrateTab = sform.ownerCt.down('[xtype="make-bomcomposite-integratePanel"]'),
  36. prTrigger = sform.down('[xtype="productDbfindTrigger"]');
  37. if(!prTrigger.getRawValue()){
  38. if(a!=1){
  39.   saas.util.BaseUtil.showErrorToast('请先选择物料');
  40. }
  41. return false
  42. }
  43. saas.util.BaseUtil.request({
  44. url: '/api/make/bomComposite/searchMainData/'+prTrigger.getRawValue(),
  45. method: 'GET',
  46. })
  47. .then(function(localJson) {
  48. if(localJson.success){
  49. var mainData = localJson.data;
  50. //Ext.decode(localJson.data);
  51. // mainData = {
  52. // noShipment : '100.8',
  53. // purchase : '10000.1',
  54. // noPicking : '500.23',
  55. // greattotal : '6000.23',
  56. // badtotal : '70000.23',
  57. // noComplete : '700.23',
  58. // safeInventory : '80.23',
  59. // safeForecastUnClash : '100'
  60. // };
  61. me.getViewModel().setData(mainData);
  62. integrateTab.getLayout().activeItem.getStore().reload();
  63. }
  64. })
  65. .catch(function(e) {
  66. saas.util.BaseUtil.showErrorToast('查询失败: ' + e.message);
  67. });
  68. }
  69. });