123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- @{
- ViewBag.Title = "权限列表";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
- @using MES.Production.Service;
- @using Central.Control.Domain;
- @using Ant.Service.Common;
- @using Ant.Service.Common.Enums;
- @model List<SYS_PERMISSION>
- <!-- table star -->
- <div class="row col-lg-12">
- <div class="wrapper wrapper-content animated fadeInUp">
- <div class="ibox">
- @using (Ajax.BeginForm("Index", null, new AjaxOptions() { }, new { @id = "form1", @class = "form-horizontal", @method = "get" }))
- {
- <div class="ibox-title">
- @{
- if (ViewBag.Module != null)
- {
- SYS_MODULE module = ViewBag.Module as SYS_MODULE;
- if (module != null)
- {
- <h5>@(module.NAME) 权限</h5>
- @Html.Hidden("moduleId", module.ID)
- @Html.Hidden("moduleType", module.MODULETYPE)
- }
- <div class="ibox-tools rboor">
- <a class="btn btn-primary btn-xs p310" id="reset" action="reset"><i class="im-plus"></i> 初始化权限</a>
- <a class="btn btn-primary btn-xs p310" id="insert" action="add"><i class="im-plus"></i> 创建新权限</a>
- <a class="btn btn-primary btn-xs p310" id="modify" action="edit"><i class="im-pencil2"></i> 编辑</a>
- <a class="btn btn-primary btn-xs p310" id="delete" action="remove"><i class="im-remove4"></i> 删除</a>
- </div>
- }
- else
- {
- <h5>权限管理</h5>
- }
- }
- </div>
- <div class="ibox-content">
- <!-- search star -->
- <div class="form-horizontal clearfix">
- <div class="col-lg-4 col-sm-4">
- <div class="form-group">
- <div class="col-lg-12 col-sm-12 input-group">
- @Html.TextBox("Search", null, new { @class = "input-sm form-control", @placeholder = "请输入查询关键词" })
- <span class="input-group-btn">
- <button type="button" onclick="submit()" class="btn btn-sm btn-primary"> 搜索</button>
- </span>
- </div>
- </div>
- </div>
- </div>
- <!-- search end -->
- <div id="example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
- <table id="example" class="table table-striped table-bordered table-hover dataTables-example dataTable" cellspacing="0" width="100%">
- <thead>
- <tr>
- <th class="tn" style="width: 40px !important"><input name="checkall" id="checkall" type="checkbox" value=""></th>
- <th>权限名称</th>
- <th>权限动作</th>
- <th style="width:100px !important;">图标</th>
- <th style="width:100px !important;">顺序</th>
- </tr>
- </thead>
- <tbody>
- @{
- if (Model != null)
- {
- @Html.Hidden("percount",Model.Count)
- foreach (var item in Model)
- {
- <tr>
- <td class="tn"><input name="checkbox_name" type="checkbox" value="@item.ID"></td>
- <td>
- <a href="javascript:modify('@item.ID')" listaction="detail"> @item.NAME</a>
- </td>
- <td>@item.PERVALUE</td>
- <td style="color:#1ab394; "><i class="@item.ICON"></i></td>
- <td>@item.SHOWORDER</td>
- </tr>
- }
- }
- }
- </tbody>
- </table>
- </div>
- </div>
- }
- </div>
- </div>
- </div>
- <!-- table end -->
- @section scripts{
- <script type="text/javascript">
- //点击修改
- function modify(n) {
- dig.addModel('添加/编辑权限', '/Sys/Permission/Detail/' + n, 500, 300, function () {
- if (this.returnValue == 'yes') {
- location.reload();
- }
- });
- }
- $(function () {
- //添加
- $('#insert').click(function () {
- var moduleId = $('#moduleId').val();
- var moduleType = $('#moduleType').val();
- if (moduleId == '' || moduleId == undefined) {
- dig.alertError('提示', '请先选择模块后再进行添加权限操作');
- return;
- }
- if (moduleType <= 1 || moduleType == '1') {
- dig.alertError('提示', '无页面的模块不能添加权限');
- return;
- }
- dig.addModel('添加/编辑权限', '/Sys/Permission/Detail?moduleId=' + moduleId, 500, 300, function () {
- if (this.returnValue == 'yes') {
- location.reload();
- }
- });
- });
- //修改
- $('#modify').click(function () {
- var vals = '';
- var num = 0;
- $('input[name="checkbox_name"]:checked').each(function () {
- vals = $(this).val();
- num++;
- });
- if (!vals) {
- dig.alertError("提示", "对不起,请选中您要操作的记录!");
- return;
- }
- if (num > 1) {
- dig.alertError("提示", "对不起,每次只能修改一条记录!");
- return;
- }
- dig.addModel('添加/编辑权限', '/Sys/Permission/Detail/' + vals, 500, 300, function () {
- if (this.returnValue == 'yes') {
- location.reload();
- }
- });
- });
- //初始化权限
- $('#reset').click(function () {
- if ($('#percount').val()>0) {
- dig.alertError("提示", "对不起,该模块已存在权限,无法初始化!");
- return;
- }
- dig.confirm('提示', '您确定要初始化权限吗?', function () {
- $.post('/Sys/Permission/Reset/' + $('#moduleId').val(), null, function (result) {
- if (result.Status == 'y') {
- dig.alertSuccess('提示', result.Msg, function () {
- location.reload();
- });
- } else {
- dig.alertError('提示', result.Msg);
- }
- }, 'json');
- });
- });
- });
- </script>
- }
|