...
|
...
|
@@ -5,7 +5,8 @@ |
|
|
var $ = require('jquery'),
|
|
|
common = require('../../../common/common');
|
|
|
|
|
|
|
|
|
var enum_switch_val={yes:"Y", no:"N"};
|
|
|
var enum_switch_name={open:"开启", close:"关闭"};
|
|
|
//下拉框
|
|
|
|
|
|
new common.dropDown({
|
...
|
...
|
@@ -13,7 +14,9 @@ new common.dropDown({ |
|
|
ajax: 'brand'
|
|
|
});
|
|
|
|
|
|
|
|
|
var buildOperateHtml=function(_index,_class,_name) {
|
|
|
return '<a data-index="' + _index + '" href="JavaScript:;" class="btn btn-warning btn-xs '+ _class +'">'+ _name +'</a>'
|
|
|
};
|
|
|
|
|
|
var g = new common.grid({
|
|
|
el: '#basicTable',
|
...
|
...
|
@@ -49,17 +52,17 @@ var g = new common.grid({ |
|
|
render: function(items) {
|
|
|
var HtmArr = [];
|
|
|
|
|
|
if (items.isNew === "N") {
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-warning btn-xs open-isNew">NEW</a>');
|
|
|
if (items.isNew === enum_switch_val.no) {
|
|
|
HtmArr.push(buildOperateHtml(items.__index,'open-isNew','NEW'));
|
|
|
}
|
|
|
if (items.isNew === "Y") {
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs close-isNew">取消NEW</a>');
|
|
|
if (items.isNew === enum_switch_val.yes) {
|
|
|
HtmArr.push(buildOperateHtml(items.__index,'close-isNew','取消NEW'));
|
|
|
}
|
|
|
if (items.isHot === "N") {
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-warning btn-xs open-isHot">HOT</a>');
|
|
|
if (items.isHot === enum_switch_val.no) {
|
|
|
HtmArr.push(buildOperateHtml(items.__index,'open-isHot','HOT'));
|
|
|
}
|
|
|
if (items.isHot === "Y") {
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs close-isHot">取消HOT</a>');
|
|
|
if (items.isHot === enum_switch_val.yes) {
|
|
|
HtmArr.push(buildOperateHtml(items.__index,'close-isHot','取消HOT'));
|
|
|
}
|
|
|
HtmArr.push('<a href="/erpproduct/brands/edit/' + items.id + '"" class="btn btn-info btn-xs">编辑</a>');
|
|
|
return HtmArr.join('');
|
...
|
...
|
@@ -71,16 +74,7 @@ g.init('/brand/getBrandDecorateList'); |
|
|
$("#filter-btn").click(function() {
|
|
|
g.reload(1);
|
|
|
});
|
|
|
var callBack=function(res,operateName) {
|
|
|
if (res.code == 200) {
|
|
|
common.util.__tip(operateName+'成功', 'success');
|
|
|
g.reload();
|
|
|
} else {
|
|
|
common.util.__tip(res.message);
|
|
|
}
|
|
|
};
|
|
|
var enum_switch_val={yes:"Y", no:"N"};
|
|
|
var enum_switch_name={open:"开启", close:"关闭"};
|
|
|
|
|
|
//品牌isHot
|
|
|
$('tbody').on('click', '.close-isHot', function() {
|
|
|
var item = g.rows[$(this).data("index")];
|
...
|
...
|
@@ -90,7 +84,14 @@ $('tbody').on('click', '.close-isHot', function() { |
|
|
id: item.id,
|
|
|
isHot: enum_switch_val.no
|
|
|
}
|
|
|
}, callBack(res,enum_switch_name.close), true);
|
|
|
}, function(res){
|
|
|
if (res.code == 200) {
|
|
|
common.util.__tip(enum_switch_name.close+'成功', 'success');
|
|
|
g.reload();
|
|
|
} else {
|
|
|
common.util.__tip(res.message);
|
|
|
}
|
|
|
}, true);
|
|
|
});
|
|
|
|
|
|
$('tbody').on('click', '.open-isHot', function(){
|
...
|
...
|
@@ -101,7 +102,14 @@ $('tbody').on('click', '.open-isHot', function(){ |
|
|
id: item.id,
|
|
|
isHot: enum_switch_val.yes
|
|
|
}
|
|
|
}, callBack(res,enum_switch_name.open), true)
|
|
|
}, function(res){
|
|
|
if (res.code == 200) {
|
|
|
common.util.__tip(enum_switch_name.open+'成功', 'success');
|
|
|
g.reload();
|
|
|
} else {
|
|
|
common.util.__tip(res.message);
|
|
|
}
|
|
|
}, true)
|
|
|
});
|
|
|
|
|
|
//品牌isNew
|
...
|
...
|
@@ -113,7 +121,14 @@ $('tbody').on('click', '.close-isNew', function() { |
|
|
id: item.id,
|
|
|
isNew: enum_switch_val.no
|
|
|
}
|
|
|
}, callBack(res,enum_switch_name.close), true);
|
|
|
}, function(res){
|
|
|
if (res.code == 200) {
|
|
|
common.util.__tip(enum_switch_name.close+'成功', 'success');
|
|
|
g.reload();
|
|
|
} else {
|
|
|
common.util.__tip(res.message);
|
|
|
}
|
|
|
}, true);
|
|
|
});
|
|
|
|
|
|
$('tbody').on('click', '.open-isNew', function() {
|
...
|
...
|
@@ -124,5 +139,12 @@ $('tbody').on('click', '.open-isNew', function() { |
|
|
id: item.id,
|
|
|
isNew: enum_switch_val.yes
|
|
|
}
|
|
|
}, callBack(res,enum_switch_name.open), true);
|
|
|
}, function(res){
|
|
|
if (res.code == 200) {
|
|
|
common.util.__tip(enum_switch_name.open+'成功', 'success');
|
|
|
g.reload();
|
|
|
} else {
|
|
|
common.util.__tip(res.message);
|
|
|
}
|
|
|
}, true);
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|