package yem.wm.cm.htqs.form;

import java.util.ArrayList;
import java.util.EventObject;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.form.FormShowParameter;
import kd.bos.form.control.Control;

/**
 *    合同签定方向确认表单插件
 * 
 * 
 * */
public class SigningConfirmEdit extends AbstractBillPlugIn {
	// 监听页面按钮点击
	@Override
	public void registerListener(EventObject e) {
		// TODO Auto-generated method stub
		super.registerListener(e);
		this.addClickListeners("btncancel","btnok");  //监听确认和取消按钮
	}
	
	@Override
	public void click(EventObject evt) {
		// TODO Auto-generated method stub
		super.click(evt);
        Control source = (Control) evt.getSource();
        if (StringUtils.equals(source.getKey(), "btnok")) {
            HashMap<String,String> hashMap = new HashMap<>();
            String ourside = (String)this.getView().getModel().getValue("yem_radiogroupfield");
           
            if ("1".equals(ourside))hashMap.put("signing", "ourside");
            if ("2".equals(ourside))hashMap.put("signing", "oppositeparty");
            this.getView().returnDataToParent(hashMap);
            this.getView().close();
        } else if (StringUtils.equals(source.getKey(),"btncancel")) {
            //被点击控件为取消则设置返回值为空并关闭页面（在页面关闭回调方法中必须验证返回值不为空，否则会报空指针）
            this.getView().returnDataToParent(null);
            this.getView().close();
        }
	}
}
