var comp_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
var role_id = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
function initComplete(){
initGrid();
}
function initGrid(){
var roleCons = roleButtonArr();
var option = {
columns : [
{display : '模板名称', name : 'TEMPLATE_NAME_602',align : 'center',width : "100%",isPrimaryKey:true,//render:editReport,
render : function(rowdata, rowindex, value, column) {
return "" + value + "";
}
}
/* {display : '填报部门', name : 'TABLE_NAME_443',align : 'center', width : "50%",showTitle:true}*/
],
pageSize : 10,
rownumbers : true,
percentWidthMode : true,
checkbox : true
};
var toolBars =getItem(comp_id, role_id, roleCons);
function getItem(compId,roleId,roleCons){
var item = "";
/*var roleArr = role_id.split(",");
if(compId=="4B75E8B6C2445B79E053243E5B0ABDAB" && $.inArray("R002105430213",roleArr)>-1){*/
item= {
items: [
{ text: '新增', click: 'onAdd', iconClass: 'add1_tem', disabled: false ,id:"stmb_xz"},
{ text: '修改', click: 'onEdit', iconClass: 'update_tem', disabled: false,id:"stmb_xg" },
{ text: '删除', click: 'onDelete', iconClass: 'delete_tem', disabled: false,id:"stmb_sc"},
{ text: '绑定', click: 'onBinding', iconClass: 'binding_tem', disabled: false,id:"stmb_bd"}
],
roleCons:""
};
/*}else{
item = false;
}*/
return item;
}
var options={
url : $.pathname() + '/ws/crud/CRUDService/queryQui',
params:{
"listId":602,
condition:"is_del = 0 and WRITER_DEPT = '"+comp_id+"'",
direction : 'desc', // 排序方式
sort : 'UPDATEDATE'
},
width:"100%",
gridOptions:option,
paperOpration:{showInput:"true"},
toolBarOptions:toolBars
};
g=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options);
}
function editmodel(id,val){
var iframe = parent.document.getElementsByName("frmright")[0];
iframe.src = encodeURI("/nwyj/page/business/exercise/examineManagement/show_questionTemplate.jsp?template_id="+id);
}
/*window.onload = function (){
$(".selectbox").attr("readonly","readonly");
};*/
function getRole_id(id){
/*var role_id = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();*/
if(id.indexOf(",")!=-1){
var role_ids = id.split(",");
for(var i=0;i1){
top.Dialog.alert("请选择一条修改记录");
return;
}
var fd_id = row[0].FD_OBJECTID_602;
var diag = new top.Dialog();
diag.Title = '修改模板';
diag.URL = $.pathname() + '/page/business/exercise/examineManagement/questionTemplateAddEdit.jsp?fd_id='+fd_id;
diag.OkButtonText = '确定';
diag.OKEvent = function(){
$form = diag.innerFrame.contentWindow.$("#editForm");
var valid = $form.validationEngine({returnIsValid: true});
if(!valid){
return;
}
var url = $.pathname() + '/ws/crud/CRUDService/update';
$.ajax({
url : url,
type : 'post',
data : $form.serialize(),
dataType : 'text',
timeout : 60000,
success : function(data){
top.Dialog.alert("修改成功!");
diag.close();
top.frmright.window.location.reload()
},
error : function(){
$.messager.alert('操作失败');
}
});
};
diag.CancelEvent = function(){
diag.close();
};
diag.Width = 400; //宽度
diag.Height = 150; //高度
diag.ButtonAlign = 'center';//发送和取消按钮的位置
diag.show();
}
/***删除模板****/
function onDelete(){
var row = g.getSelectedRows();
if(row.length==0){
top.Dialog.alert("请选择要删除的记录");
return;
}
if(row.length>1){
top.Dialog.alert("请选择一条删除记录");
return;
}
var fd_id = row[0].FD_OBJECTID_602;
$.ajax({
url : $.pathname() + '/ws/Examine/ExamineManagementService/getTaskByTemplate/',
type : 'post',
data : {template_id:fd_id},
dataType : 'json',
timeout : 15000,
async : false,
success : function(data){
if(data.length > 0){
top.Dialog.alert("当前模板正在执行任务中,不可删除");
return;
}
var delUrl = $.pathname() + '/ws/crud/CRUDService/delete';
var params = {
objectIDs : fd_id,
classid : 602
};
top.Dialog.confirm("确定要删除吗?|删除", function() {
$.request.del(delUrl, params, function(result) {
if (result.Msg.sucsess == true) {
top.Dialog.alert("删除成功!");
// 刷新表格数据
g.rend();
} else {
top.Dialog.alert("删除失败!");
}
});
$.ajax({
url : $.pathname() + '/ws/Examine/ExamineManagementService/delTemplate/',
type : 'post',
data : {template_id:fd_id},
dataType : 'json',
timeout : 60000,
success : function(data){
}
});
});
}
});
}
/*****绑定模板******/
function onBinding(){
var row = g.getSelectedRows();
if(row.length==0){
top.Dialog.alert("请选择要绑定的记录");
return;
}
if(row.length>1){
top.Dialog.alert("请选择一条绑定记录");
return;
}
var fd_id = row[0].FD_OBJECTID_602;
$.ajax({
url : $.pathname() + '/ws/Examine/ExamineManagementService/getTaskByTemplate/',
type : 'post',
data : {template_id:fd_id},
dataType : 'json',
timeout : 15000,
async : false,
success : function(data){
if(data.length > 0){
top.Dialog.alert("当前模板正在执行任务中,不可绑定");
return;
}
var diag = new top.Dialog();
diag.Title = '绑定模板';
diag.URL = $.pathname() + '/page/business/exercise/examineManagement/questionBankToTemplate.jsp?fd_id='+fd_id;
/* diag.OkButtonText = '绑定';
diag.OKEvent = function(){
var ids = diag.innerFrame.contentWindow.$("#bindQuestionId").val();
var params = {
template_id : fd_id,
ids : ids
}
var url = $.pathname() + '/ws/Examine/ExamineManagementService/bindTemplate/';
$.ajax({
url : url,
type : 'post',
data : params,
dataType : 'json',
timeout : 60000,
success : function(data){
if(data){
top.Dialog.alert("绑定成功!");
//diag.close();
}else{
top.Dialog.alert("绑定失败!");
return;
}
},
error : function(){
$.messager.alert('操作失败');
}
});
};
diag.CancelEvent = function(){
diag.close();
};*/
diag.Width = 1200; //宽度
diag.Height = 750; //高度
//diag.ButtonAlign = 'center';//发送和取消按钮的位置
diag.show();
}
});
}