Query.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. Ext.define('erp.view.oa.persontask.workDaily.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. console.log(form);
  22. Ext.each(form.items.items, function(f){
  23. if(f.logic != null && f.logic != ''){
  24. if(f.logic == 'wd_date' && f.value != null && f.value != ''){
  25. if(condition == ''){
  26. condition += f.logic + " " + f.value;
  27. } else {
  28. condition += ' AND ' + f.logic + " " + f.value;
  29. }
  30. } else if(f.logic == 'wd_emp'){
  31. if(f.value != null && f.value != ''){
  32. if(condition == ''){
  33. condition += f.logic + "='" + f.value + "' AND wd_empid=" + Ext.getCmp('wd_empid').value;
  34. } else {
  35. condition += ' AND ' + f.logic + "='" + f.value + "' AND wd_empid=" + Ext.getCmp('wd_empid').value;
  36. }
  37. } else {
  38. if(condition == ''){
  39. condition += f.logic + "='" + em_name + "' AND wd_empid=" + em_uu;
  40. } else {
  41. condition += ' AND ' + f.logic + "='" + em_name + "' AND wd_empid=" + em_uu;
  42. }
  43. }
  44. }
  45. // if(contains(f.value, 'BETWEEN', true) && contains(f.value, 'AND', true)){
  46. // if(condition == ''){
  47. // condition += f.logic + " " + f.value;
  48. // } else {
  49. // condition += ' AND ' + f.logic + " " + f.value;
  50. // }
  51. // } else {
  52. // if(condition == ''){
  53. // condition += f.logic + "='" + f.value + "'";
  54. // } else {
  55. // condition += ' AND ' + f.logic + "='" + f.value + "'";
  56. // }
  57. // }
  58. }
  59. });
  60. if(condition != ''){
  61. grid.getCount('WorkDaily!Query', condition);
  62. } else {
  63. showError('请填写筛选条件');return;
  64. }
  65. }
  66. }, '-', {
  67. text: $I18N.common.button.erpCloseButton,
  68. iconCls: 'x-button-icon-close',
  69. cls: 'x-btn-gray',
  70. handler: function(){
  71. var main = parent.Ext.getCmp("content-panel");
  72. main.getActiveTab().close();
  73. }
  74. }]
  75. },{
  76. region: 'south',
  77. xtype:'erpDatalistGridPanel',
  78. filterCondition: "wd_emp='" + em_name + "' AND wd_empid=" + em_uu,
  79. anchor: '100% 70%'
  80. }]
  81. });
  82. me.callParent(arguments);
  83. }
  84. });