userGroupGrid.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. Ext.define('erp.view.ma.userGroup.userGroupGrid',{
  2. extend: 'Ext.grid.Panel',
  3. alias: 'widget.erpUserGroupGrid',
  4. requires: ['erp.view.core.toolbar.Toolbar', 'erp.view.core.plugin.CopyPasteMenu'],
  5. region: 'south',
  6. layout : 'fit',
  7. id: 'grid',
  8. emptyText : $I18N.common.grid.emptyText,
  9. columnLines : true,
  10. autoScroll : true,
  11. store: [],
  12. columns: [],
  13. binds:null,
  14. bodyStyle: 'background-color:#f1f1f1;',
  15. plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
  16. clicksToEdit: 1,
  17. listeners:{
  18. beforeedit:function(e){
  19. var g=e.grid,r=e.record,f=e.field;
  20. if(g.binds){
  21. var bool=true;
  22. Ext.Array.each(g.binds,function(item){
  23. if(Ext.Array.contains(item.fields,f)){
  24. Ext.each(item.refFields,function(field){
  25. if(r.get(field)!=null && r.get(field)!=0 && r.get(field)!='' && r.get(field)!='0'){
  26. bool=false;
  27. }
  28. });
  29. }
  30. });
  31. return bool;
  32. }
  33. }
  34. }
  35. }), Ext.create('erp.view.core.plugin.CopyPasteMenu')],
  36. GridUtil: Ext.create('erp.util.GridUtil'),
  37. BaseUtil: Ext.create('erp.util.BaseUtil'),
  38. necessaryField: '',//必填字段
  39. detno: '',//编号字段
  40. keyField: '',//主键字段
  41. mainField: '',//对应主表主键的字段
  42. initComponent : function(){
  43. this.callParent(arguments);
  44. },
  45. listeners:{
  46. afterrender:function(f){
  47. f.GridUtil.add10EmptyItems(f);
  48. },
  49. scrollershow: function(scroller) {
  50. if (scroller && scroller.scrollEl) {
  51. scroller.clearManagedListeners();
  52. scroller.mon(scroller.scrollEl, 'scroll', scroller.onElScroll, scroller);
  53. }
  54. }
  55. },
  56. store: new Ext.data.Store({
  57. fields: ['ugp_id', 'sn_caller', 'sn_id', 'sn_module', 'sn_displayname','ugp_ifread','ugp_ifwrite','ugp_ifdelete','ugp_ifspecial','ugp_ifall']
  58. }),
  59. necessaryFields:'sn_module',
  60. columns: [{
  61. xtype: 'rownumberer',
  62. width: 35,
  63. cls: 'x-grid-header-1',
  64. align: 'center'
  65. },{
  66. style :"text-align:center",
  67. text: 'ID',
  68. width: 160,
  69. hidden:true,
  70. dataIndex: 'ugp_id',
  71. },{
  72. style :"text-align:center",
  73. text: 'caller',
  74. width: 160,
  75. hidden:true,
  76. dataIndex: 'sn_caller',
  77. },{
  78. style :"text-align:center",
  79. text: 'sn_id',
  80. width: 160,
  81. hidden:true,
  82. dataIndex: 'sn_id',
  83. },{
  84. style :"text-align:center",
  85. text: '所属模块',
  86. width: 160,
  87. dataIndex: 'sn_module',
  88. readOnly:true,
  89. ignore: true,
  90. },{
  91. style :"text-align:center",
  92. text: '功能模块',
  93. width: 120,
  94. dataIndex: 'sn_displayname',
  95. ignore: true,
  96. logic:'ignore'
  97. },{
  98. style :"text-align:center",
  99. text: '读权限',
  100. width: 120,
  101. dataIndex: 'ugp_ifread',
  102. xtype:'checkcolumn',
  103. },{
  104. style :"text-align:center",
  105. text: '写权限',
  106. width: 120,
  107. dataIndex: 'ugp_ifwrite',
  108. xtype:'checkcolumn'
  109. },{
  110. style :"text-align:center",
  111. text: '删权限',
  112. width: 120,
  113. dataIndex: 'ugp_ifdelete',
  114. xtype:'checkcolumn'
  115. },{
  116. style :"text-align:center",
  117. text: '特殊权限',
  118. width: 120,
  119. dataIndex: 'ugp_ifspecial',
  120. xtype:'checkcolumn'
  121. },{
  122. style :"text-align:center",
  123. text: '全部权限',
  124. width: 120,
  125. dataIndex: 'ugp_ifall',
  126. xtype:'checkcolumn'
  127. }],
  128. setReadOnly: function(bool){
  129. this.readOnly = bool;
  130. }
  131. });