OpenAuth.Net/OpenAuth.Mvc/Views/ResourceManager/Add.cshtml
2016-01-05 10:03:35 +08:00

157 lines
7.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@model OpenAuth.Domain.Resource
@{
ViewBag.Title = "Resource编辑界面";
Layout = null;
}
<div class="bjui-pageContent">
<form action="/ResourceManager/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.CategoryId)
</td>
</tr>
<tr>
<td>
<label for="Key" class="control-label x120">资源标识:</label>
<input type="text" name="Key" id="Key" value="@Model.Key"
data-rule="required" size="20">
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label x120">名称:</label>
<input type="text" name="Name" id="Name" value="@Model.Name"
data-rule="required" size="20">
</td>
</tr>
@if (Model.Id == 0) //添加
{
<tr>
<td>
<label for="ParentName" class="control-label x120">所属分类:</label>
<input type="text" name="ParentName" id="ParentName"
data-toggle="selectztree" size="20" data-tree="#j_select_tree1" value="">
<ul id="j_select_tree1" class="ztree hide" data-toggle="ztree"></ul>
</td>
</tr>
<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('CategoryManager/LoadForTree', 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 = '';
for (var i = 0; i < nodes.length; i++) {
ids += ',' + nodes[i].Id;
names += ',' + nodes[i].Name;
}
if (ids.length > 0) { //去掉第一个逗号
ids = ids.substr(1);
names = names.substr(1);
}
var $from = $('#' + treeId).data('fromObj');
if ($from && $from.length) $from.val(names);
$('#CategoryId').val(ids);
}
function zTreeOnClick(event, treeId, treeNode) {
var zTree = $.fn.zTree.getZTreeObj(treeId);
zTree.checkNode(treeNode, !treeNode.checked, true, true);
event.preventDefault();
}
</script>
}
else //编辑
{
<tr>
<td>
<label for="CascadeId" class="control-label x120">节点语义ID</label>
<input type="text" name="CascadeId" id="CascadeId" value="@Model.CascadeId"
data-rule="required" size="20">
</td>
</tr>
}
<tr>
<td>
<label for="Status" class="control-label x120">当前状态:</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> }>状态1</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="SortNo" class="control-label x120">排序号:</label>
<select name="SortNo" id="SortNo" data-toggle="selectpicker" data-rule="required">
<option value="0" @if (Model.SortNo == 0) { <text> selected="selected" </text> }>默认</option>
<option value="1" @if (Model.SortNo == 1) { <text> selected="selected" </text> }>状态1</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="CategoryId" class="control-label x120">资源分类标识:</label>
<select name="CategoryId" id="CategoryId" data-toggle="selectpicker" data-rule="required">
<option value="0" @if (Model.CategoryId == 0) { <text> selected="selected" </text> }>默认</option>
<option value="1" @if (Model.CategoryId == 1) { <text> selected="selected" </text> }>状态1</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="Description" class="control-label x120">描述:</label>
<input type="text" name="Description" id="Description" value="@Model.Description"
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>