shr.defineClass("shr.perfweb.perfportalNew", shr.framework.Core, { _SHOW_TODO: 1, // 右侧显示绩效待办 _SHOW_AXVTODO: 2, // 右侧显示业绩待办 _SHOW_IFRAME: 3, // 右侧显示iframe _RESOURCETARGET_AXV: 'achivementData', // 初始化默认点击业绩数据维护菜单 initalizeDOM: function () { // 初始化JS环境 shr.perfweb.perfportalNew.superClass.initalizeDOM.call(this); if (shr.getUrlParam("inFrame") == null || shr.getUrlParam("inFrame") == '') { window.location.href = shr.getContextPath() + '/dynamic.do?uipk=' + shr.getCurrentViewPage().uipk + '&inFrame=true'; } this.initMenu(); // 初始化菜单 if (shr.getUrlRequestParam("resourceTag") == this._RESOURCETARGET_AXV) { //选中 业绩维护 菜单 $('#perfAchivementManagementParent').trigger('click'); $('#perfAchivementManagementTag').trigger('click'); } else { // 自动跳转默认展示菜单 var defautMenu = shr.getUrlRequestParam("defautMenu"); if (defautMenu != undefined && defautMenu != "") { var $menuLi = $('li[name="' + defautMenu + '"]'); var $menuParent = $menuLi.parent("ul").parent(".menuList"); $menuParent.trigger('click'); $menuLi.trigger('click'); } else { this.initTodoContent(); // 初始化绩效待办 this.initMyOngoingData(); // 初始化我参与进行中的考核 } } //yien BT1468810 没任何组织绩效待办卡片权限时 ,组织绩效待办框 字段去掉(个人) this.initPersonAndOrgCardPanel(); defaultPage = this.initData['perfBatchScoreList_defaultPage']; defaultPage4Org = this.initData['orgPerfBatchScoreList_defaultPage']; }, /** * 初始左侧菜单 */ initMenu: function () { $('#workAreaDiv').append($("#leftMenuTpl").html()); $("#leftMenuTpl").remove(); this.menuClickEvent(); }, /** * 菜单点击事件 */ menuClickEvent: function () { var _self = this; $('.menuList').unbind('click').bind('click', function (event) { _self._menuClickStyle($(this)); var contentid = $(this).attr('for'); var breadcrumb = $(this).attr('breadcrumb'); var shruicode = $(this).attr('shruicode'); var perfshruicode = $(this).attr('perfshruicode'); // 【BT-01105576】breadcrumb取不到值,面包屑显示有问题 if (breadcrumb == undefined) { breadcrumb = $("li[for='myEvaluationContent']").attr("breadcrumbValue"); } if (contentid == 'myEvaluationContent') { _self.initTodoContent(breadcrumb); // 初始化绩效待办 _self.initMyOngoingData(); // 初始化我参与进行中的考核 } else if (contentid == 'axvManagementContent') { _self.initAxvTodoContent(breadcrumb); // 初始化业绩待办 } else if (!_self.customerMenuClickEvent($(this), contentid)) { _self.initIframeContent($(this).attr("uipk"), $(this).attr("iframeName"), shruicode, perfshruicode); // 跳转配置的uipk对应页面 } stopEvent(event); }); }, /** * 自定义菜单点击事件 * @param obj * @param contentid * @returns {boolean} */ customerMenuClickEvent: function (obj, contentid) { return false; }, /** * 待办卡片点击事件 */ cardClickEvent: function () { var _self = this; var $rightContentArea = $("#rightContentArea"); $rightContentArea.find('.board').unbind('click').bind('click', function (event) { // var count = $(this).find(".count").html(); var count = $(this).attr("count"); var uipk = $(this).attr("uipk"); var serviceId = decodeURIComponent($(this).attr("serviceid")); var personId = $(this).attr("personid"); var action = $(this).attr("action"); var isOrg = $(this).attr("isorg"); var iframe = $(this).attr("iframe"); // 交叉视图拆分入口携带参数 var shruicode = $(this).attr("shruicode"); // 子页面交叉视图拆分入口携带参数 var perfshruicode = $(this).attr("perfshruicode"); if (action != undefined && action != "") { action += "Action"; // 卡片定义了action属性的调用action对应的方法 shr.proxyCall.call(_self, action, _self, $(this), uipk, serviceId, personId, isOrg, shruicode, perfshruicode); } else if (iframe != undefined && iframe != "") { _self.initIframeContent(uipk, "", shruicode, perfshruicode); // 跳转配置的uipk对应页面 } else if (uipk != undefined && uipk != "") { if (count == "0") { // 待办数为0显示暂无待办事项 _self._showNoneTodoMessage(); } else { var param = { uipk: uipk, isOrg: isOrg, serviceId: serviceId, period: '' } _self._addShruicode(param, shruicode, perfshruicode); // 否则根据uipk重载页面 _self.reloadPage(param); } } }); }, /** * 团队目标下达待办卡片点击处理 * @param obj * @param uipk * @param serviceId * @param personId * @param isOrg * @param shruicode * @param perfshruicode */ getTeamPersonalTargetDataAction: function (obj, uipk, serviceId, personId, isOrg, shruicode, perfshruicode) { var _self = this; $.block.show(); var param = { uipk: uipk, serviceId: serviceId, } if (isOrg != undefined && isOrg != "") { param.isOrg = isOrg; } _self._addShruicode(param, shruicode, perfshruicode); _self.reloadPage(param); /*this.remoteCall({ method: "getTeamPersonalTargetData", param: { personId: personId, evaObjName: '', isOrg: isOrg }, async: true, success: function (data) { $.block.hide(); if (data != null && data.totalCount > 0) { //将下达数量为0的考核周期过滤掉 var periodId = ''; for (var i = 0, len = data.evaPerfPeriodBeanList.length; i < len; i++) { if (data.evaPerfPeriodBeanList[i].evaCountPerPeriod > 0) { periodId = data.evaPerfPeriodBeanList[i].periodId; break; } } var param = { uipk: uipk, serviceId: serviceId, period: periodId } if (isOrg != undefined && isOrg != "") { param.isOrg = isOrg; } _self._addShruicode(param, shruicode, perfshruicode); _self.reloadPage(param); } else { _self._showNoneTodoMessage(); } } });*/ }, /** * 团队个人目标评价待办卡片点击处理 * @param obj * @param uipk * @param serviceId * @param personId * @param isOrg * @param shruicode * @param perfshruicode */ getTeamTargetCommentListAction: function (obj, uipk, serviceId, personId, isOrg, shruicode, perfshruicode) { var _self = this; $.block.show(); //打分页面性能优化 by huan_xiong 去掉有无数据判断,直接跳转 var param = { uipk: uipk, serviceId: serviceId, personId: personId } _self._addShruicode(param, shruicode, perfshruicode); _self.reloadPage(param); /* this.remoteCall({ method: "getTeamTargetCommentList", async: true, success: function (data) { $.block.hide(); if (data != null && data.totalCount > 0) { var periodId = data.evaPerfPeriodBeanList[0].periodId; _self.reloadPage({ uipk: uipk, period: periodId, serviceId: serviceId, personId: personId }); } else { _self._showNoneTodoMessage(); } } });*/ }, /** * 我的考核目标待办卡片点击处理 * @param obj * @param uipk * @param serviceId * @param personId * @param isOrg * @param shruicode * @param perfshruicode */ getMyTargetDataAction: function (obj, uipk, serviceId, personId, isOrg, shruicode, perfshruicode) { var _self = this; this.remoteCall({ method: "getMyTargetData", param: { evaObjName: '', isOrg: isOrg }, async: false, success: function (data) { /*if (data != null && data.length > 0) {*/ var curPeriodId; if (data != null && data.length > 0){ curPeriodId = data[0]; }else{ curPeriodId = ''; } var param = { uipk: uipk, serviceId: serviceId, period: curPeriodId } _self._addShruicode(param, shruicode, perfshruicode); _self.reloadPage(param); /*} else { _self._showNoneTodoMessage(); }*/ } }); }, /** * 我的考核自评待办卡片点击处理 * @param obj * @param uipk * @param serviceId * @param personId * @param isOrg * @param shruicode * @param perfshruicode */ getPersonalTargetCommentListAction: function (obj, uipk, serviceId, personId, isOrg, shruicode, perfshruicode) { var _self = this; if (_self._hideboardwrap(obj)) { return; } $.block.show(); var param = { personId: personId }; if (isOrg != undefined && isOrg != "") { param.isOrg = isOrg; } this.remoteCall({ method: "getPersonalTargetCommentList", param: param, async: true, success: function (data) { $.block.hide(); if (data != null && data.length > 0) { globalPersonnalTargetData = data; _self._loadingSelfAssessmentData(data, obj, uipk, serviceId, personId, isOrg, shruicode, perfshruicode); } else { _self._showNoneTodoMessage2(obj.find(".nameboard")); } _self._openNameboardList(obj); } }); }, /** * 其他绩效待办卡片点击处理 * @param obj * @param uipk * @param serviceId * @param personId */ othersTodoAction: function (obj, uipk, serviceId, personId) { var safeUrl = shr.safeUrl(shr.getContextPath().replace("/shr", "") + "/easweb/webviews/workflow/processcenter.jsp?waf2skin=eas&entitypk=" + encodeURIComponent(uipk)); window.open(safeUrl); }, /** * 隐藏卡片下拉显示 * @private */ _hideboardwrap: function (obj) { var boardwrapH = obj.parents('.boardwrap').height(); if (obj.hasClass('boardfooterclick')) { $.block.hide(); obj.animate({height: boardwrapH + 'px'}, function () { obj.removeClass('boardfooterclick'); obj.removeClass('boxshadow'); obj.css('z-index', '0'); }); return true; } return false; }, /** * 加载【我的考核自评】数据 * @param data * @param obj * @param uipk * @param serviceId * @param personId * @param isOrg * @param shruicode * @param perfshruicode * @private */ _loadingSelfAssessmentData: function (data, obj, uipk, serviceId, personId, isOrg, shruicode, perfshruicode) { var _self = this; var $nameboard = obj.find('.nameboard'); if (data == undefined || data == null || data == '') { _self._showNoneTodoMessage2($nameboard); } else { $nameboard.html(''); $nameboard.append(_self._myselfEvalutionLoadList(data)); } //跳转到我的自评打分页面 obj.find('.megList li .batch, .one_column').each(function (index, el) { $(el).live('click', function () { var evaObj = $(this).attr("evaobj"); var periodId = $(this).attr("periodId"); var gradeTaskNode = $(this).attr("gradeTasknode"); var wfLevel = $(this).attr("wfLevel"); //var defaultPage = $('#defaultPage').text(); if(isOrg == "1") { if (defaultPage4Org == 'list') { uipk = 'com.kingdee.shr.perfweb.app.perfscoreNew4Org.core' } }else { if (defaultPage == 'list') { uipk = 'com.kingdee.shr.perfweb.app.perfscoreNew.core'; } } var param = { uipk: uipk, evaObj: evaObj, periodId: periodId, personId: personId, serviceId: serviceId, //personNumber: personNumber, entryType: 'myselfEvalu', gradeTaskNode: gradeTaskNode, wfLevel: wfLevel } _self._addShruicode(param, shruicode, perfshruicode); _self.reloadPage(param); }); }) }, /** * 我的考核自评待办卡片数据预览Html * @param data * @private */ _myselfEvalutionLoadList: function (data) { var $nameboardTpl = $("#nameboardTpl"); var nameboardTpl = juicerUtils.parseHtml2JuicerTpl($nameboardTpl.html()); return juicer(nameboardTpl, {rows: data}) }, /** * 打开待办卡片预览 * @param obj * @private */ _openNameboardList: function (obj) { var board = obj; var boardwrapH = obj.parents('.boardwrap').height(); var nameboard = obj.find('.nameboard'); var zIndex = $('.boardfooterclick').length + 2; board.css('z-index', zIndex); obj.addClass('boardfooterclick'); board.addClass('boxshadow'); var height = nameboard.innerHeight() + boardwrapH + 10 + 'px'; board.animate({height: height}); }, /** * 刷新待办卡片数量 */ initDataAction: function (updateCountFlag) { $.block.show(); this.remoteCall({ method: 'initData', param: { updateCountFlag: updateCountFlag }, success: function (data) { if (data && data.length > 0) { for (var item in data) { $("div[id='" + item + "']").html(data[item]); // 刷新待办数 } } $.block.hide(); } }); }, /** * 初始化右侧区域 * @param contentIndex 1:显示绩效待办 2:显示业绩数据 3:显示iframe * @param uipk iframe的src * @param iframeName 兼容老代码,有些地方iframe的子页面需要根据父页面iframe名称来定位 * @param shruicode * @param perfshruicode */ initRightContent: function (contentIndex, uipk, iframeName, shruicode, perfshruicode) { var $rightContentArea = $("#rightContentArea"); var $otherContent = $rightContentArea.find("div.content[index!='" + contentIndex + "']"); var $content; if ($rightContentArea != undefined) { $content = $rightContentArea.find("div.content[index='" + contentIndex + "']"); } // 右侧显示iframe if (contentIndex == this._SHOW_IFRAME) { if (uipk == undefined) { return; } $otherContent.hide(); $content.remove(); } else if ($content.length > 0) { // 右侧区域已渲染的情况下,重新渲染待办卡片数即可 this.initDataAction(contentIndex + ""); if (contentIndex == this._SHOW_TODO) { this.initMyOngoingData(); // 初始化我参与进行中的考核; } $otherContent.hide(); $content.show(); return; } $otherContent.hide(); // 根据视图配置模板解析右侧区域 this._parseRightContent(contentIndex, uipk, iframeName, shruicode, perfshruicode); }, /** * 初始化绩效待办区域 */ initTodoContent: function (breadcrumb) { if (breadcrumb == undefined) { breadcrumb = $("li[for='myEvaluationContent']").attr("breadcrumbValue"); } this.initRightContent(this._SHOW_TODO); var resourceTag = shr.getUrlRequestParam("resourceTag"); var url = window.location.href; if (resourceTag != "" && resourceTag != undefined) { url = url.replace(/(&resourceTag=.*?)&/g, '&'); window.history.pushState({}, 0, url); } this.initNavigationStore({ uipk: shr.getCurrentViewPage().uipk, name: breadcrumb, url: url }); this.cardClickEvent(); }, /** * 初始化业绩数据待办区域 */ initAxvTodoContent: function (breadcrumb) { this.initRightContent(this._SHOW_AXVTODO); var uipk = shr.getCurrentViewPage().uipk; var resourceTag = shr.getUrlRequestParam("resourceTag"); if (resourceTag == "" || resourceTag == undefined) { uipk += "&resourceTag=achivementData"; } this.initNavigationStore({ uipk: uipk, name: breadcrumb }); this.cardClickEvent(); }, /** * 初始化iframe区域 */ initIframeContent: function (uipk, iframeName, shruicode, perfshruicode) { if (iframeName == "" || iframeName == undefined) { iframeName = "rightContentIframe"; } this.initRightContent(this._SHOW_IFRAME, uipk, iframeName, shruicode, perfshruicode); }, /** * 初始化面包屑导航数据 */ initNavigationStore: function (item) { var items = shrDataManager.pageNavigationStore.getDatas(); if (typeof items != "undefined" && items.length == 2) { var oldUipk = items[1].uipk; var newUipk = item['uipk']; var newUrl = item['url']; items[1].name = item['name']; items[1].uipk = newUipk; if (newUrl != undefined && newUrl != "") { items[1].url = newUrl; } else { items[1].url = items[1].url.replace(oldUipk, newUipk); } shrDataManager.pageNavigationStore.setDatas(items); } }, /** * 初始化我参与进行中的考核 */ initMyOngoingData: function () { $.block.show(); var _self = this; var $rightContentArea = $("#rightContentArea"); var $myOngoingTpl = $("#myOngoingTpl"); var myOngoingTpl = juicerUtils.parseHtml2JuicerTpl($myOngoingTpl.html()); this.remoteCall({ method: "getMyOngoingAsmtList", async: true, param: {rows: $myOngoingTpl.attr("rows")}, success: function (result) { if (result && null != result.baseData && result.baseData != undefined) { var baseData = result.baseData; var processViewData = result.processViewData; var rows = []; for (var i = 0; i < baseData.length; i++) { var item = baseData[i]; var it = {}; it.planname = item["perfPlan.name"] ? item["perfPlan.name"] : '  '; if(0===item["evaObj.isOrg"].value){ it.objname = item["person.name"]; }else { it.objname = item["adminOrgUnit.name"]; } it.asignmentPoolID = item["asignmentPool.id"]; var processViewDatas = processViewData.data; var datas = {}; for (var k = 0; k < processViewDatas.length; k++) { var elem = processViewDatas[k][0][0][0]; if (elem.asignmentPoolID == it.asignmentPoolID) { datas.data = processViewDatas[k]; break; } } datas.photo = processViewData.photo; var processViewHtml = generateProcessView(datas); it.processViewHtml = processViewHtml rows.push(it); } $rightContentArea.find('#ongoingRows').html(juicer(myOngoingTpl, {rows: rows})); } _self._myOngoingViewClick(); $.block.hide(); } }); }, /** * 显示暂无待办事项 * @private */ _showNoneTodoMessage: function () { shr.showInfo({ message: $("#todoMessage1").attr("value"), hideAfter: 3 }) }, /** * 显示暂无待办事项 * @param obj * @private */ _showNoneTodoMessage2: function (obj) { obj.html($("#todoMessage2").html()); }, /** * 根据视图配置模板解析右侧区域 * @param contentIndex * @param uipk * @param iframeName * @private */ _parseRightContent: function (contentIndex, uipk, iframeName, shruicode, perfshruicode) { var _self = this; var $rightContentArea = $("#rightContentArea"); var $workAreaDiv = $('#workAreaDiv'); var rightContentTpl = juicerUtils.parseHtml2JuicerTpl($("#rightContentTpl" + contentIndex).html()); var minHeight = $(window).height() - $('.menu').offset().top - 5; var serviceId = shr.getUrlRequestParam("serviceId", window.location.href); if (uipk != undefined && uipk != "" && uipk.indexOf("serviceId") < 0) { uipk += "&serviceId=" + serviceId; } var param = { minheight: minHeight, width: $rightContentArea.width(), src: shr.getContextPath() + "/dynamic.do?uipk=" + decodeURIComponent(uipk), iframeName: iframeName } if (shruicode != undefined && shruicode != "") { param.src += "&shruicode=" + shruicode; } if (perfshruicode != undefined && perfshruicode != "") { param.src += "&perfshruicode=" + perfshruicode; } var parseRightHtml = $(juicer(rightContentTpl, param)); $rightContentArea.append(parseRightHtml); $workAreaDiv.append($rightContentArea); if (contentIndex != this._SHOW_IFRAME) { var $cardTpl = $("#cardTpl" + contentIndex); var $orgCardTpl = $("#orgCardTpl" + contentIndex); var $content = $rightContentArea.find("div.content[index='" + contentIndex + "']") this._parseCardTpl($cardTpl, $content.find('.todo'), "0"); this._parseCardTpl($orgCardTpl, $content.find('.orgtodo'), "1"); } else if (uipk != undefined && uipk != "") { var $iframe = $rightContentArea.find("iframe[name='" + iframeName + "']"); $.block.show({ text: $iframe.attr("loadtext") }); $iframe.css('min-height', minHeight + 'px'); $iframe.load(function () { $.block.hide(); }); } }, /** * 菜单点击样式控制 * @param obj */ _menuClickStyle: function (obj) { var $this = obj; var currentClass = 'selectedmenu'; if (obj.closest('ul').hasClass('menu_second')) { //二级菜单 $this = obj.closest('li'); currentClass = 'subCurrentSelsct'; } var borderleft = $this.parent().find('.borderleft'); var index = $this.index(); $('.' + currentClass).removeClass(currentClass); obj.addClass(currentClass); if (obj.attr('hasSecondMenu') == 'true') { var secondMenu = obj.find('.menu_second'); if (secondMenu.is(':hidden')) { $('.menu_second').hide(); secondMenu.show(); } else { secondMenu.hide(); } } else if (obj.closest('ul').hasClass('menu_list')) { $('.menu_second').hide(); $('.subCurrentSelsct').removeClass('subCurrentSelsct'); } var top = (parseInt($this.css("margin-bottom")) + $this.height()) * index + 'px'; borderleft.animate({top: top}, 100); }, /** * 我参与进行中的考核点击事件 */ _myOngoingViewClick: function () { var _self = this; $('.linkstyle').unbind('click').bind('click', function () { var li = $(this).parent('li'); var chart = li.find('.assessment_chart'); if (!$(this).hasClass('viewapread')) { li.animate({height: 57 + chart.innerHeight() + 'px'}); $(this).addClass('viewapread'); li.addClass('boxshadow'); } else { li.animate({height: '57px'}, function () { li.removeClass('boxshadow'); }); $(this).removeClass('viewapread'); } }); $('.more').die('click').live('click', function () { uipk = $(this).attr("uipk"); _self.reloadPage({ uipk: uipk, serviceId: '' //处理点击更多报500的问题 R20200401-2163 }); }); }, /** * 解析视图待办卡片模板 * @param $cardTpl * @param $appendTo * @param isOrg 是否组织考核 */ _parseCardTpl: function ($cardTpl, $appendTo, isOrg) { var $cardParseTpl = juicerUtils.parseHtml2JuicerTpl($("#cardTpl").html()); $cardTpl.find("cardx").each(function () { var param = { title: $(this).attr("title"), // 卡片标题 desc: $(this).attr("desc"), // 卡片描述 count: $(this).attr("count"), // 待办数 uipk: $(this).attr("uipk"), serviceid: $(this).attr("serviceid"), countflag: $(this).attr("countflag"), // 更新待办数id display: $(this).attr("display"), // 是否可见 action: $(this).attr("action"), // 点击执行自定义方法, isOrg: isOrg, // 是否组织考核 iframe: $(this).attr("iframe"), shruicode: $(this).attr("shruicode"), // 交叉视图拆分入口携带参数 perfshruicode: $(this).attr("perfshruicode"), // 子页面交叉视图拆分入口携带参数 } if (param.display == "true" || param.display == undefined) { $(juicer($cardParseTpl, param)).appendTo($appendTo); } }); }, /** * yien 补丁11 根据权限是否隐藏个人、组织填报的面板 */ initPersonAndOrgCardPanel: function() { if($('#cardTpl1 cardx[display="true"]').length < 1) { $('.content[index="1"] .todo').remove(); } if($('#orgCardTpl1 cardx[display="true"]').length < 1) { $('.orgtodo').remove(); } }, /** * 给param添加shruicode参数 * @param param * @param shruicode * @param perfshruicode * @private */ _addShruicode: function(param, shruicode, perfshruicode) { if (shruicode != undefined && shruicode != "") { param.shruicode = shruicode; } if (perfshruicode != undefined && perfshruicode != "") { param.perfshruicode = perfshruicode; } } }); /** * 阻止事件冒泡 * @param event */ function stopEvent(event) { var e = arguments.callee.caller.arguments[0] || event;//这里是因为除了IE有event其他浏览器没有所以要做兼容 if (e && e.stopPropagation) { //其他浏览器 e.stopPropagation(); } else if (window.event) { //IE浏览器 e.cancelBubble = true; } } function setIframeHeight(id) { shr.setIframeHeight(id); }