package nckd.jimin.jyyy.bd.plugin.form;

import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.form.control.Toolbar;
import kd.bos.form.control.events.UploadEvent;
import kd.bos.form.control.events.UploadListener;
import java.util.EventObject;

/**
 * 表单标识：手写签名（nckd_bos_handwritten__ext）
 * @author wnaghaiwu_kd
 * @date 2025/05/08
 */
public class HandWrittenSignFormPlugin extends AbstractBillPlugIn implements UploadListener {
    @Override
    public void initialize() {
        super.initialize();

        Toolbar toolbar = this.getControl("nckd_toolbarap");
        toolbar.addUploadListener(this);
    }

    @Override
    public void registerListener(EventObject e) {
        super.registerListener(e);
    }

    @Override
    public void upload(UploadEvent evt) {
//        UploadListener.super.upload(evt);

        Object[] urls = evt.getUrls();
        String callbackKey = evt.getCallbackKey();
        if ("nckd_btnupload".equals(callbackKey)) {
            //执行业务逻辑
            if(urls.length > 0){
                this.getModel().setValue("handwrittensign", urls[0].toString());
            }
        }
    }
}
