分录新增单据编号 点击单据编号打开单据原创
6人赞赏了该文章
1,872次浏览
编辑于2022年11月11日 11:45:09
实现步骤
分录中新增文本字段 开启显示为超链
编写表单插件实现HyperLinkClickListener接口 重写hyperLinkClick方法
监听分录
在hyperLinkClick打开单据
代码
public class AdjustBillEditPlugin extends AbstractFormPlugin implements HyperLinkClickListener { public static final String BILL_ENTRY = "billentry"; public static final String FHGK_CUSTOMER_ASK_RECORD = "fhgk_customeraskrecord"; @Override public void registerListener(EventObject e) { super.registerListener(e); // 监听分录行 EntryGrid entryGrid = this.getView().getControl(BILL_ENTRY); entryGrid.addHyperClickListener(this); } @Override public void hyperLinkClick(HyperLinkClickEvent hyperLinkClickEvent) { // 获取超链接点击的属性名 String fieldName = hyperLinkClickEvent.getFieldName(); // 获取点击分录行的下标 int rowIndex = hyperLinkClickEvent.getRowIndex(); if (StringUtils.containsIgnoreCase(fieldName,"fhgk_checkno")){ // 获取超链接信息 单据编号 Object checkNo = this.getModel().getValue(fieldName, rowIndex); // 查询单据详情 DynamicObject customerAskRecord = QueryUtil.loadSingle(FHGK_CUSTOMER_ASK_RECORD , new QFilter("billno", QCP.equals, checkNo).toArray()); BillShowParameter billShowParameter = new BillShowParameter(); // 设置打开单据的标识 billShowParameter.setFormId("fhgk_customeraskrecord"); // 设置打开单据的id billShowParameter.setPkId(customerAskRecord.getPkValue()); // 设置打开的样式 billShowParameter.getOpenStyle().setShowType(ShowType.Modal); this.getView().showForm(billShowParameter); } } }
如文章对你有帮助,那么请点赞收藏吧!
推荐阅读