sp.setCssSkin(); //皮肤换色GlWorkPlatform-username
var get_userid = $.cookie("GlWorkPlatform-userid"); //获取userid
var get_username = $.cookie("GlWorkPlatform-username"); //获取英文名
var get_chineseName = decodeURI($.cookie("GlWorkPlatform-chineseName")); //获取中文名
var UserRole = "";
document.addEventListener("visibilitychange", function () {
if (document.visibilityState == "visible") {
if ($("#spanAdminUserId").val() != $.cookie("GlWorkPlatform-userid")) {
var dialogHead = "温馨提示";
var dialogBody = "
有新用户登入,当前用户为" + decodeURI($.cookie("GlWorkPlatform-chineseName")) + "!
";
var dialogFoot = "";
$('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
sp.openDLTX(".sp-dialog");
$("#delDataTrue").click(function () {
window.location.reload()
});
}
}
})
if (get_userid == null || get_userid == "" || get_userid == "undefined") {
window.location.href = "login.html";
}
//判断从哪里进来,只有从登录页进来才可以
var get_sessionStorage = sessionStorage.getItem("GlWorkPlatform-LoginFrom");
if (get_sessionStorage == null || get_sessionStorage == "" || get_sessionStorage == "undefined") {
window.location.href = "login.html";
} else {
$("#spanAdminUserId").val(get_userid);
$("#spanAdminUserName").text(get_chineseName);
}
//退出
function btnLoginOut() {
$.cookie("GlWorkPlatform-userid", null, {path: '/', expires: -1});
$.cookie("GlWorkPlatform-username", null, {path: '/', expires: -1});
$.cookie("GlWorkPlatform-chineseName", null, {path: '/', expires: -1});
$.cookie("GlWorkPlatform-photo", null, { path: '/', expires: -1 });
$.cookie("GlWorkPlatform-onlineUsers", null, { path: '/', expires: -1 });
sessionStorage.removeItem("GlWorkPlatform-LoginFrom");
localStorage.removeItem("GlWorkPlatform-openfileArray"); ////清空保存菜单文件的变量
localStorage.removeItem("GlWorkPlatform-setLeftBarClickID");
localStorage.removeItem("GlWorkPlatform-userInfoJsonStr");
//socket.close()
window.location.href = "login.html"//"http://10.233.22.218/sy/#/sso?token=" + localStorage.getItem("main-token");
};
//判断是否是第一次进入这个系统,即是否为空库
function checkIsEmptyDatabase() {
$.ajax({
type: "get",
url: apiurljs.login + "connect/isemptydatabase",
//data: { action: "fadetail", userid: userid, routeinfoid: routeinfoid },
dataType: "json",
ContentType: 'application/x-www-form-urlencoded',
success: function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
//console.log(JSON.stringify(res.data));
document.getElementsByTagName("title")[0].innerText = res.data.SYSNAME;
//$(".sp-wrapper-head-title span").html(res.data.SYSNAME);
$.cookie("GlWorkPlatform-SYSNAME", res.data.SECTION, {path: '/', expires: 1});
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log(errorThrown);
}
});
};
//为保证页面显示效果,判断浏览器版本是否过低
function checkIEVersion() {
var getjson = sp.getExplorerInfo();
if (getjson.type == "IE") {
if (getjson.version == "8.0" || getjson.version == "7.0" || getjson.version == "6.0") {
$("#checkIEVersionDiv").text("您当前使用的是" + getjson.type + "浏览器 版本:" + getjson.version + ",版本过低,请更新IE浏览器或使用其他浏览器");
$("#checkIEVersionDiv").show();
//然后跳到需要连接的下载网站
//window.location.href="http://jiaoxueyun.com/download.jsp";
}
}
}
//20分钟不操作退出登录
$(function () {
var TimeNum = new Date().getTime();
//mousedown() 监听鼠标是否使用 keydown() 监听键盘是否可用
$(document).mousedown(function () {
TimeNum = new Date().getTime();
}).keydown(function () {
TimeNum = new Date().getTime();
}).mousemove(function () {
TimeNum = new Date().getTime();
});
//setInterval用来判断 当前时间之差
setInterval(function () {
//这里判断按键或鼠标 事件是否触发了
var TimeCount = new Date().getTime();
var minutes = Math.floor((TimeCount - TimeNum) / (60 * 1000));
//var minutes = Math.floor((TimeCount - TimeNum) / (1 * 1000));
//如果两个时间差大于20分钟
if (minutes >= 20 || $.cookie("GlWorkPlatform-userid")==null||$.cookie("GlWorkPlatform-userid")==undefined) {
var dialogHead = "温馨提示";
var dialogBody = "您已经20分钟没有操作了,请重新登录!
";
var dialogFoot = "";
$('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
sp.openDLTX(".sp-dialog");
///取消按钮
$('.sp-closeDialog').click(function (event) {
sp.closeCenter(".sp-dialog");
event.preventDefault();
event.stopPropagation();
});
//post消息的id
$("#delDataTrue").click(function () {
$.cookie("GlWorkPlatform-userid", null, { path: '/', expires: -1 });
$.cookie("GlWorkPlatform-username", null, { path: '/', expires: -1 });
$.cookie("GlWorkPlatform-chineseName", null, { path: '/', expires: -1 });
$.cookie("GlWorkPlatform-photo", null, { path: '/', expires: -1 });
$.cookie("GlWorkPlatform-onlineUsers", null, { path: '/', expires: -1 });
sessionStorage.removeItem("GlWorkPlatform-LoginFrom");
localStorage.removeItem("GlWorkPlatform-openfileArray");
localStorage.removeItem("GlWorkPlatform-setLeftBarClickID");
localStorage.removeItem("GlWorkPlatform-userInfoJsonStr");
//socket.close()
window.location.href = 'login.html';
});
}
}, 1000);
})
checkIsEmptyDatabase();
checkIEVersion();
//被邀请加入共享沟通
var userMsg = {userid: get_userid, username: get_chineseName};
if (apiurljs.meetingFlag == true) {
var socket = io.connect(apiurljs.wsio, {path: apiurljs.wspath})
window.socket = socket;
var meetingData = new Object;
socket.emit('userReg', userMsg);
socket.on('error', function (data) {
console.log(JSON.stringify(data) + ' - error');
});
socket.on('disconnect', function (data) {
//失去连接的事件
console.log(JSON.stringify(data) + ' - disconnect');
});
socket.on('reconnect', function (data) {
//重新连接的事件
console.log(JSON.stringify(data) + ' - reconnect');
socket.emit('userReg', userMsg);
});
socket.on('invitemeeting', function (data) {
meetingData = data;
$("#meetingMsg").html("【" + meetingData.title + "】的沟通会议邀请");
$("#meetingMsg").show();
var dialogHead = "系统提示×";
var dialogBody = "您有一个【" + meetingData.title + "】的沟通会议邀请,确认后跳转到沟通会议室。
如暂时不进入会议室,可以稍后在个人消息列表中选择进入。
";
var dialogFoot = "";
$('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
sp.openCenter(".sp-dialog");
$(".closeDialog").click(function (event) {
sp.closeCenter(".sp-dialog");
event.preventDefault();
event.stopPropagation();
});
$("#joinInMeet").click(function () {
sp.dialoghide();
joinMeeting();
});
});
}
function joinMeeting() {
$("#meetingMsg").hide();
var data = meetingData;
var time = new Date().valueOf();
$.cookie("wb_data" + time, JSON.stringify({
meetingid: data.meetingid,
masterid: data.masterid,
mastername: data.mastername,
userid: data.touserid,
username: data.tousername,
title: data.title,
pdf: data.pdf,
wsio: apiurljs.wsio,
wspath: apiurljs.wspath,
uploadUrl: data.uploadUrl,
AccessToken: data.AccessToken,
routeinfoid: data.routeinfoid
}), {path: '/', expires: 1});
window.sp.addTabNav("GXGT", "共享沟通", "meeting/chat.html?wb_ts=" + time);
setTimeout(function () {
$.cookie("wb_data" + time, null, {path: '/', expires: -1});
//document.getElementById('wrapper_tabs_box_col_GXGT').childNodes[0].contentWindow.postMessage({
// masterid: data.masterid,
// touserid: data.touserid,
// tousername: data.tousername,
// title: data.title,
// pdf: data.pdf,
// meetingid: data.meetingid,
// uploadUrl: data.uploadUrl,
// AccessToken: data.AccessToken,
// routeinfoid: data.routeinfoid
//}, "*")
}, 5000)
}
window.onmessage = function (event) {
if (event.data == "close") {
$("#wrapper_tabs_menu_li_GXGT").prev("li").addClass("sp-wrapper-tabs-current").show();
$("#wrapper_tabs_box_col_GXGT").prev(".sp-wrapper-tabs-box-col").addClass("sp-wrapper-tabs-box-current").show();
$("#wrapper_tabs_menu_li_GXGT").remove();
$("#wrapper_tabs_box_col_GXGT").remove();
}
if (typeof (event.data) == "object") {
console.log(event.data);
sp.addTabNav(event.data.id, event.data.title, event.data.src)
}
}
//左侧的动态新动态菜单采用angularJS的方式渲染
var app = angular.module('app', []);
app.controller("leftPartCtrl", ["$scope", "$http", "$interval", "$timeout", function ($scope, $http, $interval, $timeout) {
var self = this;
var s4 = new SM4Util();
self.userId = $.cookie("GlWorkPlatform-userid");
self.engName = $.cookie("GlWorkPlatform-username");
self.userName = $.cookie("GlWorkPlatform-chineseName");
self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
self.ctime = $.cookie("CrossPage-ctime");
self.outToken = localStorage.getItem("main-token");
///增加设备标识
localStorage.setItem("tjJxtGoldenlinkWork-deviceType", "pc");
//左侧动态赋值高度
var bodyHeight = $(window).height();
$(".sp-menu-list").height(bodyHeight - 115);
///20230222--修改左侧菜单
self.bindSetMenuSwitch = function () {
if ($(".sp-menu-switch").hasClass("hasClick")) {
$(".sp-menu-switch").removeClass("hasClick");
$(".sp-menu-list").fadeIn(200);
} else {
$(".sp-menu-switch").addClass("hasClick");
$(".sp-menu-list").fadeOut(200);
}
};
/////点击桌面设置,打开并跨域发送消息打开设置弹出层--zyg--20230426
self.btnSetDesktop = function () {
////sp.addTabNav('FZ0', '工作桌面', 'tpl/_indexgmt/index_2.html');
var id = 'FZ0';
var setID = "wrapper_tabs_box_col_" + id;
$("#spWrapperTabsPart ul li").removeClass("sp-wrapper-tabs-current");
$(".sp-wrapper-tabs-box-current").hide();
$("#spWrapperTabsPart .sp-wrapper-tabs-box .sp-wrapper-tabs-box-col").removeClass("sp-wrapper-tabs-box-current");
$("#wrapper_tabs_menu_li_" + id).addClass("sp-wrapper-tabs-current").show();
$("#" + setID).addClass("sp-wrapper-tabs-box-current").show();
$timeout(function () {
var ifr = document.getElementById('iframe_wrapper_tabs_box_col_FZ0');
var json = {};
var func = { name: "openLayerSetting", arg: json };//传输name名称以及json串
ifr.contentWindow.postMessage(func, '*');
}, 200);
};
var postCfg = {
headers: {
'Content-Type': 'application/json',
'Authorization': "Bearer " + self.get_AccessToken
}
};
self.set_imgurl = "";
self.get_userInfoJsonStr = {};
self.getReloadUserData = function () {
var postData = { };
//console.log(postData);
//console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
$http.post(apiurljs.login + "api/User/UserInfo", JSON.stringify(postData), postCfg)
.success(function (obj) {
var res1 = strToJson(s4.decryptData_CBC(obj.data));
localStorage.setItem("GlWorkPlatform-userInfoJsonStr", s4.encryptData_CBC(JSON.stringify(res1.data)));
self.get_userInfoJsonStr = res1.data;
////加载背景图片*******************************************************************************************
if (apiurljs.login.indexOf("http://139.129.27.3:85") != -1) {
self.set_imgurl = "http://139.129.27.3:8511/web/UploadAttach";
} else {
self.set_imgurl = apiurljs.login.split("glwork")[0] + "glworkweb/UploadAttach";
}
$(".sp-wrapper-tabs .sp-wrapper-tabs-head").css("background-image", "url(" + self.set_imgurl + self.get_userInfoJsonStr.bkimageurl + ")");
self.getData_bkimage();///背景图片
self.getHomePage();///
self.getUserFavoriteFunc();
self.getUserRecentFunc();
})
.error(function (XMLHttpRequest, textStatus, errorThrown) {
if (textStatus != 200) {
self.loading = false;
}
})
}
self.getReloadUserData();
self.imgColActive_code_bkimage = "";
self.bkimageArray = [];
self.bkimageArray_active = {};
self.ifHasDefault_bkimage = 0;
self.getData_bkimage = function () {
var postData = { "userid": self.userId };
//console.log(postData);
//console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
$http.post(apiurljs.login + "g2work/bkimage/queryDataUserByUserid", JSON.stringify(postData), postCfg)
.success(function (obj) {
//var res = strToJson(s4.decryptData_CBC(obj.data));
var res = obj;
//console.log(JSON.stringify(res));
if (res.success) {
self.bkimageArray = res.data;
angular.forEach(self.bkimageArray, function (item) {
item.URL_set = self.set_imgurl + item.URL;
});
} else {
self.loading = false;
self.bkimageArray = [];
self.bkimageArray_active = {};
}
})
.error(function (XMLHttpRequest, textStatus, errorThrown) {
if (textStatus != 200) {
self.loading = false;
}
})
};
$timeout(function () {
//选择底图
if ($("body").find(".sp-desk-img").length > 0) {
$(".sp-desk-img").each(function () {
$(this).click(function () {
var get_url = $(this).attr('data-url');
var get_code = $(this).attr('data-code');
$(this).addClass("sp-desk-current").siblings().removeClass("sp-desk-current");
$("#wrapper_tabs_box_col_FZ0").find("iframe").contents().find("body").css("background-image", "url(" + get_url + ")")
$("#wrapper_tabs_box_col_FZ0").find("iframe").contents().find("body").css("background-repeat", "no-repeat")
$("#wrapper_tabs_box_col_FZ0").find("iframe").contents().find("body").css("background-size", "cover")
$("#wrapper_tabs_box_col_FZ0").find("iframe").contents().find("body").css("background-position", "0 -30px")
$(".sp-wrapper-tabs .sp-wrapper-tabs-head").css("background-image", "url(" + get_url + ")");
var postData_2 = {
"userid": self.userId,
"code": get_code
};
$http.post(apiurljs.login + "g2work/bkimage/updateDataUserDefault", JSON.stringify(postData_2), postCfg)
.success(function (obj_2) {
//var res = strToJson(s4.decryptData_CBC(obj.data));
var res_2 = obj_2;
//console.log(JSON.stringify(res));
if (res_2.success) {
console.log("背景图片修改成功");
} else {
sp.dialog(res_2.message);
}
})
.error(function (XMLHttpRequest, textStatus, errorThrown) {
if (textStatus != 200) {
self.loading = false;
}
})
});
});
}
}, 1000);
////加载背景图片*******************************************************************************************
self.func = {
normalTitle: "全部",
favoriteTitle: "常用功能",
recentTitle: "最近访问",
favoriteList: [],
recentList: [],
keyWord: "",
keyCondition: "",
keyShow: false,
keyPartList: [], //当前模块下所有符合关键字的模块列表
keyPartListCopy: [], //当前模块下前12个符合关键字的模块列表
keyAllList: [], //全局模块下所有符合关键字的模块列表
keyAllListCopy: [], //全局模块下前12个符合关键字的模块列表
keyPartShow: false,
keyPartHide: false,
keyAllShow: false,
keyAllHide: false,
allFuncList: [], //存储最全的功能防止遗漏
nowFuncName: "",
nowFuncCode: ""
}
//声明一个左侧的功能列表
self.userFuncList = [];
//首选获取当前用户的个人桌面
self.getHomePage = function () {
self.userFuncList = [];
var postData = {
userid: self.userId
}
$http.post(apiurljs.login + "g2work/desktop/queryDesktopMarkT", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
//console.log(JSON.stringify(res));
//console.log(get_userInfoJsonStr);
var homePageObj = {
CNAME: "工作桌面",
C_H_I_L_D: [],
COPYCHILD: [],
///FILEN: res.data.tenantcode,
FILEN: self.get_userInfoJsonStr.desktopurl,
FUNCSCOPE: "ADMINISTATOR|ADMIN",
LEAF: 0,
LEVELS: 1,
OPENTYPE: "0",
PARENTID: "0",
PKID: "FZ0",
SORTID: 1,
SRCIMG: "",
SRCIMG32: "",
WINDOWS: "",
IMGBox: "box0",
}
$.cookie("GlWorkPlatform-userTypeEng", res.data.data, {path: '/', expires: 1});
if (res.data.data == "USER") {
$.cookie("GlWorkPlatform-userType", "普通用户", {path: '/', expires: 1})
} else if (res.data.data == "SYSADMIN") {
$.cookie("GlWorkPlatform-userType", "系统管理员", {path: '/', expires: 1})
} else if (res.data.data == "SECADMIN") {
$.cookie("GlWorkPlatform-userType", "安全管理员", {path: '/', expires: 1})
} else if (res.data.data == "AUDITADMIN") {
$.cookie("GlWorkPlatform-userType", "审计管理员", {path: '/', expires: 1})
} else if (res.data.data == "ADMIN") {
$.cookie("GlWorkPlatform-userType", "总管理员", {path: '/', expires: 1})
}
////20230423--zyg-修改,变更成加载图片base64编码,判断是否为base64图片,是直接加载,否设置图片路径;
if (res.data.imgsrc.indexOf("data:image") != -1) {
///base64图片格式直接加载
$("#spanAdminPhoto").attr("src", res.data.imgsrc);
self.usercard.img = res.data.imgsrc;
} else {
///路径图片,赋值
$("#spanAdminPhoto").attr("src", "AFrontEnd/css/icons/photo/" + res.data.imgsrc);
self.usercard.img = "AFrontEnd/css/icons/photo/" + res.data.imgsrc;
}
$.cookie("GlWorkPlatform-photo", $("#spanAdminPhoto").attr("src"), { path: '/', expires: 1 })
self.userFuncList.push(homePageObj);
self.getUserFunc();
var data = {
tablename: "SYS_CLICKLOG",
data: {
CTIME: self.ctime,
TITLE: "系统登录",
REQUESTURL: window.location.pathname,
REQUESTHEADERURL: window.location.origin,
LOGTYPE: "登录登出",
USERTYPE: $.cookie("GlWorkPlatform-userType"),
ADMIN: $.cookie("GlWorkPlatform-userTypeEng"),
CLIENTIP: sp.myIP(),
PCNAME: sp.detectOS(),
BROWSERNAME: sp.browser(),
RESPONSETIME: sp.getLocalDate1(),
USERID: self.userId,
USERNAME: self.userName
}
}
$http.post(apiurljs.login + "g2app/dataabase/insertFormData", {data: s4.encryptData_CBC(JSON.stringify(data))}, postCfg)
.success(function (res) {
$.cookie("CrossPage-ctime", null, {path: '/', expires: -1});
})
})
}
//获取用户的功能列表
self.getUserFunc = function () {
$http.post(apiurljs.login + "UserPower/Permissions", {data: s4.encryptData_CBC("")}, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
res.data.rows.forEach(function (item) {
item.showRightMenu = false;
if (item.C_H_I_L_D.length == 0) {
item.IMGBox = "box0";
} else if (item.C_H_I_L_D.length > 0 && item.C_H_I_L_D.length <= 4) {
item.IMGBox = "box4";
} else if (item.C_H_I_L_D.length > 4) {
item.IMGBox = "box9";
}
let array = angular.copy(item.C_H_I_L_D);
if (array.length > 12) {
item.COPYCHILD = array.slice(0, 12);
item.hideFunc = true;
item.showFunc = false;
} else {
item.COPYCHILD = array;
item.hideFunc = false;
item.showFunc = false;
}
self.userFuncList.push(item);
})
//记录全部功能模块列表
res.data.rows.forEach(function (item) {
item.C_H_I_L_D.forEach(function (item2) {
self.func.allFuncList.push(item2);
})
})
//默认打开工作桌面
var title = self.userFuncList[0].CNAME;
var id = self.userFuncList[0].PKID;
var src = self.userFuncList[0].FILEN;
sp.addhometabnav(id, title, src);
CrossPage = {
cname: "",
ctime: sp.getLocalDate(),
type: 0
}
// if (getParameter("openPage") == "") {
// //sp.loadmenufiles();//加载记录菜单文件
// }
// if (getParameter("openPage") != "") {
// self.secondMenu = "全部/";
// self.func.normalList.forEach(function (item) {
// if (item.PKID == getParameter("PKID")) {
// self.CrossPage(item)
// }
// })
// sp.addTabNav(getParameter("PKID"), decodeURI(getParameter("CNAME")), getParameter("openPage"))
// }
})
}
//获取用户常用功能列表
self.getUserFavoriteFunc = function () {
var postData = {
userid: self.userId,
ntops: "4"
}
$http.post(apiurljs.login + "g2work/desktop/queryFavoriteFunc", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.func.favoriteList = res.data;
})
}
//获取用户最近访问列表
self.getUserRecentFunc = function () {
var postData = {
userid: self.userId,
ntops: "4"
}
$http.post(apiurljs.login + "g2work/desktop/queryRecentFunc", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.func.recentList = res.data;
})
}
//固定二级菜单标志
self.tabFixed = false;
//固定二级菜单函数
self.setTabFixed = function () {
self.tabFixed = true;
}
//取消固定二级菜单函数
self.cancelTabFixed = function () {
self.tabFixed = false;
}
//鼠标放入执行的事件
self.openRightMenu = function (index) {
//self.initSearchFunc();
self.userFuncList.forEach(function (item) {
item.showRightMenu = false;
})
self.func.normalTitle = self.userFuncList[index].CNAME;
self.func.nowFuncCode = self.userFuncList[index].PKID;
self.func.nowFuncName = self.userFuncList[index].CNAME;
self.userFuncList[index].showRightMenu = true;
}
//鼠标移除执行的事件
self.closeRightMenu = function () {
if (self.tabFixed) {
} else {
//self.initSearchFunc();
self.userFuncList.forEach(function (item) {
item.showRightMenu = false;
})
self.func.nowFuncCode = "";
self.func.nowFuncName = "";
}
}
self.openMenuTab = function (code, cname) {
if (code == self.func.nowFuncCode && cname == self.func.nowFuncName) {
return;
//$(".sp-menu-tab").hide();
//self.func.keyWord = "";
//self.func.keyCondition = "";
//self.func.nowFuncCode = "close";
//self.func.nowFuncName = "close";
} else {
//code传空表示查看全部功能
self.func.keyWord = "";
self.func.keyCondition = "";
self.func.nowFuncCode = code;
self.func.nowFuncName = cname;
var array = [];
if (code == "") {
self.func.normalTitle = "全部";
self.func.normalList = [];
self.func.allFuncList.forEach(function (item, index) {
array.push(item);
})
} else {
self.func.normalTitle = cname;
self.func.normalList = [];
self.func.allFuncList.forEach(function (item) {
if (item.PARENTID == code) {
array.push(item);
}
})
}
if (array.length > 12) {
self.func.normalList = array.slice(0, 12);
self.func.hideFunc = true;
self.func.showFunc = false;
} else {
self.func.normalList = array;
self.func.hideFunc = false;
self.func.showFunc = false;
}
self.secondMenu = cname == "" ? "全部/" : cname + "/";
$(".sp-menu-tab").show();
}
}
self.closeMenuTab = function () {
self.func.keyWord = "";
self.func.keyCondition = "";
//self.func.nowFuncCode = "close";
//self.func.nowFuncName = "close";
$(".sp-menu-tab").hide();
}
self.selectMenu = function (item) {
if (item.FILEN != undefined && item.FILEN != '' && item.FILEN != null) {
sp.addTabNav(item.PKID, item.CNAME, item.FILEN);
}
}
//初始化搜索
self.initSearchFunc = function () {
self.func.keyWord = "";
self.func.keyCondition = "";
self.func.keyShow = false;
self.func.keyPartList = []; //当前模块下所有符合关键字的模块列表
self.func.keyPartListCopy = []; //当前模块下前12个符合关键字的模块列表
self.func.keyAllList = []; //全局模块下所有符合关键字的模块列表
self.func.keyAllListCopy = []; //全局模块下前12个符合关键字的模块列表
self.func.keyPartShow = false;
self.func.keyPartHide = false;
self.func.keyAllShow = false;
self.func.keyAllHide = false;
}
self.keyWordFunc = function () {
console.log(self.func.allFuncList);
if (self.func.keyWord == "") {
self.initSearchFunc();
} else {
self.func.keyCondition = " 【关键字: " + self.func.keyWord + " 】";
self.func.keyShow = true;
var resultArray1 = [];
var resultArray2 = [];
self.func.allFuncList.forEach(function (item) {
var index = item.CNAME.indexOf(self.func.keyWord);
if (self.func.nowFuncCode == "") {
} else {
//当前模块下的筛选结果
if (index >=0 && item.PARENTID == self.func.nowFuncCode) {
resultArray1.push(item);
}
//其他模块下的全局筛选结果
if (index >= 0 && item.PARENTID != self.func.nowFuncCode) {
resultArray2.push(item);
}
}
})
self.func.keyPartList=angular.copy(resultArray1);
self.func.keyAllList=angular.copy(resultArray2);
if (resultArray1.length > 12) {
self.func.keyPartListCopy = resultArray1.slice(0, 12);
self.func.keyPartHide = true;
self.func.keyPartShow = false;
} else {
self.func.keyPartListCopy = resultArray1;
self.func.keyPartHide = false;
self.func.keyPartShow = false;
}
if (resultArray2.length > 12) {
self.func.keyAllListCopy = resultArray2.slice(0, 12);
self.func.keyAllHide = true;
self.func.keyAllShow = false;
} else {
self.func.keyAllListCopy = resultArray2;
self.func.keyAllHide = false;
self.func.keyAllShow = false;
}
}
}
self.clearKeyWordFunc = function () {
self.func.keyWord = "";
self.func.keyCondition = "";
var resultArray = [];
self.func.allFuncList.forEach(function (item) {
if (self.func.nowFuncName == "") {
resultArray.push(item);
} else {
if (item.PARENTID == self.func.nowFuncCode) {
resultArray.push(item);
}
}
})
if (resultArray.length > 12) {
self.func.normalList = resultArray.slice(0, 12);
self.func.hideFunc = true;
self.func.showFunc = false;
} else {
self.func.normalList = resultArray;
self.func.hideFunc = false;
self.func.showFunc = false;
}
}
self.selectItemFunc = function (item) {
//console.log(item.CNAME);
//console.log(item.FILEN);
//if (item.FILEN.indexOf("@token") > -1) {
// sp.addTabNav(item.PKID, item.CNAME, item.FILEN.replace("@token", self.outToken));
// self.addRecode(item.CNAME, item.FILEN.replace("@token", self.outToken));
//} else {
// sp.addTabNav(item.PKID, item.CNAME, item.FILEN);
// self.addRecode(item.CNAME, item.FILEN);
//}
if (item.OPENTYPE == "1") {
if (item.FILEN.indexOf("@token") > -1) {
window.open(item.FILEN.replace("@token", self.outToken));
} else {
window.open(item.FILEN);
}
} else {
if (item.FILEN.indexOf("@token") > -1) {
sp.addTabNav(item.PKID, item.CNAME, item.FILEN.replace("@token", self.outToken));
} else {
sp.addTabNav(item.PKID, item.CNAME, item.FILEN);
}
}
self.addRecode(item.CNAME, item.FILEN);
self.CrossPage(item);
self.getUserRecentFunc();
self.getUserFavoriteFunc();
////关闭左侧菜单
$(".sp-menu-switch").addClass("hasClick");
$(".sp-menu-list").fadeOut(200);
}
self.loadAllKindFunc = function (index) {
//console.log(index);
let array = angular.copy(self.userFuncList[index].C_H_I_L_D);
self.userFuncList[index].COPYCHILD = array;
self.userFuncList[index].hideFunc = false;
self.userFuncList[index].showFunc = true;
}
self.loadPartKindFunc = function (index) {
//console.log(index);
let array = angular.copy(self.userFuncList[index].C_H_I_L_D);
self.userFuncList[index].COPYCHILD = array.slice(0, 12);
self.userFuncList[index].hideFunc = true;
self.userFuncList[index].showFunc = false;
}
self.showKeyPartFunc=function(){
self.func.keyPartListCopy=angular.copy(self.func.keyPartList);
self.func.keyPartHide=false;
self.func.keyPartShow=true;
}
self.hideKeyPartFunc=function(){
self.func.keyPartListCopy=angular.copy(self.func.keyPartList).slice(0, 12);
self.func.keyPartHide=true;
self.func.keyPartShow=false;
}
self.showKeyAllFunc=function(){
self.func.keyAllListCopy=angular.copy(self.func.keyAllList);
self.func.keyAllHide=false;
self.func.keyAllShow=true;
}
self.hideKeyAllFunc=function(){
self.func.keyAllListCopy=angular.copy(self.func.keyAllList).slice(0, 12);
self.func.keyAllHide=true;
self.func.keyAllShow=false;
}
//桌面自定义流程人员初始化
self.InitUser = function () {
var data = {"userid": [], "mark": "1"}
$http.post(apiurljs.login + "g2work/desktop/InitWorkflowCandoCustom", {data: s4.encryptData_CBC(JSON.stringify(data))}, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
if (res.success) {
sp.dialog("初始化成功!")
$timeout(function () {
sp.dialoghide()
}, 1000)
}
})
}
self.usercard = {
id: 0,
userid: self.userId,
username: self.userName,
img: "AFrontEnd/css/icons/photo/02.jpg",
DEPNAME: "",
SBTIME: "",
XBTIME: ""
}
self.addRecode=function (name,url) {
var postData = {
tablename: "SYS_LOG",
data: {
LOGTIME: sp.dateFtt("yyyy-MM-dd hh:mm:ss",new Date()),
LOGIP: sp.myIP(),
LOGUSER:self.userName,
LOGFUNC:name,
LOGFUNCURL:url,
LOGAPI:"insertFormData输入参数",
LOGAPIURL:"g2app/dataabase/insertFormData",
LOGAPIPOST:"",
REMARK:""
}
}
var apiData={
data:s4.encryptData_CBC(JSON.stringify(postData))
}
postData.data.LOGAPIPOST=JSON.stringify(apiData);
$http.post(apiurljs.login + "g2app/Data/insertByDataid", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
.success(function (obj) {
})
}
//跨页面记录日志参数
self.CrossPage = function (obj) {
CrossPage = {
cname: obj.CNAME,
ctime: sp.getLocalDate1(),
type: 0
}
}
//获取上传附件文件格式限制----20230517
uploadformat = [];
function getUploadFormat() {
var data = { tablename: "CODE_UPLOADFORMAT" }
$http.post(apiurljs.login + "g2app/DangAn/queryCodeData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
uploadformat = res.data;
})
};
getUploadFormat()
////头部关键字搜索---20230905
self.headBtnSearchKeyword = "";
self.headSearchResult = [];
self.headSearchResult_view = false;
self.headBtnSearch = function () {
if (sp.isval(self.headBtnSearchKeyword)) {
self.headSearchResult = [];
var data = {
"url": "/basic/api/StatSelect/selectCodeList",
"data": { "keyWord": self.headBtnSearchKeyword }
}
//console.log(JSON.stringify(data));
$http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
//console.log(JSON.stringify(res.data));
self.headSearchResult = res.data.build;
if (sp.isval(self.headSearchResult)) {
self.headSearchResult_view = true;
} else {
self.headSearchResult_view = false;
}
})
} else {
self.headSearchResult_view = false;
}
};
self.headKeywordPage = function (itemdata) {
var get_token = localStorage.getItem("main-token");
var set_url = apiurljs.onePic + "wholeProcessPage?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id + "";
sp.addTabNav(itemdata.id, '一张图', set_url);
self.headSearchResult_view = false;
};
//获取未读消息数量
self.msgNum = 0;
self.getMsgNum = function () {
var data = {
userid: self.userId,
msgkind: "公文事项办理",
mark: "未读"
}
$http.post(apiurljs.login+"g2work/routeinfo/queryDataMessageCount",{ data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
self.msgNum = res.data.MSGCOUNT;
$("#onlineUsers").html(res.data.ONLINEUSER + "人");
$.cookie("GlWorkPlatform-onlineUsers", res.data.ONLINEUSER);
console.log(res.data)
})
}
self.getMsgNum()
$interval(function () {
self.getMsgNum()
}, 10000)
self.openMsg = function () {
sp.addTabNav("XXJL","消息记录","tpl/deskunit/msgList.html")
}
//获取上班下班时间规则
// self.queryRules = function () {
// var data = {
// sqlwhere: {}
// }
// $http.post(apiurljs.login + "g2app/Attendance/queryRules", {data: s4.encryptData_CBC(JSON.stringify(data))}, postCfg)
// .success(function (obj) {
// var res = strToJson(s4.decryptData_CBC(obj.data));
// self.CARDSTART = res.data.STARTTIEM;
// self.CARDEND = res.data.ENDTIME;
// self.getDEPART()
// })
// }
//获得当前人部门
// self.getDEPART = function () {
// var data = {
// userid: self.usercard.userid
// }
// $http.post(apiurljs.login + "g2app/dataabase/queryDpName", {data: s4.encryptData_CBC(JSON.stringify(data))}, postCfg)
// .success(function (obj) {
// var res = strToJson(s4.decryptData_CBC(obj.data));
// self.usercard.DEPNAME = res.data.length == 0 ? "" : res.data[0].SECTION;
// })
// }
// self.queryRules()
// self.card = function (n) {
// var data = {
// tablename: "ATTENDANCEMAN",
// colums: "*,TO_CHAR(SBTIME,'hh24:mi:ss') as SBTIME1,TO_CHAR(XBTIME,'hh24:mi:ss') as XBTIME1",
// order: "ID",
// sqlwhere: {
// CDATE: sp.format(sp.getLocalDate()),
// CUSERID: self.usercard.userid
// },
// sqlinwhere: "",
// sqllikewhere: ""
// }
// $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg)
// .success(function (obj) {
// var res = strToJson(s4.decryptData_CBC(obj.data));
// if (res.data.length != 0) {
// self.usercard = {
// id: res.data[0].ID,
// userid: self.usercard.userid,
// username: self.usercard.username,
// DEPNAME: self.usercard.DEPNAME,
// SBTIME: res.data[0].SBTIME ? res.data[0].SBTIME1 : "",
// XBTIME: res.data[0].XBTIME ? res.data[0].XBTIME1 : "",
// DKSTATUS: res.data[0].DKSTATUS.split(",")[0]
// }
// }
// $(".cardtime").html(sp.getLocalDate().slice(11, 19))
// $interval(function () {
// $(".cardtime").html(sp.getLocalDate().slice(11, 19))
// }, 1000)
// if (n == 0) {
// sp.layer("#layer_card")
// }
// })
// }
// self.clickstatus = false;
// self.clickCard = function () {
// if (self.clickstatus == true || (self.usercard.SBTIME != '' && self.usercard.XBTIME != '')) {
// return;
// }
// self.clickstatus = true;
// if (self.usercard.id == 0) {
// var data = {
// tablename: "ATTENDANCEMAN",
// data: {
// CDATE: sp.format(sp.getLocalDate()),
// CNAME: self.usercard.username,
// CUSERID: self.usercard.userid,
// DEPNAME: self.usercard.DEPNAME,
// SBTIME: sp.format(sp.getLocalDate()) + " " + $(".cardtime").html(),
// DKSTATUS: getDKSTATUS($(".cardtime").html(), 1)
// }
// }
// $http.post(apiurljs.login + "g2app/dataabase/insertFormData", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg)
// .success(function (obj) {
// var res = strToJson(s4.decryptData_CBC(obj.data));
// self.clickstatus = false;
// if (res.success == true) {
// self.card(1)
// } else {
// sp.layerhide()
// sp.dialog(res.message)
// }
// })
// } else {
// var data = {
// id: self.usercard.id,
// tablename: "ATTENDANCEMAN",
// data: {
// CNAME: self.usercard.username,
// CUSERID: self.usercard.userid,
// DEPNAME: self.usercard.DEPNAME,
// XBTIME: sp.format(sp.getLocalDate()) + " " + $(".cardtime").html(),
// DKSTATUS: self.usercard.DKSTATUS + "," + getDKSTATUS($(".cardtime").html(), 2)
// }
// }
// $http.post(apiurljs.login + "g2app/dataabase/upFormData", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg)
// .success(function (obj) {
// var res = strToJson(s4.decryptData_CBC(obj.data));
// self.clickstatus = false;
// if (res.success == true) {
// self.card(1)
// } else {
// sp.layerhide()
// sp.dialog(res.message)
// }
// })
// }
// }
//获取服务器时间
// self.getServerTime = function () {
// var data = {
// param: "yyyy-MM-dd HH:mm:ss"
// }
// $http.post(apiurljs.login + "g2app/calendar/queryServiceDate", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg)
// .success(function (obj) {
// var res = strToJson(s4.decryptData_CBC(obj.data));
// self.ServerTime = res.data;
// self.getREMINDTIME()
// })
// }
//获取提醒时间
// self.getREMINDTIME = function () {
// var data = {
// tablename: "CODE_REMINDTIME",
// colums: "*",
// order: "ID",
// sqlwhere: "",
// sqlinwhere: "",
// sqllikewhere: ""
// };
// $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg)
// .success(function (obj) {
// var res = strToJson(s4.decryptData_CBC(obj.data));
// self.REMINDTIME = res.data;
// self.getFREQUENCY()
// })
// }
//获取提醒频率
// self.getFREQUENCY = function () {
// var data = {
// tablename: "CODE_FREQUENCY",
// colums: "*",
// order: "ID",
// sqlwhere: "",
// sqlinwhere: "",
// sqllikewhere: ""
// };
// $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg)
// .success(function (obj) {
// var res = strToJson(s4.decryptData_CBC(obj.data));
// self.FREQUENCY = res.data;
// self.getRemindList()
// })
// }
// self.getRemindList = function () {
// self.remindlist = []
// var data = {
// STRATDATE: sp.dateFtt("yyyy-MM-dd", new Date()),
// USERID: self.engName
// }
// $http.post(apiurljs.login + "g2app/calendar/queryDayData", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg)
// .success(function (obj) {
// var res = strToJson(s4.decryptData_CBC(obj.data));
// if (res.data.Items[0].task == null || res.data.Items[0].task == undefined || res.data.Items[0].task == "") {
// } else {
// self.remindlist = res.data.Items[0].task;
//
// self.remindlist.forEach(function (item) {
// self.REMINDTIME.forEach(function (item1) {
// if (item.REMINDTIME == item1.CODE) {
// item.REMINDTIME = item1.NUM * 3600000
// }
// })
// self.FREQUENCY.forEach(function (item1) {
// if (item.FREQUENCY == item1.CODE) {
// item.FREQUENCY = item1.NUM
// }
// })
// })
//
// //生成事项提醒循环
// var remindStart = [];
// $.each(self.remindlist, function (index, item) {
// remindStart[index] = $interval(function () {
// remindGoing(index);
// }, 1000)
// })
// var remindGoing = function (n) {
// remindWarning(self.remindlist[n], n)
// //判断循环是否停止
// if (self.ServerTime >= self.remindlist[n].STARTIME) {
// $interval.cancel(remindStart[n]);
// }
// }
// //到时提醒
// var remindWarning = function (obj, n) {
// var n = obj.FREQUENCY - 1;
// if (self.ServerTime == TimeToDate(obj.STARTIME, obj.REMINDTIME * n)) {
// sp.dialog(obj.MEETINGNAME + "第" + (obj.FREQUENCY - n) + "次提醒");
// $timeout(function () {
// n--
// sp.dialoghide()
// }, 5000)
// remindStart[obj.id + "times"] = $interval(function () {
// sp.dialog(obj.MEETINGNAME + "第" + (obj.FREQUENCY - n) + "次提醒");
// $timeout(function () {
// n--
// sp.dialoghide()
// }, 5000)
// }, obj.REMINDTIME, n)
// }
// }
// }
// });
// }
//self.getServerTime()
self.onePic = function () {
sp.addTabNav("DTSS", "地图搜索", apiurljs.onePic + "wholeProcessPage?token=" + self.outToken)
}
}])
var CrossPage = new Object();