更新前端

This commit is contained in:
季圣华
2018-12-19 23:51:59 +08:00
parent 609756e9e7
commit 91a6b722b9
1149 changed files with 124088 additions and 0 deletions

278
erp_web/js/common/common.js Normal file
View File

@@ -0,0 +1,278 @@
$.fn.serializeObject = function() {
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
$(function() {
domresize();
});
//========================页面高度自动调节================================
var heightInfo;
var widthInfo;
var initPageSize;
var initPageNum;
var webH;
var webW;
//改变表格宽高
function domresize()
{
webH = document.documentElement.clientHeight;
webW = document.documentElement.offsetWidth;
widthInfo = $("body").outerWidth() -27;
var mtopH = $("#searchTable").outerHeight();
var positionH = $("#position").outerHeight();
heightInfo = webH - mtopH - 86;
//分页信息修改成 15条
if(heightInfo > 450)
{
initPageSize = 15;
initPageNum = [15,30,50];
}
else
{
initPageSize = 10;
initPageNum = [10,20,30,50];
}
}
//========================页面高度自动调节================================
//判断浏览器的类型
function getOs()
{
if(navigator.userAgent.indexOf("MSIE")>0)
{
return "MSIE";
}
else if(isFirefox=navigator.userAgent.indexOf("Firefox")>0)
{
return "Firefox";
}
else if(isSafari=navigator.userAgent.indexOf("Safari")>0)
{
return "Safari";
}
else if(isCamino=navigator.userAgent.indexOf("Camino")>0)
{
return "Camino";
}
else if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0)
{
return "Gecko";
}
}
/**
* js生成唯一ID值 32位值随机值
* @returns 生成的字符串
*/
function uuid()
{
var s = [];
var hexDigits = "0123456789abcdef";
for (var i = 0; i < 36; i++)
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
s[8] = s[13] = s[18] = s[23] = "";
return s.join("");
}
/**
* js获取浏览器的地址参数
* @param name 地址参数
* @return
*/
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]); return null; //返回参数值
}
/**
* 获取按钮的权限
*/
function getBtnStr() {
var funId = window.parent.window.funId; //功能id
var btnStrList = window.parent.window.winBtnStrList; //按钮功能列表 JSON字符串
var btnEnableList =""; //按钮列表
if(funId && btnStrList) {
btnStrList = JSON.parse(btnStrList);
for(var i=0; i<btnStrList.length; i++){
if(btnStrList[i].funId ==funId){
if(btnStrList[i].btnStr) {
btnEnableList = btnEnableList + btnStrList[i].btnStr + ",";
}
}
}
if(btnEnableList) {
btnEnableList = btnEnableList.substring(0,btnEnableList.length-1);
}
}
return btnEnableList;
}
/**
* js获取当前时间 格式“yyyy-MM-dd HH:MM:SS”
*/
function getNowFormatDateTime() {
var date = new Date();
var seperator1 = "-";
var seperator2 = ":";
var month = date.getMonth() + 1;
var strDate = date.getDate();
var strHours = date.getHours();
var strMinutes = date.getMinutes();
var strSeconds = date.getSeconds();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
if (strHours >= 0 && strHours <= 9) {
strHours = "0" + strHours;
}
if (strMinutes >= 0 && strMinutes <= 9) {
strMinutes = "0" + strMinutes;
}
if (strSeconds >= 0 && strSeconds <= 9) {
strSeconds = "0" + strSeconds;
}
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
+ " " + strHours + seperator2 + strMinutes
+ seperator2 + strSeconds;
return currentdate;
}
/**
* js获取当前时间 格式“yyyy-MM”
*/
function getNowFormatMonth() {
var date = new Date();
var seperator1 = "-";
var month = date.getMonth() + 1;
if (month >= 1 && month <= 9) {
month = "0" + month;
}
var currentdate = date.getFullYear() + seperator1 + month;
return currentdate;
}
/**
* js获取当前时间 格式“yyyy-MM-dd”
*/
function getNowFormatDate() {
var date = new Date();
var seperator1 = "-";
var seperator2 = ":";
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
return currentdate;
}
/**
* js获取当前时间 格式“yyyyMMdd”
*/
function getNowFormatDateTwo() {
var date = new Date();
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = date.getFullYear() + month.toString() + strDate.toString();
return currentdate;
}
/**
* js根据时间生成编号 格式“yyyyMMddHHMMSS”
*/
function getNowFormatDateNum() {
var date = new Date();
var seperator1 = "-";
var seperator2 = ":";
var month = date.getMonth() + 1;
var strDate = date.getDate();
var strHours = date.getHours();
var strMinutes = date.getMinutes();
var strSeconds = date.getSeconds();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
if (strHours >= 0 && strHours <= 9) {
strHours = "0" + strHours;
}
if (strMinutes >= 0 && strMinutes <= 9) {
strMinutes = "0" + strMinutes;
}
if (strSeconds >= 0 && strSeconds <= 9) {
strSeconds = "0" + strSeconds;
}
var currentdate = date.getFullYear() + month.toString() + strDate.toString() + strHours
+ strMinutes + strSeconds;
return currentdate;
}
function encode(name){
return encodeURI(encodeURI(name));
}
/**
* 将数组单个金额中的数值转为正数
* @param arr
* @returns {Array}
*/
function changeListFmtPlus(arr) {
var newArr = new Array();
for(var i=0; i<arr.length; i++) {
if(arr[i] < 0){
newArr.push((0 - arr[i]).toString());
}
else {
newArr.push((arr[i]-0).toString());
}
}
return newArr;
}
/**
* 将数组单个金额中的数值转为负数
* @param arr
* @returns {Array}
*/
function changeListFmtMinus(arr) {
var newArr = new Array();
for(var i=0; i<arr.length; i++) {
if(arr[i] < 0){
newArr.push((arr[i]-0).toString());
}
else {
newArr.push((0 - arr[i]).toString());
}
}
return newArr;
}

29
erp_web/js/common/cs.js Normal file
View File

@@ -0,0 +1,29 @@
[{
"id":1,
"text":"Folder1",
"children":[{
"id":11,
"text":"File1",
"checked":true
},{
"text":"Books",
"state":"open",
"children":[{
"id":111,
"text":"<a onclick=\"NewTab('功能管理','../manage/functions.jsp')\">功能管理</a>"
},{
"id": 8,
"text":"Sub Bookds",
"state":"closed"
}]
}]
},{
"text":"Languages",
"state":"closed",
"children":[{
"text":"Java"
},{
"text":"C#"
}]
}]

View File

@@ -0,0 +1,191 @@
$(function () {
// InitLeftMenu();
tabClose();
tabCloseEven();
// $('#tabs').tabs('add',{
// title:'title',
// content:createFrame('http://www.xjz365.com')
// }).tabs({
// onSelect: function (title) {
// var currTab = $('#tabs').tabs('getTab', title);
// var iframe = $(currTab.panel('options').content);
// var src = iframe.attr('src');
// if(src)
// $('#tabs').tabs('update', { tab: currTab, options: { content: createFrame(src)} });
// }
// });
})
//初始化左侧
function InitLeftMenu() {
$("#nav").accordion({ animate: false });
$.each(_menus.menus, function (i, n) {
var menulist = '';
menulist += '<ul>';
$.each(n.menus, function (j, o) {
menulist += '<li><div><a ref="' + o.menuid + '" href="#" rel="' + o.url + '" ><span class="icon ' + o.icon + '" >&nbsp;</span><span class="nav">' + o.menuname + '</span></a></div></li> ';
})
menulist += '</ul>';
$('#nav').accordion('add', {
title: n.menuname,
content: menulist,
iconCls: 'icon ' + n.icon
});
});
$('.easyui-accordion li a').click(function () {
var tabTitle = $(this).children('.nav').text();
var url = $(this).attr("rel");
var menuid = $(this).attr("ref");
var icon = getIcon(menuid, icon);
addTab(tabTitle, url, icon);
$('.easyui-accordion li div').removeClass("selected");
$(this).parent().addClass("selected");
}).hover(function () {
$(this).parent().addClass("hover");
}, function () {
$(this).parent().removeClass("hover");
});
//选中第一个
var panels = $('#nav').accordion('panels');
var t = panels[0].panel('options').title;
$('#nav').accordion('select', t);
}
//获取左侧导航的图标
function getIcon(menuid) {
var icon = 'icon ';
$.each(_menus.menus, function (i, n) {
$.each(n.menus, function (j, o) {
if (o.menuid == menuid) {
icon += o.icon;
}
})
})
return icon;
}
function addTabIn(subtitle, url, icon) {
var dom = window.parent.jQuery('#tabs');
if (!dom.tabs('exists', subtitle)) {
dom.tabs('add', {
title: subtitle,
content: createFrame(url),
closable: true,
icon: icon
});
} else {
dom.tabs('select', subtitle);
$('#mm-tabupdate').click();
}
tabClose();
}
function newTab(name, url, funId) {
window.funId = funId;
addTabIn(name, url, '');
}
function createFrame(url) {
var s = '<iframe scrolling="auto" frameborder="0" src="' + url + '" style="width:100%;height:99%"></iframe>';
return s;
}
function tabClose() {
var dom = window.parent.jQuery('#tabs');
/*双击关闭TAB选项卡*/
$(".tabs-inner").dblclick(function () {
var subtitle = $(this).children(".tabs-closable").text();
dom.tabs('close', subtitle);
})
/*为选项卡绑定右键*/
$(".tabs-inner").bind('contextmenu', function (e) {
$('#mm').menu('show', {
left: e.pageX,
top: e.pageY
});
var subtitle = $(this).children(".tabs-closable").text();
$('#mm').data("currtab", subtitle);
dom.tabs('select', subtitle);
return false;
});
}
//绑定右键菜单事件
function tabCloseEven() {
//刷新
$('#mm-tabupdate').click(function () {
var currTab = $('#tabs').tabs('getSelected');
var url = $(currTab.panel('options').content).attr('src');
$('#tabs').tabs('update', {
tab: currTab,
options: {
content: createFrame(url)
}
})
})
//关闭当前
$('#mm-tabclose').click(function () {
var currtab_title = $('#mm').data("currtab");
$('#tabs').tabs('close', currtab_title);
})
//全部关闭
$('#mm-tabcloseall').click(function () {
$('.tabs-inner span').each(function (i, n) {
var t = $(n).text();
$('#tabs').tabs('close', t);
});
});
//关闭除当前之外的TAB
$('#mm-tabcloseother').click(function () {
$('#mm-tabcloseright').click();
$('#mm-tabcloseleft').click();
});
//关闭当前右侧的TAB
$('#mm-tabcloseright').click(function () {
var nextall = $('.tabs-selected').nextAll();
if (nextall.length == 0) {
//msgShow('系统提示','后边没有啦~~','error');
//alert('后边没有啦~~');
return false;
}
nextall.each(function (i, n) {
var t = $('a:eq(0) span', $(n)).text();
$('#tabs').tabs('close', t);
});
return false;
});
//关闭当前左侧的TAB
$('#mm-tabcloseleft').click(function () {
var prevall = $('.tabs-selected').prevAll();
if (prevall.length == 0) {
//alert('到头了,前边没有啦~~');
return false;
}
prevall.each(function (i, n) {
var t = $('a:eq(0) span', $(n)).text();
$('#tabs').tabs('close', t);
});
return false;
});
//显示版权信息
$("#mm-version").click(function () {
window.open("https://gitee.com/jishenghua/JSH_ERP");
})
}
//弹出信息窗口 title:标题 msgString:提示信息 msgType:信息类型 [error,info,question,warning]
function msgShow(title, msgString, msgType) {
$.messager.alert(title, msgString, msgType);
}