fastadmin 联动二级页面
在后台JS文件中加入跳转:
{field: 'operate', title: __('Operate'), table: table, buttons :[ {name: 'detail', text: '党组结构', title: '党组结构', icon: 'fa fa-list', extend:'data-area=["80%","80%"]', classname: 'btn btn-xs btn-primary btn-dialog', url: 'sw/communist/category?sw_communist_organiz_id={id}', } ], events: Table.api.events.operate, formatter: Table.api.formatter.operate }
对应的后代部分获取到值以后,带入新的where ,不影响之前的判断
` $wheres = [];
if ($this->request->get('sw_communist_organiz_id')){
$wheres['fa_sw_communist_category.sw_communist_organiz_id'] = array('=',$this->request->get('sw_communist_organiz_id'));
}
$list = $this->model
->where($where)
->where($wheres)
->order($sort, $order)
->paginate($limit);`
把子页面要固定的值映射一下:
$this->view->assign("sw_communist_organiz_id", $this->request->get('sw_communist_organiz_id'));
子页面的JS获取一下固定值:
sw_communist_organiz_id = Fast.api.query('sw_communist_organiz_id'); // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'sw/communist/category/index' + location.search, add_url: 'sw/communist/category/add'+'?sw_communist_organiz_id='+sw_communist_organiz_id, edit_url: 'sw/communist/category/edit', del_url: 'sw/communist/category/del', multi_url: 'sw/communist/category/multi', import_url: 'sw/communist/category/import', table: 'sw_communist_category', } });
这样就实现了联动页面固定值,主页面可以无限把自己的id往下传输,便于联动
浙公网安备 33010602011771号