f284caf6ec2d1bece19c5e42d05657188bb3de69.svn-base 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. $(function() {
  2. /** 绑定查询面板的按钮点击事件* */
  3. $searchButt = $("#searchButt");// 查询按钮
  4. $searchButt.bind('click', function() {
  5. searchHandler();
  6. });
  7. });
  8. var g;
  9. var sql_condition = "";
  10. // 初始化函数
  11. //给初始化表格添加加载条件
  12. var initCondition= " IS_DEL = '0' and NAME IS NOT NULL ";
  13. // 列表加载参数
  14. loadParams = {
  15. "listId" : '777',
  16. "condition" : initCondition,
  17. direction:'DESC',
  18. sort: 'UPDATEDATE'
  19. };
  20. function initComplete() {
  21. /**
  22. * 工具条
  23. */
  24. var roleCons = roleButtonArr();
  25. var toolBarOpt1 = {
  26. items : [
  27. {text : '新增',click : "onAdd",iconClass : 'add1_tem',id : '10000'},
  28. {text : '删除',click : "onDelete",iconClass : 'delete_tem',id : '10002'},
  29. {text : '修改',click : "onEdit",iconClass : 'update_tem',id : '10001'},
  30. {text : '查看',click : "onView",iconClass : 'view_tem',id : '10003'},
  31. {text : '导入', click: "showImportDialog", iconClass: 'import_tem',id:"rcdr"}
  32. ],
  33. roleCons:roleCons
  34. };
  35. /**
  36. * 树形列
  37. */
  38. var grid_option1 = {
  39. columns : [ {
  40. display : '姓名', name : 'NAME_777', align : 'center', width : "20%",isPrimaryKey:true,
  41. render : function(rowdata, rowindex, value, column) {
  42. return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick='openDetail(" + rowindex + ")'>" + value + "</a>";
  43. }
  44. }, {
  45. display : '单位',
  46. name : 'COMPID_777_SHOW',
  47. align : 'center',
  48. width : "20%"
  49. }, {
  50. display : '电话',
  51. name : 'TELPHONE_777',
  52. align : 'center',
  53. width : "20%"
  54. }, {
  55. display : '职能',
  56. name : 'COMPETENCY_777_SHOW',
  57. align : 'center',
  58. width : "20%"
  59. }, {
  60. display : '是否领导',
  61. name : 'ISLEADER_777_SHOW',
  62. align : 'center',
  63. width : "20%"
  64. } ],
  65. rownumbers : true,
  66. checkbox : true,
  67. pageSize : 10,
  68. percentWidthMode : true
  69. };
  70. var options1={
  71. url :'/nwyj/ws/crud/CRUDService/queryQui',
  72. params:loadParams,
  73. width:960,
  74. gridOptions:grid_option1,
  75. singleRecodeOptions:{a:"aa"},
  76. paperOpration:{showInput:"true"},
  77. toolBarOptions:toolBarOpt1
  78. };
  79. //
  80. g=gridAndSingleRecode=$("#baseMainGrid").quickgridAndSingleRecode(options1);
  81. }
  82. //查询
  83. function searchHandler() {
  84. // var ff = /[@#\$%\^&\*\~\<\>\)\(\{\}\[\]\`\/\\\'\"\;\:\:\;\!\¥\=\-\\\,\。\·\!]+/g;
  85. var name = $('#NAME_777').val();//名字
  86. // if(ff.test(name)){
  87. // top.Dialog.alert("请不要输入非法字符搜索!");
  88. // return;
  89. // }
  90. var condition = " IS_DEL='0' and NAME IS NOT NULL ";
  91. if(name!=""&&name!="姓名"){
  92. condition += " AND NAME LIKE '%" +name+"%'";
  93. }
  94. g.setOptions({// 重置加载列表的参数
  95. params : {
  96. "listId" : '777',
  97. "condition" : condition,
  98. direction:'DESC',
  99. sort: 'UPDATEDATE'
  100. }
  101. });
  102. // sql_condition = condition;
  103. // g.setNewPage(1);
  104. g.rend();// 刷新列表
  105. }
  106. // 点击新增触发方法
  107. function onAdd() {
  108. // 跳转页面
  109. var iframe = parent.document.getElementById("frmright");
  110. iframe.src = "/nwyj/page/business/am/MsgUser/msguser-update.jsp";
  111. }
  112. // 点击修改按钮触发方法
  113. function onEdit() {
  114. var rows = g.getSelectedRows();
  115. if (rows.length == 0) {
  116. top.Dialog.alert("请选择一条记录");
  117. return;
  118. }
  119. if (rows.length > 1) {
  120. top.Dialog.alert("只能选择一条记录");
  121. return;
  122. }
  123. var fd_id = rows[0].FD_OBJECTID777;
  124. var iframe = parent.document.getElementsByName("frmright")[0];
  125. iframe.src = "/nwyj/page/business/am/MsgUser/msguser-update.jsp?" + fd_id;
  126. }
  127. // 删除按钮点击事件
  128. function onDelete() {
  129. var rows = g.getSelectedRows();
  130. var rowsLength = rows.length;
  131. if (rowsLength == 0) {
  132. top.Dialog.alert("请选中要删除的记录!");
  133. return;
  134. }
  135. var ids = "";
  136. for (var i = 0; i < rowsLength; i++) {
  137. ids += rows[i].FD_OBJECTID777 + ",";
  138. }
  139. top.Dialog.confirm("确定要删除吗?|删除", function() {
  140. // 删除记录
  141. $.post($.pathname() + "/ws/crud/CRUDService/delete/", {
  142. "objectIDs" : ids,
  143. classid : 777
  144. }, function(result) {
  145. if (result.Msg.sucsess == true) {
  146. top.Dialog.alert("删除成功", null, null, null, 1);
  147. // 刷新表格数据
  148. g.rend();
  149. } else {
  150. top.Dialog.alert("删除失败");
  151. }
  152. }, "json");
  153. });
  154. }
  155. //查看详情
  156. function onView(){
  157. var rows = g.getSelectedRows();
  158. if (rows.length == 0) {
  159. top.Dialog.alert("请选择一条记录");
  160. return;
  161. }
  162. if (rows.length > 1) {
  163. top.Dialog.alert("只能选择一条记录");
  164. return;
  165. }
  166. var fd_id = rows[0].FD_OBJECTID777;
  167. var iframe = parent.document.getElementById("frmright");
  168. iframe.src = "business/am/MsgUser/msguser-info.jsp?" + fd_id;
  169. }
  170. //点击主键跳转详细信息页面
  171. this.openDetail = function(rowindex) {
  172. var row = g.getRow(rowindex);
  173. var fd_id = row.FD_OBJECTID777;
  174. var iframe = parent.document.getElementById("frmright");
  175. iframe.src = "business/am/MsgUser/msguser-info.jsp?" + fd_id;
  176. };
  177. function showPrimaryKey(obj,index){
  178. var fd_id = obj.FD_OBJECTID777;
  179. var iframe = parent.document.getElementById("frmright");
  180. iframe.src = "business/am/MsgUser/msguser-info.jsp?" + fd_id;
  181. }
  182. //导入
  183. function showImportDialog(){
  184. window.location.href="msguser-import.jsp";
  185. }