Skip to content
网游世界
网游世界

吾生有涯,而知无涯。

  • 首页
  • PHP
    • ThinkPHP
    • FastAdmin
    • webman
  • JavaScript
    • jQuery
    • AdminLTE
  • Free Pascal
  • Java
    • JeeSite
    • 若依
    • ruoyi-vue-pro
  • 其它
    • 操作系统
    • 树莓派
    • 前端
    • Null
  • 关于
网游世界

吾生有涯,而知无涯。

JeeSite 列表中添加子列表

3Vshej, 2023年12月11日 周一2023年12月11日 周一

在 JeeSite 列表中,在业务中有需要查看子表数据。具体方法为:

列表页面中,在原 dataGrid 上的 columnModel 下面增加:

// 子表格支持演示
subGrid: true,
subGridRowExpanded: function (subTableId, rowId) {
    $('#'+subTableId).html('<h5><i class="icon-docs"></i> 运费支付明细</h5>'+'<table id="'+subTableId+'_detail"></table>');
    $('#'+subTableId+'_detail').dataGrid({
        url: '${ctx}/product/flowPaymentFreight/flowPaymentFreightRecordListData',
        postData: {'paymentFreightCode': rowId},
        autoGridHeight: function(){return 'auto'}, // 设置自动高度
        autoGridWidth:  function(){return $("#"+subTableId).width()}, // 设置自动高度
        // 设置数据表格列
        columnModel: [
            {header:'${text("收货单位")}', name:'customer', width:150, align:"center",
                formatter: function(val, obj, row, act){
                    return js.val(row, 'customer.customerName');
            }},
            {header:'${text("发货时间")}', name:'shippingDate', width:150, align:"center"},
            {header:'${text("单重")}', name:'weight', width:150, align:"center"},
            {header:'${text("包装类型")}', name:'packCode', width:150, align:"center", formatter: function(val, obj, row, act){
                return js.getDictLabel(${@DictUtils.getDictListJson('package_type')}, val, '${text("未知")}', true);
            }},
            {header:'${text("包装件数")}', name:'packNum', width:150, align:"center"},
            {header:'${text("收货人")}', name:'addressee', width:150, align:"center"},
            {header:'${text("收货人电话")}', name:'addresseeMobile', width:150, align:"center"},
            {header:'${text("距离")}', name:'distance', width:150, align:"center"},
            {header:'${text("吨/公里")}', name:'tonneKm', width:150, align:"center"},
            {header:'${text("总运费")}', name:'totalAmount', width:150, align:"center", formatter: function(val, obj, row, act){
                return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值,金额情况下设置0.00);
            }},
        ],
        emptyDataHint: true, 	// 表格内没有数据的时候提示 “无数据显示” v4.1.7
        // 加载成功后执行事件
        ajaxSuccess: function(data){
            $(window).resize();
        }
    });
},

控制器中:

/**
 * 查询子表数据
 */
@RequiresPermissions("product:flowPaymentFreight:view")
@RequestMapping(value = "flowPaymentFreightRecordListData")
@ResponseBody
public Page<FlowPaymentFreightRecord> subListData(FlowPaymentFreightRecord flowPaymentFreightRecord, HttpServletRequest request, HttpServletResponse response) {
    flowPaymentFreightRecord.setPage(new Page<>(request, response));
    Page<FlowPaymentFreightRecord> page = flowPaymentFreightService.findSubPage(flowPaymentFreightRecord);
    return page;
}

 

相关文章:

  1. JeeSite 列表中增加日期范围筛选 在开发中,需要进行日期范围筛选,那么可以按以下方法来进行。...
  2. JeeSite 导出数据 默认情况下,JeeSite 会自动生成导出代码,但有时候忘记了。这里介绍如何手动添加导出功能。...
  3. JeeSite 删除数据拦截 单表操作删除时,默认框架已提供了,但有时候需要根据条件判断是否允许删除;如,客户表,如果客户信息已被......
  4. JeeSite 重置按钮不生效 测试人员在测试列表搜索时,设置搜索条件,点击“查询”按钮功能正常,点击“重置”按钮时,却没反应。...
Java JeeSite JeeSite 框架列表页子列表

文章导航

Previous post
Next post

近期文章

  • Android Studio Gradle 配置国内镜像
  • 为什么重新发明轮子
  • ruoyi-vue-pro 匿名访问
  • VUE 中接收 code 异常
  • 关于 AI

归档

  • 2025 年 4 月
  • 2025 年 3 月
  • 2025 年 2 月
  • 2025 年 1 月
  • 2024 年 12 月
  • 2024 年 11 月
  • 2024 年 10 月
  • 2024 年 9 月
  • 2024 年 8 月
  • 2024 年 7 月
  • 2024 年 6 月
  • 2024 年 5 月
  • 2024 年 4 月
  • 2024 年 3 月
  • 2024 年 2 月
  • 2024 年 1 月
  • 2023 年 12 月
除非特殊说明,本站作品采用知识共享署名 4.0 国际许可协议进行许可。
豫公网安备 41010402002622号 豫ICP备2020029609号-3
©2025 3Vshej