...
|
...
|
@@ -27,11 +27,7 @@ var ENUM = { |
|
|
|
|
|
//下拉框
|
|
|
new common.dropDown({
|
|
|
el: "#g-brandId",
|
|
|
ajax: 'brand',
|
|
|
params : {
|
|
|
status: 1
|
|
|
}
|
|
|
el: "#g-status",
|
|
|
});
|
|
|
|
|
|
var g = new common.grid({
|
...
|
...
|
@@ -40,10 +36,7 @@ var g = new common.grid({ |
|
|
parms: function () {
|
|
|
|
|
|
return {
|
|
|
brandType: common.util.__input('g-brandType'),
|
|
|
status: common.util.__input('g-status'),
|
|
|
brandId: common.util.__input('g-brandId'),
|
|
|
gender: common.util.__input('g-gender'),
|
|
|
};
|
|
|
},
|
|
|
columns: [
|
...
|
...
|
@@ -51,34 +44,22 @@ var g = new common.grid({ |
|
|
display: 'ID',
|
|
|
name: "id"
|
|
|
}, {
|
|
|
display: '品牌名称',
|
|
|
name: "brandName"
|
|
|
display: '名称',
|
|
|
name: "categoryName"
|
|
|
}, {
|
|
|
display: '品牌ID',
|
|
|
name: "brandId"
|
|
|
display: '资源位码(head)',
|
|
|
name: "contentCode"
|
|
|
}, {
|
|
|
display: '频道名称',
|
|
|
name: "categoryName"
|
|
|
}, {
|
|
|
display: '性别',
|
|
|
render: function (item) {
|
|
|
return "<p>" + ENUM.GenderEnum[item.gender] + "</p>";
|
|
|
}
|
|
|
display: '资源位码(foot)',
|
|
|
name: "contentCodeFoot"
|
|
|
}, {
|
|
|
display: '是否可用',
|
|
|
render: function (item) {
|
|
|
return "<p>" + ENUM.StatusEnum[item.status] + "</p>";
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
display: '更新时间',
|
|
|
render: function (item) {
|
|
|
var t = new Date(item.updateTime * 1000);
|
|
|
var t = new Date(item.createTime * 1000);
|
|
|
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
|
|
|
return "<p>" + formatted + "</p>";
|
|
|
}
|
|
|
},
|
|
|
|
|
|
{
|
|
|
display: '操作',
|
|
|
//}
|
...
|
...
|
@@ -86,15 +67,19 @@ var g = new common.grid({ |
|
|
render: function (items) {
|
|
|
var HtmArr = [];
|
|
|
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs info-copy">复制链接</a>');
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs info-modify">查看/编辑</a>');
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-del">删除</a>');
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-primary btn-xs info-modify">编辑</a>');
|
|
|
|
|
|
if (items.status == 1) {
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs info-close">关闭入口</a>');
|
|
|
} else {
|
|
|
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-success btn-xs info-open">开启入口</a>');
|
|
|
}
|
|
|
|
|
|
return HtmArr.join('');
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
g.init('/guang/plustar/getList');
|
|
|
g.init('/guang/plustarcategory/getList');
|
|
|
|
|
|
//==================== 按钮点击事件 =====================//
|
|
|
|
...
|
...
|
@@ -104,25 +89,26 @@ $("#filter-btn").click(function() { |
|
|
|
|
|
//添加
|
|
|
$(document).on('click', '#add-btn', function() {
|
|
|
plusStarOP("新增", '/guang/plustar/addPlustar', {});
|
|
|
plusStarOP("新增", '/guang/plustarcategory/addCategory', {});
|
|
|
|
|
|
});
|
|
|
|
|
|
//编辑
|
|
|
$(document).on('click', '.info-modify', function() {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
plusStarOP("编辑", '/guang/plustar/updatePlustar', item);
|
|
|
plusStarOP("编辑", '/guang/plustarcategory/updateCategory', item);
|
|
|
});
|
|
|
|
|
|
//删除
|
|
|
$(document).on('click', '.info-del', function() {
|
|
|
//关闭
|
|
|
$(document).on('click', '.info-close', function() {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
|
|
|
common.dialog.confirm("温馨提示","确定要删除该品牌?" , function() {
|
|
|
common.dialog.confirm("温馨提示","确定要关闭该入口?" , function() {
|
|
|
common.util.__ajax({
|
|
|
url: '/guang/plustar/delPlustar',
|
|
|
url: '/guang/plustarcategory/updateCategory',
|
|
|
data: {
|
|
|
id: item.id,
|
|
|
status: 0
|
|
|
}
|
|
|
}, function(res) {
|
|
|
if (res.code == 200) {
|
...
|
...
|
@@ -132,12 +118,29 @@ $(document).on('click', '.info-del', function() { |
|
|
});
|
|
|
});
|
|
|
|
|
|
//开启
|
|
|
$(document).on('click', '.info-open', function() {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
|
|
|
common.dialog.confirm("温馨提示","确定要开启该入口?" , function() {
|
|
|
common.util.__ajax({
|
|
|
url: '/guang/plustarcategory/updateCategory',
|
|
|
data: {
|
|
|
id: item.id,
|
|
|
status: 1
|
|
|
}
|
|
|
}, function(res) {
|
|
|
if (res.code == 200) {
|
|
|
g.reload();
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
function plusStarOP(prefix, url, item) {
|
|
|
|
|
|
var a =new common.edit(".confirm");
|
|
|
|
|
|
common.dialog.confirm(prefix+'品牌', common.util.__template2($("#template").html(), item), function () {
|
|
|
common.dialog.confirm(prefix+'plustar分类', common.util.__template2($("#template").html(), item), function () {
|
|
|
|
|
|
//
|
|
|
return a.submit(url,function(option){
|
...
|
...
|
|