基于NC65,实现客户端单据的导入导出按钮配置
其实代码非常简单,因为它自己底层已经封装好了接口,你只需要在xml文件中配置即可
首先在xml文件中添加按钮
<!-- 列表显示下的按钮 -->
<bean id="actionsOfList" class="nc.ui.uif2.actions.StandAloneToftPanelActionContainer">
<constructor-arg ref="billListView" />
<property name="model" ref="bmModel" />
<property name="actions">
<list>
<ref bean="importExportMenu"/>
</list>
</property>
</bean>
然后为按钮添加引用
<!--======= 动作:[newActions] [导入导出] ===========-->
<!-- 导入导出按钮-->
<bean id="importExportMenu" class="nc.funcnode.ui.action.MenuAction">
<property name="code" value="importExport" />
<property name="name" value="导出" />
<property name="actions">
<list>
<ref bean="ImportData" /> <!-- 导入Excel -->
<ref bean="ExportData" /> <!-- 导出Excel -->
<ref bean="ExportTemplate" /> <!-- 导出模板 -->
</list>
</property>
</bean>
<!-- 导入Excel(根据模板填充数据) -->
<bean id="ImportData" class="nc.ui.uif2.excelimport.ImportAction">
<property name="model" ref="bmModel" />
<property name="importableEditor" ref="ImportExportEditor" />
<property name="btnName" value="导入Excel" />
</bean>
<!-- 导出模板到Excel -->
<bean id="ExportTemplate" class="nc.ui.uif2.excelimport.ExportExcelTemplateAction">
<property name="model" ref="bmModel" />
<property name="importableEditor" ref="ImportExportEditor" />
<property name="btnName" value="导出模板" />
</bean>
<!-- 导入项目编辑器 -->
<bean id="ImportExportEditor" class="nc.ui.uif2.excelimport.DefaultUIF2ImportableEditor">
<property name="billcardPanelEditor" ref="billForm" />
<property name="addAction" ref="addAction" />
<property name="cancelAction" ref="cancelAction" />
<property name="saveAction" ref="saveScriptAction" />
<property name="appModel" ref="bmModel" />
</bean>
<!-- 导出数据到Excel -->
<bean id="ExportData" class="nc.ui.uif2.excelimport.ExportAction">
<property name="model" ref="bmModel" />
<property name="importableEditor" ref="ImportExportEditor" />
<property name="btnName" value="导出Excel" />
</bean>
其中 看好每个配置的ref=“”,要使其每个都能映射到,具体看你自己的代码;
最后祝大家成功
原文链接:https://blog.csdn.net/WithElapse/article/details/90902107