(大佬勿喷,只为记录)
需求:
在箭头所指位置添加”代替品”按钮且与打印按钮组有距离
1、找到需求对应的功能注册节点
2、拷出xml路径(准备编写按钮配置文件(.xml)时使用)
3、src/client目录下编写按钮类
package nc.ui.pubapp.plugin.action;
import java.awt.event.ActionEvent;
import nc.ui.pub.beans.MessageDialog;
import nc.ui.pubapp.uif2app.model.BillManageModel;
import nc.ui.so.m30.billui.view.SaleOrderBillForm;
import nc.ui.uif2.NCAction;
@SuppressWarnings("restriction")
public class XSBJDbuttonAction extends NCAction {
//根据节点xml中其他按钮bean选择model、editor的类型
private BillManageModel model;
private SaleOrderBillForm editor;
/**
* 销售订单维护
* nc/ui/so/m30/billui/model/saleorder_config.xml
* nc/ui/so/m30/billui/model/saleorder_tempsave_config.xml
*/
private static final long serialVersionUID = 1L;
public XSBJDbuttonAction(){
super.setBtnName("代替品");
}
@Override
public void doAction(ActionEvent arg0) throws Exception {
MessageDialog.showHintDlg(editor, "提示", "测试自己新按钮按下");
}
public BillManageModel getModel() {
return model;
}
public void setModel(BillManageModel model) {
this.model = model;
}
public SaleOrderBillForm getEditor() {
return editor;
}
public void setEditor(SaleOrderBillForm editor) {
this.editor = editor;
}
}
4、src/client目录下编写扩展按钮的xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- 间隔按钮 -->
<bean id="separatorAction" class="nc.funcnode.ui.action.SeparatorAction" />
<!-- 在打印按钮组后插入间隔按钮 -->
<bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
<property name="actionContainer" ref="actionsOfList" />
<property name="actionType" value="notedit" />
<property name="target" ref="printActionGroup" />
<property name="pos" value="after" />
<property name="action" ref="separatorAction" />
</bean>
<!-- 配置列表界面显示的按钮 actionsOfList-->
<!-- 在间隔按钮后插入自己的按钮 -->
<bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
<property name="actionContainer" ref="actionsOfList" />
<property name="actionType" value="notedit" />
<property name="target" ref="separatorAction" />
<property name="pos" value="after" />
<property name="action" ref="tidaiping" />
</bean>
<!-- 配置卡片界面显示的按钮 actionsOfCard-->
<!--<bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
actionsOfCard 或 actionsOfList
<property name="actionContainer" ref="actionsOfCard" />
在何种状态下显示(notedit 或 edit)
<property name="actionType" value="notedit" />
表示按钮在界面中的位置
<property name="target" ref="printActionGroup" />
新按钮的位置printActionGroup按钮前/后(before 或 after)
<property name="pos" value="after" />
将新按钮的bean放入到按钮扩展类中
<property name="action" ref="tidaiping" />
</bean>-->
<!-- 自己的按钮 -->
<bean id="tidaiping" class="nc.ui.pubapp.plugin.action.XSBJDbuttonAction">
<!-- model、editor属性名与按钮类对应 -->
<property name="model" ref="ManageAppModel" />
<property name="editor" ref="billFormEditor" />
<!-- 必须属性(不加销售订单维护节点点不开后台报code为null) -->
<property name="code" value="begin"/>
</bean>
</beans>
5、二开NC的文件统一放在src/client目录下(项目启动会自动加载此目录的文件)
6、参数注册
到此编码注册工作结束。
7、启动UAP中间件
8、启动UAP客户端(注意一定要从这里启动页面)
9、yonyou账户登录Yonyou NC,扩展按钮完成
很简单的一个事情,我却弄了好几天走了好多弯路。在这里记录一下。。。。