GridPanel.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. Ext.define('erp.view.hr.kpi.GridPanel',{
  2. extend: 'Ext.grid.Panel',
  3. alias: 'widget.erpKpiQueryGridPanel',
  4. requires: ['erp.view.core.grid.HeaderFilter', 'erp.view.core.plugin.CopyPasteMenu'],
  5. id: 'querygrid',
  6. emptyText : '无数据',
  7. columnLines : true,
  8. autoScroll : true,
  9. bodyStyle:'background-color:#f1f1f1;',
  10. cls: 'custom-grid',
  11. GridUtil: Ext.create('erp.util.GridUtil'),
  12. BaseUtil: Ext.create('erp.util.BaseUtil'),
  13. RenderUtil: Ext.create('erp.util.RenderUtil'),
  14. store: Ext.create('Ext.data.Store', {
  15. fields:[{
  16. name: 'kdb_title',
  17. type: 'string'
  18. },{
  19. name: 'kd_startkind',
  20. type: 'string'
  21. },{
  22. name: 'kdb_period',
  23. type: 'string'
  24. },{
  25. name: 'kt_beman',
  26. type: 'string'
  27. },{
  28. name: 'kt_score',
  29. type: 'string'
  30. },{
  31. name: 'kt_level',
  32. type: 'string'
  33. },{
  34. name: 'ktd_description',
  35. type: 'string'
  36. },{
  37. name: 'ktd_score_from',
  38. type: 'string'
  39. },{
  40. name: 'ktd_score_to',
  41. type: 'number'
  42. },{
  43. name: 'ktd_score',
  44. type: 'number'
  45. },{
  46. name: 'kt_bemanid',
  47. type: 'number'
  48. },{
  49. name: 'kt_id',
  50. type: 'number'
  51. },{
  52. name: 'kt_kdbid',
  53. type: 'number'
  54. }],
  55. data: []
  56. }),
  57. defaultColumns: [{
  58. dataIndex: 'kdb_title',
  59. cls: 'x-grid-header-1',
  60. sortable: false,
  61. width: 120,
  62. text: '考核模板'
  63. },{
  64. dataIndex: 'kd_startkind',
  65. cls: 'x-grid-header-1',
  66. sortable: false,
  67. text: '考核类型',
  68. width: 120,
  69. filter: {
  70. dataIndex: 'kd_startkind',
  71. displayField: 'display',
  72. queryMode: 'local',
  73. store: {data: [{display: "周考核", value: "week"},
  74. {display: "月度考核", value: "month"},
  75. {display: "季度考核", value: "season"},
  76. {display: "手动考核", value: "manual"}],
  77. fields: ["display", "value"]
  78. },
  79. valueField: "value",
  80. xtype: "combo"
  81. },
  82. xtype: 'combocolumn'
  83. },{
  84. dataIndex: 'kdb_period',
  85. cls: 'x-grid-header-1',
  86. sortable: false,
  87. text: '考核期间',
  88. width: 150
  89. },{
  90. dataIndex: 'kt_beman',
  91. cls: 'x-grid-header-1',
  92. sortable: false,
  93. text: '受评人',
  94. width: 80
  95. },{
  96. dataIndex: 'kt_score',
  97. cls: 'x-grid-header-1',
  98. sortable: false,
  99. text: '总分',
  100. width: 70
  101. },{
  102. dataIndex: 'kt_level',
  103. cls: 'x-grid-header-1',
  104. sortable: false,
  105. text: '等级',
  106. width: 70
  107. },{
  108. dataIndex: 'ktd_description',
  109. cls: 'x-grid-header-1',
  110. sortable: false,
  111. text: '考核项目',
  112. width: 200
  113. },{
  114. dataIndex: 'ktd_score_from',
  115. cls: 'x-grid-header-1',
  116. sortable: false,
  117. text: '最低分',
  118. width: 70,
  119. align: 'right'
  120. },{
  121. dataIndex: 'ktd_score_to',
  122. cls: 'x-grid-header-1',
  123. sortable: false,
  124. text: '最高分',
  125. width: 70,
  126. xtype: 'numbercolumn',
  127. align: 'right'
  128. },{
  129. dataIndex: 'ktd_score',
  130. cls: 'x-grid-header-1',
  131. sortable: false,
  132. text: '得分',
  133. width: 70,
  134. xtype: 'numbercolumn',
  135. align: 'right'
  136. },{
  137. dataIndex: 'kt_bemanid',
  138. cls: 'x-grid-header-1',
  139. sortable: false,
  140. text: '受评人ID',
  141. hidden: true,
  142. width: 0,
  143. xtype: 'numbercolumn',
  144. align: 'right'
  145. },{
  146. dataIndex: 'kt_id',
  147. cls: 'x-grid-header-1',
  148. sortable: false,
  149. text: '考核结果ID',
  150. hidden: true,
  151. width: 120
  152. },{
  153. dataIndex: 'kt_kdbid',
  154. cls: 'x-grid-header-1',
  155. sortable: false,
  156. text: '考核历史id',
  157. hidden: true,
  158. width: 120
  159. }],
  160. constructor: function(cfg) {
  161. if(cfg) {
  162. cfg.plugins = Ext.create('erp.view.core.plugin.CopyPasteMenu');
  163. Ext.apply(this, cfg);
  164. }
  165. this.callParent(arguments);
  166. },
  167. initComponent : function(){
  168. this.columns = this.defaultColumns;
  169. this.GridUtil.add10EmptyItems(this);
  170. this.callParent(arguments);
  171. },
  172. viewConfig: {
  173. getRowClass: function(record,index) {
  174. return record.get('index')%2 == 1 ? (!Ext.isEmpty(record.get('kdb_title')) ? 'custom-first' : 'custom') :
  175. (!Ext.isEmpty(record.get('kdb_title')) ? 'custom-alt-first' : 'custom-alt');
  176. }
  177. }
  178. });