package nckd.jxccl.hr.tsc.plugin.form;

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 java.util.HashMap;
import java.util.Map;

/**
 * 动态表单插件
 */
public class AnnounceDowndateFormPlugin extends AbstractFormPlugin implements Plugin {

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