PowerWindow.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. Ext.define('erp.view.oa.doc.PowerWindow', {
  2. extend: 'Ext.window.Window',
  3. alias: 'widget.powerwindow',
  4. id:'powerwindow',
  5. requires:['erp.view.oa.doc.ItemSelector'],
  6. height: 600,
  7. width: 700,
  8. closeAction: 'destroy',
  9. title:'<div align="center" class="WindowTitle">设置权限</div>',
  10. layout:'border',
  11. items:[{
  12. region:'center',
  13. layout:'border',
  14. items:[{
  15. region:'north',
  16. xtype:'form',
  17. bodyPadding: 10,
  18. layout:'column',
  19. bodyStyle:'background:#fafafa;',
  20. items:[{
  21. columnWidth:1,
  22. xtype: 'checkboxgroup',
  23. id:'checkboxgroup',
  24. padding:'0 0 0 20',
  25. fieldStyle : "background:#FFFAFA;color:#515151;",
  26. items: [{ boxLabel: '管理', name: 'DP_CONTROL', inputValue: '1'},
  27. { boxLabel: '浏览', name: 'DP_SEE', inputValue: '1' },
  28. { boxLabel: '创建', name: 'DP_SAVE', inputValue: '1' },
  29. { boxLabel: '阅读', name: 'DP_READ', inputValue: '1' },
  30. { boxLabel: '删除', name: 'DP_DELETE', inputValue: '1' },
  31. { boxLabel: '打印', name: 'DP_PRINT', inputValue: '1' },
  32. { boxLabel: '下载', name: 'DP_DOWNLOAD', inputValue: '1'}]
  33. },{
  34. xtype:'textfield',
  35. margin:'0 0 0 20',
  36. fieldLabel:'快速搜索',
  37. labelStyle:'font-weight:bold;',
  38. columnWidth:0.8
  39. },{
  40. xtype:'button',
  41. id:'search',
  42. text:'搜索',
  43. cls:'button1 pill',
  44. style:'margin-left:5px;',
  45. width:60
  46. }]
  47. },{
  48. region:'center',
  49. xtype: 'itemselector',
  50. anchor: '100%',
  51. id: 'itemselector-field',
  52. displayField: 'text',
  53. valueField: 'value',
  54. allowBlank: false,
  55. msgTarget: 'side'
  56. }],
  57. buttonAlign:'center',
  58. buttons:['->',{
  59. cls:'button1 pill',
  60. style:'margin-left:5px;',
  61. text:'保存',
  62. scope:this,
  63. handler:function(btn){
  64. btn.ownerCt.ownerCt.ownerCt.savePower(btn);
  65. }
  66. },{
  67. cls:'button1 pill',
  68. style:'margin-left:5px;',
  69. text:'关闭',
  70. handler:function(btn){
  71. btn.ownerCt.ownerCt.ownerCt.close(btn);
  72. }
  73. },'->']
  74. },{
  75. region:'west',
  76. width:'40%',
  77. xtype:'erpOrgTreePanel',
  78. bodyStyle:'background:#fafafa;'
  79. }],
  80. initComponent: function() {
  81. this.callParent(arguments);
  82. },
  83. savePower:function(btn){
  84. var checkboxgroup=Ext.getCmp('checkboxgroup');
  85. var selectorvalue=Ext.getCmp('itemselector-field').getModelData();
  86. var values=checkboxgroup.getValue();
  87. var keys=Ext.Object.getKeys(values);
  88. if(keys.length>0 && selectorvalue.length>0){
  89. Ext.Ajax.request({//拿到form的items
  90. url : basePath + 'doc/docmentPowerSet.action',
  91. params: {
  92. folderId:CurrentFolderId,
  93. powers: unescape(escape(Ext.JSON.encode(values))),
  94. objects:unescape(selectorvalue.toString())
  95. },
  96. method : 'post',
  97. callback : function(options, success, response){
  98. btn.ownerCt.ownerCt.ownerCt.close(btn);
  99. var activetab=Ext.getCmp('doctab').getActiveTab();
  100. activetab.items.items[0].loadNewStore();
  101. }
  102. });
  103. }else {
  104. showResult('提示','未选择设置角色或权限!',btn);
  105. }
  106. }
  107. });