|
|
//表单提交通用方法
|
|
|
function submit(msg, func) {
|
|
|
if ($('form').valid()) {
|
|
|
Swal.fire({
|
|
|
position: 'bottom',
|
|
|
text: msg,
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
showCancelButton: true
|
|
|
}).then(function (value) {
|
|
|
if (value.isConfirmed) {
|
|
|
func();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
//$(function () {
|
|
|
// $("form").data("validator").settings.submitHandler = function (form) {
|
|
|
// $('form button').attr('disabled', 'disabled');
|
|
|
// form.submit();
|
|
|
// };
|
|
|
//});
|
|
|
//用户操作
|
|
|
//保存
|
|
|
$('#save').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
form.submit();
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
//提交审核
|
|
|
$('#submitCheckRequest').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#CheckStatus').val('待审核');
|
|
|
form.submit();
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
//待审核时取消提交审核的申请
|
|
|
$('#submitCancelRequest').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#CheckStatus').val('未提交');
|
|
|
form.submit();
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
//申请修改
|
|
|
$('#submitModifyRequest').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#RequestEditStatus').val('已申请');
|
|
|
form.submit();
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
//取消申请
|
|
|
$('#cancelModifyRequest').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#RequestEditStatus').val('未申请');
|
|
|
form.submit();
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
//退回
|
|
|
$('#super').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
if (form.find("input[name$='Checked']").filter(':visible').not(':checked').length === 0) {
|
|
|
Swal.fire({
|
|
|
position: 'bottom',
|
|
|
text: '请标记未通过的审核项',
|
|
|
confirmButtonText: '确定'
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
if (!$('#Comment').val()) {
|
|
|
Swal.fire({
|
|
|
position: 'bottom',
|
|
|
text: '请填写审核失败原因',
|
|
|
confirmButtonText: '确定'
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#CheckStatus').val('审核失败');
|
|
|
$('#RequestEditStatus').val('未申请');
|
|
|
form.submit();
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
//审核成功
|
|
|
$('#admin1').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
if (form.find("input[name$='Checked']").filter(':visible').not(':checked').length > 0) {
|
|
|
Swal.fire({
|
|
|
position: 'bottom',
|
|
|
text: '请标记已通过的审核项',
|
|
|
confirmButtonText: '确定'});
|
|
|
return;
|
|
|
}
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#Comment').val('');
|
|
|
$('#CheckStatus').val('审核成功');
|
|
|
$('#RequestEditStatus').val('未申请');
|
|
|
form.submit();
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
//审核失败
|
|
|
$('#admin2').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
if (form.find("input[name$='Checked']").filter(':visible').not(':checked').length === 0) {
|
|
|
Swal.fire({
|
|
|
position: 'bottom',
|
|
|
text: '请标记未通过的审核项',
|
|
|
confirmButtonText: '确定'
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
if (!$('#Comment').val()) {
|
|
|
Swal.fire({
|
|
|
position: 'bottom',
|
|
|
text: '请填写审核失败原因',
|
|
|
confirmButtonText: '确定'
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#CheckStatus').val('审核失败');
|
|
|
$('#RequestEditStatus').val('未申请');
|
|
|
form.submit();
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
//批准修改申请
|
|
|
$('#admin3').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#CheckStatus').val('未提交');
|
|
|
$('#RequestEditStatus').val('未申请');
|
|
|
form.submit();
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
//拒绝修改申请
|
|
|
$('#admin4').click(function () {
|
|
|
var form = $(this).parents('form');
|
|
|
var msg = '确认' + $(this).text() + '?';
|
|
|
submit(msg, function () {
|
|
|
$('#RequestEditStatus').val('未申请');
|
|
|
form.submit();
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
/////////////////////////////////////////////////////////////
|
|
|
var cls = '.col-sm-6';
|
|
|
var ms = 500;
|
|
|
//是否最高职称聘任
|
|
|
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();
|
|
|
}
|
|
|
$('#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();
|
|
|
}
|
|
|
});
|
|
|
//
|
|
|
//是否享受学历待遇
|
|
|
if ($('#EducationGrade').val()) {
|
|
|
if ($('#EducationGrade').val() !== "") {
|
|
|
$("#EducationGradeDate").parents(cls).show();
|
|
|
}
|
|
|
else {
|
|
|
$("#EducationGradeDate").parents(cls).hide();
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
$("#EducationGradeDate").parents(cls).hide();
|
|
|
}
|
|
|
$('#EducationGrade').change(function () {
|
|
|
if ($(this).val() !== "") {
|
|
|
$("#EducationGradeDate").parents(cls).show();
|
|
|
}
|
|
|
else {
|
|
|
$("#EducationGradeDate").val('').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();
|
|
|
}
|
|
|
$('#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();
|
|
|
}
|
|
|
});
|
|
|
//查询
|
|
|
$('#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);
|
|
|
});
|
|
|
//根据身份证计算年龄
|
|
|
$('#IdNumber').change(function () {
|
|
|
if ($(this).val()) {
|
|
|
var number = $(this).val();
|
|
|
try {
|
|
|
if (number.length === 15 || number.length === 18) {
|
|
|
var value = number.length == 15 ? ('19' + number.substr(6, 6)) : number.substr(6, 8);
|
|
|
var year = parseInt(value.substr(0, 4));
|
|
|
var month = parseInt(value.substr(4, 2));
|
|
|
var day = parseInt(value.substr(6, 2));
|
|
|
var birthday = new Date(year, month, day);
|
|
|
var now = new Date();
|
|
|
var age = now.getFullYear() - birthday.getFullYear();
|
|
|
$('#AgeDisplay').text(age);
|
|
|
return;
|
|
|
}
|
|
|
} catch (e) {
|
|
|
console.error(e);
|
|
|
}
|
|
|
}
|
|
|
$('#AgeDisplay').text();
|
|
|
});
|
|
|
//根据参加工作时间计算工龄
|
|
|
$('#WorkingTime').change(function () {
|
|
|
if ($(this).val()) {
|
|
|
try {
|
|
|
var now = new Date();
|
|
|
var values = $(this).val().split('-');
|
|
|
var year = parseInt(values[0]);
|
|
|
var month = parseInt(values[1]);
|
|
|
var day = parseInt(values[2]);
|
|
|
|
|
|
var years = now.getFullYear() - new Date(year, month, day).getFullYear();
|
|
|
$('#JobAgeYearDisplay').text(years);
|
|
|
|
|
|
var months = years * 12 + (now.getMonth() + 1 - month);
|
|
|
$('#JobAgeMonthDisplay').text(months);
|
|
|
return;
|
|
|
} catch (e) {
|
|
|
console.error(e);
|
|
|
}
|
|
|
}
|
|
|
$('#JobAgeYearDisplay').text();
|
|
|
$('#JobAgeMonthDisplay').text();
|
|
|
}); |