切换导航条
此项目
正在载入...
登录
何书鹏
/
recruit
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
Karson
7 years ago
提交者
GitHub
7 years ago
提交
dc99d26252c7e18f79e95a1930515402dfa7c366
2 个父辈
c06a108f
208b9489
Merge pull request #24 from xinjiayu/master
分类管理新新增加按类型进行筛选的功能。
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
56 行增加
和
15 行删除
application/admin/controller/Category.php
application/admin/view/category/index.html
public/assets/js/backend/category.js
application/admin/controller/Category.php
查看文件 @
dc99d26
...
...
@@ -46,22 +46,33 @@ class Category extends Backend
if
(
$this
->
request
->
isAjax
())
{
$search
=
$this
->
request
->
request
(
"search"
);
$type
=
$this
->
request
->
request
(
"type"
);
//构造父类select列表选项数据
$list
=
[];
if
(
$search
)
{
foreach
(
$this
->
categorylist
as
$k
=>
$v
)
{
if
(
stripos
(
$v
[
'name'
],
$search
)
!==
false
||
stripos
(
$v
[
'nickname'
],
$search
)
!==
false
)
{
$list
[]
=
$v
;
if
(
$search
)
{
if
(
$v
[
'type'
]
==
$type
&&
stripos
(
$v
[
'name'
],
$search
)
!==
false
||
stripos
(
$v
[
'nickname'
],
$search
)
!==
false
)
{
if
(
$type
==
"all"
||
$type
==
null
)
{
$list
=
$this
->
categorylist
;
}
else
{
$list
[]
=
$v
;
}
}
}
else
{
if
(
$type
==
"all"
||
$type
==
null
)
{
$list
=
$this
->
categorylist
;
}
else
if
(
$v
[
'type'
]
==
$type
){
$list
[]
=
$v
;
}
}
}
}
else
{
$list
=
$this
->
categorylist
;
}
$total
=
count
(
$list
);
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
...
...
application/admin/view/category/index.html
查看文件 @
dc99d26
<div
class=
"panel panel-default panel-intro"
>
{:build_heading()}
<div
class=
"panel-heading"
>
{:build_heading()}
<ul
class=
"nav nav-tabs"
>
<li
class=
"active"
><a
href=
"all"
data-toggle=
"tab"
>
{:__('All')}
</a></li>
{foreach name="typeList" item="vo"}
<li><a
href=
"{$key}"
data-toggle=
"tab"
>
{$vo}
</a></li>
{/foreach}
</ul>
</div>
<div
class=
"panel-body"
>
<div
id=
"myTabContent"
class=
"tab-content"
>
<div
class=
"tab-pane fade active in"
id=
"one"
>
...
...
public/assets/js/backend/category.js
查看文件 @
dc99d26
...
...
@@ -15,10 +15,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
});
var
table
=
$
(
"#table"
);
// 初始化表格
table
.
bootstrapTable
({
var
table
=
$
(
"#table"
);
var
tableOptions
=
{
url
:
$
.
fn
.
bootstrapTable
.
defaults
.
extend
.
index_url
,
escape
:
false
,
pk
:
'id'
,
...
...
@@ -39,10 +38,33 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{
field
:
'operate'
,
title
:
__
(
'Operate'
),
table
:
table
,
events
:
Table
.
api
.
events
.
operate
,
formatter
:
Table
.
api
.
formatter
.
operate
}
]
]
});
};
// 初始化表格
table
.
bootstrapTable
(
tableOptions
);
// 为表格绑定事件
Table
.
api
.
bindevent
(
table
);
//绑定TAB事件
$
(
'a[data-toggle="tab"]'
).
on
(
'shown.bs.tab'
,
function
(
e
)
{
// var options = table.bootstrapTable(tableOptions);
var
typeStr
=
$
(
this
).
attr
(
"href"
);
var
options
=
table
.
bootstrapTable
(
'getOptions'
);
options
.
pageNumber
=
1
;
options
.
queryParams
=
function
(
params
)
{
// params.filter = JSON.stringify({type: typeStr});
params
.
type
=
typeStr
;
return
params
;
};
table
.
bootstrapTable
(
'refresh'
,
{});
return
false
;
});
//必须默认触发shown.bs.tab事件
// $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
},
add
:
function
()
{
Controller
.
api
.
bindevent
();
...
...
请
注册
或
登录
后发表评论