一、在主页面js端添加按钮 位置:public/assets/js/backend/pim/test.js 其中url的位置指的是弹窗显示的位置popup/sale/order/index(类比pim/test/index) 在url
一、在主页面js端添加按钮
位置:public/assets/js/backend/pim/test.js
其中url的位置指的是弹窗显示的位置popup/sale/order/index(类比pim/test/index)
在url中写入需要传递的参数order_number={order_number}
{field: 'id', title: __('detial'), table: table, buttons: [ { name: 'name1', text:__('detials'), title: __('detials'), icon: 'fa fa-list',//图标 classname: 'btn btn-xs btn-primary btn-dialog', //btn-dialog表示为弹窗 url: 'popup/sale/order/index?order_number={order_number}',//自带参数ids extend: 'data-area=\'["90%","75%"]\'',//弹窗大小 callback:function(data){} }, ], operate:false, fORMatter: Table.api.formatter.buttons},
二、在弹窗所在控制器中获取传递的参数
位置:application/admin/controller/popup/sale/Order.PHP
在index方法中进行添加
//获取并传递参数//获取页面参数order_number,值不为空就是order_number,若为空就是''$order_number = $this->request->get('order_number','');//为当前视图层分配一个名为“order_number”的变量,并将其值设为$order_number。$this->view->assign('order_number',$order_number);
三、展示数据到前端
位置:application/admin/view/popup/sale/order/index.html
四、将参数作为数据库搜索的限制条件
位置:application/admin/controller/popup/sale/Order.php
在index方法中的数据库查询中加入条件
->where(['order_number'=>$order_number])//限制当字段order_number等于变量order_number时执行
最终效果
来源地址:https://blog.csdn.net/weixin_46001736/article/details/128801399
--结束END--
本文标题: fastadmin:点击按钮出现弹窗,同时传递参数,并将参数展示到前端,并根据参数进行数据库查询的条件
本文链接: https://www.lsjlt.com/news/390811.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0