JXMovies/CMS/JXCMS.CMS.Movie/Admin/Views/Classify/Index.cshtml

160 lines
6.9 KiB
Plaintext
Raw Normal View History

2020-02-16 22:11:24 +08:00
@using JXCMS.CMS.Movie.Entity
@using JXCMS.Core.Extensions
@model List<JXCMS.CMS.Movie.Entity.ClassifyEntity>
@{
ViewBag.Title = "分类目录";
Layout = "_Layout";
}
<div class="container-fluid p-t-15">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-toolbar clearfix">
<div class="toolbar-btn-action">
<a data-src="@Url.Action("ClassifyDialog", "Classify", new {id = 0})" class="btn btn-primary m-r-5" id="new" data-toggle="modal" data-target="#exampleModal"><i class="mdi mdi-plus"></i> 新增</a>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>名称</th>
<th>别名</th>
<th>上级分类</th>
<th>视频数量</th>
<th>操作</th>
</tr>
</thead>
<tbody>
@if (Model.Count == 0)
{
<tr>
<td colspan="5" style="text-align: center">无数据</td>
</tr>
}
@foreach (var classifyEntity in Model)
{
<tr>
<td>@classifyEntity.Name</td>
<td>@(classifyEntity.Alias.IsNullOrEmpty() ? "-" : classifyEntity.Alias)</td>
<td>@(classifyEntity.Parent == null ? "无" : classifyEntity.Parent.Name)</td>
<td>@classifyEntity.Count</td>
<td>
<div class="btn-group">
<a class="btn btn-xs btn-default" data-src="@Url.Action("ClassifyDialog", "Classify", new {id = classifyEntity.Id})" title="编辑" data-toggle="modal" data-target="#exampleModal">
<i class="mdi mdi-pencil"></i>
</a>
<a class="btn btn-xs btn-default" title="删除" data-toggle="tooltip" onclick="delClassify(@classifyEntity.Id, '@classifyEntity.Name')"
@if (classifyEntity.Count > 0)
{
@:disabled
}>
<i class="mdi mdi-window-close"></i>
</a>
</div>
</td>
</tr>
}
</tbody>
</table>
</div>
<ul class="pagination">
@if (ViewBag.pageNumber != 1)
{
<li>
<a href="@Url.Action("Index", "Classify")">&lt;&lt;</a>
</li>
}
@for (int i = ViewBag.pageNumber - 3; i < ViewBag.pageNumber + 3; i++)
{
if (i < 1 || i > ViewBag.totlePage)
{
continue;
}
if (i == ViewBag.pageNumber)
{
<li class="active">
<span>@i</span>
</li>
}
else
{
<li>
<a href="@Url.Action("Index", "Classify", new {pageNumber = i})">@i</a>
</li>
}
}
@if (ViewBag.pageNumber < ViewBag.totlePage)
{
<li>
<a href="@Url.Action("Index", "Classify", new {pageNumber = ViewBag.totlePage})">&gt;&gt;</a>
</li>
}
</ul>
</div>
</div>
</div>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
正在加载,请稍后...
</div>
</div>
</div>
</div>
<form id="delForm" action="@Url.Action("DeleteClassify")" method="post">
<input type="hidden" name="id" id="delId"/>
</form>
</div>
@section style
{
<link rel="stylesheet" href="@Url.ContentAdmin("js/jconfirm/jquery-confirm.min.css")">
}
@section script
{
<script src="@Url.ContentAdmin("js/bootstrap-notify.min.js")"></script>
<script type="text/javascript" src="@Url.ContentAdmin("js/lightyear.js")"></script>
<script src="@Url.ContentAdmin("js/jconfirm/jquery-confirm.min.js")"></script>
<script type="text/javascript">
$('#exampleModal').on('show.bs.modal', function(event) {
var button = $(event.relatedTarget); // Button that triggered the modal
var recipient = button.data('src'); // Extract info from data-* attributes
var content = $(this).find(".modal-content");
content.html("正在加载,请稍后...");
$.get(recipient, function(data, status) {
if (status === "success") {
content.html(data)
} else{
content.html("发生错误,请重试")
}
})
});
function delClassify(id, name) {
$.alert({
title: '删除分类地址' + name,
content: '是否删除' + name + '?(如果该分类下有子分类,子分类将变为顶级分类)<br />该操作不可恢复',
buttons: {
confirm: {
text: '是',
btnClass: 'btn-primary',
action: function(){
$('#delId').val(id);
$('#delForm').submit();
}
},
cancel: {
text: '否'
}
}
});
}
</script>
}