操作列插件设置可见性和锁定性
应用场景
插件需要动态控制操作列的显示和隐藏的情况,一般是状态变化后更新操作列。
功能介绍
1. 单据体上操作列控制列的显示与隐藏实例代码
Ø 值更新的情况下进行控制
public void propertyChanged(PropertyChangedArgs propertychangedargs) {
this.getView().showMessage("title", "content", MessageTypes.Commit);
EntryGrid entryGrid = this.getControl("entryentity");
List<String> opeIds = new ArrayList<>();
opeIds.add("view");
entryGrid.hideOperateItems("operationcolumnap", 0, opeIds);
this.getView().showMessage(propertychangedargs.getChangeSet().toString());
}
Ø 初始加载时控制显示与隐藏
@Override
public void initialize() {
EntryGrid entryGrid = this.getControl("entryentity");
entryGrid.addPackageDataListener(pkEvent -> {
Object status = pkEvent.getRowData().get("status");
if (pkEvent.getSource() instanceof OperationColumn
&& "operationcolumnap".equalsIgnoreCase(((OperationColumn) pkEvent.getSource()).getKey())) {
List<OperationColItem> operationColItems = (List<OperationColItem>) pkEvent.getFormatValue();
for (OperationColItem operationColItem : operationColItems) {
//
if ("audit".equalsIgnoreCase(operationColItem.getOperationKey()) && status == "审核") {
operationColItem.setVisible(false);
operationColItem.setLocked(true);
}
}
}
});
super.initialize();
}
2. 列表上操作列设置可见性示例代码
@Override
public void initialize() {
EntryGrid entryGrid = this.getControl("entryentity");
entryGrid.addPackageDataListener(pkEvent -> {
Object status = pkEvent.getRowData().get("status");
if (pkEvent.getSource() instanceof OperationColumn
&& "operationcolumnap".equalsIgnoreCase(((OperationColumn) pkEvent.getSource()).getKey())) {
List<OperationColItem> operationColItems = (List<OperationColItem>) pkEvent.getFormatValue();
for (OperationColItem operationColItem : operationColItems) {
//
if ("audit".equalsIgnoreCase(operationColItem.getOperationKey()) && status == "审核") {
operationColItem.setVisible(false);
operationColItem.setLocked(true);
}
}
}
});
super.initialize();
}
相关链接
开发服务云新特性发布汇总
https://club.kdcloud.com/article/76619783260443136
操作列插件设置可见性和锁定性
本文2024-09-23 00:23:32发表“云苍穹知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-cangqiong-139169.html