nc6新增自定义按钮步骤

添加按钮 三种 方式

自己建的xml一定要要和系统的xml放到相同路径下,不然 不会显示

1.首先在功能注册找到要扩展的功能节点对应的XXXconfig.xml

2.自己新建一个xml

xml version="1.0" encoding="UTF-8"?>

<beans></beans>

   <bean class="nc.ui.pubapp.plugin.action.InsertActionInfo"></bean>

        <property name="actionContainer" <="" span="">ref="container" /></property>

        <property name="actionType" value="</span>notedit<span style=" font-size:="" 13px;text-decoration:="" underline;"=""></property>" />

        <property name="target" <="" span="">ref="printMenuAction" /></property>

        <property name="</span>pos<span style=" font-size:="" 13px;text-decoration:="" underline;"=""></property>" value="after" />

        <property name="action" <="" span="">ref="purchZanguAction" /></property>

   <bean id="purchZanguAction" class="nc.ui.jtekt_ext.extpu.m45.action.PurchZanguAction"></bean>

        <property name="model" <="" span="">ref="ManageAppModel" /></property>

20200928190958.jpg

3.自己创建action类 在类里面isActionEnable实现按钮的控制和doaction业务的逻辑处理


package nc.ui.jtekt_ext.extpu.m45.action;

import java.awt.event.ActionEvent;

import nc.ui.pubapp.uif2app.view.BillForm;

import nc.ui.uif2.NCAction;

import nc.ui.uif2.UIState;

import nc.ui.uif2.model.AbstractAppModel;

import nc.ui.uif2.model.BillManageModel;

@SuppressWarnings("serial")

public class PurchZanguAction extends NCAction {

         private BillManageModel model;

         private BillForm editor;

         public PurchZanguAction() {

//按钮名称

                   super.setBtnName("模具费用分摊");

         }

         @Override

         public void doAction(ActionEvent arg0) throws Exception {

                   if (null != this.model.getSelectedData()) {

                            // TODO 实现你的业务逻辑。

                   }

         }

         // 在isActionEnable实现对按钮使能控制  控制按钮是否可编辑

         @Override

         protected boolean isActionEnable() {

                   // 获取界面选择的所有单据

                   Object[] objs = this.model.getSelectedOperaDatas();

                   // 按钮默认不可编辑

                   boolean isActionEnable = false;

                   // 选中行显示

                   if (objs != null && objs.length > 0) {

                            isActionEnable = true;

                   }

                   return isActionEnable;

         }

         public BillManageModel getModel() {

                   return model;

         }

         public void setModel(BillManageModel model) {

                   // 加入AbstractAppModel监听(陷阱,一定要记得加)

                    model.addAppEventListener(this);

                   this.model = model;

         }

         public BillForm getEditor() {

                   return editor;

         }

         public void setEditor(BillForm editor) {

                   this.editor = editor;

         }

}

4.功能注册里面注册xml,参数注册的名称要以Plugin开头


20200928190847.jpg
![20200928190958.jpg](https://upload-images.jianshu.io/upload_images/20301465-108f04f556f3fed0.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

5.前台打开界面就可以看到

已成功XML 注意 model与editor 导入的类一定要注意。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
        <property name="actionContainer" ref="actionsOfList" />
        <property name="actionType" value="notedit" />
        <property name="target" ref="printMenuAction" />
        <property name="pos" value="after" />
        <property name="action" ref="sysOAAction" />
    </bean>
    
    <bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
        <property name="actionContainer" ref="actionsOfCard" />
        <property name="actionType" value="notedit" />
        <property name="target" ref="IMAction" />
        <property name="pos" value="after" />
        <property name="action" ref="sysOAAction" />
    </bean>
    
    <!--联查OA-->
    <bean id="sysOAAction" class="nc.ui.pu.m21.action.OrderToOAAction">
        <property name="model" ref="manageAppModel" />
        <property name="code" value="sysOAAction" />
    </bean>
    
    
        <bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
        <property name="actionContainer" ref="actionsOfList" />
        <property name="actionType" value="notedit" />
        <property name="target" ref="printMenuAction" />
        <property name="pos" value="after" />
        <property name="action" ref="orderimport" />
    </bean>
    
    <bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
        <property name="actionContainer" ref="actionsOfCard" />
        <property name="actionType" value="notedit" />
        <property name="target" ref="IMAction" />
        <property name="pos" value="after" />
        <property name="action" ref="orderimport" />
    </bean>
    
    <!--采购订单导入-->
    <bean id="orderimport" class="nc.ui.pu.m21.action.OrderImportExcelAction">
        <property name="model" ref="manageAppModel"/>
    </bean>
    
   <bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
        <property name="actionContainer" ref="actionsOfList" />
        <property name="actionType" value="notedit" />
        <property name="target" ref="printMenuAction" />
        <property name="pos" value="after" />
        <property name="action" ref="sendeamcction" />
    </bean>
    
    <bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
        <property name="actionContainer" ref="actionsOfCard" />
        <property name="actionType" value="notedit" />
        <property name="target" ref="IMAction" />
        <property name="pos" value="after" />
        <property name="action" ref="sendeamcction" />
    </bean>
    
   <!--  发送EAM -->
    <bean id="sendeamcction" class="nc.ui.pu.m21.action.SendDataEamAction">
        <property name="model" ref="manageAppModel" />
    </bean>
    
    <!-- 采购订单拦截 -->
      <bean class="nc.ui.pubapp.plugin.action.ActionInterceptorInfo">
        <property name="target" ref="saveAction"/>
        <property name="interceptor">
            <bean class="nc.ui.pu.m21.Interceptor.OrderSaveInterceptor">
                <property name="model" ref="manageAppModel" />
                <property name="editor" ref="billFormEditor" /> 
            </bean>
        </property>
    </bean> 
    
     <!-- add by CYQ 2020年9月22日 离职人员修订按钮 -->
    <bean id="ryxdAction" class="nc.ui.pu.m21.action.QuitPsndocEditAction">
        <property name="editor" ref="billFormEditor" />
        <property name="model" ref="manageAppModel" />
    </bean>
    
    <bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
        <property name="actionContainer" ref="actionsOfList" />
        <property name="actionType" value="notedit" />
        <property name="target" ref="printMenuAction" />
        <property name="pos" value="after" />
        <property name="action" ref="ryxdAction" />
    </bean>
    
    <bean class="nc.ui.pubapp.plugin.action.InsertActionInfo">
        <property name="actionContainer" ref="actionsOfCard" />
        <property name="actionType" value="notedit" />
        <property name="target" ref="IMAction" />
        <property name="pos" value="after" />
        <property name="action" ref="ryxdAction" />
        <!--  -->
    </bean>
</beans>

最后一种

直接在原有XML在添加 参考

<?xml version="1.0" encoding="gbk"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
 <!-- 环境变量 -->
 <bean id="context" class="nc.vo.uif2.LoginContext">
 </bean>
 <!-- 模板容器,负责对模板的统一装载 -->
 <bean id="templateContainer" class="nc.ui.uif2.editor.TemplateContainer"
     init-method="load">
     <property name="context" ref="context" />
     <property name="nodeKeies">
         <list>
             <value>bt</value>
         </list>
     </property>
 </bean>
 <!-- 对象转换器工厂,由此获取操作对象的特征信息,元数据要实现IBDObject接口 -->
 <!-- 对于有元数据的VO,可以使用下面的配置 -->
 <bean id="boadatorfactory" class="nc.vo.bd.meta.BDObjectAdpaterFactory" />
 <!-- 应用服务类,负责进行模型操作的处理 -->
 <bean id="batchModelService" class="nc.ui.pubapp.pub.smart.SmartBatchAppModelService">
     <property name="serviceItf" value="nc.itf.sphzxzy.IMmcontrastMaintain" />
     <property name="voClass" value="nc.vo.sphzxzy.mmcontrast.MMContrastVO" />
 </bean>
 <!-- 批量操作应用模型 ,缓存界面数据 -->
 <bean id="batchBillTableModel" class="nc.ui.pubapp.uif2app.model.BatchBillTableModel">
     <property name="context" ref="context" />
     <property name="service" ref="batchModelService" />
     <property name="validationService" ref="validateService" />
     <property name="businessObjectAdapterFactory" ref="boadatorfactory" />
 </bean>
 <!-- 批量操作前台校验 -->
 <bean id="validateService" class="nc.ui.uif2.model.DefaultBatchValidationService">
     <property name="editor" ref="list" />
 </bean>
     
 <bean id="modelDataManager" class="nc.ui.pubapp.uif2app.model.BatchModelDataManager">
     <property name="model" ref="batchBillTableModel" />
     <property name="service" ref="batchModelService" />
 </bean>
 <!-- 编辑态关闭节点时提示是否保存 -->
 <bean id="closingListener" class="nc.ui.uif2.FunNodeClosingHandler">
     <property name="model" ref="batchBillTableModel" />
     <property name="saveaction" ref="saveAction" />
     <property name="cancelaction" ref="cancelAction" />
 </bean>
 
 <bean id="orgPanel" class="nc.ui.pubapp.uif2app.view.OrgPanel"
     init-method="initUI">
     <property name="model" ref="batchBillTableModel" />
     <property name="dataManager" ref="modelDataManager" />
 </bean>
 <!-- 列表控件 -->
 <bean id="list" class="nc.ui.pubapp.uif2app.view.ShowUpableBatchBillTable"
     init-method="initUI">
     <property name="model" ref="batchBillTableModel" />
     <property name="voClassName" value="nc.vo.sphzxzy.mmcontrast.MMContrastVO" />
     <property name="isBodyAutoAddLine" value="false" />
     <property name="addLineAction" ref="addAction" />
 </bean>
 
 <!-- 事件监听 -->
 <bean id="appEventHandlerMediator" class="nc.ui.pubapp.uif2app.model.AppEventHandlerMediator">
     <property name="model" ref="batchBillTableModel" />
     <property name="handlerGroup">
         <list>
             <!-- 表体字段编辑前事件 -->
             <bean class="nc.ui.pubapp.uif2app.event.EventHandlerGroup">
                 <property name="event" value="nc.ui.pubapp.uif2app.event.card.CardBodyBeforeEditEvent"/>
                 <property name="handler">
                     <bean class="nc.ui.sphzxzy.mmcontrast.handler.BodyBeforeEditHandler"/>
                 </property>
             </bean>     
             <!-- 表体表尾字段编辑后事件 -->
             <bean class="nc.ui.pubapp.uif2app.event.EventHandlerGroup">
                 <property name="event" value="nc.ui.pubapp.uif2app.event.card.CardBodyAfterEditEvent"/>
                 <property name="handler">
                     <bean class="nc.ui.sphzxzy.mmcontrast.handler.BodyAfterEditHandler"/>
                 </property>
             </bean> 
         </list>
     </property>     
 </bean> 
 <!-- 界面布局总装-->
 <bean id="container" class="nc.ui.uif2.TangramContainer"
     init-method="initUI">
     <property name="tangramLayoutRoot">
         <bean class="nc.ui.uif2.tangramlayout.node.VSNode">
             <property name="down">
                 <bean class="nc.ui.uif2.tangramlayout.node.CNode">
                     <property name="component" ref="list" />
                 </bean>
             </property>
             <property name="up">
                 <bean class="nc.ui.uif2.tangramlayout.node.CNode">
                     <property name="component" ref="orgPanel" />
                 </bean>
             </property>
             <property name="dividerLocation" value="31" />
         </bean>
     </property>
         <property name="actions">
                 <list>
                 <ref bean="addAction" />
                     <ref bean="editAction" />
                     <ref bean="delAction" />
                     <ref bean="separatorAction" />
             
                     <ref bean="refreshAction" />
                     <ref bean="QueryAction" />
                     
                     <!--<ref bean="printActionGroup" />-->
                 </list>
         </property>
         <property name="editActions">
                 <list>
                 <ref bean="addAction" />
                     <ref bean="delAction" />
                     <ref bean="separatorAction" />
             
                     <ref bean="saveAction" />
                     <ref bean="cancelAction" />
                 </list>
         </property>
     <property name="model" ref="batchBillTableModel" />
 </bean> 

 <!-- Actions -->
 <bean id="separatorAction" class="nc.funcnode.ui.action.SeparatorAction" />
 <bean id="addAction" class="nc.ui.sphzxzy.mmcontrast.action.MmcontrastAddLineAction">
     <property name="model" ref="batchBillTableModel" />
     <property name="voClassName" value="nc.vo.sphzxzy.mmcontrast.MMContrastVO" />
 </bean>
 <bean id="editAction" class="nc.ui.pubapp.uif2app.actions.batch.BatchEditAction">
     <property name="model" ref="batchBillTableModel" />
 </bean>
 <bean id="delAction" class="nc.ui.pubapp.uif2app.actions.batch.BatchDelLineAction">
     <property name="model" ref="batchBillTableModel" />
 </bean>
 <bean id="saveAction" class="nc.ui.pubapp.uif2app.actions.batch.BatchSaveAction">
     <property name="model" ref="batchBillTableModel" />
     <property name="editor" ref="list" />
 </bean>
 
 <!-- 查询 -->
 <bean id="QueryAction" class="nc.ui.qili.rack.action.QueryAction">
             <property name="batchBillTableModel" ref="batchBillTableModel"></property>
             <property name="modelDataManager" ref="modelDataManager"></property>
             <property name="list" ref="list"></property>
     </bean>
     
 
 <bean id="cancelAction" class="nc.ui.pubapp.uif2app.actions.batch.BatchCancelAction">
     <property name="model" ref="batchBillTableModel" />
     <property name="editor" ref="list" />
 </bean>
 <bean id="refreshAction" class="nc.ui.uif2.actions.batch.BatchRefreshAction">
     <property name="model" ref="batchBillTableModel"></property>
     <property name="modelManager" ref="modelDataManager"></property>
 </bean>

 <!-- 打印管理,这是一个下拉按钮,按钮下边的放置三个子按钮预览、打印 、输出 -->
 <bean id="printActionGroup" class="nc.funcnode.ui.action.MenuAction">
     <property name="code" value="printManage" />
<property name="name">
         <bean class="nc.ui.uif2.I18nFB">
             <property name="resDir" value="common"></property>
             <property name="resId" value="UC001-0000007"></property>
             <property name="defaultValue" value="打印"></property>
         </bean>
     </property>
     <property name="actions">
         <list>
             <ref bean="printpreviewaction" />
             <ref bean="printaction" />
             <ref bean="outputAction" />
         </list>
     </property>
 </bean>
 <!-- 预览 -->
 <bean id="printpreviewaction" class="nc.ui.pubapp.uif2app.actions.SingleTablePrintAction">
     <property name="preview" value="true" />
     <property name="model" ref="batchBillTableModel" />
     <property name="editor" ref="list" />
 </bean>
 <!-- 打印 -->
 <bean id="printaction" class="nc.ui.pubapp.uif2app.actions.SingleTablePrintAction">
     <property name="preview" value="false" />
     <property name="model" ref="batchBillTableModel" />
     <property name="editor" ref="list" />
 </bean>
 <!-- 输出 -->
 <bean id="outputAction" class="nc.ui.pubapp.uif2app.actions.OutputAction">
    <property name="model" ref="batchBillTableModel" />
    <property name="parent" ref="list" />
 </bean> 
</beans>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 214,904评论 6 497
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 91,581评论 3 389
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 160,527评论 0 350
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,463评论 1 288
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,546评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,572评论 1 293
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,582评论 3 414
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,330评论 0 270
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,776评论 1 307
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,087评论 2 330
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,257评论 1 344
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,923评论 5 338
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,571评论 3 322
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,192评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,436评论 1 268
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,145评论 2 366
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,127评论 2 352