Form.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. Ext.define('erp.view.oa.officialDocument.rod.query.Form',{
  2. extend: 'Ext.form.Panel',
  3. alias: 'widget.erpRODQueryFormPanel',
  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. grid.getCount('ReceiveOfficialDocument!Query', condition);
  48. } else {
  49. showError('请填写筛选条件');return;
  50. }
  51. console.log(condition);
  52. }
  53. }, '-', {
  54. text: $I18N.common.button.erpCloseButton,
  55. iconCls: 'x-button-icon-close',
  56. cls: 'x-btn-gray',
  57. handler: function(){
  58. var main = parent.Ext.getCmp("content-panel");
  59. main.getActiveTab().close();
  60. }
  61. }],
  62. initComponent : function(){
  63. // alert(em_uu + caller);
  64. var param = {caller: caller, condition: ''};
  65. this.FormUtil.getItemsAndButtons(this, 'common/singleFormItems.action', param);
  66. this.callParent(arguments);
  67. },
  68. getGroupDa : function(condition, page, pageSize){
  69. var me = Ext.getCmp('grid');
  70. if(!page){
  71. page = 1;
  72. }
  73. if(!pageSize){
  74. pageSize = 15;
  75. }
  76. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(true);//loading...
  77. Ext.Ajax.request({//拿到grid的columns
  78. url : basePath + url,
  79. params: {
  80. page: page,
  81. pageSize: pageSize,
  82. condition: condition
  83. },
  84. method : 'post',
  85. async: false,
  86. callback : function(options, success, response){
  87. // console.log(response);
  88. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  89. var res = new Ext.decode(response.responseText);
  90. if(res.exceptionInfo){
  91. showError(res.exceptionInfo);return;
  92. }
  93. if(!res.success){
  94. return;
  95. } else {
  96. console.log(res.success);
  97. dataCount = res.count;
  98. me.store.loadData(res.success);
  99. }rrrrrrrrrrrrrrr
  100. }
  101. });
  102. }
  103. });