mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
137 lines
5.1 KiB
Plaintext
137 lines
5.1 KiB
Plaintext
@model OpenAuth.Domain.Role
|
||
@{
|
||
ViewBag.Title = "title";
|
||
Layout = null;
|
||
}
|
||
|
||
<div class="bjui-pageContent">
|
||
<form action="/RoleManager/Add" class="pageForm" data-toggle="validate">
|
||
<table class="table table-condensed table-hover">
|
||
<tbody>
|
||
|
||
<tr>
|
||
<td>
|
||
@Html.HiddenFor(m => m.Id)
|
||
@Html.HiddenFor(m => m.CreateTime)
|
||
<tr>
|
||
<td>
|
||
|
||
<label for="Name" class="control-label x90">角色名称:</label>
|
||
<input type="text" name="Name" id="Name" value="@Model.Name"
|
||
data-rule="required" size="20">
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
|
||
<label for="Status" class="control-label x90">当前状态:</label>
|
||
<select name="Status" id="Status" data-toggle="selectpicker" data-rule="required">
|
||
<option value="0" @if (Model.Status == 0) { <text> selected="selected" </text> }>正常</option>
|
||
<option value="1" @if (Model.Status == 1) { <text> selected="selected" </text> }>禁用</option>
|
||
</select>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
|
||
<label for="Type" class="control-label x90">角色类型:</label>
|
||
<select name="Type" id="Type" data-toggle="selectpicker" data-rule="required">
|
||
<option value="0" @if (Model.Type == 0) { <text> selected="selected" </text> }>管理员</option>
|
||
<option value="1" @if (Model.Type == 1) { <text> selected="selected" </text> }>普通角色</option>
|
||
</select>
|
||
</td>
|
||
</tr>
|
||
|
||
|
||
<tr>
|
||
<td>
|
||
<label for="OrgName" class="control-label x90">所属机构:</label>
|
||
<input id="OrgId" name="OrgId" value="" style="display: none"/>
|
||
<input type="text" name="OrgName" id="OrgName"
|
||
data-toggle="selectztree" size="20" data-tree="#j_select_tree1" value="@Model.OrgName">
|
||
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
|
||
<label for="OrgCascadeId" class="control-label x90">机构级联ID:</label>
|
||
<input type="text" name="OrgCascadeId" id="OrgCascadeId" value="@Model.OrgCascadeId"
|
||
data-rule="required" size="20">
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</form>
|
||
</div>
|
||
<div class="bjui-pageFooter">
|
||
<ul>
|
||
<li><button type="button" class="btn-close">关闭</button></li>
|
||
<li><button type="submit" class="btn-green">保存</button></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<script type="text/javascript">
|
||
$(document).ready(function () {
|
||
Init();
|
||
});
|
||
function Init() {
|
||
var setting = {
|
||
view: {
|
||
selectedMulti: false
|
||
},
|
||
check: {
|
||
enable: true,
|
||
chkStyle: "radio",
|
||
radioType: "all"
|
||
},
|
||
data: {
|
||
key: {
|
||
name: 'Name',
|
||
title: 'Name'
|
||
},
|
||
simpleData: {
|
||
enable: true,
|
||
idKey: 'Id',
|
||
pIdKey: 'ParentId',
|
||
rootPId: 'null'
|
||
}
|
||
},
|
||
callback: {
|
||
onClick: zTreeOnClick,
|
||
onCheck: zTreeCheck
|
||
}
|
||
};
|
||
$.getJSON('OrgManager/LoadOrg', function (json) {
|
||
var zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
||
zTreeObj.expandAll(true);
|
||
});
|
||
}
|
||
|
||
function zTreeCheck(e, treeId, treeNode) {
|
||
var zTree = $.fn.zTree.getZTreeObj(treeId),
|
||
nodes = zTree.getCheckedNodes(true);
|
||
var ids = '', names = '', cascadeids='';
|
||
for (var i = 0; i < nodes.length; i++) {
|
||
ids += ',' + nodes[i].Id;
|
||
names += ',' + nodes[i].Name;
|
||
cascadeids += ',' + nodes[i].CascadeId;
|
||
}
|
||
if (ids.length > 0) { //去掉第一个逗号
|
||
ids = ids.substr(1);
|
||
names = names.substr(1);
|
||
cascadeids = cascadeids.substr(1);
|
||
}
|
||
|
||
var $from = $('#' + treeId).data('fromObj');
|
||
if ($from && $from.length) $from.val(names);
|
||
|
||
$('#OrgId').val(ids);
|
||
$('#OrgCascadeId').val(cascadeids);
|
||
}
|
||
function zTreeOnClick(event, treeId, treeNode) {
|
||
var zTree = $.fn.zTree.getZTreeObj(treeId);
|
||
zTree.checkNode(treeNode, !treeNode.checked, true, true);
|
||
event.preventDefault();
|
||
}
|
||
</script> |