|
|
@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("城中区教育局管理员");
|
|
|
}
|
|
|
<div class="card card-info">
|
|
|
<form action="@url" method="post" class="form-horizontal">
|
|
|
<div class="card-body">
|
|
|
<div class="row">
|
|
|
@Html.AntiForgeryToken()
|
|
|
@if (Context.Request.Query.ContainsKey("iframe")||(Context.Request.Method=="POST"&&Context.Request.Form.ContainsKey("iframe")))
|
|
|
{
|
|
|
@Html.Hidden("iframe","")
|
|
|
}
|
|
|
<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)
|
|
|
@Html.Display(prop.PropertyName, uihit)
|
|
|
</div>
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@if ((Model.CheckStatus == "未提交" || Model.CheckStatus == "审核失败") && User.Identity.Name == Model.LoginName)
|
|
|
{
|
|
|
@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">
|
|
|
@{
|
|
|
var checkedProp = props.FirstOrDefault(o => o.PropertyName == prop.PropertyName + "Checked");
|
|
|
@if (checkedProp != null)
|
|
|
{
|
|
|
<div class="form-control" style="border-color:transparent;padding-left:0;">
|
|
|
@if (Model.CheckStatus == "待审核" && User.IsInRole("学校管理员"))
|
|
|
{
|
|
|
@Html.Editor(checkedProp.PropertyName)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
<div class="form-control" style="border-color:transparent;padding-left:0;">
|
|
|
@Html.Hidden(checkedProp.PropertyName)
|
|
|
@Html.Display(checkedProp.PropertyName, "Bool")
|
|
|
</div>
|
|
|
}
|
|
|
</div>
|
|
|
}
|
|
|
}
|
|
|
</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 (isCheck)
|
|
|
{
|
|
|
@Html.TextAreaFor(o => o.Comment, new { @class = "form-control" })
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
<div class="form-control" style="border-color:transparent;height:auto;padding-left:0;">
|
|
|
@Html.HiddenFor(o => o.Comment)
|
|
|
@Html.DisplayFor(o => o.Comment)
|
|
|
</div>
|
|
|
}
|
|
|
</div>
|
|
|
<div class="col-sm-2"></div>
|
|
|
</div>
|
|
|
<div class="row">
|
|
|
<div class="col-sm-6">
|
|
|
<div class="form-group row">
|
|
|
<div class="col-sm-4"> </div>
|
|
|
<div class="col-sm-8">
|
|
|
@if (!Context.Request.Query.ContainsKey("iframe"))
|
|
|
{
|
|
|
<a href="@Url.Action("Index","Home")" class="btn btn-primary">返回</a>
|
|
|
}
|
|
|
@if (User.Identity.Name == Model.LoginName)
|
|
|
{
|
|
|
@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>
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@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>
|
|
|
</div>
|
|
|
</div>
|
|
|
</form>
|
|
|
</div>
|
|
|
@section scripts{
|
|
|
<script>
|
|
|
function submit(msg, func) {
|
|
|
Swal.fire({
|
|
|
position:'bottom',
|
|
|
text: msg,
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
showCancelButton: true
|
|
|
}).then(function (value) {
|
|
|
if (value.isConfirmed) {
|
|
|
func();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
</script>
|
|
|
<script>
|
|
|
//用户操作
|
|
|
//提交审核
|
|
|
$('#submitCheckRequest').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#CheckStatus').val('待审核');
|
|
|
form.submit();
|
|
|
});
|
|
|
});
|
|
|
//申请修改
|
|
|
$('#submitModifyRequest').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#RequestEditStatus').val('已申请');
|
|
|
form.submit();
|
|
|
});
|
|
|
});
|
|
|
//取消申请
|
|
|
$('#cancelModifyRequest').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#RequestEditStatus').val('未申请');
|
|
|
form.submit();
|
|
|
});
|
|
|
});
|
|
|
</script>
|
|
|
<script>
|
|
|
//批准申请修改
|
|
|
$('#super').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#CheckStatus').val('未提交');
|
|
|
$('#RequestEditStatus').val('未申请');
|
|
|
form.submit();
|
|
|
});
|
|
|
});
|
|
|
//审核成功
|
|
|
$('#admin1').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#Comment').val('');
|
|
|
$('#CheckStatus').val('审核成功');
|
|
|
form.submit();
|
|
|
});
|
|
|
});
|
|
|
//审核失败
|
|
|
$('#admin2').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#CheckStatus').val('审核失败');
|
|
|
form.submit();
|
|
|
});
|
|
|
});
|
|
|
//批准修改申请
|
|
|
$('#admin3').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#CheckStatus').val('未提交');
|
|
|
$('#RequestEditStatus').val('未申请');
|
|
|
form.submit();
|
|
|
});
|
|
|
});
|
|
|
//拒绝修改申请
|
|
|
$('#admin4').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#RequestEditStatus').val('未申请');
|
|
|
form.submit();
|
|
|
});
|
|
|
});
|
|
|
</script>
|
|
|
<script>
|
|
|
var cls = '.col-sm-6';
|
|
|
//是否最高职称聘任
|
|
|
if ($('#IsJobAsMaxTitle').val()) {
|
|
|
if ($('#IsJobAsMaxTitle').val() === "True") {
|
|
|
$("[data-my-group='JobAsMaxTitle2']").parents(cls).hide();
|
|
|
$("[data-my-group='JobAsMaxTitle1']").parents(cls).show();
|
|
|
}
|
|
|
else {
|
|
|
$("[data-my-group='JobAsMaxTitle1']").parents(cls).hide();
|
|
|
$("[data-my-group='JobAsMaxTitle2']").parents(cls).show();
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
$("[data-my-group='JobAsMaxTitle1']").parents(cls).hide();
|
|
|
$("[data-my-group='JobAsMaxTitle2']").parents(cls).hide();
|
|
|
}
|
|
|
//是否享受学历待遇
|
|
|
if ($('#EducationGrade').val()) {
|
|
|
if ($('#EducationGrade').val() !== "") {
|
|
|
$("#EducationGradeDate").parents(cls).show();
|
|
|
}
|
|
|
else {
|
|
|
$("#EducationGradeDate").parents(cls).hide();
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
$("#EducationGradeDate").parents(cls).hide();
|
|
|
}
|
|
|
//是否在编在岗
|
|
|
if ($('#HasPosition').val()) {
|
|
|
if ($('#HasPosition').val() === "True") {
|
|
|
$("[data-my-group='HasPosition2']").parents(cls).hide();
|
|
|
$("[data-my-group^='HasPosition1']").parents(cls).show();
|
|
|
if ($('#IsMiddleLevel').val()) {
|
|
|
if ($('#IsMiddleLevel').val() === "True") {
|
|
|
$("[data-my-group='HasPosition12']").parents(cls).hide();
|
|
|
$("[data-my-group='HasPosition11']").parents(cls).show();
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
$("[data-my-group='HasPosition11']").parents(cls).hide();
|
|
|
$("[data-my-group='HasPosition12']").parents(cls).show();
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
$("[data-my-group='HasPosition11']").parents(cls).hide();
|
|
|
$("[data-my-group='HasPosition12']").parents(cls).hide();
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
$("[data-my-group^='HasPosition1']").parents(cls).hide();
|
|
|
$("[data-my-group='HasPosition2']").parents(cls).show();
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
$("[data-my-group^='HasPosition1']").parents(cls).hide();
|
|
|
$("[data-my-group^='HasPosition2']").parents(cls).hide();
|
|
|
}
|
|
|
</script>
|
|
|
<script>
|
|
|
$('#IsJobAsMaxTitle').change(function () {
|
|
|
if ($(this).val() === "True") {
|
|
|
$("[data-my-group='JobAsMaxTitle2']").parents(cls).hide();
|
|
|
$("[data-my-group='JobAsMaxTitle1']").parents(cls).show();
|
|
|
}
|
|
|
else if ($(this).val() === "False") {
|
|
|
$("[data-my-group='JobAsMaxTitle1']").parents(cls).hide();
|
|
|
$("[data-my-group='JobAsMaxTitle2']").parents(cls).show();
|
|
|
}
|
|
|
else {
|
|
|
$("[data-my-group='JobAsMaxTitle1']").parents(cls).hide();
|
|
|
$("[data-my-group='JobAsMaxTitle2']").parents(cls).hide();
|
|
|
}
|
|
|
});
|
|
|
//
|
|
|
$('#EducationGrade').change(function () {
|
|
|
if ($(this).val() !== "") {
|
|
|
$("#EducationGradeDate").parents(cls).show();
|
|
|
}
|
|
|
else {
|
|
|
$("#EducationGradeDate").val('').parents(cls).hide();
|
|
|
}
|
|
|
});
|
|
|
//
|
|
|
$('#HasPosition').change(function () {
|
|
|
if ($(this).val() === "True") {
|
|
|
$("[data-my-group='HasPosition2']").parents(cls).hide();
|
|
|
$("[data-my-group='HasPosition1']").parents(cls).show();
|
|
|
}
|
|
|
else if ($(this).val() === "False") {
|
|
|
$("[data-my-group='HasPosition1']").parents(cls).hide();
|
|
|
$("[data-my-group='HasPosition2']").parents(cls).show();
|
|
|
}
|
|
|
else {
|
|
|
$("[data-my-group='HasPosition1']").parents(cls).hide();
|
|
|
$("[data-my-group='HasPosition2']").parents(cls).hide();
|
|
|
}
|
|
|
});
|
|
|
$('#IsMiddleLevel').change(function () {
|
|
|
if ($(this).val() === "True") {
|
|
|
$("[data-my-group='HasPosition12']").parents(cls).hide();
|
|
|
$("[data-my-group='HasPosition11']").parents(cls).show();
|
|
|
}
|
|
|
else if ($(this).val() === "False") {
|
|
|
$("[data-my-group='HasPosition11']").parents(cls).hide();
|
|
|
$("[data-my-group='HasPosition12']").parents(cls).show();
|
|
|
}
|
|
|
else {
|
|
|
$("[data-my-group='HasPosition11']").parents(cls).hide();
|
|
|
$("[data-my-group='HasPosition12']").parents(cls).hide();
|
|
|
}
|
|
|
});
|
|
|
</script>
|
|
|
<script>
|
|
|
$('#query').click(function () {
|
|
|
var url = $(this).attr('data-action') + '?' + $(this).parents('form').find('input,select').not('[value=""]').serialize();
|
|
|
window.location.href = url;
|
|
|
});
|
|
|
$('#export').click(function () {
|
|
|
var url = $(this).attr('data-action') + '?' + $(this).parents('form').find('input,select').not('[value=""]').serialize();
|
|
|
window.open(url);
|
|
|
});
|
|
|
</script>
|
|
|
} |