Form.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. Ext.define('erp.view.oa.publicAdmin.book.bookManage.Form',{
  2. extend: 'Ext.form.Panel',
  3. alias: 'widget.erpBookFormPanel',
  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(caller, condition);
  48. } else {
  49. showError('请填写筛选条件');return;
  50. }
  51. }
  52. }, '-', {
  53. text: $I18N.common.button.erpCloseButton,
  54. iconCls: 'x-button-icon-close',
  55. cls: 'x-btn-gray',
  56. handler: function(){
  57. var main = parent.Ext.getCmp("content-panel");
  58. main.getActiveTab().close();
  59. }
  60. }],
  61. initComponent : function(){
  62. var param = {caller: caller, condition: ''};
  63. this.FormUtil.getItemsAndButtons(this, 'common/singleFormItems.action', param);
  64. this.callParent(arguments);
  65. }
  66. });