wangting
2024-12-26 fa261e8c1220b31af54e8167e4de9c3320b1af27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.vci.client.common;
 
import javax.swing.JComponent;
import javax.swing.JPanel;
 
import com.vci.client.framework.rightConfig.object.FunctionObject;
import com.vci.client.framework.util.RightControlUtil;
 
/**
 * 每个模块的实现类要继承自此PANEL,通过传入的模块对象,处理当前用户在该模块下的权限,
 * 页面上校验操作权限时只需传入操作的标识即可。
 * @author xf
 *
 */
public class VCIBasePanel extends JPanel  {
    
    /**
     * 
     */
    private static final long serialVersionUID = -894240142116864397L;
 
    protected static FunctionObject funcObj = null;
    
    public VCIBasePanel(FunctionObject funcObj){
        this.funcObj = funcObj;
    }
    
    /**
     * 校验操作权限
     * @param operate
     * @return
     */
    public static boolean checkRight(String operate,JComponent component){
        boolean res = RightControlUtil.checkOperateRightByModule(funcObj.getId(), operate);
        if(component != null){
            component.setVisible(res);
        }
        return res;
    }
    
    /**
     * 返回功能模块对象
     * return 功能模块FunctionObject对象
     */
    public FunctionObject getFuncObj(){
        return funcObj;
    }
}