package nckd.jxccl.hr.psms.plugin.form.other;

import kd.bos.entity.operate.result.IOperateInfo;
import kd.bos.form.events.AfterDoOperationEventArgs;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.sdk.plugin.Plugin;
import nckd.jxccl.base.common.constant.FormConstant;

/**
* 配置有职位津贴的管理人员
* 实体标识：nckd_managerallowance
* @author W.Y.C
* @date 2025/12/18 21:32
* @version 1.0
*/
public class ManagerAllowanceListPlugin extends AbstractListPlugin implements Plugin {

    @Override
    public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
        if(afterDoOperationEventArgs.getOperationResult() != null){
            String operateKey = afterDoOperationEventArgs.getOperateKey();
            if(FormConstant.SUBMIT_OP.equalsIgnoreCase(operateKey)){
                if(!afterDoOperationEventArgs.getOperationResult().isSuccess()){
                    for (IOperateInfo iOperateInfo : afterDoOperationEventArgs.getOperationResult().getAllErrorOrValidateInfo()) {
                        if(iOperateInfo.getMessage().equalsIgnoreCase("只有暂存的数据才允许提交。")){
                            afterDoOperationEventArgs.getOperationResult().setShowMessage(false);
                            this.getView().showTipNotification("只有未确认的数据才允许确认。");
                        }
                    }
                }
            }
        }
    }
}