Form.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. Ext.define('erp.view.oa.myProcess.jprocessEfficiency.Form',{
  2. extend: 'Ext.form.Panel',
  3. alias: 'widget.erpJProcessEfficiencyFormPanel',
  4. id: 'form',
  5. region: 'north',
  6. frame : true,
  7. layout : 'column',
  8. autoScroll : true,
  9. defaultType : 'textfield',
  10. labelSeparator : ':',
  11. buttonAlign : 'center',
  12. fieldDefaults : {
  13. margin : '4 2 4 2',
  14. fieldStyle : "background:#FFFAFA;color:#515151;",
  15. labelAlign : "right",
  16. blankText : $I18N.common.form.blankText
  17. },
  18. FormUtil: Ext.create('erp.util.FormUtil'),
  19. BaseUtil: Ext.create('erp.util.BaseUtil'),
  20. tbar: [{
  21. name: 'query',
  22. text: $I18N.common.button.erpQueryButton,
  23. iconCls: 'x-button-icon-query',
  24. cls: 'x-btn-gray',
  25. handler: function(){
  26. var grid = Ext.getCmp('grid');
  27. var form = Ext.getCmp('form');
  28. var condition = '';
  29. Ext.each(form.items.items, function(f){
  30. if(f.logic != null && f.logic != '' && f.value != null && f.value != ''){
  31. if(contains(f.value, 'BETWEEN', true) && contains(f.value, 'AND', true)){
  32. if(condition == ''){
  33. condition += f.logic + " " + f.value;
  34. } else {
  35. condition += ' AND ' + f.logic + " " + f.value;
  36. }
  37. } else {
  38. if(condition == ''){
  39. condition += f.logic + "='" + f.value + "'";
  40. } else {
  41. condition += ' AND ' + f.logic + "='" + f.value + "'";
  42. }
  43. }
  44. }
  45. });
  46. if(condition != ''){
  47. url = "oa/myprocess/searchJNodeEfficiency.action";
  48. // url = "oa/myprocess/search2.action";
  49. form.getGroupDa(condition);
  50. } else {
  51. showError('请填写筛选条件');return;
  52. }
  53. console.log(condition);
  54. }
  55. }, '-', {
  56. name: 'summary',
  57. text: '汇总',
  58. iconCls: 'x-button-icon-submit',
  59. cls: 'x-btn-gray',
  60. handler: function(){
  61. // var grid = Ext.getCmp('querygrid');
  62. // grid.BaseUtil.exportexcel(grid);
  63. }
  64. }, '-', {
  65. text: $I18N.common.button.erpCloseButton,
  66. iconCls: 'x-button-icon-close',
  67. cls: 'x-btn-gray',
  68. handler: function(){
  69. var main = parent.Ext.getCmp("content-panel");
  70. main.getActiveTab().close();
  71. }
  72. }],
  73. initComponent : function(){
  74. // alert(em_uu + caller);
  75. var param = {caller: caller, condition: ''};
  76. this.FormUtil.getItemsAndButtons(this, 'common/singleFormItems.action', param);
  77. this.callParent(arguments);
  78. },
  79. getGroupDa : function(condition, page, pageSize){
  80. var me = Ext.getCmp('grid');
  81. if(!page){
  82. page = 1;
  83. }
  84. if(!pageSize){
  85. pageSize = 15;
  86. }
  87. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(true);//loading...
  88. Ext.Ajax.request({//拿到grid的columns
  89. url : basePath + url,
  90. params: {
  91. page: page,
  92. pageSize: pageSize,
  93. condition: condition
  94. },
  95. method : 'post',
  96. async: false,
  97. callback : function(options, success, response){
  98. // console.log(response);
  99. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  100. var res = new Ext.decode(response.responseText);
  101. if(res.exceptionInfo){
  102. showError(res.exceptionInfo);return;
  103. }
  104. if(!res.jprocesslist){
  105. return;
  106. } else {
  107. console.log(res.jprocesslist);
  108. dataCount = res.count;
  109. me.store.loadData(res.jprocesslist);
  110. }
  111. }
  112. });
  113. }
  114. });