etms/asset/js/cetc54/jcdp/portal.js
liyuchen c24bea2687 Initial commit: JCDP 教育培训管理系统 v54
- 系统管理模块(用户/角色/组织/权限/日志)
- 教育培训计划管理模块
- 教育培训实施模块
- 考试管理模块
- 调研问卷管理模块
- 外派培训管理模块
- 年度培训总结模块
- 学习资源管理模块
- 任职资格管理模块
- 即时通讯模块
- APP 版本管理
- 统计分析模块(FineReport)
- 代码审查标准和报告(CODE_REVIEW_GUIDE.md, CODE_REVIEW_REPORT.md)
- 项目开发指南(PROJECT_GUIDE.md)
2026-04-16 16:41:34 +08:00

304 lines
9.6 KiB
JavaScript

/**
* Created by jinxs on 2016.08.02.
*/
var webroot = $("#hdWebroot").val();
var taskDataCache;
var applyDataCache;
$(function () {
var msgListUrl = webroot + "/Inbox/list";
var taskListUrl=webroot+"/Task/tasklist";
var applyListUrl=webroot+"/Task/applyList";
var changeStatus = webroot + "/Inbox/changeMsgStatus";
var divTop = $("#top");
var customIframe = $("#customIframe");
var linkMyTask = $("#linkMyTask");
var linkMsgCount = $("#linkMsgCount");
var linkTaskCount = $("#linkTaskCount");
var linkApplyCount = $("#linkApplyCount");
var divMyTask = $("#divMyTask");
var divMsg = $("#divMsg");
var divTask = $("#divTask");
var divApply = $("#divApply");
var divCustom = $("#divCustom");
var divMyTask_close = $("#divMyTask_close");
var dialogSize = {width: 540, height: '80%'};
var dialogApply = $('#dialogApply');
var form_apply = $('#form_apply');
var dialogTask = $('#dialogTask');
var form_task = $('#form_task');
divCustomAutoFit();
initPalMsg();
initPalTask();
initPalApply();
initMsgDialog();
initTaskDialog();
initApplyDialog();
addEvents();
//-----------------------------------------------------------------------
function showMsgCount(count) {
if(count>99){
return "99+";
}else{
return count+"";
}
}
function initPalMsg() {
$.ajax({
type: 'post',
url: msgListUrl,
data: {msgstatus: 0, orderField: 'list.sendtime', descended: true, pageIndex: 1, pageSize: 5},
success: function (result) {
var data = result.data;
var temp = template("msg_temp", data);
divMsg.html(temp);
linkMsgCount.html(showMsgCount(data.total));
if (data.total == 0) {
$("#msgList").html("<div class='noReadMsgTip'>没有未读消息</div>");
}
}
});
}
function initPalTask() {
$.ajax({
type: 'post',
url: taskListUrl,
data: {orderField: 'tl.APPLYTIME',type:0, descended: true, pageIndex: 1, pageSize: 5},
success: function (result) {
var data = result.data;
taskDataCache=data.rows;
var temp = template("task_temp", data);
divTask.html(temp);
linkTaskCount.html(showMsgCount(data.total));
if (data.total == 0) {
$("#taskList").html("<div class='noReadMsgTip'>没有待办任务</div>");
}
}
});
}
function initPalApply() {
$.ajax({
type: 'post',
url: applyListUrl,
data: {type: 0, orderField: 'APPLYTIME', descended: true, pageIndex: 1, pageSize: 5},
success: function (result) {
var data = result.data;
applyDataCache=data.rows;
var temp = template("apply_temp", data);
divApply.html(temp);
linkApplyCount.html(showMsgCount(data.total));
if (data.total == 0) {
$("#applyList").html("<div class='noReadMsgTip'>没有未完成的申请</div>");
}
}
});
}
function divCustomAutoFit() {
divCustom.autoFit(true);
customIframe.css({width: divCustom.width(), height: divCustom.height()});
}
function initMsgDialog() {
var dialog = $('#dialog');
var grid_form = $('#grid_form');
dialog.uiDialog({
title: '查看',
width: dialogSize.width,
height: dialogSize.height,
onOpen: function () {
var dialogP = $('#dialog').uiDialog('getUserParam');
var msg = dialogP.msg;
grid_form.uiForm('load', msg);
},
onClose: function () {
var dialogP = $('#dialog').uiDialog('getUserParam');
var id = dialogP.msg.id;
ajaxChangeStatus(id);
},
buttons: [
{
id: 'btnCancel',
label: '关闭',
icons: {left: 'icon_cancel'},
disabled: false,
style: 'button_cancel',
onClick: function () {
dialog.uiDialog('close');
}
}
]
});
grid_form.uiForm({
template: 'grid_form_temp',
onLoadSuccess: function (data) {
}
});
}
function ajaxChangeStatus(ids) {
$.ajax({
type: 'post',
url: changeStatus,
data: {ids: ids, status: 1},
dataType: "json",
success: function (result) {
initPalMsg();
}
});
}
function initTaskDialog() {
dialogTask.uiDialog({
title: '查看',
width: dialogSize.width,
height: dialogSize.height,
showBtnBar:false,
maximized: true,
onOpen: function () {
var dialogP = dialogTask.uiDialog('getUserParam');
var task = dialogP.task;
form_task.uiForm('load', task);
},
onPanelResize:function () {
divTaskIframeAutoSize();
}
});
form_task.uiForm({
template: 'form_task_temp',
onLoadSuccess: function (data) {
divTaskIframeAutoSize();
}
});
function divTaskIframeAutoSize() {
var height = dialogTask.uiPanel("content").height();
$("#divTaskIframe").height(height-64);
}
}
function initApplyDialog() {
dialogApply.uiDialog({
title: '查看',
width: dialogSize.width,
height: dialogSize.height,
showBtnBar: false,
maximized: true,
onOpen: function () {
var dialogP = dialogApply.uiDialog('getUserParam');
var apply = dialogP.apply;
form_apply.uiForm('load', apply);
},
onPanelResize: function () {
divApplyIframeAutoSize();
}
});
form_apply.uiForm({
template: 'form_apply_temp',
onLoadSuccess: function (data) {
divApplyIframeAutoSize();
}
});
function divApplyIframeAutoSize() {
var height = dialogApply.uiPanel("content").height();
$("#divApplyIframe").height(height - 64);
}
}
function addEvents() {
linkMyTask.bind("mouseover", function (e) {
if (!divMyTask.is(":visible") || divMyTask.hasClass("slideOutUp")) {
divMyTask.removeClass('animated slideOutUp').addClass('animated fadeInDown fast').show();
}
});
divMyTask_close.bind("click", function () {
divMyTask.removeClass('animated fadeInDown').addClass('animated slideOutUp fast');
setTimeout(function () {
divMyTask.hide();
},500);
});
$(document).unbind(".myTask").bind("mousedown.myTask", function (e) {
var targetlink = $(e.target).closest(".linkMyTask");
var target = $(e.target).closest(".divMyTask");
var targetDialog = $(e.target).closest(".ui_dialog");
if (targetlink==0&&target.length == 0 && targetDialog.length == 0) {
divMyTask_close.click();
}
});
$(window).bind('resize', function () {
divCustomAutoFit();
});
}
});
function showMoreMsg() {
openTab('tabs-4dbf4801f6c74c05b07629d037c072ba','fa-inbox','消息','/inbox',true);
}
function showMoreTask() {
openTab('tabs-1cacf210910640a58c2f3fe190122711','fa-tasks','我的待办','/task/myTask',true);
}
function showMoreApply() {
openTab('tabs-1cb2fb93db774202bdd2532fa57d9bff','fa-inbox','我的申请','/task/myApply',true);
}
function showMyInfo() {
openTab('tabs-b0a68ab9eb434f77843ed1e6a02eb2d1','fa-user','个人信息','/user/userProfile/index')
}
function openTab(id,icon,title,url,updateOnOpen) {
if (top.$('#tabs')) {
if(updateOnOpen==undefined){
updateOnOpen=false;
}
top.$('#tabs').uiTabs('add', {
id: id,
fontIcon: {icon: icon, color: '#000'},
icon: 'list',
title: title,
iniframe: true,
url: webroot+url,
updateOnOpen: updateOnOpen,
padding: '5px',
closable: true,
collapsible: false
});
}
}
//查看
function viewMsg(id, msgtitle, username, usercode, sendtime, msgcontent) {
var dialog = $('#dialog');
var msg = {
id: id,
msgtitle: msgtitle,
username: username,
usercode: usercode,
sendtime: sendtime,
msgcontent: msgcontent
}
dialog.uiDialog('setUserParam', {msg: msg});
dialog.uiDialog('open');
dialog.uiDialog('title').html('查看消息');
}
//查看
function viewTask(data) {
var dialog = $('#dialogTask');
var task = taskDataCache[data];
dialog.uiDialog('setUserParam', {task: task});
dialog.uiDialog('open');
dialog.uiDialog('title').html('待办任务');
}
//查看
function viewApply(data) {
var dialog = $('#dialogApply');
var apply = $.extend({},applyDataCache[data],{type:0});
dialog.uiDialog('setUserParam', {apply: apply});
dialog.uiDialog('open');
dialog.uiDialog('title').html('未完成申请');
}