EmpWorkdateQuery.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. Ext.define('erp.view.hr.attendance.EmpWorkdateQuery', {
  2. extend : 'Ext.Viewport',
  3. layout : 'anchor',
  4. hideBorders : true,
  5. requires:['erp.view.hr.attendance.EwGridPanel'],
  6. initComponent : function() {
  7. var me = this;
  8. Ext.apply(me, {
  9. items : [ {
  10. region : 'north',
  11. xtype : 'erpQueryFormPanel',
  12. anchor : '100% 15%',
  13. caller:'EmpWorkdateQuery',
  14. onQuery: function() {
  15. var grid = Ext.getCmp('querygrid');
  16. var ym=Ext.getCmp('q_date').value;
  17. if(ym){
  18. var year=ym.substring(0,4);
  19. var month=ym.substring(4,6);
  20. var temp = new Date(year,month,0);
  21. var form = this;
  22. var condition = grid.defaultCondition || '';
  23. condition = form.spellCondition(condition);
  24. if(Ext.isEmpty(condition)) {
  25. condition = grid.emptyCondition || '1=1';
  26. }
  27. grid.setLoading(true);
  28. Ext.Ajax.request({
  29. url: basePath + 'hr/attendance/getDatas.action',
  30. params:{condition: condition},
  31. callback: function(opt, s, r) {
  32. grid.setLoading(false);
  33. var res = Ext.decode(r.responseText);
  34. var data = res.data;
  35. if(!data || data.length == 0){
  36. grid.store.removeAll();
  37. grid.GridUtil.add10EmptyItems(grid);
  38. } else {
  39. grid.store.loadData(res.data);
  40. }
  41. var c=temp.getDate();
  42. if(c==28){
  43. grid.columns[32].hide();
  44. grid.columns[33].hide();
  45. grid.columns[34].hide();
  46. }
  47. if(c==29){
  48. grid.columns[32].show();
  49. grid.columns[33].hide();
  50. grid.columns[34].hide();
  51. }
  52. if(c==30){
  53. grid.columns[32].show();
  54. grid.columns[33].show();
  55. grid.columns[34].hide();
  56. }
  57. if(c==31){
  58. grid.columns[32].show();
  59. grid.columns[33].show();
  60. grid.columns[34].show();
  61. }
  62. }
  63. });
  64. }else{
  65. showError("请选择年月");
  66. }
  67. }
  68. }, {
  69. region : 'south',
  70. _noc : 1,
  71. xtype : 'erpEwGridPanel',
  72. anchor : '100% 85%',
  73. autoQuery : false
  74. } ]
  75. });
  76. me.callParent(arguments);
  77. }
  78. });