如何实现业务表格跳转页面设计器设计器页面

后端实现

代理继承界面设计器视图模型

@Model.model(MyView.MODEL_MODEL)
@Model(displayName = "视图代理")
@Model.Advanced(type = ModelTypeEnum.PROXY)
public class MyView extends UiDesignerViewProxy {
    public static final String MODEL_MODEL = "hr.simple.MyView";

    @Field.Integer
    @Field(displayName = "页面布局ID")
    private Long uiDesignerViewLayoutId;
}

重写查询接口,返回页面布局ID,重写创建接口,实现创建页面逻辑。

package pro.shushi.pamirs.top.core.action;

import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import pro.shushi.pamirs.boot.base.constants.ViewConstants;
import pro.shushi.pamirs.boot.base.enmu.ActionTargetEnum;
import pro.shushi.pamirs.boot.base.ux.annotation.action.UxAction;
import pro.shushi.pamirs.boot.base.ux.annotation.action.UxRoute;
import pro.shushi.pamirs.boot.base.ux.annotation.button.UxRouteButton;
import pro.shushi.pamirs.framework.connectors.data.sql.Pops;
import pro.shushi.pamirs.framework.connectors.data.sql.query.LambdaQueryWrapper;
import pro.shushi.pamirs.meta.annotation.Action;
import pro.shushi.pamirs.meta.annotation.Function;
import pro.shushi.pamirs.meta.annotation.Model;
import pro.shushi.pamirs.meta.api.dto.condition.Pagination;
import pro.shushi.pamirs.meta.api.dto.wrapper.IWrapper;
import pro.shushi.pamirs.meta.api.session.PamirsSession;
import pro.shushi.pamirs.meta.constant.FunctionConstants;
import pro.shushi.pamirs.meta.enmu.*;
import pro.shushi.pamirs.top.api.model.MyView;
import pro.shushi.pamirs.ui.designer.api.designe.UiDesignerViewLayoutService;
import pro.shushi.pamirs.ui.designer.model.UiDesignerViewLayout;
import pro.shushi.pamirs.ui.designer.pmodel.UiDesignerViewLayoutProxy;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author Yexiu at 20:39 on 2025/3/27
 */

@Component
@Model.model(MyView.MODEL_MODEL)
public class MyViewAction {

    @Autowired
    private UiDesignerViewLayoutService uiDesignerViewLayoutService;

    @Action.Advanced(name = FunctionConstants.create, managed = true)
    @Action(displayName = "创建", summary = "添加", bindingType = ViewTypeEnum.FORM)
    @Function(name = FunctionConstants.create)
    @Function.fun(FunctionConstants.create)
    public MyView create(MyView data) {
        UiDesignerViewLayoutProxy uiDesignerViewLayoutProxy = new UiDesignerViewLayoutProxy();
        uiDesignerViewLayoutProxy.setBizType(data.getBizType());
        uiDesignerViewLayoutProxy.setDesignerActionBarType(data.getDesignerActionBarType());
        uiDesignerViewLayoutProxy.setViewType(data.getType());
        uiDesignerViewLayoutProxy.setModel(data.getModel());
        uiDesignerViewLayoutProxy.setModule(PamirsSession.getServApp());
        uiDesignerViewLayoutProxy.setViewTitle(data.getTitle());
        uiDesignerViewLayoutProxy.setUsingDefaultView(data.getLoadLayout());

        UiDesignerViewLayoutProxy saveUiDesigner = uiDesignerViewLayoutService.create(uiDesignerViewLayoutProxy);
        data.setDesignerViewId(saveUiDesigner.getId());
        return data;
    }

    @Function.Advanced(type = FunctionTypeEnum.QUERY, displayName = "查询列表")
    @Function.fun(FunctionConstants.queryPage)
    @Function(openLevel = {FunctionOpenEnum.API, FunctionOpenEnum.LOCAL})
    public Pagination<MyView> queryPage(Pagination<MyView> page, IWrapper<MyView> queryWrapper) {

        LambdaQueryWrapper<MyView> wrapper = Pops.<MyView>lambdaQuery().from(MyView.MODEL_MODEL)
                .eq(MyView::getSys, Boolean.FALSE)
                .eq(MyView::getSystemSource, SystemSourceEnum.UI);
        Pagination<MyView> myViewPagination = new MyView().queryPage(page, wrapper);
        List<MyView> content = myViewPagination.getContent();
        // 提前返回,就算是NULL的也没事,省去不必要的判断
        if (CollectionUtils.isEmpty(content)) {
            return myViewPagination;
        }
        List<UiDesignerViewLayout> uiDesignerViewLayoutList = new UiDesignerViewLayout().queryList();
        if (CollectionUtils.isEmpty(uiDesignerViewLayoutList)) {
            return myViewPagination;
        }
        Map<String, Long> userTaskMap = uiDesignerViewLayoutList.stream().collect(Collectors.toMap(
                i-> buildMapKey(i.getModel(), i.getViewName()), UiDesignerViewLayout::getId, (old, n) -> old)
        );
        for (MyView myView : content) {
            myView.setUiDesignerViewLayoutId(userTaskMap.get(buildMapKey(myView.getModel(), myView.getName())));
        }
        return myViewPagination;
    }

    private String buildMapKey(String model, String viewName) {
        return model + ":" + viewName;
    }
}

在页面设计器创建页面

Oinone社区 作者:yexiu原创文章,如若转载,请注明出处:https://doc.oinone.top/other/20853.html

访问Oinone官网:https://www.oinone.top获取数式Oinone低代码应用平台体验

(0)
yexiu的头像yexiu数式员工
上一篇 2025年3月27日 am11:33
下一篇 2025年4月17日 pm4:20

相关推荐

  • 前端学习路径

    准备工作 环境准备-1h安装基础环境,需要Node和PNPM如果已经安装检查对应版本,体验阶段建议版本保持一致 克隆一个空工程-0.5h全新工程 注意事项-0.5h静态资源解压,如果还没有对应的后端服务。可以使用:https://demo.oinone.top(Oinone演示环境),账号密码:admin/admin 前端基础 1.1.1了解组件-3h– 组件如何开发– 组件如何复用– 组件如何嵌套 1.1.2 更近一步-5h– 构建更复杂的工作台– 如何发起后端请求– 构建一个通用的图表组件 1.1.3 深入了解概念-5h– 通用概念、名词解释– 页面渲染原理– 组件执行原理 1.1.4业务实战-实现通用的甘特图组件-8h– 怎么与第三方结合– 如何在开源组件上接入Oinone, 并复用 1.1.5 业务实战-实现通用的画廊组件-6h–如何更近一步复用–基础学习结束 前端进阶 2.1.1代码和无代码如何结合-4h– 了解无代码如何使用和基础概念 2.1.2使用无代码搭建增删改查-8h– 了解无代码如何使用和基础概念 最后一步 当您实现玩基础和进阶的所有的效果,Oinone的整体使用您已经大致掌握了,接下来您可以找一个当前业务的场景来实现它把!

    2025年9月1日
    90500
  • IP黑白名单实现拦截三方用户

    已知厂商IP为10.139.0.1,经系统检测122.233.24.28、138.122.12.9为风险IP,需要禁止访问。 白名单配置:10.139.0.1 黑名单配置:122.233.24.28、138.122.12.9 厂商请求到Oinone开放平台请求头需携带X-Forwarded-For和X-Real-IP,例如: X-Forwarded-For 122.233.24.28 X-Real-IP 122.233.24.28 经Nginx代理后,oinone获取的请求头内容: X-Forwarded-For 122.233.24.28, 10.139.0.1 # 代理追加厂商IP到末尾 X-Real-IP 122.233.24.28 # 保持客户端原始值,Nginx不处理 效果:厂商10.139.0.1发送的请求且用户X-Real-IP不在黑名单内才放行。 注意事项 Nginx如果配置X-Real-IP需关闭,否则拿到的永远是厂商IP。 proxy_set_header X-Real-IP $remote_addr; 相关文章 开放应用中的ip黑白名单

    2025年5月15日
    43000
  • Oinone 初级学习路径

    文档说明 文档链接 介绍Oinone前端相关知识点 前端基础学习路径 介绍Oinone后端相关知识点 后端基础学习路径 介绍平台基础组件 平台基础组件 介绍平台设计器常用场景实操 设计器基础学习路径 设计器实操案例示例 7.2 实战训练(积分发放)

    2024年6月15日
    1.2K00
  • 如何通过业务数据拿到工作流用户任务待办

    在模型里面建一个非存储字段,用来传输工作流用户任务待办ID。。 界面设计器把这个字段拖到列表页里,并在跳转动作上配置上下文参数,把任务待办id传到表单页里。 重写教师模型的queryPage,通过业务数据id查询出每条业务数据的工作流用户任务待办id返回给前端。 @Function.Advanced(displayName = "查询教师列表", type = FunctionTypeEnum.QUERY, category = FunctionCategoryEnum.QUERY_PAGE, managed = true) @Function(openLevel = {FunctionOpenEnum.LOCAL, FunctionOpenEnum.REMOTE, FunctionOpenEnum.API}) public Pagination<Teacher> queryPage(Pagination<Teacher> page, IWrapper<Teacher> queryWrapper) { Pagination<Teacher> teacherPagination = new Teacher().queryPage(page, queryWrapper); List<Teacher> content = teacherPagination.getContent(); if (CollectionUtils.isEmpty(content)) { return teacherPagination; } List<Long> teacherIds = content.stream().map(Teacher::getId).collect(Collectors.toList()); List<WorkflowUserTask> workflowUserTasks = Models.data().queryListByWrapper(Pops.<WorkflowUserTask>lambdaQuery() .from(WorkflowUserTask.MODEL_MODEL) .in(WorkflowUserTask::getNodeDataBizId, teacherIds) .orderByDesc(WorkflowUserTask::getCreateDate) ); if (CollectionUtils.isEmpty(workflowUserTasks)) { return teacherPagination; } Map<Long/*业务id*/, WorkflowUserTask> userTaskMap = workflowUserTasks.stream().collect(Collectors.toMap( WorkflowUserTask::getNodeDataBizId, a -> a, (old, n) -> old) ); for (Teacher teacher : content) { if (userTaskMap.containsKey(teacher.getId())) { teacher.setWorkflowUserTaskId(userTaskMap.get(teacher.getId()).getId()); } } return teacherPagination; } 查看效果,任务待办id成功传到表单里面。

    2025年1月10日
    2.0K00
  • 开放应用中的ip黑白名单

    IP白名单配置 入口:集成应用>开放管理>应用>授权调整>IP白名单配置 IP白名单取请求头中的X-Forwarded-For属性的最后一个值,X-Forwarded-For以英文,分割ip地址。 X-Forwarded-For: clientIP, proxy1IP, proxy2IP, …, proxyNIP 根据 RFC 7239 标准所述,X-Forwarded-For含义如下: clientIP:最左边的 IP,表示最初发起请求的客户端 IP(即真实用户 IP)。 proxyXIP:从左往右依次为中间各级代理服务器的 IP。 最右边的 IP:表示离当前 Web 服务器最近的一层代理服务器(IP白名单拦截的此IP)。 Nginx配置示例 以Nginx为例,为确保X-Forwarded-For拿到的是真实的IP地址,需要增加配置。 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; IP黑名单配置 入口:集成应用>开放管理>应用>黑名单 取值来源:从请求头 X-Real-IP 中提取客户端 IP。 验证逻辑: 若 X-Real-IP 不存在,直接拦截并返回异常提示:未获取到真实IP地址。 检查提取的 IP 是否在阻止列表中。 相关文章 IP黑白名单实现拦截三方用户

    2025年5月15日
    46300

Leave a Reply

登录后才能评论