QueryPanel_application.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. Ext.define('saas.view.make.bomComposite.QueryPanel_application', {
  2. extend: 'Ext.grid.Panel',
  3. xtype: 'make-bomcomposite-querypanel-application',
  4. plugins: [
  5. 'gridexporter',
  6. ],
  7. initComponent: function () {
  8. var me = this;
  9. Ext.apply(me, {
  10. queryUrl: '/api/make/bomComposite/applicationList/',
  11. columns: [{
  12. text: '请购单号',
  13. dataIndex: 'ap_code',
  14. width: 150,
  15. listeners: {
  16. click: function(tableView, td, rowIdx, colIdx, e, model, tr) {
  17. var data = model.data;
  18. saas.util.BaseUtil.openTab('purchase-application-formpanel', '请购单' + "(" + data.ap_code + ")", data.apid, {
  19. initId: data.apid
  20. });
  21. }
  22. },
  23. renderer:function(v){
  24. return '<span style="color:#3E80F6;cursor:pointer;">'+ v +'</span>';
  25. }
  26. }, {
  27. text: '序号',
  28. dataIndex: 'ad_detno',
  29. xtype: 'numbercolumn',
  30. align: 'center',
  31. width: 80,
  32. renderer: function (v, m, r) {
  33. return saas.util.BaseUtil.numberFormat(v, 0, false);
  34. },
  35. }, {
  36. text: '请购数量',
  37. dataIndex: 'ad_qty',
  38. xtype: 'numbercolumn',
  39. width: 80,
  40. renderer: function (v, m, r) {
  41. return saas.util.BaseUtil.numberFormat(v, 6, true);
  42. }
  43. }, {
  44. text: '已转采购数',
  45. dataIndex: 'ad_yqty',
  46. xtype: 'numbercolumn',
  47. width: 100,
  48. renderer: function (v, m, r) {
  49. return saas.util.BaseUtil.numberFormat(v, 6, true);
  50. }
  51. }, {
  52. xtype:'datecolumn',
  53. text: '需求日期',
  54. dataIndex: 'ad_delivery',
  55. width: 120,
  56. }, {
  57. text: '单据状态',
  58. dataIndex: 'ap_status',
  59. width: 120,
  60. }],
  61. tbar: [{
  62. xtype: 'radiogroup',
  63. name: 'redio_application',
  64. width: 300,
  65. simpleValue: true,
  66. items: [
  67. { boxLabel: '所有请购', inputValue: 'ALL' },
  68. { boxLabel: '未转采购单', inputValue: 'NONE', checked: true }
  69. ],
  70. listeners: {
  71. change: function (r, newValue) {
  72. var grid = r.ownerCt.ownerCt,
  73. store = grid.store;
  74. if (newValue == 'NONE') {
  75. store.addFilter({
  76. filterFn: function (rec) {
  77. return rec.get('thisqty') > 0 && rec.get('ap_status') =='已审核' && rec.get('ad_status')!='已关闭';
  78. },
  79. anyMatch: true,
  80. caseSensitive: false
  81. });
  82. } else {
  83. store.clearFilter();
  84. }
  85. }
  86. }
  87. }],
  88. store: {
  89. filters: [{
  90. filterFn: function (rec) {
  91. return rec.get('thisqty') > 0 && rec.get('ap_status') =='已审核' && rec.get('ad_status')!='已关闭';
  92. },
  93. anyMatch: true,
  94. caseSensitive: false
  95. }],
  96. proxy: {
  97. type: 'ajax',
  98. url: me.queryUrl,
  99. timeout: 8000,
  100. actionMethods: {
  101. read: 'GET'
  102. },
  103. reader: {
  104. type: 'json',
  105. rootProperty: 'data',
  106. totalProperty: '',
  107. },
  108. listeners: {
  109. exception: function (proxy, response, operation, eOpts) {
  110. if (operation.success) {
  111. if (response.timedout) {
  112. saas.util.BaseUtil.showErrorToast('请求超时');
  113. }
  114. } else {
  115. if (response.timedout) {
  116. saas.util.BaseUtil.showErrorToast('请求超时');
  117. } else {
  118. console.error('exception: ', response);
  119. var message = response.responseJson ? (response.responseJson.message == null ? '没有数据' : response.responseJson.message) : '请求超时';
  120. saas.util.BaseUtil.showErrorToast('查询失败:' + message);
  121. }
  122. }
  123. }
  124. }
  125. },
  126. listeners: {
  127. beforeload: function (store, op) {
  128. var prCode = me.ownerCt.ownerCt.down('productDbfindTrigger').getRawValue();
  129. if (prCode) {
  130. store.getProxy().url = me.queryUrl + prCode;
  131. } else {
  132. return false;
  133. }
  134. }
  135. }
  136. }
  137. });
  138. me.callParent(arguments);
  139. },
  140. });