Form.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. Ext.define('erp.view.oa.officialDocument.fileManagement.noFile.Form',{
  2. extend: 'Ext.form.Panel',
  3. alias: 'widget.erpNoFileFormPanel',
  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 who = getUrlParam('whoami');
  29. var flag = '';
  30. if(contains(who, 'Send', true)){
  31. flag = 'sod_';
  32. } else if(contains(who, 'Receive', true)){
  33. flag = 'rod_';
  34. } else if(contains(who, 'Instruction', true)){
  35. flag = 'in_';
  36. }
  37. var condition = " (" + flag +"statuscode='OVERED' AND " + flag + "isfile=0 ) ";
  38. if(Ext.getCmp('date').value != null && Ext.getCmp('date').value != ''){
  39. // if(condition == ''){
  40. // condition += " (" + flag + "date " + Ext.getCmp('date').value + ")";
  41. // } else {
  42. condition += " AND (" + flag + "date " + Ext.getCmp('date').value + ")";
  43. // }
  44. }
  45. if(Ext.getCmp('secretlevel').value != null && Ext.getCmp('secretlevel').value != ''){
  46. // if(condition == ''){
  47. // condition += " (" + flag + "secretlevel='" + Ext.getCmp('secretlevel').value + "')";
  48. // } else {
  49. condition += " AND (" + flag + "secretlevel='" + Ext.getCmp('secretlevel').value + "')";
  50. // }
  51. }
  52. if(Ext.getCmp('emergencydegree').value != null && Ext.getCmp('emergencydegree').value != ''){
  53. // if(condition == ''){
  54. // condition += " (" + flag + "emergencydegree='" + Ext.getCmp('emergencydegree').value + "')";
  55. // } else {
  56. condition += " AND (" + flag + "emergencydegree='" + Ext.getCmp('emergencydegree').value + "')";
  57. // }
  58. }
  59. if(Ext.getCmp('title').value != null && Ext.getCmp('title').value != ''){
  60. // if(condition == ''){
  61. // condition += " (" + flag + "title like'%" + Ext.getCmp('title').value + "%')";
  62. // } else {
  63. condition += " AND (" + flag + "title like'%" + Ext.getCmp('title').value + "%')";
  64. // }
  65. }
  66. if(condition != ''){
  67. grid.getCount(who, condition);
  68. } else {
  69. showError('请填写筛选条件');return;
  70. }
  71. console.log(condition);
  72. }
  73. }, '-', {
  74. text: $I18N.common.button.erpCloseButton,
  75. iconCls: 'x-button-icon-close',
  76. cls: 'x-btn-gray',
  77. handler: function(){
  78. var main = parent.Ext.getCmp("content-panel");
  79. main.getActiveTab().close();
  80. }
  81. }, '->',{
  82. id: 'rod',
  83. iconCls: 'group-all',
  84. text: "收文",
  85. cls: 'x-btn-gray'
  86. }, '-', {
  87. id: 'sod',
  88. iconCls: 'group-all',
  89. text: "发文",
  90. cls: 'x-btn-gray'
  91. }, '-', {
  92. id: 'in',
  93. iconCls: 'group-all',
  94. text: "内部请示",
  95. cls: 'x-btn-gray'
  96. }],
  97. initComponent : function(){
  98. // alert(em_uu + caller);
  99. var param = {caller: caller, condition: ''};
  100. this.FormUtil.getItemsAndButtons(this, 'common/singleFormItems.action', param);
  101. this.callParent(arguments);
  102. },
  103. getGroupDa : function(condition, page, pageSize){
  104. var me = Ext.getCmp('grid');
  105. if(!page){
  106. page = 1;
  107. }
  108. if(!pageSize){
  109. pageSize = 15;
  110. }
  111. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(true);//loading...
  112. Ext.Ajax.request({//拿到grid的columns
  113. url : basePath + url,
  114. params: {
  115. page: page,
  116. pageSize: pageSize,
  117. condition: condition
  118. },
  119. method : 'post',
  120. async: false,
  121. callback : function(options, success, response){
  122. // console.log(response);
  123. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  124. var res = new Ext.decode(response.responseText);
  125. if(res.exceptionInfo){
  126. showError(res.exceptionInfo);return;
  127. }
  128. if(!res.success){
  129. return;
  130. } else {
  131. console.log(res.success);
  132. dataCount = res.count;
  133. me.store.loadData(res.success);
  134. }
  135. }
  136. });
  137. }
  138. });