Forms.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. Ext.define('erp.view.oa.info.Forms',{
  2. extend: 'Ext.form.Panel',
  3. alias: 'widget.erpPagingFormPanels',
  4. id: 'forms',
  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 condition = 'pr_releaserid=' + em_uu;
  28. if(Ext.getCmp('prd_recipientid').value != null && Ext.getCmp('prd_recipientid').value != ''){
  29. condition += " AND prd_recipientid=" + Ext.getCmp('prd_recipientid').value;
  30. }
  31. if(Ext.getCmp('pr_date').value != null && Ext.getCmp('pr_date').value != ''){
  32. if(condition == ''){
  33. condition += " (pr_date " + Ext.getCmp('pr_date').value + ")";
  34. } else {
  35. condition += " AND (pr_date " + Ext.getCmp('pr_date').value + ")";
  36. }
  37. }
  38. if(Ext.getCmp('pr_context').value != null && Ext.getCmp('pr_context').value != ''){
  39. if(condition == ''){
  40. condition += " pr_context like'%" + Ext.getCmp('pr_context').value + "%'";
  41. } else {
  42. condition += " AND pr_context like'%" + Ext.getCmp('pr_context').value + "%'";
  43. }
  44. }
  45. if(condition != ''){
  46. grid.getCount('PagingRelease', condition);
  47. } else {
  48. showError('请填写筛选条件');return;
  49. }
  50. }
  51. }, '-', {
  52. text: $I18N.common.button.erpCloseButton,
  53. iconCls: 'x-button-icon-close',
  54. cls: 'x-btn-gray',
  55. handler: function(){
  56. var main = parent.Ext.getCmp("content-panel");
  57. main.getActiveTab().close();
  58. }
  59. }, '->', {
  60. id: 'vastdelete',
  61. iconCls: 'group-delete',
  62. cls: 'x-btn-gray',
  63. text: $I18N.common.button.erpDeleteButton,
  64. handler: function(){
  65. }
  66. },/*'-',{
  67. iconCls: 'group-read',
  68. cls: 'x-btn-gray',
  69. text: "重发",
  70. handler: function(){
  71. }
  72. },'-',{
  73. iconCls: 'group-post',
  74. cls: 'x-btn-gray',
  75. text: "转发",
  76. handler: function(){
  77. }
  78. },*/'-',{
  79. id: 'all',
  80. iconCls: 'group-all',
  81. text: "查看所有寻呼",
  82. cls: 'x-btn-gray',
  83. },'-',{
  84. id: 'read',
  85. iconCls: 'group-read',
  86. text: "查看已阅寻呼",
  87. cls: 'x-btn-gray',
  88. },'-',{
  89. id: 'unread',
  90. iconCls: 'group-unread',
  91. text: "查看未阅寻呼",
  92. cls: 'x-btn-gray',
  93. }],
  94. initComponent : function(){
  95. var param = {caller: caller, condition: ''};
  96. this.FormUtil.getItemsAndButtons(this, 'common/singleFormItems.action', param);
  97. this.callParent(arguments);
  98. },
  99. getGroupDa : function(condition, page, pageSize){
  100. var me = Ext.getCmp('querygrid');
  101. if(!page){
  102. page = 1;
  103. }
  104. if(!pageSize){
  105. pageSize = 15;
  106. }
  107. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(true);//loading...
  108. Ext.Ajax.request({//拿到grid的columns
  109. url : basePath + url,
  110. params: {
  111. page: page,
  112. pageSize: pageSize,
  113. condition: condition
  114. },
  115. method : 'post',
  116. async: false,
  117. callback : function(options, success, response){
  118. // console.log(response);
  119. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  120. var res = new Ext.decode(response.responseText);
  121. if(res.exceptionInfo){
  122. showError(res.exceptionInfo);return;
  123. }
  124. if(!res.success){
  125. return;
  126. } else {
  127. console.log(res.success);
  128. dataCount = res.count;
  129. me.store.loadData(res.success);
  130. }
  131. }
  132. });
  133. }
  134. });