DataList.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. Ext.define('saas.view.sys.messagelog.DataList', {
  2. extend: 'Ext.grid.Panel',
  3. xtype: 'sys-messagelog-datalist',
  4. autoScroll: true,
  5. frame:true,
  6. layout:'fit',
  7. dataUrl:'http://192.168.253.58:8920/messagelog/list',
  8. saveUrl:'/api/common/number/save',
  9. deleteUrl:'/api/common/number/delete/',
  10. tbar: [{
  11. cls:'x-formpanel-btn-orange',
  12. xtype:'button',
  13. text:'查询',
  14. listeners: {
  15. click: 'onQuery'
  16. }
  17. },'->'],
  18. //字段属性
  19. columns : [{
  20. text : "id",
  21. width : 0,
  22. dataIndex : "id",
  23. xtype : "numbercolumn",
  24. },{
  25. text : "单据编号",
  26. width : 200.0,
  27. dataIndex : "ml_code",
  28. },
  29. {
  30. text : "操作",
  31. dataIndex : "ml_content",
  32. width : 220.0,
  33. },
  34. {
  35. text : "结果",
  36. dataIndex : "ml_result",
  37. width : 120.0,
  38. },
  39. {
  40. text : "处理人",
  41. dataIndex : "ml_man",
  42. width : 200,
  43. }],
  44. dbSearchFields: [],
  45. condition:'',
  46. initComponent: function() {
  47. var me = this;
  48. if(me.columns){
  49. var fields = me.columns.map(column => column.dataIndex);
  50. me.store = Ext.create('Ext.data.Store',{
  51. fields:fields,
  52. autoLoad: true,
  53. pageSize: 10,
  54. data: [],
  55. proxy: {
  56. timeout:8000,
  57. type: 'ajax',
  58. url: me.dataUrl,
  59. actionMethods: {
  60. read: 'GET'
  61. },
  62. reader: {
  63. type: 'json',
  64. rootProperty: 'data.list',
  65. totalProperty: 'data.total',
  66. }
  67. },
  68. listeners: {
  69. beforeload: function (store, op) {
  70. var condition = me.condition;
  71. if (Ext.isEmpty(condition)) {
  72. condition = "";
  73. }
  74. Ext.apply(store.proxy.extraParams, {
  75. number: op._page,
  76. size: store.pageSize,
  77. condition: JSON.stringify(condition)
  78. });
  79. }
  80. }
  81. });
  82. Ext.apply(me, {
  83. dockedItems:[{
  84. xtype: 'pagingtoolbar',
  85. dock: 'bottom',
  86. displayInfo: true,
  87. emptyMsg: "暂无数据",
  88. store: me.store,
  89. displayMsg: '显示{0}到{1}条数据,共有{2}条',
  90. beforePageText: "当前第",
  91. afterPageText: "页,共{0}页"
  92. }]
  93. });
  94. }
  95. me.callParent(arguments);
  96. },
  97. getCondition: function(f,conditionExpression){
  98. var condition = '';
  99. if((f.xtype == 'checkbox' || f.xtype == 'radio')&&f.logic){
  100. }else if(f.xtype=='textfield'&&f.value!=''){
  101. condition=conditionExpression.replace(new RegExp("\\{0}","g"), f.value);
  102. }
  103. if(condition.length>0){
  104. condition+= ' AND ';
  105. }
  106. return condition;
  107. },
  108. refresh:function(){
  109. //debugger
  110. }
  111. });