nc65用友uap开发节点通过按钮调用打开另外一个节点并传数据跳编辑态(推单)

本文介绍如何在用友UAP平台通过按钮调用另一个功能节点并传递数据进入编辑状态,具体包括按钮代码实现、XML配置修改及节点初始化监听类的编写。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

nc65用友uap开发节点通过按钮调用打开另外一个节点并传数据跳编辑态(推单)
目标:如图所示,通过合同续约按钮调用打开合同管理中心节点,并且把相应数据传入到合同管理中心节点(编辑态)
1.按钮代码:
package nc.ui.fdc_pr.h303113510.actions;

import java.awt.event.ActionEvent;

import nc.desktop.ui.WorkbenchEnvironment;
import nc.funcnode.ui.FuncletInitData;
import nc.funcnode.ui.FuncletWindowLauncher;
import nc.ui.fdc_pr.h303202005.ace.handler.InitDataUtil;
import nc.ui.pub.beans.MessageDialog;
import nc.ui.uif2.NCAction;
import nc.ui.uif2.model.AbstractAppModel;
import nc.vo.fdc_pr.h303113510.AggRentPact;
import nc.vo.sm.funcreg.FuncRegisterVO;
/**
 * 
 * @author: zenglong
 * @ClassName: ContracttAction 
 * @Description: 续约合同按钮
 * @date: 2016年12月18日
 */
public class ContracttAction extends NCAction {
	
	private static final long serialVersionUID = 9169939802794646069L;
	private AbstractAppModel model;
	public AbstractAppModel getModel() {
		return model;
	}
	public void setModel(AbstractAppModel model) {
		this.model = model;
	}
	public ContracttAction(){
		setBtnName("合同续约");
		setCode("contractt");
	}
	@Override
	public void doAction(ActionEvent e) throws Exception {
		AggRentPact aggRent=(AggRentPact) this.getModel().getSelectedData();
		if (aggRent==null || aggRent.equals("")) {
			MessageDialog.showErrorDlg(getModel().getContext().getEntranceUI(),"错误","请选中行后进行操作");
			return;
		}

		FuncRegisterVO funvo = WorkbenchEnvironment.getInstance().getFuncRegisterVO("H303113510");
		FuncletWindowLauncher.openFuncNodeInTabbedPane(null, funvo, getInitData(aggRent), null, true);
	}

	public FuncletInitData getInitData(AggRentPact aggRent){
		FuncletInitData data  = new FuncletInitData();
		
		data.setInitData(aggRent);
		data.setInitType(-1);
		return data;
	}
}
2.需要打开节点的xml配置文件中,修改初始化监听

<!-- 打开节点监听 newadd-->
	<bean id="InitDataListener" class="nc.ui.fdc_pr.h303113510.ace.handler.MyDefaultFuncNodeInitDataListener">
		<property name="model" ref="bmModel"/>
		<property name="context" ref="context"></property>
		<property name="voClassName" value="nc.vo.fdc_pr.h303113510.AggRentPact"/>
		<property name="billform" ref="billForm"></property>
		<property name="defaultUIF2RefEditor">
			<ref bean="defaultUIF2RefEditor" />
		</property>
	</bean>
<!-- 导入编辑器 -->
	<bean id="defaultUIF2RefEditor" class="nc.itf.fdc.pub.DefaultUIF2RefEditor">
		<property name="addAction" ref="addAction" />
		<property name="billcardPanelEditor" ref="billForm" />
		<property name="appModel" ref="bmModel" />
	</bean>



3.节点初始化监听类

package nc.ui.fdc_pr.h303113510.ace.handler;

import nc.funcnode.ui.FuncletInitData;
import nc.itf.fdc.pub.DefaultUIF2RefEditor;
import nc.ui.pubapp.uif2app.model.DefaultFuncNodeInitDataListener;
import nc.ui.pubapp.uif2app.view.ShowUpableBillForm;
import nc.vo.fdc_pr.h303113510.AggRentPact;
import nc.vo.fdc_pr.h303202005.AggRevfare;

/**
 * 
 * @author: zenglong
 * @ClassName: MyDefaultFuncNodeInitDataListener 
 * @Description: 节点打开初始化数据
 * @date: 2016年12月18日
 */
public class MyDefaultFuncNodeInitDataListener extends DefaultFuncNodeInitDataListener {

	ShowUpableBillForm billform;
	private DefaultUIF2RefEditor defaultUIF2RefEditor = null;
    public void initData(FuncletInitData data) {
    	if (null == data) {
			this.getModel().initModel(null);
			return;
		}
    	//用参数中传过来的数据初始化AppModel,可能会转换成VO或VO数组,根据业务确定
    	AggRentPact initData =(AggRentPact) data.getInitData();
    	//调用添加按钮
    	getDefaultUIF2RefEditor().addNew();
    	//初始化数据
    	getDefaultUIF2RefEditor().setValue(initData);
}
	public ShowUpableBillForm getBillform() {
		return billform;
	}
	public void setBillform(ShowUpableBillForm billform) {
		this.billform = billform;
	}
	public DefaultUIF2RefEditor getDefaultUIF2RefEditor() {
		return defaultUIF2RefEditor;
	}
	public void setDefaultUIF2RefEditor(DefaultUIF2RefEditor defaultUIF2RefEditor) {
		this.defaultUIF2RefEditor = defaultUIF2RefEditor;
	}
    
    
}
4.
package nc.itf.fdc.pub;

import nc.ui.pub.bill.BillData;
import nc.ui.uif2.NCAction;
import nc.ui.uif2.editor.IBillCardPanelEditor;
import nc.ui.uif2.model.AbstractUIAppModel;
import nc.vo.pub.AggregatedValueObject;



public  class DefaultUIF2RefEditor  {
 
	
	
	private NCAction addAction = null;
									
	private Exception ex;    //保存过程中通过拦截器将异常抛出 

	
	private IBillCardPanelEditor billcardPanelEditor = null;
	
	private AbstractUIAppModel appModel = null;
	

	protected NCAction createAddAction()
	{
		return null;
	}
	
	protected NCAction createSaveAction()
	{
		return null;
	} 
	
	protected NCAction createCancelAction()
	{
		return null;
	}
	
	protected IBillCardPanelEditor createBillCardPanelEditor()
	{
		return null;
	}
	
	protected AbstractUIAppModel createAppModel()
	{
		return null;
	}
	
	
	 
	
	/**
	 * 新增操作
	 * 
	 * @see nc.itf.trade.excelimport.IImportableEditor#addNew()
	 */
	public void addNew() {
		try {
			getAddAction().actionPerformed(null);
		} catch (Exception e) {
			nc.bs.logging.Logger.error(e.getMessage());
		}
	} 
	
	/**
	 * 设值操作
	 * 
	 * 标准的操作步骤如下:
	 * 1,转型VO为ExtendedAggregatedValueObject
	 * 2,根据转换规则处理VO的相关属性值
	 * 3,将处理后的VO值设置到界面上
	 */
	public void setValue(Object obj) {
		if(getBillcardPanelEditor() != null)
		{
			BillData bd = getBillcardPanelEditor().getBillCardPanel().getBillData();
			bd.setBillValueVO((AggregatedValueObject)obj);
		}
	}



	
	/**
	 * 返回AddAction对象
	 */
	public NCAction getAddAction() {
		
		if(addAction == null)
			addAction = createAddAction();
		return this.addAction;
	}

	

	public void setAddAction(NCAction addAction) {
		this.addAction = addAction;
	}

	public IBillCardPanelEditor getBillcardPanelEditor() {
		
		if(billcardPanelEditor == null)
			billcardPanelEditor = createBillCardPanelEditor();
		return billcardPanelEditor;
	}

	public void setBillcardPanelEditor(IBillCardPanelEditor billcardPanelEditor) {
		this.billcardPanelEditor = billcardPanelEditor;
	}



	
	public AbstractUIAppModel getAppModel() {
		
		if(this.appModel == null)
			appModel = createAppModel();
		return appModel;
	}

	public void setAppModel(AbstractUIAppModel model) {
		this.appModel = model;
	}
	
	public int getExportCount() {
		return 1;
	}

	public Exception getEx() {
		return ex;
	}

	public void setEx(Exception ex) {
		this.ex = ex;
	}
}




评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值