切换导航条
此项目
正在载入...
登录
何书鹏
/
anttest
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
pppscn
6 years ago
提交者
Karson
6 years ago
提交
49464f613526b761e4f9ae17e0d8d23ca146e774
1 个父辈
84ecf5a0
selectpage支持返回树形结构
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
21 行增加
和
1 行删除
application/common/controller/Backend.php
application/common/controller/Backend.php
查看文件 @
49464f6
...
...
@@ -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
);
}
}
}
//这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮
return
json
([
'list'
=>
$list
,
'total'
=>
$total
]);
...
...
请
注册
或
登录
后发表评论