修复后台授权问题,调整后台列表批量操作例子
This commit is contained in:
@@ -11,8 +11,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "addArticleForm", @class = "form-horizontal m-t" }))
|
||||
{
|
||||
<form asp-action="AddArticle" asp-controller="Article" asp-area="AdminCP" method="post" class="form-horizontal m-t" id="addArticleForm">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">文章栏目:</label>
|
||||
<div class="col-sm-8">
|
||||
@@ -156,7 +155,7 @@
|
||||
<button class="btn btn-default" type="button" onclick="closethisdialog();"><i class="fa fa-close"></i> 取消 </button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -42,20 +42,16 @@
|
||||
</button>
|
||||
}
|
||||
<button id="btn_edit" type="button" class="btn btn-outline btn-default" onclick="top.showDialog('addarticle','批量迁移文章','/AdminCP/Article/MoveArticle',0,0)">
|
||||
<span class="glyphicon glyphicon-move" aria-hidden="true"></span> 批量迁移
|
||||
<span class="glyphicon glyphicon-move" aria-hidden="true"></span> 文章迁移
|
||||
</button>
|
||||
<button id="btn_delete" type="button" class="btn btn-outline btn-default" onclick="doBatchHide()">
|
||||
<span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span> 批量隐藏
|
||||
<button id="btn_delete" type="button" class="btn btn-outline btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
批量处理 <span class="caret"></span>
|
||||
</button>
|
||||
<button id="btn_delete" type="button" class="btn btn-outline btn-default" onclick="doBatchShow()">
|
||||
<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span> 批量显示
|
||||
</button>
|
||||
@*<button id="btn_edit" type="button" class="btn btn-outline btn-default">
|
||||
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改
|
||||
</button>
|
||||
<button id="btn_delete" type="button" class="btn btn-outline btn-default">
|
||||
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
|
||||
</button>*@
|
||||
<ul class="dropdown-menu dropdown-menu-left">
|
||||
<li><a href="javascript:;" onclick="doBatchAction('/AdminCP/Article/DoBatchHideArticle','隐藏')"><i class="fa fa-eye-slash"></i> 批量隐藏</a></li>
|
||||
<li><a href="javascript:;" onclick="doBatchAction('/AdminCP/Article/DoBatchShowArticle','显示')"><i class="fa fa-eye"></i> 批量显示</a></li>
|
||||
<li><a href="javascript:;" onclick="doBatchAction('/AdminCP/Article/DoBatchDelArticle','删除')"><i class="fa fa-close"></i> 批量删除</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<table id="tb_departments"></table>
|
||||
|
||||
@@ -106,7 +102,7 @@
|
||||
pageNumber: 1, //初始化加载第一页,默认第一页
|
||||
pageSize: 25, //每页的记录行数(*)
|
||||
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
|
||||
search: true, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
|
||||
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
|
||||
strictSearch: true,
|
||||
showColumns: true, //是否显示所有的列
|
||||
showRefresh: true, //是否显示刷新按钮
|
||||
@@ -164,8 +160,9 @@
|
||||
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
||||
limit: params.limit, //页面大小
|
||||
page: (params.offset / params.limit)+1, //页码
|
||||
kid:$("#kid").val(),
|
||||
departmentname: $("#keyword").val()
|
||||
kid: $("#kid").val(),
|
||||
keyword: $("#keyword").val(),
|
||||
isshowsub: $("#isshowsub").prop("checked") ? 1 : 0
|
||||
};
|
||||
return temp;
|
||||
};
|
||||
@@ -213,92 +210,6 @@
|
||||
|
||||
return oInit;
|
||||
};
|
||||
function doBatchHide() {
|
||||
var list = $('#tb_departments').bootstrapTable('getAllSelections');
|
||||
var ids = [];
|
||||
if (!list || list.length <1) {
|
||||
layer.alert("请至少选择一篇文章!", { icon: 2 });
|
||||
return false;
|
||||
}
|
||||
list.map(function (item, index) {
|
||||
if (item.id) {
|
||||
ids.push(item.id);
|
||||
}
|
||||
})
|
||||
//alert(JSON.stringify(ids));
|
||||
//执行操作
|
||||
var loading = layer.load(0, {
|
||||
shade: [0.2, '#000'] //0.1透明度的背景
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/AdminCP/Article/DoBatchHideArticle",
|
||||
data: { ids: JSON.stringify(ids)},
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
layer.msg(data.message, {
|
||||
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
||||
}, function () {
|
||||
doSearch();
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.close(loading);
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function doBatchShow() {
|
||||
var list = $('#tb_departments').bootstrapTable('getAllSelections');
|
||||
var ids = [];
|
||||
if (!list || list.length <1) {
|
||||
//alert('请至少选择一行!');
|
||||
layer.alert("请至少选择一篇文章!", { icon: 2 });
|
||||
return false;
|
||||
}
|
||||
list.map(function (item, index) {
|
||||
if (item.id) {
|
||||
ids.push(item.id);
|
||||
}
|
||||
})
|
||||
//alert(JSON.stringify(ids));
|
||||
//执行操作
|
||||
var loading = layer.load(0, {
|
||||
shade: [0.2, '#000'] //0.1透明度的背景
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/AdminCP/Article/DoBatchShowArticle",
|
||||
data: { ids: JSON.stringify(ids)},
|
||||
dataType: "JSON",
|
||||
success: function (data) {
|
||||
if (data.status == "success") {
|
||||
layer.close(loading);
|
||||
layer.msg(data.message, {
|
||||
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
||||
}, function () {
|
||||
doSearch();
|
||||
});
|
||||
} else {
|
||||
layer.close(loading);
|
||||
layer.alert(data.message, { icon: 2 });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
layer.close(loading);
|
||||
layer.alert('执行错误,请联系管理员!', { icon: 2 });
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user