package yem.wmc.ydn.formplugin.dynamic;

import kd.bos.bill.OperationStatus;
import kd.bos.form.FormShowParameter;
import kd.bos.form.IFormView;
import kd.bos.form.ShowType;
import kd.bos.form.plugin.AbstractFormPlugin;

import java.util.EventObject;
import java.util.HashMap;
import java.util.Map;


/**
 * 采购看板
 * @author  zhangh
 */
public class ProcuanaBillForm extends AbstractFormPlugin {

    @Override
    public void afterCreateNewData(EventObject e) {
        Map<String, String> map  = new HashMap<>();
        map.put("yem_ca_purchasetotal", "yem_grossflex");//首页顶部年度总量
        map.put("yem_ca_exetotal","yem_flexpanelap");//首页顶部执行总量
        map.put("yem_ca_purchaseline","yem_tfmpie");//首页中部折线
        map.put("yem_ca_userexetop","yem_bar");//首页中部柱状图
        map.put("yem_ca_execupon","yem_flexpanelap2");//首页底部已执行
        map.put("yem_ca_unexecupon","yem_flexpanelap21");//首页底部未执行
        showForm(map);
    }

    public void showForm(Map<String, String> map) {
        for (String key : map.keySet()) {
            IFormView view = this.getView();
            FormShowParameter showParameter = new FormShowParameter();
            showParameter.setStatus(OperationStatus.EDIT);
            showParameter.getOpenStyle().setShowType(ShowType.InContainer);
            showParameter.getOpenStyle().setTargetKey(map.get(key));
            showParameter.setSendToClient(true);
            showParameter.setFormId(key);
            view.showForm(showParameter);
        }
    }
}
