分页跳转指定界面,bootstrap-table-jumpto 不生效

陨冬y 9天前 62

三天前我在社区提个问题,大佬说要看代码,我就另开了一篇帖子说这个事,也是实在找不到什么办法了

html代码

<div class="panel panel-default panel-intro">
    {:build_heading()}
    <div class="panel-body">
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade active in" id="one">
                <div class="widget-body no-padding">
                    <div id="toolbar" class="toolbar">
                        {:build_toolbar('refresh,del')}
                        <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('leescoreorder/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="leescoreorder/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
                    </div>
                    <table id="table" class="table table-striped table-bordered table-hover" 
                           data-operate-add="{:$auth->check('scoreorder/send')}" 
                           data-operate-edit="{:$auth->check('scoreorder/edit')}" 
                           data-operate-del="{:$auth->check('scoreorder/del')}" 
                           width="100%">
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

JS代码

define(['jquery', 'bootstrap', 'bootstrap-table-jumpto', 'backend', 'table', 'form'], function ($, undefined,showjumpto,Backend, Table, Form) {
    // 'bootstrap-table-jumpto',
    // showJumoto,
    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'leescoreorder/index',
                    add_url: 'leescoreorder/add',
                    // edit_url: 'scoreorder/edit',
                    del_url: 'leescoreorder/del',
                    faild_url: 'leescoreorder/faild',
                    send_url: 'leescoreorder/send',
                    multi_url: 'leescoreorder/multi',
                    improt_url: 'leescoreorder/import',
                    table: 'leescore_order',
                }
            });

            var table = $("#table");
            // 初始化表格
            table.bootstrapTable({
                showjumpto:true,
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                exportOptions: {
                    ignoreColumn: [0, 'operate','status','status_text','paytime','money','user.username'], //默认不导出第一列(checkbox)与操作(operate)列
                },
                exportDataType: 'all',
                searchFormVisible: true,
                pageList: [10, 25, 50, 'All'],
                columns: [
                    [
                        {checkbox: true},
                        {field: 'order_id', title: __('order id'), operate: 'LIKE'},
                        {field: 'createtime', title: __('订单时间'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'uid', title: __('Uid'), visible: false, operate: false},
                        {field: 'goods_name', title: __('goods name')},
                        {field: 'user.username', title: __('username'), visible: false ,operate: false},
                        {field: 'shouhuo_name', title: __('shouhuo_name')},
                        {field: 'shouhuo_mobile', title: __('shouhuo_mobile')},
                        {field: 'shouhuo_region', title: __('省'), operate: false},
                        {field: 'shouhuo_city', title: __('市'), operate: false},
                        {field: 'shouhuo_xian', title: __('县/区'), operate: false},
                        {field: 'address', title: __('收货地址'),operate:'LIKE'},
                        {field: 'other', title: __('备注信息'),operate:false},
                        {field: 'buy_num', title: __('数量(件)'), operate: 'BETWEEN'},
                        {field: 'goods_name', title: __('产品名称'), operate: false},
                        {field: 'guige', title: __('规格'), operate: false},
                        {field: 'danwei', title: __('单位'), operate: false},
                        {field: 'team', title: __('团队'), searchList: {"xingkong": __('星空联盟'), "yunshidai": __('云时代'), "chuanglianguoji": __('创联国际'), "jingtianguoji": __('景天国际'), "mengranguoji": __('梦然国际'), "weishijiao": __('微视角'), "chuanglianguoji": __('创联国际'), "other": __('其他')}, operate: 'FIND_IN_SET', formatter: Table.api.formatter.label},
                        {field: 'shouquan', title: __('订货授权代码')},
                        {field: 'group_name', title: __('订货级别'), operate: false},
                        {field: 'sq_name', title: __('授权名')},
                        {field: 'sq_mobile', title: __('授权电话')},
                        {field: 'virtual_name', title: __('快递公司'), operate: false},
                        {field: 'virtual_sn', title: __('快递单号')},

                        {field: 'money', title: __('Money'), visible:false},

                        {
                            field: 'status',
                            title: __('Status'),
                            visible: false,
                            searchList: {
                                "-2": __('Status -2'),
                                "-1": __("Status -1"),
                                "0": __('Status 0'),
                                "1": __('Status 1'),
                                "2": __('Status 2'),
                                "3": __('Status 3'),
                                "4": __('Status 4'),
                                "5": __('Status 5'),
                                "6": __('Status 6'),
                                "7": __('Status 7'),
                            }
                        },
                        {field: 'status_text', title: __('Status'), operate: false},
                        {
                            field: 'paytime',
                            title: __('Paytime'),
                            operate: 'RANGE',
                            addclass: 'datetimerange',
                            formatter: Table.api.formatter.datetime
                        },
                        {
                            field: 'operate', title: __('Operate'), table: table, buttons: [
                                {
                                    name: 'send',
                                    text: __('view'),
                                    icon: 'fa fa-eye',
                                    classname: 'btn btn-xs btn-info btn-dialog',
                                    url: 'leescoreorder/send'
                                },

                            ], events: Table.api.events.operate, formatter: Table.api.formatter.operate
                        }
                    ]
                ],
                exportTypes:['excel']
            });


            // 为表格绑定事件
            Table.api.bindevent(table);
            //当表格数据加载完成时
            table.on('load-success.bs.table', function (e, data) {
                //这里可以获取从服务端获取的JSON数据
                console.log(data);
                //这里我们手动设置底部的值
                $("#mmm").text(data.extend.mmm);
                $("#num").text(data.extend.num);
                $("#wsh").text(data.extend.wsh);
                $("#shz").text(data.extend.shz);
                $("#shsb").text(data.extend.shsb);
                $("#dfh").text(data.extend.dfh);
                $("#yfh").text(data.extend.yfh);
                $("#dlqx").text(data.extend.dlqx);
                $("#ywc").text(data.extend.ywc);
            });
        },
        add: function () {
            Controller.api.bindevent();
        },

        /*        edit: function () {
                    Controller.api.bindevent();
                },*/
        send: function () {
            $("#bohui").on('click', function () {
                $("#c-virtual_sn").attr('data-rule', true);
                $("#c-virtual_name").attr('data-rule', true);
            });
            $("#bohui").on('click', function () {
                layer.confirm(__('msg tip'), {
                    title: __('action'),
                    btn: [__("yes"), __("no")] //按钮
                }, function () {
                    $("#send-form").attr("action", "leescoreorder/faild").submit();
                });
            });

            $("#shenheed").on('click', function () {
                $("#send-form").attr("action", "leescoreorder/shenheed").submit();
            });
            $("#shenheing").on('click', function () {
                $("#send-form").attr("action", "leescoreorder/shenheing").submit();
            });
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };

    return Controller;
});

插件代码我就不放了 因为有的界面可以正常使用 require-backend.js

end1.jpg
end2.jpg

这两天比较忙 没有注意confused 大佬帮帮忙

最后于 9天前 被陨冬y编辑
最新回复 (2)
返回