|
@@ -8,6 +8,7 @@ use think\Controller;
|
|
|
use think\Hook;
|
|
|
use think\Lang;
|
|
|
use think\Session;
|
|
|
+use fast\Tree;
|
|
|
|
|
|
|
|
|
* 后台控制器基类
|
|
@@ -425,6 +426,13 @@ class Backend extends Controller
|
|
|
$searchfield = (array)$this->request->request("searchField/a");
|
|
|
|
|
|
$custom = (array)$this->request->request("custom/a");
|
|
|
+
|
|
|
+ $istree = $this->request->request("isTree", 0);
|
|
|
+ $ishtml = $this->request->request("isHtml", 0);
|
|
|
+ if($istree) {
|
|
|
+ $word = [];
|
|
|
+ $pagesize = 99999;
|
|
|
+ }
|
|
|
$order = [];
|
|
|
foreach ($orderby as $k => $v) {
|
|
|
$order[$v[0]] = $v[1];
|
|
@@ -467,9 +475,21 @@ class Backend extends Controller
|
|
|
unset($item['password'], $item['salt']);
|
|
|
$list[] = [
|
|
|
$primarykey => isset($item[$primarykey]) ? $item[$primarykey] : '',
|
|
|
- $field => isset($item[$field]) ? $item[$field] : ''
|
|
|
+ $field => isset($item[$field]) ? $item[$field] : '',
|
|
|
+ 'pid' => isset($item['pid']) ? $item['pid'] : 0
|
|
|
];
|
|
|
}
|
|
|
+ if($istree) {
|
|
|
+ $tree = Tree::instance();
|
|
|
+ $tree->init(collection($list)->toArray(), 'pid');
|
|
|
+ $list = $tree->getTreeList($tree->getTreeArray(0), $field);
|
|
|
+ if(!$ishtml){
|
|
|
+ foreach ($list as &$item) {
|
|
|
+ $item = str_replace(' ', ' ', $item);
|
|
|
+ }
|
|
|
+ unset($item);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return json(['list' => $list, 'total' => $total]);
|