Query.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. Ext.define('erp.view.oa.persontask.workPlan.Query',{
  2. extend: 'Ext.Viewport',
  3. layout: 'anchor',
  4. hideBorders: true,
  5. initComponent : function(){
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. xtype: 'erpFormPanel',
  10. region: 'north',
  11. anchor: '100% 30%',
  12. tbar: [{
  13. name: 'query',
  14. text: $I18N.common.button.erpQueryButton,
  15. iconCls: 'x-button-icon-query',
  16. cls: 'x-btn-gray',
  17. handler: function(){
  18. var grid = Ext.getCmp('grid');
  19. var form = Ext.getCmp('form');
  20. var condition = '';
  21. Ext.each(form.items.items, function(f){
  22. if(f.logic != null && f.logic != '' && f.value != null && f.value != ''){
  23. if(contains(f.value, 'BETWEEN', true) && contains(f.value, 'AND', true)){
  24. if(condition == ''){
  25. condition += f.logic + " " + f.value;
  26. } else {
  27. condition += ' AND ' + f.logic + " " + f.value;
  28. }
  29. } else {
  30. if(condition == ''){
  31. condition += f.logic + "='" + f.value + "'";
  32. } else {
  33. condition += ' AND ' + f.logic + "='" + f.value + "'";
  34. }
  35. }
  36. }
  37. });
  38. if(condition != ''){
  39. grid.getCount('WorkPlan!Query', condition);
  40. } else {
  41. showError('请填写筛选条件');return;
  42. }
  43. }
  44. }, '-', {
  45. text: $I18N.common.button.erpCloseButton,
  46. iconCls: 'x-button-icon-close',
  47. cls: 'x-btn-gray',
  48. handler: function(){
  49. var main = parent.Ext.getCmp("content-panel");
  50. main.getActiveTab().close();
  51. }
  52. }]
  53. },{
  54. region: 'south',
  55. xtype:'erpDatalistGridPanel',
  56. anchor: '100% 70%'
  57. }]
  58. });
  59. me.callParent(arguments);
  60. }
  61. });