Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-portal-fe2
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
mingdan.ge
8 years ago
Commit
4a20ac03e335ed9f94cba6528e5837d9f371d72f
1 parent
a80225c9
类目页面+筛选+删除
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
237 additions
and
49 deletions
code/apps/category/controllers/category.js
code/apps/category/interfaces/category.js
code/apps/category/views/Index.html
code/apps/operations/controllers/salecategory.js
code/apps/operations/interfaces/salecategory.js
code/apps/operations/views/salecategory/Index.html
dist/yohobuy-portal-fe/5.0.2/jquery/category.Index.js
code/apps/category/controllers/category.js
View file @
4a20ac0
module
.
exports
=
function
(
app
)
{
/*物理类目管理*/
app
.
get
(
"/erpproduct/sort/index"
,
"category.Index"
,
"category_queryAllProductSortList"
,
function
(
plist
,
req
,
res
){
app
.
get
(
"/erpproduct/sort/index"
,
"category.Index"
,
function
(
plist
,
req
,
res
){
this
.
$extend
=
{
moduleName
:
'物理类目管理'
,
pageName
:
'物理类目管理列表'
,
data
:
plist
.
data
gridurl
:
'/erpproduct/sorter/getlist'
}
});
/*添加物理类目管理*/
...
...
@@ -24,6 +24,9 @@ module.exports=function(app) {
}
return
sort
;
});
/*列表*/
app
.
post
(
"/erpproduct/sorter/getlist"
,
"category_queryAllProductSortList"
);
/*【添加品类】ajax请求接口*/
app
.
post
(
"/product/sort/addProductSort"
,
"category_addProductSort"
);
/*【修改品类】ajax请求接口*/
...
...
@@ -32,4 +35,6 @@ module.exports=function(app) {
app
.
post
(
"/erpproduct/sorter/open"
,
"category_publishProductSort"
);
/*关闭*/
app
.
post
(
"/erpproduct/sorter/close"
,
"category_closeProductSort"
);
/*删除*/
app
.
post
(
"/erpproduct/sorter/del"
,
"category_delProductSort"
);
}
\ No newline at end of file
...
...
code/apps/category/interfaces/category.js
View file @
4a20ac0
...
...
@@ -4,6 +4,9 @@ module.exports={
queryAllProductSortList
:{
title
:
'获取所有品类'
,
url
:
'/product/queryAllProductSortList'
,
params
:
[
{
name
:
'status'
,
type
:
'Number'
}
]
},
addProductSort
:{
title
:
'商品管理>【添加品类】ajax请求接口'
,
...
...
@@ -58,6 +61,13 @@ module.exports={
params
:
[
{
name
:
'param'
,
type
:
'Number'
}
]
},
delProductSort
:{
title
:
'delProductSort'
,
url
:
'/product/delProductSort'
,
params
:
[
{
name
:
'param'
,
type
:
'Number'
}
]
}
}
}
\ No newline at end of file
...
...
code/apps/category/views/Index.html
View file @
4a20ac0
...
...
@@ -2,10 +2,26 @@
<
%include '../../common/views/__partail/ListHeader'%>
<div
class=
"contentpanel"
>
<div
style=
"margin-bottom: 20px"
>
<div
class=
"panel-body"
>
<a
href=
"/product/class/new"
class=
"btn btn-success"
><i
class=
"fa fa-plus"
></i>
添加品类
</a>
</div>
<div
class=
"panel-body"
>
<div
class=
"row"
>
<div
class=
"panel-col2"
>
<select
name=
"status"
id=
"status"
tabindex=
"-1"
title=
""
class=
"select2-offscreen brandBtn-group"
>
<option
value=
"-1"
>
未选择
</option>
<option
value=
"0"
>
开启
</option>
<option
value=
"1"
>
关闭
</option>
</select>
</div>
<div
class=
"panel-col"
>
<a
id=
"filter-btn"
href=
"javascript:;"
class=
"btn btn-info"
>
筛选
</a>
<a
id=
"filter-all"
href=
"/erpproduct/sort/index"
class=
"btn btn-info"
>
全部
</a>
</div>
</div>
</div>
<div
class=
"panel"
>
<div
class=
"panel-body nopadding"
>
<div
class=
"table-responsive"
>
...
...
@@ -43,6 +59,10 @@
data-status=
"<%item.status%>"
>
<
%if item.booleanStatus%>关闭
<
%else%>开启
<
%/if%>
</a>
<
%if item.canDelFlag%>
<a
href=
"/erpproduct/sorter/del/<%item.id%>"
class=
"btn btn-xs del-class-btn btn-danger"
>
删除
</a>
<
%/if%>
</td>
</tr>
<
%/each%>
...
...
@@ -52,6 +72,46 @@
</div>
</div>
</div>
<div
class=
"panel"
>
<div
class=
"panel-body nopadding"
>
<div
class=
"sale-category-table dataTables_wrapper no-footer"
id=
"basicTable"
></div>
</div>
</div>
</div>
<input
type=
"hidden"
id=
"gridurl"
value=
"<%gridurl%>"
>
<script
type=
"text/template"
id=
"tableHdTemp"
>
<
div
class
=
"level-hd clearfix"
>
<
span
class
=
"folder"
style
=
"width: 10%"
><
/span
>
<
span
style
=
"width: 10%"
>
ID
<
/span
>
<
span
style
=
"width: 15%"
>
品类名称
<
/span
>
<
span
style
=
"width: 10%"
>
品类缩写
<
/span
>
<
span
style
=
"width: 15%"
>
所属分类
<
/span
>
<
span
class
=
"orderby"
width
=
"10%"
>
排序
<
/span
>
<
span
class
=
"status"
width
=
"10%"
>
状态
<
/span
>
<
span
class
=
"operate"
width
=
"20%"
>
操作
<
/span
>
<
/div
>
</script>
<script
type=
"text/template"
id=
"tableTemp2"
>
<
span
class
=
"folder"
style
=
"width: 10%"
><
/span
>
<
span
style
=
"width: 10%"
>
[[
id
]]
<
/span
>
<
span
style
=
"width: 15%"
>
[[
sortName
]]
<
/span
>
<
span
style
=
"width: 10%"
>
[[
sortInitials
]]
<
/span
>
<
span
style
=
"width: 15%"
>
[[
sortLevel
]]
级分类
<
/span
>
<
span
class
=
"orderby"
width
=
"10%"
>
[[
orderBy
]]
<
/span
>
<
span
class
=
"status"
width
=
"10%"
>
[[
if
status
==
"1"
]]
<
b
style
=
"color: #449d44"
>
开启
<
/b>
[
[
/
if
]
]
[
[if status=="0"
]
]<b style="color: #d9534f">关闭</
b
>
[[
/if]]</
span
>
<
span
class
=
"operate"
width
=
"20%"
data
-
id
=
"[[id]]"
data
-
name
=
"[[sortName]]"
>
<
a
class
=
"btn btn-info btn-xs edit-class-btn"
href
=
"/product/class/edit/[[id]]"
>
编辑
<
/a
>
<
b
class
=
"openAndClose"
data
-
id
=
"[[id]]"
data
-
name
=
"[[sortName]]"
>
[[
if
status
==
"1"
]]
<
a
class
=
"btn btn-danger open-close-btn btn-xs close-category"
data
-
status
=
"[[status]]"
href
=
"javascript:;"
>
关闭
<
/a>
[
[
/
if
]
]
[[
if
status
==
"0"
]]
<
a
class
=
"btn btn-warning open-close-btn btn-xs open-category"
data
-
status
=
"[[status]]"
href
=
"javascript:;"
>
开启
<
/a>
[
[
/
if
]
]
<
/b
>
[[
if
canDelFlag
]]
<
a
href
=
"/erpproduct/sorter/del/[[id]]"
class
=
"btn btn-xs del-class-btn btn-danger"
>
删除
<
/a
>
[[
/if]
]
<
/span
>
</script>
<
%include '../../common/views/__ui/footer'%>
\ No newline at end of file
...
...
code/apps/operations/controllers/salecategory.js
View file @
4a20ac0
...
...
@@ -43,6 +43,9 @@ module.exports=function(app) {
/*开关销售类目*/
app
.
post
(
"/sale/salesCategory/updateSCStatus"
,
"salecategory_updateSCStatus"
);
/*删除销售类目*/
app
.
post
(
"/sale/salesCategory/delSC"
,
"salecategory_delSC"
);
/*批量添加标签接口*/
app
.
post
(
"/sale/salesCategoryLabel/addSCLabel"
,
"salecategory_addSCLabel"
);
...
...
code/apps/operations/interfaces/salecategory.js
View file @
4a20ac0
...
...
@@ -82,6 +82,13 @@ module.exports={
{
name
:
'state'
,
type
:
'string'
}
]
},
delSC
:{
title
:
"删除销售类目"
,
url
:
'/salesCategory/delSC'
,
params
:
[
{
name
:
'categoryId'
,
type
:
'string'
}
]
},
addSCLabel
:{
title
:
"批量添加标签接口"
,
url
:
'/salesCategoryLabel/addSCLabel'
,
...
...
code/apps/operations/views/salecategory/Index.html
View file @
4a20ac0
...
...
@@ -3,17 +3,21 @@
<div
class=
"contentpanel"
>
<div
class=
"panel panel-default"
style=
"margin:10px 0; display: none"
>
<div
class=
"panel-body nopadding"
>
<div
class=
"state-select"
>
<strong>
状态:
</strong>
<label><input
type=
"radio"
name=
"state"
value=
""
>
全部
</label>
<label
class=
"current"
><input
type=
"radio"
name=
"state"
value=
"1"
>
开启
</label>
<label><input
type=
"radio"
name=
"state"
value=
"0"
>
关闭
</label>
<div
class=
"panel-body"
>
<div
class=
"row"
>
<div
class=
"panel-col2"
>
<select
name=
"state"
id=
"state"
tabindex=
"-1"
title=
""
class=
"select2-offscreen brandBtn-group"
>
<option
value=
"-1"
>
未选择
</option>
<option
value=
"1"
>
开启
</option>
<option
value=
"0"
>
关闭
</option>
</select>
</div>
<div
class=
"panel-col"
>
<a
id=
"filter-btn"
href=
"javascript:;"
class=
"btn btn-info"
>
筛选
</a>
<a
id=
"filter-all"
href=
"/sale/category/index"
class=
"btn btn-info"
>
全部
</a>
</div>
</div>
</div>
<a
href=
"javascript:;"
id=
"add-root-category"
class=
"btn btn-success"
style=
"margin:10px 0;"
><i
class=
"fa fa-plus"
></i>
添加根分类
</a>
<div
class=
"panel"
>
...
...
@@ -263,7 +267,10 @@
<
a
class
=
"btn btn-danger btn-xs close-category"
href
=
"javascript:;"
>
关闭
<
/a
>
[[
/if]
]
[[
if
b
.
state
==
"0"
]]
<
a
class
=
"btn btn-warning btn-xs open-category"
href
=
"javascript:;"
>
开启
<
/a
>
<
a
class
=
"btn btn-warning btn-xs open-category"
href
=
"javascript:;"
>
开启
[[
b
.
canDelFlag
]]
啊
<
/a
>
[[
/if]
]
[[
if
b
.
canDelFlag
]]
<
a
class
=
"btn btn-warning btn-xs del-category"
href
=
"javascript:;"
>
删除
<
/a
>
[[
/if]
]
<
/span
>
<
/div
>
...
...
@@ -296,6 +303,7 @@
<
b
class
=
"openAndClose"
data
-
id
=
"[[categoryId]]"
data
-
name
=
"[[categoryName]]"
>
[[
if
state
==
"1"
]]
<
a
class
=
"btn btn-danger btn-xs close-category"
href
=
"javascript:;"
>
关闭
<
/a>
[
[
/
if
]
]
[[
if
state
==
"0"
]]
<
a
class
=
"btn btn-warning btn-xs open-category"
href
=
"javascript:;"
>
开启
<
/a>
[
[
/
if
]
]
[[
if
canDelFlag
]]
<
a
class
=
"btn btn-danger btn-xs del-category"
href
=
"javascript:;"
>
删除
<
/a>
[
[
/
if
]
]
<
/b
>
<
/span
>
</script>
...
...
dist/yohobuy-portal-fe/5.0.2/jquery/category.Index.js
View file @
4a20ac0
...
...
@@ -10,46 +10,141 @@ webpackJsonp([23],[
var
$
=
__webpack_require__
(
1
);
var
common
=
__webpack_require__
(
2
);
//列表展示效果
var
$toggleTd
=
$
(
'.toggle-td'
);
$toggleTd
.
click
(
function
()
{
var
$this
=
$
(
this
),
$thisNext
=
$this
.
closest
(
'tr'
).
nextAll
(),
thisVal
=
$
(
this
).
closest
(
'tr'
).
attr
(
'data-val'
);
if
(
$this
.
closest
(
'tr'
).
attr
(
'data-status'
)
===
'close'
)
{
$thisNext
.
filter
(
function
(
index
)
{
return
$
(
this
).
attr
(
'data-parent'
)
===
thisVal
;
}).
removeClass
(
'hidden'
);
$this
.
closest
(
'tr'
).
attr
(
'data-status'
,
'open'
).
find
(
'.toggle-td'
).
find
(
'span'
)
.
removeClass
(
'glyphicon-folder-close'
).
addClass
(
'glyphicon-folder-open'
);
}
else
{
//下拉框
new
common
.
dropDown
({
el
:
"#status"
});
var
renderHd
=
false
;
/*
var g2 = new common.grid({
el: '#basicTable2',
parms: function() {
return {
status: common.util.__input('status'), //$.trim($('#status').val()) || '',
};
},
columns: [{
display: "",
name: ""
},{
display: "ID",
name: "id"
}, {
display: "品类名称",
name: "brandIco",
render: function(item) {
return '<img src="' + item.brandIco + '" width="100" height="100"/>'
}
}, {
display: '品类缩写',
name: "brandName"
}, {
display: '所属分类',
name: "brandNameEn"
}, {
display: '排序',
name: "brandLevel"
}, {
display: '状态',
name: "status",
render: function(item) {
if(item.status==1){
var name ="开启" ;
}else {
var name ="关闭" ;
}
return name;
}
}, {
display: '操作',
name: "status",
render: function(items) {
alert(1);
var HtmArr = [];
HtmArr.push('<a href="/erpproduct/brands/edit/' + items.id + '"" class="btn btn-info btn-xs">编辑</a>');
if (items.status === 0) {
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-warning btn-xs open-brand">开启品牌</a>');
}
if (items.status === 1) {
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs close-brand">关闭品牌</a>');
}
return HtmArr.join('');
}
}]
});
*/
var
g
=
new
common
.
grid
({
el
:
"#basicTable"
,
parms
:
function
()
{
return
{
status
:
common
.
util
.
__input
(
'status'
),
//$.trim($('#status').val()) || '',
};
},
columns
:
[{
display
:
''
,
name
:
'foler'
,
render
:
function
(
item
)
{
debugger
;
var
html
=
""
,
top
=
true
;
if
(
!
renderHd
)
{
html
+=
$
(
'#tableHdTemp'
).
html
();
init
(
item
);
renderHd
=
true
;
}
else
{
init
(
item
)}
return
html
;
function
init
(
item
){
if
(
top
){
html
+=
"<div id='category_id_"
+
item
.
id
+
"' class='level-wrap clearfix'>"
;
top
=
false
;
}
else
{
html
+=
"<div id='category_id_"
+
item
.
id
+
"' class='level-wrap clearfix' style='display: none'>"
}
html
+=
common
.
util
.
__template2
(
$
(
'#tableTemp2'
).
html
(),
item
);
if
(
item
.
subList
){
for
(
var
i
=
0
;
i
<
item
.
subList
.
length
;
i
++
){
init
(
item
.
subList
[
i
]);
}
}
html
+=
"</div>"
;
}
}
}
]
});
g
.
init
(
$
(
"#gridurl"
).
val
());
//g.init("/erpproduct/sort/index");
$
(
"#filter-btn"
).
click
(
function
()
{
renderHd
=
false
;
g
.
reload
(
1
);
});
//打开层级类目
$
(
document
).
on
(
'click'
,
'.folder'
,
function
()
{
var
$wrap
=
$
(
this
).
parent
();
if
(
!
$
(
this
).
hasClass
(
'open'
))
{
if
(
$wrap
.
find
(
'> .level-wrap'
).
size
()
>
0
)
{
var
position
=
$
(
this
).
css
(
"background-position"
);
var
a
=
position
.
substring
(
0
,
position
.
indexOf
(
"px"
));
$wrap
.
find
(
'> .level-wrap'
).
show
().
find
(
".folder"
).
css
(
"background-position"
,
(
parseInt
(
a
)
+
36
)
+
"px"
);
$
(
this
).
addClass
(
'open'
);
}
}
else
{
$
(
this
).
removeClass
(
'open'
);
if
(
$wrap
.
find
(
'.level-wrap'
).
size
()
>
0
)
{
$wrap
.
find
(
'.level-wrap'
).
hide
().
find
(
".folder"
).
removeClass
(
'open'
).
css
(
"background-position"
,
"12px center"
);
}
}
});
//列表展示效果
$thisNext
.
filter
(
function
(
index
)
{
var
thisR
=
$
(
this
).
attr
(
'data-parent'
)
===
thisVal
;
if
(
thisR
&&
$
(
this
).
attr
(
'data-status'
)
===
'open'
)
{
$
(
this
).
find
(
'.toggle-td'
).
trigger
(
'click'
);
}
return
thisR
;
}).
addClass
(
'hidden'
);
$this
.
closest
(
'tr'
).
attr
(
'data-status'
,
'close'
).
find
(
'.toggle-td'
).
find
(
'span'
)
.
removeClass
(
'glyphicon-folder-open'
).
addClass
(
'glyphicon-folder-close'
);
}
var
$toggleTd
=
$
(
'.toggle-td'
);
})
;
;
//列表编辑
...
...
Please
register
or
login
to post a comment