Form.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. Ext.define('erp.view.oa.myProcess.synergy.query.Form',{
  2. extend: 'Ext.form.Panel',
  3. alias: 'widget.erpSynergyQueryFormPanel',
  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. if(Ext.getCmp('sy_date').value != null && Ext.getCmp('sy_date').value != ''){
  30. if(condition == ''){
  31. condition += " (sy_date " + Ext.getCmp('sy_date').value + ")";
  32. } else {
  33. condition += " AND (sy_date " + Ext.getCmp('sy_date').value + ")";
  34. }
  35. }
  36. if(Ext.getCmp('sy_type').value != null && Ext.getCmp('sy_type').value != ''){
  37. if(condition == ''){
  38. condition += " (sy_type = " + Ext.getCmp('sy_type').value + ")";
  39. } else {
  40. condition += " AND (sy_type = " + Ext.getCmp('sy_type').value + ")";
  41. }
  42. }
  43. if(Ext.getCmp('sy_releaser_id').value != null && Ext.getCmp('sy_releaser_id').value != ''){
  44. if(condition == ''){
  45. condition += " (sy_releaser_id = " + Ext.getCmp('sy_releaser_id').value + ")";
  46. } else {
  47. condition += " AND (sy_releaser_id = " + Ext.getCmp('sy_releaser_id').value + ")";
  48. }
  49. }
  50. if(Ext.getCmp('sy_depart').value != null && Ext.getCmp('sy_depart').value != ''){
  51. if(condition == ''){
  52. condition += " (sy_depart = " + Ext.getCmp('sy_depart').value + ")";
  53. } else {
  54. condition += " AND (sy_depart = " + Ext.getCmp('sy_depart').value + ")";
  55. }
  56. }
  57. if(Ext.getCmp('sy_title').value != null && Ext.getCmp('sy_title').value != ''){
  58. if(condition == ''){
  59. condition += " (sy_title like '%" + Ext.getCmp('sy_title').value + "%')";
  60. } else {
  61. condition += " AND (sy_title like '%" + Ext.getCmp('sy_title').value + "%')";
  62. }
  63. }
  64. if(condition != ''){
  65. grid.getCount('Synergy!Data', condition);
  66. } else {
  67. showError('请填写筛选条件');return;
  68. }
  69. console.log(condition);
  70. }
  71. }, '-', {
  72. text: $I18N.common.button.erpCloseButton,
  73. iconCls: 'x-button-icon-close',
  74. cls: 'x-btn-gray',
  75. handler: function(){
  76. var main = parent.Ext.getCmp("content-panel");
  77. main.getActiveTab().close();
  78. }
  79. }],
  80. initComponent : function(){
  81. // alert(em_uu + caller);
  82. var param = {caller: caller, condition: ''};
  83. this.FormUtil.getItemsAndButtons(this, 'common/singleFormItems.action', param);
  84. this.callParent(arguments);
  85. },
  86. getGroupDa : function(condition, page, pageSize){
  87. var me = Ext.getCmp('grid');
  88. if(!page){
  89. page = 1;
  90. }
  91. if(!pageSize){
  92. pageSize = 15;
  93. }
  94. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(true);//loading...
  95. Ext.Ajax.request({//拿到grid的columns
  96. url : basePath + url,
  97. params: {
  98. page: page,
  99. pageSize: pageSize,
  100. condition: condition
  101. },
  102. method : 'post',
  103. async: false,
  104. callback : function(options, success, response){
  105. // console.log(response);
  106. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  107. var res = new Ext.decode(response.responseText);
  108. if(res.exceptionInfo){
  109. showError(res.exceptionInfo);return;
  110. }
  111. if(!res.success){
  112. return;
  113. } else {
  114. console.log(res.success);
  115. dataCount = res.count;
  116. me.store.loadData(res.success);
  117. }rrrrrrrrrrrrrrr
  118. }
  119. });
  120. }
  121. });