40e2fdde8619e0deee2812cc0c519b71fc93bc54.svn-base 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. var comp_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  2. var role_id = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
  3. function initComplete(){
  4. initGrid();
  5. }
  6. function initGrid(){
  7. var roleCons = roleButtonArr();
  8. var option = {
  9. columns : [
  10. {display : '模板名称', name : 'TEMPLATE_NAME_602',align : 'center',width : "100%",isPrimaryKey:true,//render:editReport,
  11. render : function(rowdata, rowindex, value, column) {
  12. return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick=editmodel('"+rowdata.FD_OBJECTID602+"','"+value+"')>" + value + "</a>";
  13. }
  14. }
  15. /* {display : '填报部门', name : 'TABLE_NAME_443',align : 'center', width : "50%",showTitle:true}*/
  16. ],
  17. pageSize : 10,
  18. rownumbers : true,
  19. percentWidthMode : true,
  20. checkbox : true
  21. };
  22. var toolBars =getItem(comp_id, role_id, roleCons);
  23. function getItem(compId,roleId,roleCons){
  24. var item = "";
  25. /*var roleArr = role_id.split(",");
  26. if(compId=="4B75E8B6C2445B79E053243E5B0ABDAB" && $.inArray("R002105430213",roleArr)>-1){*/
  27. item= {
  28. items: [
  29. { text: '新增', click: 'onAdd', iconClass: 'add1_tem', disabled: false ,id:"stmb_xz"},
  30. { text: '修改', click: 'onEdit', iconClass: 'update_tem', disabled: false,id:"stmb_xg" },
  31. { text: '删除', click: 'onDelete', iconClass: 'delete_tem', disabled: false,id:"stmb_sc"},
  32. { text: '绑定', click: 'onBinding', iconClass: 'binding_tem', disabled: false,id:"stmb_bd"}
  33. ],
  34. roleCons:""
  35. };
  36. /*}else{
  37. item = false;
  38. }*/
  39. return item;
  40. }
  41. var options={
  42. url : $.pathname() + '/ws/crud/CRUDService/queryQui',
  43. params:{
  44. "listId":602,
  45. condition:"is_del = 0 and WRITER_DEPT = '"+comp_id+"'",
  46. direction : 'desc', // 排序方式
  47. sort : 'UPDATEDATE'
  48. },
  49. width:"100%",
  50. gridOptions:option,
  51. paperOpration:{showInput:"true"},
  52. toolBarOptions:toolBars
  53. };
  54. g=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options);
  55. }
  56. function editmodel(id,val){
  57. var iframe = parent.document.getElementsByName("frmright")[0];
  58. iframe.src = encodeURI("/nwyj/page/business/exercise/examineManagement/show_questionTemplate.jsp?template_id="+id);
  59. }
  60. /*window.onload = function (){
  61. $(".selectbox").attr("readonly","readonly");
  62. };*/
  63. function getRole_id(id){
  64. /*var role_id = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();*/
  65. if(id.indexOf(",")!=-1){
  66. var role_ids = id.split(",");
  67. for(var i=0;i<role_ids.length;i++){
  68. if(role_ids[i]=="R002105430210"||role_ids[i]=="R002105430211"||role_ids[i]=="R002105430212"||role_ids[i]=="R002105430213"){
  69. return role_ids[i];
  70. }
  71. }
  72. }else{
  73. return id;
  74. }
  75. }
  76. /***新增模板****/
  77. function onAdd(){
  78. var diag = new top.Dialog();
  79. diag.Title = '添加模板';
  80. diag.URL = $.pathname() + '/page/business/exercise/examineManagement/questionTemplateAddEdit.jsp?fd_id=';
  81. diag.OkButtonText = '确定';
  82. diag.OKEvent = function(){
  83. $form = diag.innerFrame.contentWindow.$("#editForm");
  84. var valid = $form.validationEngine({returnIsValid: true});
  85. if(!valid){
  86. return;
  87. }
  88. var url = $.pathname() + '/ws/crud/CRUDService/create';
  89. $.ajax({
  90. url : url,
  91. type : 'post',
  92. data : $form.serialize(),
  93. dataType : 'text',
  94. timeout : 60000,
  95. success : function(data){
  96. top.Dialog.alert("保存成功!");
  97. diag.close();
  98. top.frmright.window.location.reload()
  99. },
  100. error : function(){
  101. $.messager.alert('操作失败');
  102. }
  103. });
  104. };
  105. diag.CancelEvent = function(){
  106. diag.close();
  107. };
  108. diag.Width = 400; //宽度
  109. diag.Height = 150; //高度
  110. diag.ButtonAlign = 'center';//发送和取消按钮的位置
  111. diag.show();
  112. }
  113. /***修改模板****/
  114. function onEdit(){
  115. var row = g.getSelectedRows();
  116. if(row.length==0){
  117. top.Dialog.alert("请选择要修改的记录");
  118. return;
  119. }
  120. if(row.length>1){
  121. top.Dialog.alert("请选择一条修改记录");
  122. return;
  123. }
  124. var fd_id = row[0].FD_OBJECTID_602;
  125. var diag = new top.Dialog();
  126. diag.Title = '修改模板';
  127. diag.URL = $.pathname() + '/page/business/exercise/examineManagement/questionTemplateAddEdit.jsp?fd_id='+fd_id;
  128. diag.OkButtonText = '确定';
  129. diag.OKEvent = function(){
  130. $form = diag.innerFrame.contentWindow.$("#editForm");
  131. var valid = $form.validationEngine({returnIsValid: true});
  132. if(!valid){
  133. return;
  134. }
  135. var url = $.pathname() + '/ws/crud/CRUDService/update';
  136. $.ajax({
  137. url : url,
  138. type : 'post',
  139. data : $form.serialize(),
  140. dataType : 'text',
  141. timeout : 60000,
  142. success : function(data){
  143. top.Dialog.alert("修改成功!");
  144. diag.close();
  145. top.frmright.window.location.reload()
  146. },
  147. error : function(){
  148. $.messager.alert('操作失败');
  149. }
  150. });
  151. };
  152. diag.CancelEvent = function(){
  153. diag.close();
  154. };
  155. diag.Width = 400; //宽度
  156. diag.Height = 150; //高度
  157. diag.ButtonAlign = 'center';//发送和取消按钮的位置
  158. diag.show();
  159. }
  160. /***删除模板****/
  161. function onDelete(){
  162. var row = g.getSelectedRows();
  163. if(row.length==0){
  164. top.Dialog.alert("请选择要删除的记录");
  165. return;
  166. }
  167. if(row.length>1){
  168. top.Dialog.alert("请选择一条删除记录");
  169. return;
  170. }
  171. var fd_id = row[0].FD_OBJECTID_602;
  172. $.ajax({
  173. url : $.pathname() + '/ws/Examine/ExamineManagementService/getTaskByTemplate/',
  174. type : 'post',
  175. data : {template_id:fd_id},
  176. dataType : 'json',
  177. timeout : 15000,
  178. async : false,
  179. success : function(data){
  180. if(data.length > 0){
  181. top.Dialog.alert("当前模板正在执行任务中,不可删除");
  182. return;
  183. }
  184. var delUrl = $.pathname() + '/ws/crud/CRUDService/delete';
  185. var params = {
  186. objectIDs : fd_id,
  187. classid : 602
  188. };
  189. top.Dialog.confirm("确定要删除吗?|删除", function() {
  190. $.request.del(delUrl, params, function(result) {
  191. if (result.Msg.sucsess == true) {
  192. top.Dialog.alert("删除成功!");
  193. // 刷新表格数据
  194. g.rend();
  195. } else {
  196. top.Dialog.alert("删除失败!");
  197. }
  198. });
  199. $.ajax({
  200. url : $.pathname() + '/ws/Examine/ExamineManagementService/delTemplate/',
  201. type : 'post',
  202. data : {template_id:fd_id},
  203. dataType : 'json',
  204. timeout : 60000,
  205. success : function(data){
  206. }
  207. });
  208. });
  209. }
  210. });
  211. }
  212. /*****绑定模板******/
  213. function onBinding(){
  214. var row = g.getSelectedRows();
  215. if(row.length==0){
  216. top.Dialog.alert("请选择要绑定的记录");
  217. return;
  218. }
  219. if(row.length>1){
  220. top.Dialog.alert("请选择一条绑定记录");
  221. return;
  222. }
  223. var fd_id = row[0].FD_OBJECTID_602;
  224. $.ajax({
  225. url : $.pathname() + '/ws/Examine/ExamineManagementService/getTaskByTemplate/',
  226. type : 'post',
  227. data : {template_id:fd_id},
  228. dataType : 'json',
  229. timeout : 15000,
  230. async : false,
  231. success : function(data){
  232. if(data.length > 0){
  233. top.Dialog.alert("当前模板正在执行任务中,不可绑定");
  234. return;
  235. }
  236. var diag = new top.Dialog();
  237. diag.Title = '绑定模板';
  238. diag.URL = $.pathname() + '/page/business/exercise/examineManagement/questionBankToTemplate.jsp?fd_id='+fd_id;
  239. /* diag.OkButtonText = '绑定';
  240. diag.OKEvent = function(){
  241. var ids = diag.innerFrame.contentWindow.$("#bindQuestionId").val();
  242. var params = {
  243. template_id : fd_id,
  244. ids : ids
  245. }
  246. var url = $.pathname() + '/ws/Examine/ExamineManagementService/bindTemplate/';
  247. $.ajax({
  248. url : url,
  249. type : 'post',
  250. data : params,
  251. dataType : 'json',
  252. timeout : 60000,
  253. success : function(data){
  254. if(data){
  255. top.Dialog.alert("绑定成功!");
  256. //diag.close();
  257. }else{
  258. top.Dialog.alert("绑定失败!");
  259. return;
  260. }
  261. },
  262. error : function(){
  263. $.messager.alert('操作失败');
  264. }
  265. });
  266. };
  267. diag.CancelEvent = function(){
  268. diag.close();
  269. };*/
  270. diag.Width = 1200; //宽度
  271. diag.Height = 750; //高度
  272. //diag.ButtonAlign = 'center';//发送和取消按钮的位置
  273. diag.show();
  274. }
  275. });
  276. }