package nckd.jxccl.sit.hcsi.formplugin.web.file.attach;

import kd.bos.form.CloseCallBack;
import kd.bos.form.FormShowParameter;
import kd.bos.form.ShowType;
import kd.bos.form.events.AfterDoOperationEventArgs;
import kd.bos.form.events.BeforeDoOperationEventArgs;
import kd.bos.form.events.ClosedCallBackEvent;
import kd.bos.form.operate.FormOperate;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.sdk.plugin.Plugin;

/**
 * 标准单据列表插件
 */
public class SIBaseListEx extends AbstractListPlugin implements Plugin {

    private static final Log logger = LogFactory.getLog(SIBaseListEx.class);

    @Override
    public void beforeDoOperation(BeforeDoOperationEventArgs args) {
        super.beforeDoOperation(args);
        FormOperate formOperate = (FormOperate)args.getSource();
        String opKey = formOperate.getOperateKey();
        switch (opKey) {
            case "donothing_adjust":
                this.opeanAdjustPage();
                break;
        }
    }

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

    private void opeanAdjustPage() {
        FormShowParameter formShowParameter = new FormShowParameter();
        formShowParameter.setShowTitle(true);
        formShowParameter.setFormId("nckd_adjustsibase");
        formShowParameter.getOpenStyle().setShowType(ShowType.Modal);
        formShowParameter.setCloseCallBack(new CloseCallBack(this, "adjustSIBase"));
        this.getView().showForm(formShowParameter);
    }

    @Override
    public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
        super.closedCallBack(closedCallBackEvent);
        String actionId = closedCallBackEvent.getActionId();
        if ("adjustSIBase".equals(actionId)) {

        }
    }
}