1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- @{
- ViewBag.Title = "分配角色";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
- @using MES.Production.Service;
- @using Central.Control.Domain;
- @using Ant.Service.Common;
- @using Ant.Service.Common.Enums;
- <style type="text/css">
- body {
- background-color: white;
- }
- </style>
- @model PageInfo
- @Html.Hidden("userId",ViewData["userId"])
- @Html.Hidden("roleId", ViewData["roleId"])
- <!-- table star -->
- <div class="row col-lg-12">
- <div class="wrapper wrapper-content animated fadeInUp" style="overflow-y:scroll;height:320px;">
- <div class="ibox">
- <div class="ibox-content" style="padding:0;">
- <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: 70px !important">系统预定义</th>
- </tr>
- </thead>
- <tbody>
- @{foreach (var item in Model.List)
- {
- <tr>
- <td class="tn"><input name="checkbox_name" type="checkbox" value="@item.ID"></td>
- <td>
- <a href="javascript:void(0)"> @item.ROLENAME</a>
- </td>
- <td>@item.ROLEDESC</td>
- <td>@item.ISCUSTOM</td>
- </tr>
- }
- }
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- <div class="hr-line-dashed">
- <div class="form-group" style="margin-top:10px !important;">
- <div class="col-sm-2 col-sm-offset-2">
- <button class="btn btn-primary btn-save" type="submit"><i class="fa fa-check"></i> <span>确定保存</span></button>
- <button class="btn btn-warning" id="btn-dig-close" type="button"><i class="im-undo2"></i> 取消返回</button>
- </div>
- </div>
- </div>
- </div>
- <!-- table end -->
- @section scripts{
- <script type="text/javascript">
- $(function () {
- var dialog = top.dialog.get(window);
- //设置选中用户角色
- var roleId = $('#roleId').val();
- if (roleId != '') {
- var r_id = roleId.split(',');
- $('input[name="checkbox_name"]').each(function() {
- for (var i = 0; i < r_id.length; i++) {
- if ($(this).val() == r_id[i]) {
- $(this).prop('checked', true);
- }
- }
- });
- }
- //保存用户角色
- $('.btn-save').click(function() {
- var v = '';
- $('input[name="checkbox_name"]:checked').each(function() {
- v += $(this).val() + ',';
- });
- $.post('/Sys/Role/UserRole', {
- userId: $('#userId').val(),
- roleId: v
- }, function(res) {
- if (res.Status === 'y') {
- dig.alertSuccess('提示', res.Msg, function () {
- dialog.close('yes').remove();
- });
- } else {
- dig.alertError('提示', res.Msg);
- }
- }, 'json');
- });
- });
- </script>
- }
|