DataListPanel.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /*
  2. * @Description: 数据列表
  3. * @Author: hy
  4. * @Date: 2019-08-12 18:33:04
  5. * @LastEditTime: 2019-08-20 08:54:26
  6. */
  7. Ext.define('uas.view.grid.dataList.DataListPanel', {
  8. extend: 'Ext.grid.Panel',
  9. xtype: 'dataListPanel',
  10. dataUrl:'/api/searchPlanTree',
  11. plugins: {
  12. gridHeaderFilter: true
  13. },
  14. selModel: {
  15. type: 'checkboxmodel',
  16. checkOnly: true
  17. },
  18. emptyText: '无数据',
  19. loadMask: true,
  20. bind:'{dataListGridStore}',
  21. initComponent: function () {
  22. var me = this;
  23. Ext.apply(me, {
  24. store: Ext.create('uas.store.DataListGridStore',{
  25. grid: me,
  26. autoLoad: true,
  27. autoDestroy: true
  28. })
  29. });
  30. //加载筛选方案
  31. me.callParent(arguments);
  32. me.getSearchPlan();
  33. },
  34. dockedItems: [{
  35. name:'operateToolbar',
  36. cls:'x-grid-operateToolbar',
  37. xtype: 'toolbar',
  38. dock: 'top',
  39. height:32,
  40. items:[{
  41. xtype:'button',
  42. text:'筛选',
  43. handler:function(me){
  44. const grid = me.up('dataListPanel');
  45. if(!grid.searchPlanWindow){
  46. grid.searchPlanWindow = Ext.create('widget.searchPlanWindow',{
  47. height:grid.getHeight()*0.8,
  48. width:grid.getWidth()*0.8,
  49. renderTo:grid.getEl(),
  50. grid:grid
  51. }).show();
  52. }else{
  53. grid.searchPlanWindow.show();
  54. }
  55. }
  56. },{
  57. margin:'0 0 0 6',
  58. xtype:'button',
  59. text:'批处理'
  60. },{
  61. margin:'0 0 0 6',
  62. xtype:'button',
  63. text:'上一页'
  64. },{
  65. margin:'0 0 0 6',
  66. xtype:'button',
  67. text:'下一页'
  68. },{
  69. margin:'0 0 0 6',
  70. xtype:'button',
  71. text:'导出'
  72. },{
  73. margin:'0 0 0 6',
  74. xtype:'button',
  75. text:'个性设置'
  76. },{
  77. margin:'0 0 0 12',
  78. xtype:'button',
  79. text:'关闭'
  80. }]
  81. },{
  82. xtype: 'toolbar',
  83. dock: 'top',
  84. name:'searchPlan',
  85. cls:'x-grid-searchPlan',
  86. height:32,
  87. items:[{
  88. xtype:'displayfield',
  89. value:'查询方案:'
  90. }]
  91. },{
  92. xtype: 'toolbar',
  93. dock: 'top',
  94. name:'filterToolbar',
  95. cls:'x-grid-filterToolbar',
  96. height:32,
  97. items:[{
  98. xtype:'displayfield',
  99. value:'筛选条件:'
  100. },'->']
  101. },{
  102. xtype: 'dataListPaging'
  103. }],
  104. columns: [{
  105. dataIndex: 'id',
  106. text: '序号',
  107. width:60,
  108. locked: true
  109. }, {
  110. dataIndex: 'code',
  111. text: '采购单号',
  112. width:240,
  113. locked: true,
  114. filter: {
  115. type:'string'
  116. }
  117. }, {
  118. dataIndex: 'status',
  119. text: '单据状态',
  120. width:100,
  121. filter: {
  122. type:'string'
  123. }
  124. }, {
  125. xtype: 'datecolumn',
  126. dataIndex: 'date',
  127. text: '下单日期',
  128. width: 200,
  129. filter: {
  130. type:'date'
  131. }
  132. }, {
  133. dataIndex: 'vendor',
  134. text: '供应商名',
  135. width: 220,
  136. filter: {
  137. type:'string'
  138. }
  139. }, {
  140. dataIndex: 'price',
  141. text: '含税金额',
  142. width:190,
  143. filter: {
  144. type:'number'
  145. }
  146. },{
  147. dataIndex: 'special',
  148. text:'特殊采购',
  149. width:120,
  150. filter: {
  151. type:'combo',
  152. combo:[
  153. ["true", "是"],
  154. ["false", "否"]
  155. ]
  156. }
  157. },{
  158. dataIndex: 'currency',
  159. text: '币别',
  160. width:70
  161. },{
  162. dataIndex: 'recordman',
  163. text: '采购员',
  164. width:70
  165. },{
  166. dataIndex: 'auditman',
  167. text: '审核人',
  168. width:70
  169. }],
  170. getSearchPlan:function(){
  171. const me = this;
  172. Ext.Ajax.request({
  173. url: me.dataUrl,
  174. params: '',
  175. method: 'GET',
  176. async:false,
  177. success: function(response, opts) {
  178. var _data = Ext.decode(response.responseText);
  179. if(_data&&_data.data){
  180. const searchPlan = me.down('[name=searchPlan]');
  181. let items = [];
  182. Ext.Array.each(_data.data,function(p){
  183. if(p.children&&p.children.length>0){
  184. Ext.Array.each(p.children,function(item){
  185. items.push({
  186. text:item.text,
  187. xtype:'button'
  188. })
  189. })
  190. }
  191. });
  192. searchPlan.add(items);
  193. }
  194. },
  195. failure: function(response, opts) {}
  196. });
  197. }
  198. });