...
|
...
|
@@ -4,79 +4,50 @@ |
|
|
var $ = require('jquery');
|
|
|
common = require('../common/common');
|
|
|
|
|
|
|
|
|
var ENUM = {
|
|
|
HotEnum: {
|
|
|
'1': '是',
|
|
|
'0': '否',
|
|
|
'0': '否'
|
|
|
},
|
|
|
|
|
|
StatusEnum: {
|
|
|
0:'关闭',
|
|
|
1:'开启',
|
|
|
},
|
|
|
|
|
|
1:'开启'
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//下拉框
|
|
|
new common.dropDown({
|
|
|
el: "#articleGender"
|
|
|
el: "#sort",
|
|
|
ajax: 'guangGetTagCategoryByStatus'
|
|
|
});
|
|
|
|
|
|
new common.dropDown({
|
|
|
el: "#maxSortId",
|
|
|
ajax: 'guangGetTagCategoryByStatus',
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
var g = new common.grid({
|
|
|
el: '#basicTable',
|
|
|
size: 10,
|
|
|
parms: function () {
|
|
|
|
|
|
return {
|
|
|
tagName: common.util.__input('articleTitle'),
|
|
|
classifyId: common.util.__input('maxSortId'),
|
|
|
isHot: common.util.__input('articleGender'),
|
|
|
status: common.util.__input('status'),
|
|
|
classifyId: common.util.__input('sort'),
|
|
|
isHot: common.util.__input('isArticleHot'),
|
|
|
status: common.util.__input('status')
|
|
|
};
|
|
|
},
|
|
|
columns: [
|
|
|
{
|
|
|
display: 'ID',
|
|
|
name: "id"
|
|
|
},
|
|
|
|
|
|
{
|
|
|
display: '标签名称',
|
|
|
name: "tagName"
|
|
|
}, {
|
|
|
display: '标签分类',
|
|
|
name: "classifyName"
|
|
|
}, {
|
|
|
display: '是否热门',
|
|
|
render: function (item) {
|
|
|
return "<p>" + ENUM.HotEnum[item.isHot] + "</p>";
|
|
|
}
|
|
|
}, {
|
|
|
display: '状态',
|
|
|
render: function (item) {
|
|
|
return "<p>" + ENUM.StatusEnum[item.status] + "</p>";
|
|
|
}
|
|
|
}, {
|
|
|
display: '操作',
|
|
|
//}
|
|
|
name: "status",
|
|
|
render: function (items) {
|
|
|
var HtmArr = [];
|
|
|
|
|
|
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>');
|
|
|
|
|
|
return HtmArr.join('');
|
|
|
}
|
|
|
}]
|
|
|
{display: 'ID', name: "id"},
|
|
|
{display: '标签名称', name: "tagName"},
|
|
|
{display: '标签分类', name: "classifyName"},
|
|
|
{display: '是否热门', render: function (item) {
|
|
|
return "<p>" + ENUM.HotEnum[item.isHot] + "</p>";
|
|
|
}},
|
|
|
{display: '状态', render: function (item) {
|
|
|
return "<p>" + ENUM.StatusEnum[item.status] + "</p>";
|
|
|
}},
|
|
|
{display: '操作', name: "status", render: function (items) {
|
|
|
var HtmArr = [];
|
|
|
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>');
|
|
|
return HtmArr.join('');
|
|
|
}}
|
|
|
]
|
|
|
});
|
|
|
g.init('/guang/tags/getList');
|
|
|
|
...
|
...
|
@@ -89,7 +60,6 @@ $("#filter-btn").click(function() { |
|
|
//添加
|
|
|
$(document).on('click', '#add-btn', function() {
|
|
|
articleCategoryOP("新增", '/guang/tags/addTag', {});
|
|
|
|
|
|
});
|
|
|
|
|
|
//编辑
|
...
|
...
|
@@ -101,12 +71,11 @@ $(document).on('click', '.info-modify', function() { |
|
|
//删除
|
|
|
$(document).on('click', '.info-del', function() {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
|
|
|
common.dialog.confirm("温馨提示","确定要删除该标签?" , function() {
|
|
|
common.util.__ajax({
|
|
|
url: '/guang/tags/delTag',
|
|
|
data: {
|
|
|
id: item.id,
|
|
|
id: item.id
|
|
|
}
|
|
|
}, function(res) {
|
|
|
if (res.code == 200) {
|
...
|
...
|
@@ -118,15 +87,11 @@ $(document).on('click', '.info-del', function() { |
|
|
|
|
|
|
|
|
function articleCategoryOP(prefix, url, item) {
|
|
|
|
|
|
var a =new common.edit(".confirm");
|
|
|
|
|
|
common.dialog.confirm(prefix+'标签', common.util.__template2($("#template").html(), item), function () {
|
|
|
|
|
|
//
|
|
|
var a = new common.edit(".tagInfo", {bucket:"articleTags"});
|
|
|
common.dialog.confirm(prefix + '标签', common.util.__template2($("#template").html(), item), function () {
|
|
|
return a.submit(url,function(option){
|
|
|
option.success=function(res){
|
|
|
res=res.data;
|
|
|
option.success = function(res){
|
|
|
res = res.data;
|
|
|
if(res.code=="200"){
|
|
|
a.$tip("提交成功", function() {
|
|
|
g.reload();
|
...
|
...
|
@@ -136,24 +101,19 @@ function articleCategoryOP(prefix, url, item) { |
|
|
}
|
|
|
return false;
|
|
|
},
|
|
|
option.error=function(res){
|
|
|
a.$tip(res.message);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
a.init();
|
|
|
|
|
|
|
|
|
new common.dropDown({
|
|
|
el: "#classifyId",
|
|
|
ajax: 'guangGetTagCategoryByStatus',
|
|
|
params:function(){
|
|
|
return {status:1};
|
|
|
option.error = function(res){
|
|
|
a.$tip(res.message);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
});
|
|
|
a.init();
|
|
|
|
|
|
|
|
|
new common.dropDown({
|
|
|
el: "#classifyId",
|
|
|
ajax: 'guangGetTagCategoryByStatus',
|
|
|
params:function(){
|
|
|
return {status:1};
|
|
|
}
|
|
|
});
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|