123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- 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 "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick=editmodel('"+rowdata.FD_OBJECTID602+"','"+value+"')>" + value + "</a>";
- }
- }
- /* {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;i<role_ids.length;i++){
- if(role_ids[i]=="R002105430210"||role_ids[i]=="R002105430211"||role_ids[i]=="R002105430212"||role_ids[i]=="R002105430213"){
- return role_ids[i];
- }
- }
- }else{
- return id;
- }
- }
- /***新增模板****/
- function onAdd(){
- var diag = new top.Dialog();
- diag.Title = '添加模板';
- diag.URL = $.pathname() + '/page/business/exercise/examineManagement/questionTemplateAddEdit.jsp?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/create';
- $.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 onEdit(){
- 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;
-
- 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();
-
- }
- });
-
- }
|