Form.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. Ext.define('erp.view.oa.myProcess.timeoutNode.Form',{
  2. extend: 'Ext.form.Panel',
  3. alias: 'widget.erpTimeoutNodeFormPanel',
  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/searchTimeoutJNode.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. // 加一个超时字段;
  77. this.FormUtil.getItemsAndButtons(this, 'common/singleFormItems.action', param);
  78. var timeout = Ext.create('Ext.form.field.Text',{
  79. name: 'name',
  80. fieldLabel: '超时大于',
  81. allowBlank: true,
  82. value:0,
  83. readOnly:true
  84. });
  85. var label = Ext.create('Ext.form.Label',{
  86. text: '分钟 ',
  87. margins: '0 0 0 0'
  88. })
  89. this.callParent(arguments);
  90. this.insert(5,timeout);
  91. this.add(label);
  92. },
  93. getGroupDa : function(condition, page, pageSize){
  94. var me = Ext.getCmp('grid');
  95. if(!page){
  96. page = 1;
  97. }
  98. if(!pageSize){
  99. pageSize = 15;
  100. }
  101. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(true);//loading...
  102. Ext.Ajax.request({//拿到grid的columns
  103. url : basePath + url,
  104. params: {
  105. page: page,
  106. pageSize: pageSize,
  107. condition: condition
  108. },
  109. method : 'post',
  110. async: false,
  111. callback : function(options, success, response){
  112. // console.log(response);
  113. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  114. var res = new Ext.decode(response.responseText);
  115. if(res.exceptionInfo){
  116. showError(res.exceptionInfo);return;
  117. }
  118. if(!res.jprocesslist){
  119. return;
  120. } else {
  121. console.log(res.jprocesslist);
  122. dataCount = res.count;
  123. me.store.loadData(res.jprocesslist);
  124. }
  125. }
  126. });
  127. }
  128. });