1. 程式人生 > >Laravel 模板上 取得request傳值

Laravel 模板上 取得request傳值

例項一穀粒網後臺彈窗傳值:

                $.modalDialog({
                    title: "差異查詢 ",
                    width: '80%',
                    height: 600,
                    resizable: true,
                    queryParams: { s:startDate,e:endDate },
                    href: "/admin/sale/orderm/differentialQueryView?",
                    onLoad: function () {

                    },
                    onLoadError: function (xmlHttpRequest, textStatus, errorThrown) {
                        if (xmlHttpRequest.status == 401) {
                            window.location.href = "{{route('login')}}";
                        } else {
                            $.messager.show({
                                title: "錯誤",
                                msg: xmlHttpRequest.responseText,
                                timeout: 1000 * 2
                            });
                        }
                    },
                    buttons: [{
                        text: '取消',
                        iconCls: 'icon-cancel',
                        handler: function () {
                            $.modalDialog.handler.dialog('destroy');
                            $.modalDialog.handler = undefined;
                        }
                    }
                    ]
                });

queryParams為A頁面傳值引數,

下面是B頁面彈層取得A頁面的值

        $goodsdg.datagrid({
            url: "{{url('admin/sale/orderm/differentialQuery')}}",
            fit: true,
            pagination: true,
            pageSize: 20,
            pageList: [20, 40, 60, 80, 100],
            queryParams: {
                    s: "{{request()->input("s")}}",
                    e: "{{request()->input("e")}}"
            },
            rownumbers: true,
            border: false,
            singleSelect: true,
            idField: 'id',
            fitColumns: false,
            columns: [[
                {field : 'ordermid',title : 'ID',width : parseInt($(this).width()*0.02),checkbox:true},
                {field: 'ordermcode', title: '訂單編號', width: parseInt($(this).width() * 0.08)},
                {field: 'ordermkindnum', title: '種類數', width: parseInt($(this).width() * 0.03)},
                {field: 'ordermsumnum', title: '商品數量', width: parseInt($(this).width() * 0.03)},
                {field: 'ordermmoney', title: '下單金額', width: parseInt($(this).width() * 0.05)},
                {field: 'ordermactualmoney', title: '實際金額', width: parseInt($(this).width() * 0.05)},
                {field: 'ordermstatus', title: '狀態', width: parseInt($(this).width() * 0.05)},
                {field: 'customername', title: '客戶名稱', width: parseInt($(this).width() * 0.05)},
                {field: 'ordermshipcontact', title: '聯絡人', width: parseInt($(this).width() * 0.05)},
                {field: 'ordermphone', title: '手機', width: parseInt($(this).width() * 0.07)},
                {field: 'ordermtime', title: '下單時間', width: parseInt($(this).width() * 0.07)},
                {field: 'wmTime', title: '出庫時間', width: parseInt($(this).width() * 0.07)},
                
            ]],
            toolbar: '#goodstb'
        });

B頁面的queryParams s和e的是值 是A頁面傳遞過來的

{{request()->input("s")}}

{{request()->input("e")}}