多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
~~~ /** * 查看 */ public function index() { if ($this->request->isAjax()) { $where =[]; $request = $this->request->request(); if ( ! empty($request['search'])) { $where['name'] = ['like' , $request['search'] . '%']; } $tree = Tree::instance(); $tree->init(collection($this->model->where($where)->order('weigh desc,id desc')->select())->toArray(), 'pid'); $treeData = $tree->getTreeList($tree->getTreeArray(0), 'name'); // $treeArr = array_column($treeData, 'name', 'id'); $list = []; foreach ($treeData as $k => $v) { $list[] = $v; } $total = count($list); $result = array("total" => $total, "rows" => $list); return json($result); } return $this->view->fetch(); } ~~~ ~~~ {field: 'name', title: __('Name'), operate: 'LIKE', align: 'left', formatter:function (value, row, index) { return value.toString().replace(/(&|&)nbsp;/g, ' '); } }, ~~~