- 系统管理模块(用户/角色/组织/权限/日志) - 教育培训计划管理模块 - 教育培训实施模块 - 考试管理模块 - 调研问卷管理模块 - 外派培训管理模块 - 年度培训总结模块 - 学习资源管理模块 - 任职资格管理模块 - 即时通讯模块 - APP 版本管理 - 统计分析模块(FineReport) - 代码审查标准和报告(CODE_REVIEW_GUIDE.md, CODE_REVIEW_REPORT.md) - 项目开发指南(PROJECT_GUIDE.md)
1777 lines
72 KiB
JavaScript
1777 lines
72 KiB
JavaScript
var webroot = $("#hdWebroot").val();
|
||
var rootUrl = webroot + '/resource/file/';
|
||
var dialogSize = {width: "60%", height: "60%"};//弹出窗口大小
|
||
var editPage = rootUrl + 'editPage';
|
||
var saveUrl = rootUrl + 'save';//保存添加数据地址
|
||
var deleteUrl = rootUrl + 'delete';//删除地址
|
||
var fileListUrl = rootUrl + 'getDetailPageset';//分页数据地址
|
||
var addOKURL = rootUrl + 'addOK';//增加好评量
|
||
var historyUrl = rootUrl + 'historyRecord';//审批历史记录
|
||
var historyFileId = "";//审批历史记录 点击某一行的id
|
||
|
||
var rootUrl_admin = webroot + '/resource/fileAdmin/';
|
||
var adminAdoptReject = rootUrl_admin + 'adminAdopt';//部门管理员审批-通过与驳回
|
||
var idsAdmin = "";
|
||
|
||
var rootUrl_leader = webroot + '/resource/fileLeader/';
|
||
var leaderPage = rootUrl_leader + 'leaderPage';//部门领导审批
|
||
var leaderAdoptReject = rootUrl_leader + 'leaderAdoptReject';//部门领导审批-通过与驳回
|
||
var idsLeader ="";
|
||
|
||
var pg = $('#pg').val();//1资料管理2上传资料或选择历史资料3部门管理员审批4部门领导审批5用户查看资料
|
||
|
||
var limitationUrl = rootUrl + 'limitationList';//发放范围list
|
||
var saveLimitationUrl = rootUrl + 'saveLimitation';//发放范围save
|
||
var deleteLimitationUrl = rootUrl + 'deleteLimitation';//发放范围delete
|
||
var deleteOtherUrl = rootUrl + 'deleteOtherLimitation';//删除其他发放范围
|
||
var file_id = "";//文件id
|
||
var getUserNameAndCodeUrl= webroot + '/train/plantodo/pdcreateclass/' + 'getUserNameAndCode';
|
||
// var departmentComboxUrl = webroot + '/exam/exampaper/'+'departmentCombox';//部门下拉框
|
||
var departmentComboxUrl = webroot+'/train/createClass/GetOrgList?orgid=001001001';
|
||
var classComboxUrl = webroot + '/exam/exampaper/' + 'classCombox';//班级下拉框
|
||
var courseComboxUrl = rootUrl+'courseCombox';//课程下拉框
|
||
var saveCourseUrl = rootUrl + 'saveCourse';//save课程对应的人员
|
||
var saveClassUrl = rootUrl + 'saveClass';//save班级对应的人员
|
||
|
||
var isNotLoginerURL = rootUrl + 'isNotLoginer';//判断当前登录用户是否有编辑,删除权限
|
||
var getFileUrl = rootUrl + 'getFileUrl';//获取文件地址
|
||
|
||
var deleteLimitationFileUrl = rootUrl + 'deleteLimitationFile';//依据文件id删除limitation表中的全所部门人员课程班级
|
||
var deletePersonUrl = rootUrl + 'deletePerson';//删除课程班级对应的人
|
||
var updateLimitationUrl = rootUrl + "updateLimitation";//更新limitation表中的文件id
|
||
var deleteTemporaryFileUrl = rootUrl + "deleteTemporaryFile";//删除临时文件
|
||
var temporary_file = "临时文件";
|
||
var updateClassUrl = rootUrl + 'updateClass';//更新班级班级对应人的表的file_id
|
||
var updateCourseUrl = rootUrl + 'updateCourse';//更新班级课程对应人的表的file_id
|
||
var personflag=0;
|
||
var classflag=0;
|
||
var courseflag=0;
|
||
var limitationflag=0;
|
||
var getApproverUrl = webroot + '/train/groupinplan/groupinplangroup/' + 'getApprover';
|
||
var depart_leader = "";
|
||
var depart_approver = "";
|
||
|
||
$(function () {
|
||
var dialog_suggestion = $('#dialog_suggestion');
|
||
var dialog_leader = $('#dialog_leader');
|
||
var dialog_history = $('#dialog_history');
|
||
var grid_history = $('#grid_history');
|
||
|
||
var grid_limitation = $('#grid_limitation');
|
||
var dialog_limitation =$('#dialog_limitation');//部门
|
||
var grid_form_limitation = $('#grid_form_limitation');
|
||
var dialog_person =$('#dialog_person');//人员
|
||
var grid_form_person = $('#grid_form_person');
|
||
var dialog_class = $('#dialog_class');//发放范围 班级 弹出窗口
|
||
var grid_form_class = $('#grid_form_class');//发放范围 班级 弹出窗口 form
|
||
var dialog_course = $('#dialog_course');//发放范围 课程 弹出窗口
|
||
var grid_form_course = $('#grid_form_course');//发放范围 课程 弹出窗口 form
|
||
|
||
var dialog_workflow = $('#dialog_workflow');
|
||
|
||
|
||
addEvents();
|
||
//获取审批人
|
||
var approver_type = "";
|
||
if(pg === "3"){//部门管理员
|
||
approver_type = "5";
|
||
}else if(pg === "4"){//部门领导
|
||
approver_type = "1";
|
||
}
|
||
$.ajax({
|
||
type: 'post',
|
||
url: getApproverUrl + '?type=' + approver_type,
|
||
dataType: "json",
|
||
success: function (result) {
|
||
initUserGrid();
|
||
if(result.success && result.data.approver !== undefined && result.data.approver !== ""){
|
||
$('#approver').html(result.data.approver);
|
||
$('#approverfont').show();
|
||
$('#approver').show();
|
||
}
|
||
|
||
if(result.success && result.data.depart_leader !== undefined && result.data.depart_leader !== ""){
|
||
depart_leader = result.data.depart_leader;
|
||
}
|
||
if(result.success && result.data.depart_approver !== undefined && result.data.depart_approver !== ""){
|
||
depart_approver = result.data.depart_approver;
|
||
}
|
||
},
|
||
error:function() {
|
||
initUserGrid();
|
||
}
|
||
});
|
||
|
||
var grid = $('#grid_detail').uiGrid({
|
||
autoFit: true,
|
||
border: false,
|
||
colFit: true,
|
||
colFitAllTime: true,
|
||
gridTitleFix: true,
|
||
showCellTip: false,
|
||
showHeader: false,
|
||
icon: 'list',
|
||
url: fileListUrl,
|
||
queryParams:{pg: pg},
|
||
defaultSortField: 'uploadTime'
|
||
});
|
||
|
||
//初始化表单
|
||
var formInit = function () {
|
||
$('#grid_form_edit').uiForm({
|
||
template: 'grid_form_temp',
|
||
onLoadSuccess: function (result) {
|
||
$('#txtcategory').dictCombobox();
|
||
$('#txtzlqx').dictCombobox();
|
||
$('#btnReupload').uiButton();
|
||
|
||
switch ($('#dialog_edit').uiDialog('getUserParam').action) {
|
||
case 'view':
|
||
$('#uploadDes').hide();
|
||
$('#uploadAcc').hide();
|
||
$('#btnReupload').hide();
|
||
$('#dialog_edit').uiDialog('title').html('查看详情');
|
||
$('#grid_form_edit').uiForm('setReadonly', true);
|
||
// $('#txtReportContent').attr("disabled", "disabled");//注释原因:会导致textarea变小
|
||
//
|
||
//查看时隐藏按钮等
|
||
// $(':radio').attr('disabled', true);//隐藏所有按钮
|
||
$('#cbInstitute').attr('disabled', true);
|
||
$('#cbDepartment').attr('disabled', true);
|
||
$('#cbPerson').attr('disabled', true);
|
||
$('#cbClass').attr('disabled', true);
|
||
$('#cbCourse').attr('disabled', true);
|
||
setTimeout( function(){
|
||
$("#grid_limitation .grid_toolbar table").find("tr").find("td:eq(0)").hide();
|
||
$("#grid_limitation .grid_data table").find("tr").find("td:eq(1)").hide();
|
||
},1000);
|
||
|
||
break;
|
||
case 'edit':
|
||
$('#uploadDes').hide();
|
||
$('#uploadAcc').hide();
|
||
$('#btnReupload').bind('click', function () {
|
||
$('#uploadDes').show();
|
||
$('#uploadAcc').show();
|
||
});
|
||
break;
|
||
case 'add':
|
||
$('#accList').hide();
|
||
$('#btnReupload').hide();
|
||
break;
|
||
default :
|
||
break;
|
||
}
|
||
|
||
}
|
||
});
|
||
|
||
//初始化发放范围grid
|
||
// grid_limitation.uiGrid({
|
||
$('#grid_limitation').uiGrid({
|
||
url: limitationUrl
|
||
});
|
||
|
||
//初始化 发放范围-添加部门 弹出窗口dialog
|
||
if(limitationflag==0){
|
||
dialog_limitation.uiDialog({
|
||
// $('#dialog_limitation').uiDialog({
|
||
title: '添加',
|
||
icon: 'list',
|
||
width: dialogSize.width,
|
||
height: dialogSize.height,
|
||
mask: true,
|
||
showBtnBar: true,
|
||
lazyLoad: true,
|
||
updateOnOpen: true,
|
||
maskContainer: $('#dialog_edit'),
|
||
onOpen: function () {
|
||
// $('#grid_form_limitation').uiForm('load');//为组件加载数据
|
||
|
||
var dialogP = $('#dialog_limitation').uiDialog('getUserParam');
|
||
op = dialogP.action;
|
||
var id = dialogP.id;
|
||
switch (op) {
|
||
case 'view':
|
||
case 'edit':
|
||
$('#grid_form_limitation').uiForm('load', $('#grid_limitation').uiGrid('selectedData')[0]);
|
||
break;
|
||
case 'add':
|
||
$('#grid_form_limitation').uiForm('load', {});
|
||
break;
|
||
default :
|
||
break;
|
||
}
|
||
|
||
},
|
||
onClose:function () {
|
||
|
||
},
|
||
buttons: [
|
||
{
|
||
id: 'btnOK',
|
||
label: '保存',
|
||
style: 'button_submit',
|
||
icons: {left: 'icon_submit'},
|
||
disabled: false,
|
||
onClick: function () {
|
||
$('#grid_form_limitation').uiForm('submit', {
|
||
url: saveLimitationUrl,
|
||
onSubmit: function (param) {
|
||
param.id = $('#hdIDDepartment').val();
|
||
param.user = $('#txtdepartment').uiCombo('getText');
|
||
param.user_id = $('#txtdepartment').uiCombo('getValue');
|
||
// var uuid = guid();//前端生成32位UUID
|
||
param.file_id = file_id;
|
||
param.file = temporary_file;
|
||
param.limitation = "2";
|
||
|
||
var isValid = $('#grid_form_limitation').uiForm('validate');
|
||
return isValid; // 返回false终止表单提交
|
||
},
|
||
success: function (result) {
|
||
if (result.success) {
|
||
dialog_limitation.uiDialog('close');//保存成功后关闭对话框
|
||
// grid_limitation.uiGrid('loadData');//保存成功后刷新界面,调用了后台的list方法
|
||
$('#grid_limitation').uiGrid('loadData');
|
||
}
|
||
showResult(result.success, result.message);
|
||
}
|
||
});
|
||
return false;
|
||
}
|
||
},
|
||
{
|
||
id: 'btnCancel',
|
||
label: '关闭',
|
||
icons: {left: 'icon_cancel'},
|
||
disabled: false,
|
||
style: 'button_cancel',
|
||
onClick: function () {
|
||
dialog_limitation.uiDialog('close');
|
||
}
|
||
}
|
||
]});
|
||
limitationflag++;
|
||
}
|
||
|
||
|
||
|
||
//初始化 发放范围 添加部门 弹出窗口form
|
||
grid_form_limitation.uiForm({
|
||
// $('#grid_form_limitation').uiForm({
|
||
template: 'grid_form_temp_limitation',
|
||
onLoadSuccess: function (data) {
|
||
$('#txtdepartment').uiCombobox({
|
||
mode: "remote",
|
||
url: departmentComboxUrl
|
||
});
|
||
}
|
||
});
|
||
|
||
//初始化 发放范围-添加人员 弹出窗口 dialog
|
||
if(personflag==0){
|
||
dialog_person.uiDialog({
|
||
title: '添加',
|
||
icon: 'list',
|
||
width: dialogSize.width,
|
||
height: dialogSize.height,
|
||
mask: true,
|
||
showBtnBar: true,
|
||
lazyLoad: true,
|
||
updateOnOpen: true,
|
||
maskContainer: $('#dialog_edit'),
|
||
onOpen: function () {
|
||
// $('#grid_form_limitation').uiForm('load');//为组件加载数据
|
||
|
||
var dialogP = $('#dialog_person').uiDialog('getUserParam');
|
||
op = dialogP.action;
|
||
var id = dialogP.id;
|
||
|
||
switch (op) {
|
||
case 'view':
|
||
case 'edit':
|
||
$('#grid_form_person').uiForm('load', $('#grid_limitation').uiGrid('selectedData')[0]);
|
||
break;
|
||
case 'add':
|
||
$('#grid_form_person').uiForm('load', {});
|
||
break;
|
||
default :
|
||
break;
|
||
}
|
||
|
||
},
|
||
onClose:function () {
|
||
|
||
},
|
||
buttons: [
|
||
{
|
||
id: 'btnOK',
|
||
label: '保存',
|
||
style: 'button_submit',
|
||
icons: {left: 'icon_submit'},
|
||
disabled: false,
|
||
onClick: function () {
|
||
$('#grid_form_person').uiForm('submit', {
|
||
url: saveLimitationUrl,
|
||
onSubmit: function (param) {
|
||
param.id = $('#hdIDPerson').val();
|
||
param.user = $('#person').uiCombobox('getText');
|
||
param.user_id = $('#person_id').uiCombobox('getText');
|
||
// var uuid = guid();//前端生成32位UUID
|
||
param.file_id = file_id;
|
||
param.file = temporary_file;
|
||
param.limitation = "3";
|
||
|
||
var isValid = $('#grid_form_person').uiForm('validate');
|
||
return isValid; // 返回false终止表单提交
|
||
},
|
||
success: function (result) {
|
||
if (result.success) {
|
||
dialog_person.uiDialog('close');//保存成功后关闭对话框
|
||
$('#grid_limitation').uiGrid('loadData');//保存成功后刷新界面,调用了后台的list方法
|
||
}
|
||
showResult(result.success, result.message);
|
||
}
|
||
});
|
||
return false;
|
||
}
|
||
},
|
||
{
|
||
id: 'btnCancel',
|
||
label: '关闭',
|
||
icons: {left: 'icon_cancel'},
|
||
disabled: false,
|
||
style: 'button_cancel',
|
||
onClick: function () {
|
||
dialog_person.uiDialog('close');
|
||
}
|
||
}
|
||
]});
|
||
personflag++;
|
||
}
|
||
|
||
|
||
|
||
//初始化 发放范围-添加人员 弹出窗口 form
|
||
grid_form_person.uiForm({
|
||
template: 'grid_form_temp_person',
|
||
onLoadSuccess: function (data) {
|
||
$('#person').uiCombobox({
|
||
mode: 'remote',
|
||
searchable: true,
|
||
loader: comboxLoad,
|
||
delay:500,
|
||
hasDownArrow:false,
|
||
url: getUserNameAndCodeUrl,
|
||
onLoadSuccess: function (data) {
|
||
$('#person').uiCombobox("setText",$('#person').val());
|
||
},
|
||
onSelect:function (data) {
|
||
var dataArray = data.usercode.split("|");
|
||
var teacher = dataArray[0];
|
||
var teacher_code = dataArray[1];
|
||
$('#person').uiCombobox("setText",teacher);
|
||
$('#person_id').uiCombobox("setText",teacher_code);
|
||
}
|
||
});
|
||
$('#person_id').uiCombobox({
|
||
mode: 'remote',
|
||
searchable: true,
|
||
loader: comboxLoad,
|
||
delay:500,
|
||
hasDownArrow:false,
|
||
url: getUserNameAndCodeUrl,
|
||
onLoadSuccess: function (data) {
|
||
$('#person_id').uiCombobox("setText",$('#person_id').val());
|
||
},
|
||
onSelect:function (data) {
|
||
var dataArray = data.usercode.split("|");
|
||
var teacher = dataArray[0];
|
||
var teacher_code = dataArray[1];
|
||
$('#person').uiCombobox("setText",teacher);
|
||
$('#person_id').uiCombobox("setText",teacher_code);
|
||
}
|
||
});
|
||
}
|
||
});
|
||
|
||
//初始化 发放范围-添加班级 弹出窗口dialog
|
||
if(classflag==0){
|
||
|
||
$('#dialog_class').uiDialog({
|
||
title: '添加',
|
||
icon: 'list',
|
||
width: dialogSize.width,
|
||
height: dialogSize.height,
|
||
mask: true,
|
||
showBtnBar: true,
|
||
lazyLoad: true,
|
||
updateOnOpen: true,
|
||
maskContainer: $('#dialog_edit'),
|
||
onOpen: function () {
|
||
// $('#grid_form_limitation').uiForm('load');//为组件加载数据
|
||
|
||
var dialogP = $('#dialog_class').uiDialog('getUserParam');
|
||
op = dialogP.action;
|
||
var id = dialogP.id;
|
||
switch (op) {
|
||
case 'view':
|
||
case 'edit':
|
||
$('#grid_form_class').uiForm('load', $('#grid_limitation').uiGrid('selectedData')[0]);
|
||
break;
|
||
case 'add':
|
||
$('#grid_form_class').uiForm('load', {});
|
||
break;
|
||
default :
|
||
break;
|
||
}
|
||
|
||
},
|
||
onClose:function () {
|
||
|
||
},
|
||
buttons: [
|
||
{
|
||
id: 'btnOK',
|
||
label: '保存',
|
||
style: 'button_submit',
|
||
icons: {left: 'icon_submit'},
|
||
disabled: false,
|
||
onClick: function () {
|
||
$('#grid_form_class').uiForm('submit', {
|
||
url: saveLimitationUrl,
|
||
onSubmit: function (param) {
|
||
param.id = $('#hdIDClass').val();
|
||
param.user = $('#txtclass').uiCombo('getText');
|
||
param.user_id = $('#txtclass').uiCombo('getValue');
|
||
// var uuid = guid();//前端生成32位UUID
|
||
param.file_id = file_id;
|
||
param.file = temporary_file;
|
||
param.limitation = "4";
|
||
|
||
var isValid = $('#grid_form_class').uiForm('validate');
|
||
return isValid; // 返回false终止表单提交
|
||
},
|
||
success: function (result) {
|
||
if (result.success) {
|
||
dialog_class.uiDialog('close');//保存成功后关闭对话框
|
||
// grid_limitation.uiGrid('loadData');//保存成功后刷新界面,调用了后台的list方法
|
||
$('#grid_limitation').uiGrid('loadData');
|
||
}
|
||
|
||
//通过班级id将对应的人和工资号存入limitation_class表的person和person_id
|
||
var limitation_id = "";
|
||
if(result.data.id != undefined){
|
||
limitation_id = result.data.id;
|
||
}
|
||
|
||
$.ajax({
|
||
type: 'post',
|
||
url: saveClassUrl,
|
||
data: {'classid':$('#txtclass').uiCombo('getValue'),
|
||
'file_id':file_id,
|
||
'limitation_id':limitation_id
|
||
},
|
||
dataType: "json",
|
||
success: function (result) {
|
||
if (result.success) {
|
||
// dialog_course.uiDialog('close');//保存成功后关闭对话框
|
||
}
|
||
showResult(result.success, result.message);
|
||
},
|
||
error:function() {
|
||
alert("提交失败");
|
||
}
|
||
});
|
||
|
||
showResult(result.success, result.message);
|
||
}
|
||
});
|
||
return false;
|
||
}
|
||
},
|
||
{
|
||
id: 'btnCancel',
|
||
label: '关闭',
|
||
icons: {left: 'icon_cancel'},
|
||
disabled: false,
|
||
style: 'button_cancel',
|
||
onClick: function () {
|
||
dialog_class.uiDialog('close');
|
||
}
|
||
}
|
||
]});
|
||
classflag++;
|
||
}else {
|
||
|
||
}
|
||
|
||
//初始化 发放范围 添加班级 弹出窗口form
|
||
grid_form_class.uiForm({
|
||
template: 'grid_form_temp_class',
|
||
onLoadSuccess: function (data) {
|
||
$('#txtclass').uiCombobox({
|
||
mode: "remote",
|
||
searchable: true,
|
||
url: classComboxUrl
|
||
});
|
||
}
|
||
});
|
||
|
||
//初始化 发放范围-添加课程 弹出窗口dialog
|
||
if(courseflag==0){
|
||
|
||
$('#dialog_course').uiDialog({
|
||
title: '添加',
|
||
icon: 'list',
|
||
width: dialogSize.width,
|
||
height: dialogSize.height,
|
||
mask: true,
|
||
showBtnBar: true,
|
||
lazyLoad: true,
|
||
updateOnOpen: true,
|
||
maskContainer: $('#dialog_edit'),
|
||
onOpen: function () {
|
||
// $('#grid_form_limitation').uiForm('load');//为组件加载数据
|
||
|
||
var dialogP = $('#dialog_course').uiDialog('getUserParam');
|
||
op = dialogP.action;
|
||
var id = dialogP.id;
|
||
switch (op) {
|
||
case 'view':
|
||
case 'edit':
|
||
$('#grid_form_course').uiForm('load', $('#grid_limitation').uiGrid('selectedData')[0]);
|
||
break;
|
||
case 'add':
|
||
$('#grid_form_course').uiForm('load', {});
|
||
break;
|
||
default :
|
||
break;
|
||
}
|
||
|
||
},
|
||
onClose:function () {
|
||
|
||
},
|
||
buttons: [
|
||
{
|
||
id: 'btnOK',
|
||
label: '保存',
|
||
style: 'button_submit',
|
||
icons: {left: 'icon_submit'},
|
||
disabled: false,
|
||
onClick: function () {
|
||
$('#grid_form_course').uiForm('submit', {
|
||
url: saveLimitationUrl,
|
||
onSubmit: function (param) {
|
||
param.id = $('#hdIDCourse').val();
|
||
param.user = $('#txtcourse').uiCombo('getText');
|
||
param.user_id = $('#txtcourse').uiCombo('getValue');
|
||
// var uuid = guid();//前端生成32位UUID
|
||
param.file_id = file_id;
|
||
param.file = temporary_file;
|
||
param.limitation = "5";
|
||
|
||
var isValid = $('#grid_form_course').uiForm('validate');
|
||
return isValid; // 返回false终止表单提交
|
||
},
|
||
success: function (result) {
|
||
if (result.success) {
|
||
dialog_course.uiDialog('close');//保存成功后关闭对话框
|
||
// grid_limitation.uiGrid('loadData');//保存成功后刷新界面,调用了后台的list方法
|
||
$('#grid_limitation').uiGrid('loadData');
|
||
}
|
||
|
||
//通过课程id将对应的人和工资号存入limitation_course表的person和person_id
|
||
var limitation_id = "";
|
||
if(result.data.id != undefined){
|
||
limitation_id = result.data.id;
|
||
}
|
||
|
||
$.ajax({
|
||
type: 'post',
|
||
url: saveCourseUrl,
|
||
data: {'courseid':$('#txtcourse').uiCombo('getValue'),
|
||
'file_id':file_id,
|
||
'limitation_id':limitation_id
|
||
},
|
||
dataType: "json",
|
||
success: function (result) {
|
||
if (result.success) {
|
||
// dialog_course.uiDialog('close');//保存成功后关闭对话框
|
||
}
|
||
showResult(result.success, result.message);
|
||
},
|
||
error:function() {
|
||
alert("提交失败");
|
||
}
|
||
});
|
||
|
||
showResult(result.success, result.message);
|
||
}
|
||
});
|
||
return false;
|
||
}
|
||
},
|
||
{
|
||
id: 'btnCancel',
|
||
label: '关闭',
|
||
icons: {left: 'icon_cancel'},
|
||
disabled: false,
|
||
style: 'button_cancel',
|
||
onClick: function () {
|
||
dialog_course.uiDialog('close');
|
||
}
|
||
}
|
||
]});
|
||
courseflag++;
|
||
}
|
||
|
||
//初始化 发放范围 添加课程 弹出窗口form
|
||
grid_form_course.uiForm({
|
||
template: 'grid_form_temp_course',
|
||
onLoadSuccess: function (data) {
|
||
$('#txtcourse').uiCombobox({
|
||
mode: "remote",
|
||
searchable: true,
|
||
url: courseComboxUrl
|
||
});
|
||
}
|
||
});
|
||
|
||
//添加部门按钮点击事件
|
||
$('#btnDepartment').bind('click', function () {
|
||
dialog_limitation.uiDialog('title').html('添加');
|
||
dialog_limitation.uiDialog('setUserParam', {action: 'add'});
|
||
dialog_limitation.uiDialog('button', 'btnOK').show();
|
||
dialog_limitation.uiDialog('button', 'btnSave').hide();
|
||
dialog_limitation.uiDialog('open');
|
||
});
|
||
|
||
//添加人员按钮点击事件
|
||
$('#btnPerson').bind('click', function () {
|
||
dialog_person.uiDialog('title').html('添加');
|
||
dialog_person.uiDialog('setUserParam', {action: 'add'});
|
||
dialog_person.uiDialog('button', 'btnOK').show();
|
||
dialog_person.uiDialog('button', 'btnSave').hide();
|
||
dialog_person.uiDialog('open');
|
||
|
||
});
|
||
|
||
//添加班级按钮点击事件
|
||
$('#btnClass').bind('click', function () {
|
||
dialog_class.uiDialog('title').html('添加');
|
||
dialog_class.uiDialog('setUserParam', {action: 'add'});
|
||
dialog_class.uiDialog('button', 'btnOK').show();
|
||
dialog_class.uiDialog('button', 'btnSave').hide();
|
||
dialog_class.uiDialog('open');
|
||
});
|
||
|
||
//添加课程按钮点击事件
|
||
$('#btnCourse').bind('click', function () {
|
||
dialog_course.uiDialog('title').html('添加');
|
||
dialog_course.uiDialog('setUserParam', {action: 'add'});
|
||
dialog_course.uiDialog('button', 'btnOK').show();
|
||
dialog_course.uiDialog('button', 'btnSave').hide();
|
||
dialog_course.uiDialog('open');
|
||
});
|
||
|
||
//删除
|
||
$('#btnDelete').bind('click', function () {
|
||
var ids = $('#grid_limitation').uiGrid('selectedData', 'id');
|
||
if (ids.length == 0) {
|
||
showResult(false, '请选择要删除的行!', 'alert');
|
||
} else {
|
||
deleteLimitationRow(ids);
|
||
}
|
||
});
|
||
|
||
$('#grid_limitation').hide();
|
||
};
|
||
|
||
//初始化弹出窗口
|
||
var dialog = $('#dialog_edit').uiDialog({
|
||
title: '新建',
|
||
icon: 'list',
|
||
width: '95%',
|
||
height: '95%',
|
||
mask: true,
|
||
showBtnBar: true,
|
||
lazyLoad: true,
|
||
updateOnOpen: true,
|
||
url: editPage,
|
||
queryParams:{pg: pg},
|
||
onLoadComplete: formInit,
|
||
onOpen: function () {
|
||
var form = $('#grid_form_edit');
|
||
var dialogP = $('#dialog_edit').uiDialog('getUserParam');
|
||
var id = dialogP.id;
|
||
switch (dialogP.action) {
|
||
case 'view':
|
||
case 'edit':
|
||
form.uiForm('load', grid.uiGrid('selectedData')[0]);//加载远程数据
|
||
|
||
$('#grid_limitation').uiGrid('loadData',{queryParams:{"file_id": id}});
|
||
$('#grid_limitation').show();
|
||
editShowHide();
|
||
|
||
break;
|
||
case 'add':
|
||
form.uiForm('load', {});
|
||
break;
|
||
default :
|
||
break;
|
||
}
|
||
},
|
||
onClose:function () {
|
||
// window.location.reload();
|
||
|
||
setTimeout( function(){
|
||
//关闭窗口将临时文件清空
|
||
$.ajax({
|
||
type:'post',
|
||
url:deleteTemporaryFileUrl,
|
||
data:{"file":temporary_file,
|
||
"file_id":file_id
|
||
},
|
||
dataType:'json',
|
||
success:function (result) {
|
||
// window.location.reload();//刷新
|
||
},
|
||
error:function () {
|
||
alert("删除临时文件失败");
|
||
}
|
||
});
|
||
},100);
|
||
|
||
},
|
||
buttons: [
|
||
{
|
||
id: 'btnOK',
|
||
label: '提交',
|
||
style: 'button_submit',
|
||
icons: {left: 'icon_submit'},
|
||
disabled: false,
|
||
onClick: function () {
|
||
|
||
$('#grid_form_edit').uiForm('submit', {
|
||
url: saveUrl,
|
||
onSubmit: function (params) {
|
||
|
||
params.id = $('#hdID').val();
|
||
params.category = $('#txtcategory').dictCombobox('getText');
|
||
params.pg = $('#pg').val();
|
||
// if($('#submitState').val() == '1'){
|
||
// showResult(false, '正在上传文件,请耐心等待!', 'alert');
|
||
// return false;
|
||
// }
|
||
// if($('#hidFile').val() == '1'){
|
||
// showResult(false, '上传文件大小需要小于5G!', 'alert');
|
||
// return false;
|
||
// }
|
||
|
||
if($('input:radio[id="cbInstitute"]:checked').val() == "on"){
|
||
params.limitation = "1";
|
||
}else if($('input:radio[id="cbDepartment"]:checked').val() == "on"){
|
||
params.limitation = "2";
|
||
if($('[class=spanId]').length == 0){
|
||
alert("请添加部门!");
|
||
return false;
|
||
}
|
||
}else if($('input:radio[id="cbPerson"]:checked').val() == "on"){
|
||
params.limitation = "3";
|
||
if($('[class=spanId]').length == 0){
|
||
alert("请添加人员!");
|
||
return false;
|
||
}
|
||
}else if($('input:radio[id="cbClass"]:checked').val() == "on"){
|
||
params.limitation = "4";
|
||
if($('[class=spanId]').length == 0){
|
||
alert("请添加班级!");
|
||
return false;
|
||
}
|
||
}else if($('input:radio[id="cbCourse"]:checked').val() == "on") {
|
||
params.limitation = "5";
|
||
if($('[class=spanId]').length == 0){
|
||
alert("请添加课程!");
|
||
return false;
|
||
}
|
||
}else{
|
||
alert("请指定资料发放范围!");
|
||
return false;
|
||
}
|
||
|
||
var isValid = $('#grid_form_edit').uiForm('validate');
|
||
if (!isValid) {
|
||
}
|
||
$('#submitState').val(1);
|
||
return isValid; // 返回false终止表单提交
|
||
},
|
||
success: function (data) {
|
||
$('#submitState').val(0);
|
||
if (data.success) {
|
||
|
||
var file_id_ = "";
|
||
if(data.data !== undefined){
|
||
file_id_ = data.data.id;
|
||
}
|
||
if($('input:radio[id="cbInstitute"]:checked').val() == "on"){
|
||
var spanId = $('[class=spanId]:eq(0)').text();
|
||
var user = "全所";
|
||
var user_id = "1";
|
||
var limitation = "1";
|
||
$.ajax({
|
||
type: 'post',
|
||
url: saveLimitationUrl,
|
||
data: {"id":spanId,
|
||
"user":user,
|
||
"user_id":user_id,
|
||
"file_id":file_id_,
|
||
"limitation":limitation},
|
||
dataType: "json",
|
||
success: function (result) {
|
||
},
|
||
error:function() {
|
||
alert("插入资料全所权限失败");
|
||
}
|
||
});
|
||
|
||
}else{
|
||
var file = "";
|
||
$.ajax({
|
||
type: 'post',
|
||
url: updateLimitationUrl,
|
||
data: {"file_id":file_id,
|
||
"file_id_":file_id_,
|
||
"file":file
|
||
},
|
||
dataType: "json",
|
||
success: function (result) {
|
||
},
|
||
error:function() {
|
||
alert("更新limitation表中的试卷id失败");
|
||
}
|
||
});
|
||
|
||
// // var limitationArray = [];
|
||
// if($('[class=spanId]').length > 0){
|
||
// var j = $('[class=spanId]').length;
|
||
// for (var i=0;i<$('[class=spanId]').length;i++){
|
||
// var spanId=$('[class=spanId]:eq('+i+')').text();
|
||
// // var limitationInfo = {};
|
||
// // limitationInfo.id = spanId;
|
||
// // limitationInfo.file_id = file_id;
|
||
//
|
||
// $.ajax({
|
||
// type: 'post',
|
||
// url: saveLimitationUrl,
|
||
// data: {"id":spanId,
|
||
// "file_id":file_id},
|
||
// dataType: "json",
|
||
// success: function (result) {
|
||
// },
|
||
// error:function() {
|
||
// alert("更新资料权限失败");
|
||
// }
|
||
// });
|
||
// }
|
||
// }
|
||
}
|
||
|
||
//更新班级课程对应人的表的file_id
|
||
if($('input:radio[id="cbClass"]:checked').val() == "on"){
|
||
$.ajax({
|
||
type: 'post',
|
||
url: updateClassUrl,
|
||
data: {"file_id":file_id,//临时试卷id
|
||
"file_id_":file_id_//正式试卷id
|
||
},
|
||
dataType: "json",
|
||
success: function (result) {
|
||
},
|
||
error:function() {
|
||
alert("更新班级对应人的表的file_id失败");
|
||
}
|
||
});
|
||
}else if($('input:radio[id="cbCourse"]:checked').val() == "on"){
|
||
$.ajax({
|
||
type: 'post',
|
||
url: updateCourseUrl,
|
||
data: {"file_id":file_id,//临时试卷id
|
||
"file_id_":file_id_//正式试卷id
|
||
},
|
||
dataType: "json",
|
||
success: function (result) {
|
||
},
|
||
error:function() {
|
||
alert("更新课程对应人的表的file_id失败");
|
||
}
|
||
});
|
||
}
|
||
|
||
dialog.uiDialog('close');
|
||
grid.uiGrid('loadData');
|
||
showResult(data.success, data.message);
|
||
}else{
|
||
if(data.message == null || data.message == undefined || data.message == ""){
|
||
showResult(data.success, "上传失败,网络异常,请联系管理员!");
|
||
}else{
|
||
showResult(data.success, data.message);
|
||
}
|
||
}
|
||
}
|
||
});
|
||
return false;
|
||
}
|
||
},
|
||
{
|
||
id: 'btnCancel',
|
||
label: '取消',
|
||
icons: {left: 'icon_cancel'},
|
||
disabled: false,
|
||
style: 'button_cancel',
|
||
onClick: function () {
|
||
dialog.uiDialog('close');
|
||
}
|
||
}
|
||
]
|
||
});
|
||
|
||
//初始化视频播放窗口
|
||
$('#swfdialog').uiDialog({
|
||
title: '视频播放',
|
||
width: '505',
|
||
height:'470',
|
||
onOpen: function () {
|
||
var swfdialog = $('#swfdialog').uiDialog('getUserParam');
|
||
var id = swfdialog.id[0];
|
||
//获取文件地址
|
||
$.ajax({
|
||
type:'post',
|
||
url:getFileUrl,
|
||
data:{'id':id},
|
||
dataType:'json',
|
||
success:function (result) {
|
||
if(result.success){
|
||
if(result.data.rows.length > 0){
|
||
var data=result.data.rows[0];
|
||
var fileURL = data.fileurl;
|
||
|
||
var s1 = new SWFObject(webroot+"/files/mediaplayer.swf","single","500","400","7");//IE支持
|
||
s1.addParam("allowfullscreen","true");//全屏播放
|
||
s1.addVariable("width","500");
|
||
s1.addVariable("height","400");
|
||
s1.addVariable("autostart","true");
|
||
// s1.addVariable("file","/files/222.flv");
|
||
s1.addVariable("file",webroot+"/"+fileURL.replace('\\','/'));
|
||
s1.write("player");
|
||
}
|
||
}
|
||
},
|
||
error:function () {
|
||
|
||
}
|
||
});
|
||
|
||
// s1.addVariable("repeat","false");
|
||
// s1.addVariable("image","");
|
||
// s1.addVariable("showdownload","false");
|
||
// s1.addVariable("link","/Video2/2019/%E5%AD%A6%E4%B9%A0%E5%9B%AD%E5%9C%B0/%E6%B2%B3%E5%8C%97%E5%A5%BD%E6%95%85%E4%BA%8B.flv");
|
||
// s1.addParam("allowfullscreen","true");
|
||
// s1.addVariable("showdigits","true");
|
||
// s1.addVariable("shownavigation","true");
|
||
// s1.addVariable("logo","");
|
||
// s1.write("player");
|
||
}
|
||
});
|
||
|
||
//初始化部门管理员审批窗口
|
||
dialog_suggestion.uiDialog({
|
||
title: '审批',
|
||
icon: 'list',
|
||
width: dialogSize.width,
|
||
height: dialogSize.height,
|
||
mask: true,
|
||
showBtnBar: true,
|
||
lazyLoad: true,
|
||
updateOnOpen: true,
|
||
onOpen: function () {
|
||
$('#grid_form_suggestion').uiForm('load');//为组件加载数据
|
||
},
|
||
onClose:function () {
|
||
|
||
},
|
||
buttons: [
|
||
{
|
||
id: 'btnOK',
|
||
label: '通过',
|
||
style: 'button_submit',
|
||
icons: {left: 'icon_submit'},
|
||
disabled: false,
|
||
onClick: function () {
|
||
$('#grid_form_suggestion').uiForm('submit', {
|
||
url: adminAdoptReject,
|
||
onSubmit: function (param) {
|
||
param.id = idsAdmin;
|
||
param.admin_suggestion = $('#txtsuggestion').val();
|
||
param.state = 2;//部门管理员通过,状态变为待部门领导审批
|
||
param.state_desc = "待部门领导审批";
|
||
|
||
var isValid = $('#grid_form_suggestion').uiForm('validate');
|
||
return isValid; // 返回false终止表单提交
|
||
},
|
||
success: function (result) {
|
||
if (result.success) {
|
||
dialog_suggestion.uiDialog('close');//保存成功后关闭对话框
|
||
grid.uiGrid('loadData');//保存成功后刷新界面,调用了后台的list方法
|
||
}
|
||
showResult(result.success, result.message);
|
||
}
|
||
});
|
||
}
|
||
},
|
||
{
|
||
id: 'btnCancel',
|
||
label: '驳回',
|
||
icons: {left: 'icon_cancel'},
|
||
disabled: false,
|
||
style: 'button_cancel',
|
||
onClick: function () {
|
||
$('#grid_form_suggestion').uiForm('submit', {
|
||
url: adminAdoptReject,
|
||
onSubmit: function (param) {
|
||
param.id = idsAdmin;
|
||
param.admin_suggestion = $('#txtsuggestion').val();
|
||
param.state = 4;//部门管理员未通过,状态变为审批不通过
|
||
param.state_desc = "审批不通过";
|
||
|
||
var isValid = $('#grid_form_suggestion').uiForm('validate');
|
||
return isValid; // 返回false终止表单提交
|
||
},
|
||
success: function (result) {
|
||
if (result.success) {
|
||
dialog_suggestion.uiDialog('close');//保存成功后关闭对话框
|
||
grid.uiGrid('loadData');//保存成功后刷新界面,调用了后台的list方法
|
||
}
|
||
showResult(result.success, result.message);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
]
|
||
});
|
||
|
||
//初始化部门管理员审批form表单
|
||
$('#grid_form_suggestion').uiForm({
|
||
template: 'grid_form_temp_suggestion',
|
||
onLoadSuccess: function (result) {
|
||
|
||
}
|
||
});
|
||
|
||
//初始化部门领导审批模板
|
||
var formInitLeader = function(){
|
||
$('#txtadvice').uiValidate();//是否必填
|
||
|
||
// $('#dialog_leader_suggestion').uiGrid({
|
||
// autoFit: true,
|
||
// border:false,
|
||
// colFit:true,
|
||
// gridTitleFix: false,
|
||
// width:"100%",
|
||
// height:"100%",
|
||
// showHeader:false,
|
||
// icon: 'list'
|
||
// // url:
|
||
// })
|
||
|
||
};
|
||
|
||
//初始化部门领导审批窗口
|
||
dialog_leader.uiDialog({
|
||
title: '审批',
|
||
icon: 'list',
|
||
width:"80%",
|
||
height:"60%",
|
||
mask: true,
|
||
showBtnBar: true,
|
||
updateOnOpen: true,
|
||
lazyLoad: true,
|
||
url: leaderPage,
|
||
onLoadComplete: formInitLeader,
|
||
// onOpen: function () {
|
||
// dialog_leader.uiDialog('getUserParam');
|
||
// },
|
||
buttons: [
|
||
{
|
||
id: 'btnOK',
|
||
label: '通过',
|
||
style: 'button_submit',
|
||
icons: {left: 'icon_submit'},
|
||
disabled: false,
|
||
onClick: function () {
|
||
if($('#txtadvice').val() == ""){
|
||
return;
|
||
}
|
||
var txtadvice = $('#txtadvice').val();
|
||
$.ajax({
|
||
type: 'post',
|
||
url: leaderAdoptReject,
|
||
data:{
|
||
'id':idsLeader[0],//id与对象,数据库中的id须一致,才能匹配成功
|
||
'leader_advice':txtadvice,//leader_advice与对象,数据库中的leader_advice须一致,才能匹配成功
|
||
'state':3,//部门领导通过,状态变为审批通过
|
||
'state_desc':"审批通过"
|
||
},
|
||
dataType: "json",
|
||
success: function (result) { //result是接收后台return的结果
|
||
showResult(result.success, result.message);
|
||
grid.uiGrid('loadData');
|
||
dialog_leader.uiDialog('close');//保存成功后关闭对话框
|
||
},
|
||
error:function() {
|
||
alert("提交失败");
|
||
}
|
||
});
|
||
}
|
||
},
|
||
{
|
||
id: 'btnCancel',
|
||
label: '驳回',
|
||
icons: {left: 'icon_cancel'},
|
||
disabled: false,
|
||
style: 'button_cancel',
|
||
onClick: function () {
|
||
if($('#txtadvice').val() == ""){
|
||
return;
|
||
}
|
||
var txtadvice = $('#txtadvice').val();
|
||
$.ajax({
|
||
type: 'post',
|
||
url: leaderAdoptReject,
|
||
data:{
|
||
'id':idsLeader[0],//id与对象,数据库中的id须一致,才能匹配成功
|
||
'leader_advice':txtadvice,//leader_advice与对象,数据库中的leader_advice须一致,才能匹配成功
|
||
'state':4,//部门领导未通过,状态变为审批不通过
|
||
'state_desc':"审批不通过"
|
||
},
|
||
dataType: "json",
|
||
success: function (result) { //result是接收后台return的结果
|
||
showResult(result.success, result.message);
|
||
grid.uiGrid('loadData');
|
||
dialog_leader.uiDialog('close');//保存成功后关闭对话框
|
||
},
|
||
error:function() {
|
||
alert("提交失败");
|
||
}
|
||
});
|
||
}
|
||
}
|
||
]
|
||
});
|
||
|
||
//初始化审批历史记录窗口
|
||
dialog_history.uiDialog({
|
||
title: '审批历史记录',
|
||
icon: 'list',
|
||
width: dialogSize.width,
|
||
height: dialogSize.height,
|
||
mask: true,
|
||
showBtnBar: true,
|
||
lazyLoad: true,
|
||
updateOnOpen: true,
|
||
onOpen: function () {
|
||
// $('#grid_form_history').uiForm('load');//为组件加载数据
|
||
|
||
//初始化审批历史记录
|
||
if(grid_history.attr("class") == null){
|
||
grid_history.uiGrid({
|
||
// autoFit: true,
|
||
// border: false,
|
||
// colFit: true,
|
||
colFitAllTime: true,
|
||
// gridTitleFix: true,
|
||
// showCellTip: false,
|
||
// showHeader: false,
|
||
icon: 'list',
|
||
url: historyUrl,
|
||
queryParams:{'file_id': historyFileId[0]},
|
||
defaultSortField: 'approver_edittime'
|
||
});
|
||
}else {
|
||
grid_history.uiGrid('loadData', {queryParams:{'file_id': historyFileId[0]}});
|
||
}
|
||
},
|
||
onClose:function () {
|
||
|
||
}
|
||
});
|
||
|
||
// $('#grid_form_history').uiForm({
|
||
// template: 'grid_form_temp_history',
|
||
// onLoadSuccess: function (result) {
|
||
//
|
||
// }
|
||
// });
|
||
|
||
//初始化 审批流程 弹出窗口 form
|
||
var formspInit_workflow = function () {
|
||
//初始化 审批流程 grid
|
||
$('#spgrid_workflow').uiGrid({
|
||
gridTitleFix: false,
|
||
colFit:true,
|
||
localData:{rows:[
|
||
{num:'1',leader: '部门管理员 '+depart_approver},
|
||
{num:'2',leader: '部门领导 '+depart_leader}
|
||
]}
|
||
|
||
});
|
||
};
|
||
|
||
//初始化 审批流程 弹出窗口 dialog
|
||
dialog_workflow.uiDialog({
|
||
title: '审批流程',
|
||
icon: 'list',
|
||
width: dialogSize.width,
|
||
height: dialogSize.height,
|
||
mask: true,
|
||
showBtnBar: true,
|
||
updateOnOpen: true,
|
||
lazyLoad: true,
|
||
onLoadComplete: formspInit_workflow,
|
||
onOpen: function () {
|
||
|
||
},
|
||
buttons: [
|
||
{
|
||
id: 'btnCancel',
|
||
label: '关闭',
|
||
icons: {left: 'icon_cancel'},
|
||
disabled: false,
|
||
style: 'button_cancel',
|
||
onClick: function () {
|
||
dialog_workflow.uiDialog('close');
|
||
}
|
||
}
|
||
]
|
||
});
|
||
|
||
function addEvents() {
|
||
template.helper('fileCateFilter',function(value){
|
||
return {1:'经营管理',2:'专业技术',3:'专门技能'}[value]||value;
|
||
});
|
||
//新建
|
||
$('#btn1').bind('click', function () {
|
||
dialog.uiDialog('title').html('新建');
|
||
dialog.uiDialog('setUserParam', {action: 'add'});
|
||
dialog.uiDialog('button', 'btnOK').show();
|
||
dialog.uiDialog('button', 'btnSave').hide();
|
||
dialog.uiDialog('open');
|
||
file_id = guid();//只要新建就生成临时文件id
|
||
});
|
||
//删除
|
||
$('#btn2').bind('click', function () {
|
||
var ids = $('#grid_detail').uiGrid('selectedData', 'id');
|
||
if (ids.length == 0) {
|
||
showResult(false, '请选择要删除的行!', 'alert');
|
||
} else {
|
||
deleteRow(ids);
|
||
}
|
||
});
|
||
//审批历史记录
|
||
$('#btn_history').bind('click', function () {
|
||
historyFileId = grid.uiGrid('selectedData', 'id');
|
||
if(historyFileId.length == 0){
|
||
showResult(false,'请选择要历史审批的记录!','alert');
|
||
}
|
||
else if(historyFileId.length > 1){
|
||
showResult(false,'请选择要审批的一条记录,不支持同时选择多条记录!','alert');
|
||
}
|
||
else{
|
||
dialog_history.uiDialog('title').html('审批历史记录');
|
||
dialog_history.uiDialog('setUserParam', {action: 'add'});
|
||
dialog_history.uiDialog('button', 'btnOK').show();
|
||
dialog_history.uiDialog('button', 'btnSave').hide();
|
||
dialog_history.uiDialog('open');
|
||
}
|
||
|
||
});
|
||
//部门管理员审批
|
||
$('#btn3').bind('click', function () {
|
||
idsAdmin = grid.uiGrid('selectedData', 'id');
|
||
if(idsAdmin.length == 0){
|
||
showResult(false,'请选择要审批的记录!','alert');
|
||
}
|
||
else if(idsAdmin.length > 1){
|
||
showResult(false,'请选择要审批的一条记录,不支持同时选择多条记录!','alert');
|
||
}
|
||
else{
|
||
dialog_suggestion.uiDialog('title').html('审批');
|
||
dialog_suggestion.uiDialog('setUserParam', {action: 'add'});
|
||
dialog_suggestion.uiDialog('button', 'btnOK').show();
|
||
dialog_suggestion.uiDialog('button', 'btnSave').hide();
|
||
dialog_suggestion.uiDialog('open');
|
||
}
|
||
});
|
||
//部门领导审批
|
||
$('#btn4').bind('click', function () {
|
||
idsLeader= grid.uiGrid('selectedData', 'id');
|
||
if(idsLeader.length == 0){
|
||
showResult(false,'请选择要审批的记录!','alert');
|
||
}
|
||
else if(idsLeader.length > 1){
|
||
showResult(false,'请选择要审批的一条记录,不支持同时选择多条记录!','alert');
|
||
}
|
||
else{
|
||
dialog_leader.uiDialog('title').html('审批');
|
||
dialog_leader.uiDialog('setUserParam', {action: 'add'});
|
||
dialog_leader.uiDialog('button', 'btnOK').show();
|
||
dialog_leader.uiDialog('button', 'btnSave').hide();
|
||
dialog_leader.uiDialog('open');
|
||
}
|
||
});
|
||
//审批流程
|
||
$('#btnWorkflow').bind('click', function () {
|
||
var addgroupids = grid.uiGrid('selectedData', 'providerdepartid');
|
||
if(addgroupids.length === 1){
|
||
var applicant_departid = addgroupids[0];
|
||
$.ajax({
|
||
type: 'post',
|
||
url: getApproverUrl + '?type=' + null + '&departid='+applicant_departid,
|
||
dataType: "json",
|
||
success: function (result) {
|
||
if(result.success && result.data.depart_leader !== undefined && result.data.depart_leader !== ""){
|
||
depart_leader = result.data.depart_leader;
|
||
}else {
|
||
depart_leader = "";
|
||
}
|
||
if(result.success && result.data.depart_approver !== undefined && result.data.depart_approver !== ""){
|
||
depart_approver = result.data.depart_approver;
|
||
}else {
|
||
depart_approver = "";
|
||
}
|
||
|
||
//将前端数据直接放到grid表格中
|
||
$('#spgrid_workflow').uiGrid('loadData',{
|
||
localData:{rows:[
|
||
{num:'1',leader: '部门管理员 '+depart_approver},
|
||
{num:'2',leader: '部门领导 '+depart_leader}
|
||
]}
|
||
});
|
||
|
||
},
|
||
error:function() {
|
||
}
|
||
});
|
||
|
||
}else if(addgroupids.length > 1){
|
||
showResult(false, '请选择要查看的一行数据,不支持同时选择多行!', 'alert');
|
||
return false;
|
||
}
|
||
dialog_workflow.uiDialog('setUserParam', {action: 'add', id: 0});
|
||
dialog_workflow.uiDialog('button', 'btnOK').show();
|
||
dialog_workflow.uiDialog('open');
|
||
dialog_workflow.uiDialog('title').html('审批流程');
|
||
});
|
||
|
||
}
|
||
|
||
function initUserGrid() {
|
||
$('#cate_s').uiCombobox();
|
||
|
||
//初始化搜索框
|
||
$('#searchbox').uiSearchbox({
|
||
prompt: '标题|资料分类|部门',
|
||
searcher: function (v) {
|
||
// var cateId = $('#cate_s').uiCombobox("getValue");
|
||
// grid.uiGrid('loadData', {queryParams: {key: $.trim(v),cateId:cateId}, pageIndex: 1});
|
||
grid.uiGrid('loadData', {queryParams: {key: $.trim(v)}, pageIndex: 1});
|
||
}
|
||
});
|
||
|
||
|
||
}
|
||
|
||
});
|
||
function checkSize(ele){
|
||
var size_m = (ele.files[0].size / 1024);
|
||
if(size_m >= 1024*1024*5){
|
||
$('#hidFile').val(1);
|
||
return false;
|
||
}
|
||
$('#hidFile').val(0);
|
||
return true;
|
||
}
|
||
//查看
|
||
function viewRow(id) {
|
||
var dialog = $('#dialog_edit');
|
||
dialog.uiDialog('setUserParam', {action: 'view', id: id});
|
||
dialog.uiDialog('button', 'btnSave').hide();
|
||
dialog.uiDialog('button', 'btnOK').hide();
|
||
dialog.uiDialog('open');
|
||
|
||
file_id = id;
|
||
|
||
}
|
||
//编辑
|
||
function editRow(id) {
|
||
showResult(false,'已提交的资料不允许编辑!','alert');
|
||
return false;
|
||
|
||
// $.ajax({
|
||
// type: 'post',
|
||
// url: isNotLoginerURL,
|
||
// data: {id:id},
|
||
// dataType: "json",
|
||
// success: function (result) {
|
||
// if(result.success){
|
||
//
|
||
// }else{
|
||
// $('#dialog_edit').uiDialog('close');
|
||
// alert("您没有权限编辑其他人上传的资料");
|
||
// }
|
||
// },
|
||
// error:function() {
|
||
// alert("判断当前登录用户是否有编辑权限失败");
|
||
// }
|
||
// });
|
||
|
||
var dialog = $('#dialog_edit');
|
||
dialog.uiDialog('title').html('编辑');
|
||
dialog.uiDialog('setUserParam', {action: 'edit', id: id});
|
||
dialog.uiDialog('button', 'btnSave').show();
|
||
dialog.uiDialog('button', 'btnOK').show();
|
||
dialog.uiDialog('open');
|
||
|
||
file_id = id;
|
||
}
|
||
//视频点播
|
||
function swfVideo(id) {
|
||
var swfdialog = $('#swfdialog');
|
||
swfdialog.uiDialog('title').html('视频点播');
|
||
swfdialog.uiDialog('setUserParam', { id: id});
|
||
swfdialog.uiDialog('open');
|
||
// window.open("test.html");
|
||
};
|
||
//增加好评量
|
||
function addOK(id) {
|
||
$.ajax({
|
||
type: 'post',
|
||
url: addOKURL,
|
||
data: {id:id},
|
||
success: function (result) {
|
||
if(result.success){
|
||
showResult(result, "好评成功!");
|
||
$('#grid_detail').uiGrid('loadData');
|
||
}else
|
||
{
|
||
showResult(result, "好评失败!");
|
||
}
|
||
}
|
||
});
|
||
}
|
||
// 删除
|
||
function deleteRow(id) {
|
||
// $.ajax({
|
||
// type: 'post',
|
||
// url: isNotLoginerURL,
|
||
// data: {id:id},
|
||
// dataType: "json",
|
||
// success: function (result) {
|
||
// if(result.success){
|
||
//
|
||
//
|
||
// }else{
|
||
// // $('#dialog_edit').uiDialog('close');
|
||
// alert("您没有权限删除其他人上传的资料");
|
||
// }
|
||
// },
|
||
// error:function() {
|
||
// alert("判断当前登录用户是否有删除权限失败");
|
||
// }
|
||
// });
|
||
|
||
deleteData("确定要删除所选信息吗?", deleteUrl, {ids: id}, function (result) {
|
||
if (result.success) {
|
||
$('#grid_detail').uiGrid('loadData');
|
||
|
||
deleteLimitation(id);//依据文件id删除limitation表中的全所部门人员课程班级
|
||
deletePerson(id,1);//依据文件id删除课程班级对应的人
|
||
}
|
||
});
|
||
}
|
||
//删除
|
||
function deleteData(confirmText, url, data, callback) {
|
||
$.uiMessagebox.confirm({
|
||
title: '确认操作',
|
||
content: confirmText,
|
||
onClose: function (value) {
|
||
if (value) {
|
||
$.ajax({
|
||
type: 'post',
|
||
url: url,
|
||
data: data,
|
||
success: function (result) {
|
||
callback && callback.call(this, result);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
});
|
||
}
|
||
//删除发放范围
|
||
function deleteLimitationRow(id) {
|
||
deleteData("确定要删除所选信息吗?", deleteLimitationUrl, {ids: id}, function (result) {
|
||
if (result.success) {
|
||
$('#grid_limitation').uiGrid('loadData');
|
||
|
||
deletePerson(id,2);//依据limitation id删除课程班级对应的人
|
||
}
|
||
});
|
||
}
|
||
|
||
//依据文件id删除limitation表中的全所部门人员课程班级
|
||
function deleteLimitation(id) {
|
||
$.ajax({
|
||
type: 'post',
|
||
url: deleteLimitationFileUrl,
|
||
data: {'id':id},
|
||
dataType: "json",
|
||
success: function (result) {
|
||
},
|
||
error:function() {
|
||
alert("依据文件id删除limitation表中的全所部门人员课程班级失败!");
|
||
}
|
||
});
|
||
}
|
||
|
||
//删除课程班级对应的人
|
||
function deletePerson(id,num) {//num 1依据试卷id删 2依据limitation id删
|
||
$.ajax({
|
||
type: 'post',
|
||
url: deletePersonUrl,
|
||
data: {'id':id,
|
||
'num':num},
|
||
dataType: "json",
|
||
success: function (result) {
|
||
},
|
||
error:function() {
|
||
alert("删除课程班级对应的人失败!");
|
||
}
|
||
});
|
||
}
|
||
|
||
//查看发放范围
|
||
function viewLimitationRow(id) {
|
||
if($('input:radio[id="cbDepartment"]:checked').val() == "on"){
|
||
var dialog_limitation = $('#dialog_limitation');
|
||
dialog_limitation.uiDialog('setUserParam', {action: 'view', id: id});
|
||
// dialog_limitation.uiDialog('button', 'btnSave').hide();
|
||
// dialog_limitation.uiDialog('button', 'btnOK').hide();
|
||
dialog_limitation.uiDialog('open');
|
||
}else if($('input:radio[id="cbPerson"]:checked').val() == "on"){
|
||
var dialog_person = $('#dialog_person');
|
||
dialog_person.uiDialog('setUserParam', {action: 'view', id: id});
|
||
// dialog_person.uiDialog('button', 'btnSave').hide();
|
||
// dialog_person.uiDialog('button', 'btnOK').hide();
|
||
dialog_person.uiDialog('open');
|
||
}else if($('input:radio[id="cbClass"]:checked').val() == "on"){
|
||
var dialog_class = $('#dialog_class');
|
||
dialog_class.uiDialog('setUserParam', {action: 'view', id: id});
|
||
// dialog_class.uiDialog('button', 'btnSave').hide();
|
||
// dialog_class.uiDialog('button', 'btnOK').hide();
|
||
dialog_class.uiDialog('open');
|
||
}else if($('input:radio[id="cbCourse"]:checked').val() == "on"){
|
||
var dialog_course = $('#dialog_person');
|
||
dialog_course.uiDialog('setUserParam', {action: 'view', id: id});
|
||
// dialog_course.uiDialog('button', 'btnSave').hide();
|
||
// dialog_course.uiDialog('button', 'btnOK').hide();
|
||
dialog_course.uiDialog('open');
|
||
}
|
||
}
|
||
//编辑发放范围
|
||
function editLimitationRow(id) {
|
||
if($('input:radio[id="cbDepartment"]:checked').val() == "on"){
|
||
var dialog_limitation = $('#dialog_limitation');
|
||
dialog_limitation.uiDialog('title').html('编辑');
|
||
dialog_limitation.uiDialog('setUserParam', {action: 'edit', id: id});
|
||
dialog_limitation.uiDialog('button', 'btnSave').show();
|
||
dialog_limitation.uiDialog('button', 'btnOK').show();
|
||
dialog_limitation.uiDialog('open');
|
||
}else if($('input:radio[id="cbPerson"]:checked').val() == "on"){
|
||
var dialog_person = $('#dialog_person');
|
||
dialog_person.uiDialog('title').html('编辑');
|
||
dialog_person.uiDialog('setUserParam', {action: 'edit', id: id});
|
||
dialog_person.uiDialog('button', 'btnSave').show();
|
||
dialog_person.uiDialog('button', 'btnOK').show();
|
||
dialog_person.uiDialog('open');
|
||
}else if($('input:radio[id="cbClass"]:checked').val() == "on"){
|
||
var dialog_class = $('#dialog_class');
|
||
dialog_class.uiDialog('title').html('编辑');
|
||
dialog_class.uiDialog('setUserParam', {action: 'edit', id: id});
|
||
dialog_class.uiDialog('button', 'btnSave').show();
|
||
dialog_class.uiDialog('button', 'btnOK').show();
|
||
dialog_class.uiDialog('open');
|
||
}else if($('input:radio[id="cbCourse"]:checked').val() == "on"){
|
||
var dialog_course = $('#dialog_course');
|
||
dialog_course.uiDialog('title').html('编辑');
|
||
dialog_course.uiDialog('setUserParam', {action: 'edit', id: id});
|
||
dialog_course.uiDialog('button', 'btnSave').show();
|
||
dialog_course.uiDialog('button', 'btnOK').show();
|
||
dialog_course.uiDialog('open');
|
||
}
|
||
}
|
||
|
||
//指定发放范围
|
||
function specifiedRange(num) {
|
||
if (num === 1){
|
||
deleteOtherLimitation();
|
||
$('#grid_limitation').hide();
|
||
|
||
}else if(num === 2){
|
||
deleteOtherLimitation();
|
||
$('#grid_limitation').uiGrid('loadData',{queryParams:{"file_id": file_id}});
|
||
$('#grid_limitation').show();
|
||
$('#spanDepartment').show();
|
||
$('#spanPerson').hide();
|
||
$('#spanClass').hide();
|
||
$('#spanCourse').hide();
|
||
$('#btnDepartment').show();
|
||
$('#btnPerson').hide();
|
||
$('#btnClass').hide();
|
||
$('#btnCourse').hide();
|
||
}else if(num === 3){
|
||
deleteOtherLimitation();
|
||
$('#grid_limitation').uiGrid('loadData',{queryParams:{"file_id": file_id}});
|
||
$('#grid_limitation').show();
|
||
$('#spanDepartment').hide();
|
||
$('#spanPerson').show();
|
||
$('#spanClass').hide();
|
||
$('#spanCourse').hide();
|
||
$('#btnDepartment').hide();
|
||
$('#btnPerson').show();
|
||
$('#btnClass').hide();
|
||
$('#btnCourse').hide();
|
||
}else if(num === 4){
|
||
deleteOtherLimitation();
|
||
$('#grid_limitation').uiGrid('loadData',{queryParams:{"file_id": file_id}});
|
||
$('#grid_limitation').show();
|
||
$('#spanDepartment').hide();
|
||
$('#spanPerson').hide();
|
||
$('#spanClass').show();
|
||
$('#spanCourse').hide();
|
||
$('#btnDepartment').hide();
|
||
$('#btnPerson').hide();
|
||
$('#btnClass').show();
|
||
$('#btnCourse').hide();
|
||
}else if(num === 5){
|
||
deleteOtherLimitation();
|
||
$('#grid_limitation').uiGrid('loadData',{queryParams:{"file_id": file_id}});
|
||
$('#grid_limitation').show();
|
||
$('#spanDepartment').hide();
|
||
$('#spanPerson').hide();
|
||
$('#spanClass').hide();
|
||
$('#spanCourse').show();
|
||
$('#btnDepartment').hide();
|
||
$('#btnPerson').hide();
|
||
$('#btnClass').hide();
|
||
$('#btnCourse').show();
|
||
}
|
||
}
|
||
|
||
//查看 编辑 指定范围
|
||
function editShowHide() {
|
||
if($('input:radio[id="cbInstitute"]:checked').val() == "on"){
|
||
$('#grid_limitation').hide();
|
||
// $('#tdRange').replaceWith("<td colspan=\"3\" id=\"tdRange\">指定全所</td>");
|
||
}else if($('input:radio[id="cbDepartment"]:checked').val() == "on"){
|
||
$('#btnDepartment').show();
|
||
$('#btnPerson').hide();
|
||
$('#btnClass').hide();
|
||
$('#btnCourse').hide();
|
||
$('#spanDepartment').show();
|
||
$('#spanPerson').hide();
|
||
// $('#tdRange').replaceWith("<td colspan=\"3\" id=\"tdRange\">指定部门</td>");
|
||
$('#spanClass').hide();
|
||
$('#spanCourse').hide();
|
||
|
||
}else if($('input:radio[id="cbPerson"]:checked').val() == "on"){
|
||
$('#btnDepartment').hide();
|
||
$('#btnPerson').show();
|
||
$('#btnClass').hide();
|
||
$('#btnCourse').hide();
|
||
$('#spanDepartment').hide();
|
||
$('#spanPerson').show();
|
||
$('#spanClass').hide();
|
||
$('#spanCourse').hide();
|
||
// $('#tdRange').replaceWith("<td colspan=\"3\" id=\"tdRange\">指定人员</td>");
|
||
|
||
// $(':radio').attr('disabled', true);
|
||
// $(':button').attr('disabled', true);
|
||
|
||
}else if($('input:radio[id="cbClass"]:checked').val() == "on"){
|
||
$('#spanDepartment').hide();
|
||
$('#spanPerson').hide();
|
||
$('#spanClass').show();
|
||
$('#spanCourse').hide();
|
||
$('#btnDepartment').hide();
|
||
$('#btnPerson').hide();
|
||
$('#btnClass').show();
|
||
$('#btnCourse').hide();
|
||
}else if($('input:radio[id="cbCourse"]:checked').val() == "on"){
|
||
$('#spanDepartment').hide();
|
||
$('#spanPerson').hide();
|
||
$('#spanClass').hide();
|
||
$('#spanCourse').show();
|
||
$('#btnDepartment').hide();
|
||
$('#btnPerson').hide();
|
||
$('#btnClass').hide();
|
||
$('#btnCourse').show();
|
||
}
|
||
}
|
||
|
||
//删除其他的指定范围
|
||
function deleteOtherLimitation(){
|
||
$.ajax({
|
||
type: 'post',
|
||
url: deleteOtherUrl,
|
||
data: {"file_id": file_id},
|
||
dataType: "json",
|
||
success: function (result) {
|
||
deletePerson(file_id,1);//依据文件id删除课程班级对应的人
|
||
$('#grid_limitation').uiGrid('loadData');
|
||
},
|
||
error:function() {
|
||
alert("删除其他的指定范围失败");
|
||
}
|
||
});
|
||
}
|
||
|
||
//生成32位UUID
|
||
function S4() {
|
||
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
|
||
}
|
||
function guid() {
|
||
return (S4()+S4()+S4()+S4()+S4()+S4()+S4()+S4());
|
||
}
|
||
function comboxLoad(param, success, error) {
|
||
var opts = $(this).uiCombobox('options');
|
||
if (!opts.url) return false;
|
||
$.ajax({
|
||
type: opts.method,
|
||
url: opts.url,
|
||
showLoading: false,
|
||
data: param,
|
||
showAlert:false,
|
||
dataType: 'json',
|
||
success: function (result) {
|
||
if (result.success) {
|
||
success(result.data);
|
||
}
|
||
},
|
||
error: function () {
|
||
error.apply(this, arguments);
|
||
}
|
||
});
|
||
} |