DataListPanel.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. cls:'x-btn-blue',
  42. xtype:'button',
  43. text:'筛选',
  44. handler:function(me){
  45. const grid = me.up('dataListPanel');
  46. if(!grid.searchPlanWindow){
  47. grid.searchPlanWindow = Ext.create('widget.searchPlanWindow',{
  48. height:grid.getHeight()*0.8,
  49. width:grid.getWidth()*0.8,
  50. renderTo:grid.getEl(),
  51. grid:grid
  52. }).show();
  53. }else{
  54. grid.searchPlanWindow.show();
  55. }
  56. }
  57. },{
  58. margin:'0 0 0 6',
  59. xtype:'button',
  60. text:'批处理'
  61. },{
  62. margin:'0 0 0 6',
  63. xtype:'button',
  64. text:'上一页'
  65. },{
  66. margin:'0 0 0 6',
  67. xtype:'button',
  68. text:'下一页'
  69. },{
  70. margin:'0 0 0 6',
  71. xtype:'button',
  72. text:'导出'
  73. },{
  74. margin:'0 0 0 6',
  75. xtype:'button',
  76. text:'个性设置'
  77. },{
  78. margin:'0 0 0 12',
  79. xtype:'button',
  80. text:'关闭'
  81. }]
  82. },{
  83. xtype: 'toolbar',
  84. dock: 'top',
  85. name:'searchPlan',
  86. cls:'x-grid-searchPlan',
  87. height:32,
  88. items:[{
  89. xtype:'displayfield',
  90. value:'查询方案:'
  91. }]
  92. },{
  93. xtype: 'toolbar',
  94. dock: 'top',
  95. name:'filterToolbar',
  96. cls:'x-grid-filterToolbar',
  97. height:32,
  98. items:[{
  99. xtype:'displayfield',
  100. value:'筛选条件:'
  101. },'->']
  102. },{
  103. xtype: 'dataListPaging'
  104. }],
  105. columns: [{
  106. dataIndex: 'id',
  107. text: '序号',
  108. width:60,
  109. align:'center',
  110. locked: true
  111. }, {
  112. dataIndex: 'code',
  113. text: '采购单号',
  114. width:240,
  115. locked: true,
  116. filter: {
  117. type:'string'
  118. }
  119. }, {
  120. dataIndex: 'status',
  121. text: '单据状态',
  122. width:100,
  123. filter: {
  124. type:'string'
  125. }
  126. }, {
  127. xtype: 'datecolumn',
  128. dataIndex: 'date',
  129. text: '下单日期',
  130. width: 200,
  131. filter: {
  132. type:'date'
  133. }
  134. }, {
  135. dataIndex: 'vendor',
  136. text: '供应商名',
  137. width: 220,
  138. filter: {
  139. type:'string'
  140. }
  141. }, {
  142. dataIndex: 'price',
  143. text: '含税金额',
  144. width:190,
  145. filter: {
  146. type:'number'
  147. }
  148. },{
  149. dataIndex: 'special',
  150. text:'特殊采购',
  151. width:120,
  152. filter: {
  153. type:'combo',
  154. combo:[
  155. ["true", "是"],
  156. ["false", "否"]
  157. ]
  158. }
  159. },{
  160. dataIndex: 'currency',
  161. text: '币别',
  162. width:70
  163. },{
  164. dataIndex: 'recordman',
  165. text: '采购员',
  166. width:70
  167. },{
  168. dataIndex: 'auditman',
  169. text: '审核人',
  170. width:70
  171. }],
  172. getSearchPlan:function(){
  173. const me = this;
  174. Ext.Ajax.request({
  175. url: me.dataUrl,
  176. params: '',
  177. method: 'GET',
  178. async:false,
  179. success: function(response, opts) {
  180. var _data = Ext.decode(response.responseText);
  181. if(_data&&_data.data){
  182. const searchPlan = me.down('[name=searchPlan]');
  183. let items = [];
  184. Ext.Array.each(_data.data,function(p){
  185. if(p.children&&p.children.length>0){
  186. Ext.Array.each(p.children,function(item){
  187. items.push({
  188. text:item.text,
  189. xtype:'button'
  190. })
  191. })
  192. }
  193. });
  194. searchPlan.add(items);
  195. }
  196. },
  197. failure: function(response, opts) {}
  198. });
  199. }
  200. });