Files
zszq-trs/YLErpWeb/wwwroot/Scripts/app/mainLayout.js
T
2024-05-09 14:06:26 +08:00

110 lines
3.7 KiB
JavaScript
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.
//处理负数四舍五入问题(源码-4.055 => -4.05,需求为-4.055 => -4.06
if (numeral && numeral.fn.format) {
var oldFormat = numeral.fn.format;
numeral.fn.format = function (inputString, roundingFunction) {
var value = this._value;
if (value < 0) {
this._value = -1 * value;
var absFormatValue = oldFormat.call(this, inputString, roundingFunction);
return (absFormatValue === "NaN" || absFormatValue === 0) ? absFormatValue : ("-" + absFormatValue);
}
return oldFormat.call(this, inputString, roundingFunction);
};
}
$(function () {
var collaspeIn = false, $body = $("body");
function sidebarHandle() {
collaspeIn && $body.addClass("page-sidebar-collapsed");
$("#bntSidebarToggleCollapse").on('click', function () {
if (collaspeIn) {
collaspeIn = false;
$("#bntSidebarToggleCollapse").addClass("using");
$('body').removeClass("page-sidebar-collapsed");
} else {
collaspeIn = true;
$("body").addClass("page-sidebar-collapsed");
$("#bntSidebarToggleCollapse").removeClass("using");
}
$(document).trigger('resize');
});
$(".page-sidebar").on({
mouseenter() {
collaspeIn && $("body").removeClass("page-sidebar-collapsed");
},
mouseleave() {
collaspeIn && $("body").addClass("page-sidebar-collapsed");
}
});
$("#btnSidebarToggleVisible").on("click", function () {
$body.removeClass('page-sidebar-collapsed');
$body.toggleClass("page-sidebar-visible");
return false;
});
$(window).on('resize', function () {
if ($(window).width() < 992) {
$body.removeClass("page-sidebar-visible");
}
});
}
function menuHandle() {
$(".accordion-menu").on("click", "a", function () {
var $sub = $(this).next(".sub-menu")
, $li = $(this).parent("li")
, $open = $(".accordion-menu > li.open");
var open = function () {
$(".accordion-menu > li.open > .sub-menu").slideUp(100);
$open.removeClass("open");
};
if ($sub.length && !$body.hasClass("page-sidebar-collapsed")) {
if ($li.hasClass("open")) {
$sub.slideUp(100);
$li.removeClass("open");
} else {
$open.length && open();
$sub.slideDown(100);
$li.addClass("open");
}
return false;
} else if ($sub.length && $body.hasClass("page-sidebar-collapsed")) {
return false;
}
});
}
sidebarHandle();
menuHandle();
});
$(function () {
//$('.modal-dialog').draggable({ handle: '.modal-header'});
//checkdate
if (moment($("#mainsystemvaluedate").html()).isBefore(moment().format("YYYY-MM-DD"))) {
$("#mainsystemvaluedate").append(`<span class="glyphicon glyphicon-warning-sign" title="系统为历史日期" style="color: red;"></span>`);
}
$('#changePasswordA').on('click', function () {
if (typeof changePasswordCtrl === 'undefined') {
$.get('/home/_changePassword', null, function (resp) {
$('body').append(resp);
changePasswordCtrl.showModal();
}, 'html');
} else {
changePasswordCtrl.showModal();
}
});
});
function modifyPassword() {
main.infopage("修改密码", "/Account/changepassword", { area: ['600px', '500px'] });
}