You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
178 lines
9.2 KiB
178 lines
9.2 KiB
@model EditTeacherModel
|
|
@using System.ComponentModel
|
|
@{
|
|
var url = Url.Action(null, null);
|
|
var props = ViewData.ModelMetadata.Properties;
|
|
var isEdit = Model.CheckStatus == "未提交" || Model.CheckStatus == "审核失败";
|
|
var isCheck = Model.CheckStatus == "待审核" && User.IsInRole("学校管理员");
|
|
isCheck = isCheck || Model.CheckStatus == "审核成功" && User.IsInRole("城中区教育局管理员");
|
|
var iframe = Context.Request.Query.ContainsKey("iframe") || (Context.Request.Method == "POST" && Context.Request.Form.ContainsKey("iframe"));
|
|
var self = Context.Request.Query.ContainsKey("self") || (Context.Request.Method == "POST" && Context.Request.Form.ContainsKey("self"));
|
|
}
|
|
<div class="card card-info">
|
|
<form action="@url" method="post" class="form-horizontal">
|
|
<div class="card-body">
|
|
<div class="row">
|
|
@Html.AntiForgeryToken()
|
|
@if (iframe)
|
|
{
|
|
@Html.Hidden("iframe", "")
|
|
}
|
|
@if (self)
|
|
{
|
|
@Html.Hidden("self", "")
|
|
}
|
|
<div class="col-sm-12">
|
|
<div class="form-group row">
|
|
<div class="col-sm-2 col-form-label"></div>
|
|
@Html.ValidationSummary(true, "错误:", new { @class = "text-danger col-sm-10" }, "div")
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
@foreach (var prop in props)
|
|
{
|
|
var metadata = prop as Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadata;
|
|
var isReadOnly = metadata.Attributes.Attributes.Any(o => o.GetType() == typeof(ReadOnlyAttribute));
|
|
var isDisplayOnly = metadata.Attributes.Attributes.Any(o => o.GetType() == typeof(DisplayOnlyAttribute));
|
|
var isHidden = metadata.Attributes.Attributes.Any(o => o.GetType() == typeof(HiddenInputAttribute));
|
|
var desc = (metadata.Attributes.Attributes.OfType<DescriptionAttribute>().FirstOrDefault() as DescriptionAttribute)?.Description;
|
|
var isRequired = metadata.Attributes.Attributes.Any(o => o.GetType() == typeof(RequiredAttribute));
|
|
var labelCalss = "col-sm-4 col-form-label" + (isRequired ? " required" : "");
|
|
if (prop.PropertyName.EndsWith("Checked") || prop.PropertyName.EndsWith("Comment"))
|
|
{
|
|
continue;
|
|
}
|
|
if (isHidden)
|
|
{
|
|
@Html.Hidden(prop.PropertyName)
|
|
continue;
|
|
}
|
|
if (prop.HideSurroundingHtml || isDisplayOnly)
|
|
{
|
|
@Html.Hidden(prop.PropertyName)
|
|
continue;
|
|
}
|
|
var uihit = prop.DataTypeName ?? prop.TemplateHint;
|
|
<div class="col-sm-6">
|
|
<div class="form-group row @prop.ModelType.Name @uihit">
|
|
@Html.Label(prop.PropertyName, prop.GetDisplayName(), new { @class = labelCalss })
|
|
<div class="col-sm-6" title="@desc">
|
|
@if (isReadOnly)
|
|
{
|
|
<div class="form-control" style="border-color:transparent;height:auto;padding-left:0;">
|
|
@Html.Hidden(prop.PropertyName)
|
|
<div id="@Html.Id(prop.PropertyName)Display">@Html.Display(prop.PropertyName, uihit)</div>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
if (self && (Model.CheckStatus == "未提交" || Model.CheckStatus == "审核失败"))
|
|
{
|
|
@Html.Editor(prop.PropertyName, uihit)
|
|
}
|
|
else
|
|
{
|
|
@Html.Hidden(prop.PropertyName)
|
|
<div class="form-control" style="border-color:transparent;height:auto;padding-left:0;">
|
|
@Html.Display(prop.PropertyName, uihit)
|
|
</div>
|
|
}
|
|
}
|
|
@Html.ValidationMessage(prop.PropertyName, new { @class = "text-danger" })
|
|
</div>
|
|
<div class="col-sm-2 checkbox">
|
|
@{
|
|
var checkedProp = props.FirstOrDefault(o => o.PropertyName == prop.PropertyName + "Checked");
|
|
@if (checkedProp != null)
|
|
{
|
|
@if (!self && (Model.CheckStatus == "待审核" && User.IsInRole("学校管理员")))
|
|
{
|
|
@Html.Editor(checkedProp.PropertyName)
|
|
}
|
|
else
|
|
{
|
|
@Html.Hidden(checkedProp.PropertyName)
|
|
@Html.Display(checkedProp.PropertyName, "Bool")
|
|
|
|
}
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
<div class="form-group row">
|
|
@Html.LabelFor(o => o.Comment, new { @class = "col-sm-2 col-form-label" })
|
|
<div class="col-sm-8">
|
|
@if (!self && isCheck)
|
|
{
|
|
@Html.TextAreaFor(o => o.Comment, new { @class = "form-control" })
|
|
}
|
|
else
|
|
{
|
|
<div class="form-control" style="border-color:transparent;height:auto;padding-left:0;color:red;">
|
|
@Html.HiddenFor(o => o.Comment)
|
|
@Html.DisplayFor(o => o.Comment)
|
|
</div>
|
|
}
|
|
</div>
|
|
<div class="col-sm-2"></div>
|
|
</div>
|
|
<div class="row text-center">
|
|
<div class="col-sm-12">
|
|
@if (!iframe)
|
|
{
|
|
<a href="@Url.Action("Index","Home")" class="btn btn-primary">返回</a>
|
|
}
|
|
@if (self)
|
|
{
|
|
@if (Model.CheckStatus == "未提交" || Model.CheckStatus == "审核失败")
|
|
{
|
|
<button class="btn btn-primary" type="submit">保存</button>
|
|
<button id="submitCheckRequest" type="button" class="btn btn-primary">提交审核</button>
|
|
}
|
|
else
|
|
{
|
|
if (Model.RequestEditStatus == "已申请")
|
|
{
|
|
<button id="cancelModifyRequest" type="button" class="btn btn-primary">取消申请</button>
|
|
}
|
|
else
|
|
{
|
|
<button id="submitModifyRequest" type="button" class="btn btn-primary">申请修改</button>
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
@if (User.IsInRole("城中区教育局管理员") && Model.CheckStatus == "审核成功")
|
|
{
|
|
<span>教育局管理员:</span>
|
|
<button id="super" type="button" class="btn btn-primary">退回</button>
|
|
}
|
|
else if (User.IsInRole("学校管理员"))
|
|
{
|
|
@if (Model.CheckStatus == "待审核")
|
|
{
|
|
<span>学校管理员:</span>
|
|
<button id="admin1" type="button" class="btn btn-primary">审核通过</button>
|
|
<button id="admin2" type="button" class="btn btn-primary">审核失败</button>
|
|
}
|
|
@if (Model.RequestEditStatus == "已申请")
|
|
{
|
|
<span>学校管理员:</span>
|
|
<button id="admin3" type="button" class="btn btn-primary">批准修改申请</button>
|
|
<button id="admin4" type="button" class="btn btn-primary">拒绝修改申请</button>
|
|
}
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
@section scripts{
|
|
<script src="~/js/update.js"></script>
|
|
} |