若依框架,bootstrap table的自定义初始化查询条件赋值

父页面点击查询,附带查询条件,传值另一页面

 /*搜索后的企业列表,点击详情,在原页面上更新详情页*/
    function toQykDetail(comName) {
        /* var prefix = ctx + "system/gxqTyc";*/
       /* search("5");*/
/*
        $.modal.openTab("天眼查企业库详情", encodeURI('system/gxqTyc/toQiyekuDetail?comName=' + comName));
*/
        window.location.href='/system/gxqTyc/toQiyekuDetail?comName='+ comName;
    }

子页面,初始化查询,带上此条件

 var prefix = ctx + "system/gxqTyc";

    //初始化查询条件传参
    queryParams = function(params) {
        var comName = [[${comName}]];
        if(comName!=null&&comName!=""){
            $("input[name=comName]").val(comName);
        }
        var search = {};
        $.each($("#formId").serializeArray(), function(i, field) {
            search[field.name] = field.value;
        });
        search.pageSize = params.limit;
        search.pageNum = params.offset / params.limit + 1;
        search.searchValue = params.search;
        search.orderByColumn = params.sort;
        search.isAsc = params.order;
        return search;
        var comName =null;
    }

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "企业列表",
            showExport: false,
            queryParams:queryParams,
            columns: [
                {
                    field : 'id',
                    title : '序号',
                    visible: false
                },
                {
                    field : 'comName',
                    title : '企业名称',
                    sortable: false
                },
                {
                    field : 'thisCreditCode',
                    title : '企业信用码',
                    sortable: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="#" οnclick="toQykDetail(\''+row.comName+'\')"><i class="fa fa-edit"></i>查看</a> ');
                      /*  actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" οnclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');*/
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

关键代码:

 //初始化查询条件传参
    queryParams = function(params) {
        var comName = [[${comName}]];
        if(comName!=null&&comName!=""){
            $("input[name=comName]").val(comName);
        }
        var search = {};
        $.each($("#formId").serializeArray(), function(i, field) {
            search[field.name] = field.value;
        });
        search.pageSize = params.limit;
        search.pageNum = params.offset / params.limit + 1;
        search.searchValue = params.search;
        search.orderByColumn = params.sort;
        search.isAsc = params.order;
        return search;
        var comName =null;
    }

然后配置

queryParams:queryParams,

就可以了

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值