左树右表页面,点击表格的新建按钮,获取选中的树节点
通过自定义action的方式来实现
新建一个action文件TreeActionWidget.ts
import { ActionType, ActionWidget, SPI, ViewActionTarget, RouterViewActionWidget } from '@kunlun/dependencies';
import { OioNotification } from '@kunlun/vue-ui-antd';
@SPI.ClassFactory(
ActionWidget.Token({
actionType: [ActionType.View],
target: [ViewActionTarget.Router],
name: 'uiView0000000000079503' // action对应的name
})
)
export class TreeActionWidget extends RouterViewActionWidget {
protected async clickAction() {
const context = this.rootRuntimeContext.view.context || {};
const activeTreeContext = context.activeTreeContext || null;
if (!activeTreeContext) {
// 没有选中左侧树
OioNotification.error('', '请选择左侧节点!');
} else {
// 选中的时候
(this.action as any).context = activeTreeContext;
// 执行原先的action逻辑
super.clickAction();
}
}
}
Oinone社区 作者:oinone原创文章,如若转载,请注明出处:https://doc.oinone.top/frontend/72.html
访问Oinone官网:https://www.oinone.top获取数式Oinone低代码应用平台体验