package nckd.jxccl.swc.mas.plugin.form.empmgt;

import kd.bos.form.events.AfterDoOperationEventArgs;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.sdk.plugin.Plugin;
import nckd.jxccl.base.common.constant.FormConstant;
import nckd.jxccl.swc.constants.MasConstant;

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

/**
* 载入党政职务履历弹窗
* 实体标识：nckd_loadppdatepopup
* @author W.Y.C
* @date 2025/11/30 20:18
* @version 1.0
*/
public class LoadppDatePopupFormPlugin extends AbstractFormPlugin implements Plugin {

    @Override
    public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
        String operateKey = afterDoOperationEventArgs.getOperateKey();
        boolean success = afterDoOperationEventArgs.getOperationResult() != null && afterDoOperationEventArgs.getOperationResult().isSuccess();
        if (success && FormConstant.AFFIRM_OP.equalsIgnoreCase(operateKey)) {
            Object value = this.getModel().getValue("nckd_date");
            Object payUnit = this.getModel().getValue(MasConstant.NCKD_MULPAYUNIT);
            Map<String,Object> map = new HashMap(2);
            map.put("date",value);
            map.put(MasConstant.NCKD_MULPAYUNIT,payUnit);
            this.getView().returnDataToParent(map);
            this.getView().close();
        }
    }
}