CmDetailGrid.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /**
  2. *
  3. */
  4. Ext.define('erp.view.fa.ars.CmDetailGrid',{
  5. extend: 'Ext.grid.Panel',
  6. alias: 'widget.cmdetailgrid',
  7. layout : 'fit',
  8. id: 'cmdetailgrid',
  9. emptyText : $I18N.common.grid.emptyText,
  10. columnLines : true,
  11. autoScroll : true,
  12. store: Ext.create('Ext.data.Store', {
  13. fields:[{
  14. name: 'tb_code',
  15. type: 'string'
  16. },{
  17. name: 'tb_kind',
  18. type: 'string'
  19. },{
  20. name: 'tb_date',
  21. type: 'string'
  22. },{
  23. name: 'tb_aramount',
  24. type: 'number'
  25. },{
  26. name: 'tb_rbamount',
  27. type: 'number'
  28. },{
  29. name: 'tb_balance',
  30. type: 'number'
  31. },{
  32. name: 'tb_index',
  33. type: 'number'
  34. }],
  35. data: []
  36. }),
  37. defaultColumns: [{
  38. dataIndex: 'tb_date',
  39. cls: 'x-grid-header-1',
  40. text: '日期',
  41. width: 200
  42. },{
  43. dataIndex: 'tb_kind',
  44. cls: 'x-grid-header-1',
  45. text: '单据类型',
  46. width: 120
  47. },{
  48. dataIndex: 'tb_code',
  49. cls: 'x-grid-header-1',
  50. text: '单据编号',
  51. width: 150
  52. },{
  53. dataIndex: 'tb_aramount',
  54. cls: 'x-grid-header-1',
  55. text: '应收金额',
  56. width: 120,
  57. renderer:function(val, meta, record){
  58. if(record.data['tb_index']==1||record.data['tb_index']==3){
  59. if(val==0||val=='0'){
  60. return '';
  61. }else{
  62. return val;
  63. }
  64. }else{
  65. return val;
  66. }
  67. }
  68. },{
  69. dataIndex: 'tb_rbamount',
  70. cls: 'x-grid-header-1',
  71. text: '收款金额',
  72. width: 120,
  73. renderer:function(val, meta, record){
  74. if(record.data['tb_index']==1||record.data['tb_index']==3){
  75. if(val==0||val=='0'){
  76. return '';
  77. }else{
  78. return val;
  79. }
  80. }else{
  81. return val;
  82. }
  83. }
  84. },{
  85. dataIndex: 'tb_balance',
  86. cls: 'x-grid-header-1',
  87. text: '余额',
  88. width: 120/*,
  89. renderer:function(val, meta, record){
  90. console.log(arguments);
  91. if(record.data['tb_index']==2){
  92. if(val==0||val=='0'){
  93. return '';
  94. }else{
  95. return val;
  96. }
  97. }else{
  98. return val;
  99. }
  100. }*/
  101. }],
  102. detailColumns: [],
  103. bodyStyle:'background-color:#f1f1f1;',
  104. GridUtil: Ext.create('erp.util.GridUtil'),
  105. RenderUtil: Ext.create('erp.util.RenderUtil'),
  106. initComponent : function(){
  107. this.columns = this.defaultColumns;
  108. this.callParent(arguments);
  109. },
  110. // renderFun:function(){
  111. // console.log(arguments);
  112. // },
  113. viewConfig: {
  114. getRowClass: function(record) {
  115. return record.get('isCount') ? 'isCount' : null;
  116. }
  117. }
  118. });