1.生成代码引入项目后

2. 首先 处理html代码,在下面js里加入 以下代码到图中位置

detailView: true,
onExpandRow: function (index, row, $detail) {
    initChildTable(index, row, $detail);
},

3.在插入 

initChildTable = function (index, row, $detail) {
    var childTable = $detail.html('<table style="table-layout:fixed"></table>').find('table');
    $(childTable).bootstrapTable({
        detailView: true,
        onExpandRow: function (index, row, $detail) {
            initChildTables(index, row, $detail);
        },
        url: prefix + "/listPart",
        method: 'get',
        sidePagination: "server",
        contentType: "application/json;charset=UTF-8",
        queryParams: {
            tAreaParentId: row.tAreaId
        },
        columns: [{
            field: 'tAreaId',
            title: 'ID'
        },
            {
                field: 'tAreaName',
                title: '名称'
            },
            {
                field: 'tStatus',
                title: '状态',
                align: 'center',
                formatter: function (value, row, index) {
                    return $.table.selectDictLabel(tStatusDatas, value);
                }
            },
            {
                title: '操作',
                align: 'center',
                formatter: function (value, row, index) {
                    var actions = [];
                    actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" οnclick="$.operate.editTab(\'' + row.tAreaId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                    actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" οnclick="$.operate.remove(\'' + row.tAreaId + '\')"><i class="fa fa-remove"></i>删除</a>');
                    return actions.join('');
                }
            }]
    });
}

4.html 就处理完了 具体参数根据实际情况更改

5.控制器 

/**
 * 查询
 */
@GetMapping("/listPart" )
@ResponseBody
public TableDataInfo listPart(Integer tAreaParentId) {
  startPage();
  List<SysArea> list = sysAreaService.selectSysAreaParentList(tAreaParentId);
  return getDataTable(list);
}

6.I***Service

7. ****impl

8. ***mapper

9. ***.xml 这里就正常写sql语句就好了

备注:只整明白了get请求,post请求没搞懂,会的在下面评论啊

 

Logo

快速构建 Web 应用程序

更多推荐