田源
2025-01-09 8a166a60cfd1a2e593ffa103d10c0dc224fc8628
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
49
50
51
52
53
package com.vci.client.uif.actions.client;
 
import java.util.Map;
 
import javax.swing.JOptionPane;
 
import com.vci.client.common.ConfigUtils;
import com.vci.client.ui.swing.components.VCIJOptionPane;
 
public abstract class DoseNotSelectDataHasRightCheckAction extends AbstractBusionessOperationAction {
 
    /**
     * Action框架主入口,继承复写请慎重...
     */
    public boolean doAction(){
        // 不基于已选择的数据,不需要对数据进行权限判断
        String rightSwitch = ConfigUtils.getConfigValue("right.switch");
        if(rightSwitch != null && rightSwitch.equals("on")){
            //判断使用的选择的数据还是Sourcedata
            Object obj = null;
            boolean select = false;
            Map<String, String> params = getButtonParams();
            if(params.containsKey("needselect")) {
                String needselect = params.get("needselect");
                if(needselect.equalsIgnoreCase("true")) {
                    select = true;
                }
            }
            if(!select) {
                obj = getRegionPanel().getSourceData();
            } else {
                Object[] objs = getDataModel().getSelectObjects();
                if(objs != null && objs.length > 0) {
                    obj = objs[0];
                }
            }
            //判断是否为空
            if(obj != null) {
                setCheckObject(obj);
                if(!checkHasRight()){
                    VCIJOptionPane.showMessageDialog(
                            getParentComponent(), "您没有权限进行此操作!", "提示", JOptionPane.INFORMATION_MESSAGE);
                    return false;
                }
            }
        }
        
        // 在选定了数据及有权限之后,执行
        boolean res = doActionDetailBySelectedObject();
                
        return res;
    }
}