QueryPanel_stockdetail.js 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. Ext.define('saas.view.make.bomComposite.QueryPanel_stockdetail', {
  2. extend: 'Ext.grid.Panel',
  3. xtype: 'make-bomcomposite-querypanel-stockdetail',
  4. plugins: [
  5. 'gridexporter',
  6. ],
  7. initComponent: function () {
  8. var me = this;
  9. Ext.apply(me, {
  10. queryUrl: '/api/make/bomComposite/stockDetailList/',
  11. columns: [{
  12. text: '仓库编号',
  13. dataIndex: 'pw_whcode',
  14. width: 150
  15. }, {
  16. text: '仓库名称',
  17. dataIndex: 'wh_description',
  18. width: 200
  19. }, {
  20. text: '仓库类型',
  21. dataIndex: 'wh_type',
  22. width: 150
  23. }, {
  24. text: '库存数量',
  25. dataIndex: 'pw_onhand',
  26. xtype: 'numbercolumn',
  27. renderer: function (v, m, r) {
  28. return saas.util.BaseUtil.numberFormat(v, 6, true);
  29. }
  30. }],
  31. store: {
  32. proxy: {
  33. type: 'ajax',
  34. url: me.queryUrl,
  35. timeout: 8000,
  36. autoLoad: false,
  37. actionMethods: {
  38. read: 'GET'
  39. },
  40. reader: {
  41. type: 'json',
  42. rootProperty: 'data',
  43. totalProperty: '',
  44. },
  45. listeners: {
  46. exception: function (proxy, response, operation, eOpts) {
  47. if (operation.success) {
  48. if (response.timedout) {
  49. saas.util.BaseUtil.showErrorToast('请求超时');
  50. }
  51. } else {
  52. if (response.timedout) {
  53. saas.util.BaseUtil.showErrorToast('请求超时');
  54. } else {
  55. console.error('exception: ', response);
  56. var message = response.responseJson ? (response.responseJson.message == null ? '没有数据' : response.responseJson.message) : '请求超时';
  57. saas.util.BaseUtil.showErrorToast('查询失败:' + message);
  58. }
  59. }
  60. }
  61. }
  62. },
  63. listeners: {
  64. beforeload: function (store, op) {
  65. var prCode = me.ownerCt.ownerCt.down('productDbfindTrigger').getRawValue();
  66. if (prCode) {
  67. store.getProxy().url = me.queryUrl + prCode;
  68. } else {
  69. return false;
  70. }
  71. },
  72. load: function (store, records, successful, operation, eOpts) {
  73. }
  74. }
  75. }
  76. });
  77. me.callParent(arguments);
  78. },
  79. });