Form.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. Ext.define('erp.view.common.productRelative.Form',{
  2. extend: 'Ext.form.Panel',
  3. alias: 'widget.ProductRelativeFormPanel',
  4. id: 'queryform',
  5. region: 'north',
  6. frame : true,
  7. header: false,//不显示title
  8. layout : 'column',
  9. autoScroll : true,
  10. defaultType : 'textfield',
  11. labelSeparator : ':',
  12. buttonAlign : 'center',
  13. fieldDefaults : {
  14. margin : '2 2 2 2',
  15. fieldStyle : "background:#FFFAFA;color:#515151;",
  16. labelAlign : "right",
  17. blankText : $I18N.common.form.blankText
  18. },
  19. FormUtil: Ext.create('erp.util.FormUtil'),
  20. initComponent : function(){
  21. var urlcondition = getUrlParam('condition');//从url解析参数
  22. urlcondition = (urlcondition == null) ? "" : urlcondition.replace(/IS/g,"=");
  23. var param = {caller: caller, condition: urlcondition};
  24. this.FormUtil.getItemsAndButtons(this, 'common/singleFormItems.action', param);
  25. this.callParent(arguments);
  26. this.addKeyBoardEvents();
  27. },
  28. addKeyBoardEvents: function(){
  29. var me = this;
  30. if(Ext.isIE){
  31. document.body.attachEvent('onkeydown', function(){//ie的事件名称不同,也不支持addEventListener
  32. if(window.event.altKey && window.event.ctrlKey && window.event.keyCode == 83){
  33. me.FormUtil.onAdd('form' + caller, 'Form配置维护(' + caller + ')', "jsps/ma/multiform.jsp?formCondition=fo_idIS" + me.fo_id +
  34. "&gridCondition=fd_foidIS" + me.fo_id + "&whoami=" + caller);
  35. }
  36. });
  37. } else {
  38. document.body.addEventListener("keydown", function(e){
  39. if(Ext.isFF5){//firefox不支持window.event
  40. e = e || window.event;
  41. }
  42. if(e.altKey && e.ctrlKey && e.keyCode == 83){
  43. me.FormUtil.onAdd('form' + caller, 'Form配置维护(' + caller + ')', "jsps/ma/multiform.jsp?formCondition=fo_idIS" + me.fo_id +
  44. "&gridCondition=fd_foidIS" + me.fo_id + "&whoami=" + caller);
  45. }
  46. });
  47. }
  48. }
  49. });