/* * @Description: 数据列表 * @Author: hy * @Date: 2019-08-12 18:33:04 * @LastEditTime: 2019-08-20 08:54:26 */ Ext.define('uas.view.grid.dataList.DataListPanel', { extend: 'Ext.grid.Panel', xtype: 'dataListPanel', dataUrl:'/api/searchPlanTree', plugins: { gridHeaderFilter: true }, selModel: { type: 'checkboxmodel', checkOnly: true }, emptyText: '无数据', loadMask: true, bind:'{dataListGridStore}', initComponent: function () { var me = this; Ext.apply(me, { store: Ext.create('uas.store.DataListGridStore',{ grid: me, autoLoad: true, autoDestroy: true }) }); //加载筛选方案 me.callParent(arguments); me.getSearchPlan(); }, dockedItems: [{ name:'operateToolbar', cls:'x-grid-operateToolbar', xtype: 'toolbar', dock: 'top', height:32, items:[{ cls:'x-btn-blue', xtype:'button', text:'筛选', handler:function(me){ const grid = me.up('dataListPanel'); if(!grid.searchPlanWindow){ grid.searchPlanWindow = Ext.create('widget.searchPlanWindow',{ height:grid.getHeight()*0.8, width:grid.getWidth()*0.8, renderTo:grid.getEl(), grid:grid }).show(); }else{ grid.searchPlanWindow.show(); } } },{ margin:'0 0 0 6', xtype:'button', text:'批处理' },{ margin:'0 0 0 6', xtype:'button', text:'上一页' },{ margin:'0 0 0 6', xtype:'button', text:'下一页' },{ margin:'0 0 0 6', xtype:'button', text:'导出' },{ margin:'0 0 0 6', xtype:'button', text:'个性设置' },{ margin:'0 0 0 12', xtype:'button', text:'关闭' }] },{ xtype: 'toolbar', dock: 'top', name:'searchPlan', cls:'x-grid-searchPlan', height:32, items:[{ xtype:'displayfield', value:'查询方案:' }] },{ xtype: 'toolbar', dock: 'top', name:'filterToolbar', cls:'x-grid-filterToolbar', height:32, items:[{ xtype:'displayfield', value:'筛选条件:' },'->'] },{ xtype: 'dataListPaging' }], columns: [{ dataIndex: 'id', text: '序号', width:60, align:'center', locked: true }, { dataIndex: 'code', text: '采购单号', width:240, locked: true, filter: { type:'string' } }, { dataIndex: 'status', text: '单据状态', width:100, filter: { type:'string' } }, { xtype: 'datecolumn', dataIndex: 'date', text: '下单日期', width: 200, filter: { type:'date' } }, { dataIndex: 'vendor', text: '供应商名', width: 220, filter: { type:'string' } }, { dataIndex: 'price', text: '含税金额', width:190, filter: { type:'number' } },{ dataIndex: 'special', text:'特殊采购', width:120, filter: { type:'combo', combo:[ ["true", "是"], ["false", "否"] ] } },{ dataIndex: 'currency', text: '币别', width:70 },{ dataIndex: 'recordman', text: '采购员', width:70 },{ dataIndex: 'auditman', text: '审核人', width:70 }], getSearchPlan:function(){ const me = this; Ext.Ajax.request({ url: me.dataUrl, params: '', method: 'GET', async:false, success: function(response, opts) { var _data = Ext.decode(response.responseText); if(_data&&_data.data){ const searchPlan = me.down('[name=searchPlan]'); let items = []; Ext.Array.each(_data.data,function(p){ if(p.children&&p.children.length>0){ Ext.Array.each(p.children,function(item){ items.push({ text:item.text, xtype:'button' }) }) } }); searchPlan.add(items); } }, failure: function(response, opts) {} }); } });