package nckd.jxccl.hr.htm.plugin.form.quitapply;

import kd.bos.bill.BillShowParameter;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.form.ShowType;
import kd.bos.form.events.AfterDoOperationEventArgs;
import kd.bos.form.events.HyperLinkClickArgs;
import kd.bos.list.plugin.AbstractListPlugin;
import nckd.jxccl.hr.htm.common.quitapply.QuitApplyConstant;

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

/**
 * 退休申请列表插件
 * @entity: nckd_retireapplybasebill
 * @author: jtd
 * @date: 2025/11/18 19:40
 */
public class RetireApplyBaseBillListPlugin extends AbstractListPlugin {

    @Override
    public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
        super.afterDoOperation(afterDoOperationEventArgs);

        if (afterDoOperationEventArgs.getOperationResult() != null && afterDoOperationEventArgs.getOperationResult().isSuccess()) {
            // 新增退休待办申请
            if (StringUtils.equals(QuitApplyConstant.RETIRE_APPLE_OP,afterDoOperationEventArgs.getOperateKey())) {
                BillShowParameter showParameter = new BillShowParameter();
                showParameter.setFormId(QuitApplyConstant.NCKD_RETIREAPPLY_ENTITY);
                showParameter.setCaption("新增代退休申请");
                showParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
                getView().showForm(showParameter);
            }
        }
    }

    @Override
    public void billListHyperLinkClick(HyperLinkClickArgs args) {
        super.billListHyperLinkClick(args);

        // 自定义超链接点击事情处理
        args.setCancel(true);
        // 打开退休申请表单
        BillShowParameter showParameter = new BillShowParameter();
        showParameter.setFormId(QuitApplyConstant.NCKD_RETIREAPPLY_ENTITY);
        showParameter.setPkId(getFocusRowPkId());
        showParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
        getView().showForm(showParameter);
    }
}
