index.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. var gridObj;
  2. var gridObj1;
  3. var pagingObj;
  4. $(function () {
  5. $("#condition_div1").hide();
  6. $("#condition_div").show();
  7. gridObj = $.fn.bsgrid.init('searchTable', {
  8. url: prjContextPath+"/xxbsAction!querySy.action",
  9. pageSizeSelect: true,
  10. stripeRows: true,
  11. pageSize: thisPageSize,//当前页显示行数
  12. otherParames:{"perPage":thisPageSize},//
  13. pageSizeSelect:false,
  14. displayBlankRows: false, // single grid setting
  15. displayPagingToolbarOnlyMultiPages: true, // single grid setting
  16. complete:set_pageCon_end() //执行完成后回调函数
  17. });
  18. // 表格的checkbox选择
  19. if($('#searchTable thead tr th:eq(0) input[type=checkbox]').length == 1) {
  20. $('#searchTable thead tr th:eq(0) input[type=checkbox]').change(function () {
  21. var checked = $.bsgrid.adaptAttrOrProp($(this), 'checked') ? true : false;
  22. $.bsgrid.adaptAttrOrProp($('#searchTable tbody tr td:nth-child(1)>input[type=checkbox]'), 'checked', checked);
  23. });
  24. }
  25. });
  26. function checkbox(record, rowIndex, colIndex, options) {
  27. return '<input type="checkbox" value="' + gridObj.getColumnValue(rowIndex, gridObj.getColumnAttr(colIndex, options.settings.colsProperties.indexAttr)) + '"/>';
  28. }
  29. //渲染字典项-栏目名称
  30. function render_lmname(record, rowIndex, colIndex, options){
  31. return '<a href="#" onclick="lmname(\'' + gridObj.getRecordIndexValue(record, 'xxbs_lmid')+ '\')">'+gridObj.getRecordIndexValue(record, 'xxbs_lmname') +'</a>';
  32. }
  33. function lmname(xxbs_lmid){
  34. $("#sTable_pt_outTab").hide();
  35. $("#condition_div").hide();
  36. $("#condition_div1").show();
  37. gridObj1 =$.fn.bsgrid.init('sTable' , {
  38. url: prjContextPath+"/xxbsAction!query.action",
  39. pageSizeSelect: true,
  40. stripeRows: true,
  41. pageSize: thisPageSize,//当前页显示行数
  42. otherParames:{"perPage":thisPageSize,"xxbs_lmid":xxbs_lmid},
  43. pageSizeSelect:false,
  44. displayBlankRows: false,// single grid setting
  45. displayPagingToolbarOnlyMultiPages: false // single grid setting
  46. });
  47. }
  48. function show_mess_clo(){
  49. if(winhandle!=null){
  50. winhandle.reset();
  51. }
  52. }
  53. var winHandle;
  54. /*获取勾选的checkbox值*/
  55. function getCheckedIds() {
  56. var records = getCheckedRecords();
  57. var ids = '';
  58. for(var i = 0; i < records.length; i++) {
  59. ids += ',' + gridObj.getRecordIndexValue(records[i], 'id');
  60. }
  61. // alert(ids.length > 0 ? ids.substring(1) : '');
  62. }
  63. /*获取勾选checkbox对象*/
  64. function getCheckedRecords() {
  65. var records = new Array();
  66. $('#searchTable tbody tr').each(function() {
  67. if($(this).find('td:eq(0)>input:checked').length == 1){
  68. records[records.length] = gridObj.getRowRecord($(this));
  69. }
  70. });
  71. return records;
  72. }
  73. /*执行完成后回调函数*/
  74. function set_pageCon_end(){
  75. }
  76. var person_win_handle;
  77. //临时跳转到信息审核页面 按钮调用方法
  78. //点击菜单提交
  79. function jump_xxsh(){
  80. /*var url = prjContextPath+"/system/person/lygbperson_query.jsp?zuzhijigouid="+jigouid;
  81. person_win_handle = openWindow(url,450,200,'信息报送查看页面',this.window); */
  82. parent.sumbitMen('/lyxxbs/xxsh/xxsh.jsp');
  83. }
  84. function neirong(xxbs_id,xxbs_zt){
  85. // alert(xxbs_id);
  86. // alert(xxbs_zt);
  87. // if(){
  88. //
  89. // }
  90. //parent.sumbitMen('/lyxxbs/xxbs/xxbs_neirong.jsp?xxbs_id='+xxbs_id+'&xxbs_zt='+xxbs_zt);
  91. var url = prjContextPath+'/lyxxbs/xxbs/xxbs_neirong.jsp?xxbs_id='+xxbs_id+'&xxbs_zt='+xxbs_zt;
  92. person_win_handle = openWindow(url,1200,380,'信息报送内容编辑页面',this.window);
  93. }
  94. //查看按钮调用方法
  95. function data_query(jigouid){
  96. var url = prjContextPath+"/system/person/lygbperson_query.jsp?zuzhijigouid="+jigouid;
  97. person_win_handle = openWindow(url,450,200,'信息报送查看页面',this.window);
  98. }
  99. //上报按钮调用方法
  100. function sb_data(dataid){
  101. var data_id=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), "xxbs_id");
  102. var xxbs_zt=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), "xxbs_zt");
  103. if(data_id==""||data_id==null){
  104. winHandle=openSecondMessageWindow('请选择一条数据!',prjContextPath);
  105. return;
  106. }
  107. if(xxbs_zt!="0"){
  108. winHandle=openSecondMessageWindow('只能上报“新建”状态的数据!',prjContextPath);
  109. return;
  110. }
  111. $.post(prjContextPath+"/xxbsAction!shangbao.action",{xxbs_zt:"1",xxbs_id:data_id},function(json){
  112. if(json.success==1){
  113. winHandle=openSecondMessageWindow('上报成功!',prjContextPath);
  114. if(gridObj.options.curPageRowsNum==1){
  115. if(gridObj.options.curPage==1){
  116. gridObj.refreshPage();
  117. }else{
  118. gridObj.prevPage();
  119. }
  120. }else{
  121. gridObj.refreshPage();
  122. }
  123. }else{
  124. winHandle=openSecondMessageWindow('操作失败,请联系管理员!',prjContextPath);
  125. }
  126. });
  127. }
  128. //修改按钮调用方法
  129. function upd_data(dataid){
  130. var data_id=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), "xxbs_id");
  131. if(data_id==""||data_id==null){
  132. winHandle=openSecondMessageWindow('请选择一条数据!',prjContextPath);
  133. return;
  134. }
  135. var xxbs_zt=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), "xxbs_zt");
  136. if(xxbs_zt!="0"){
  137. winHandle=openSecondMessageWindow('只能上报“新建”状态的数据!',prjContextPath);
  138. return;
  139. }
  140. var url = prjContextPath+"/lyxxbs/xxbs/xxbs_upd.jsp?data_id="+data_id;
  141. person_win_handle = openWindow(url,750,380,'信息报送修改页面',this.window);
  142. }
  143. //查看按钮调用方法
  144. function sel_data(dataid){
  145. var data_id=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), "xxbs_id");
  146. if(data_id==""||data_id==null){
  147. winHandle=openSecondMessageWindow('请选择一条数据!',prjContextPath);
  148. return;
  149. }else{
  150. var url = prjContextPath+"/lyxxbs/xxbs/xxbs_sel.jsp?data_id="+data_id;
  151. person_win_handle = openWindow(url,750,380,'信息报送查看页面',this.window);
  152. }
  153. }
  154. //增加按钮调用方法
  155. function add_data(){
  156. var zuzhijigouid=tree.getSelectedItemId();//获取数据库中主键
  157. if(!checkIsNotEmpty(zuzhijigouid)){
  158. winHandle=openSecondMessageWindow('请选择左侧的栏目!',prjContextPath);
  159. return false;
  160. }
  161. var url = prjContextPath+"/lyxxbs/xxbs/xxbs_add.jsp?lmid="+zuzhijigouid;
  162. person_win_handle = openWindow(url,750,380,'信息报送增加页面',this.window);
  163. }
  164. function del_data(dataid){
  165. var data_id=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), 'xxbs_id');
  166. var data_zt=gridObj.getRecordIndexValue(gridObj.getRowRecord(gridObj.getSelectedRow()), 'xxbs_zt');
  167. if(data_id==""||data_id==null){
  168. winHandle=openSecondMessageWindow('请选择一条数据!',prjContextPath);
  169. return;
  170. }
  171. if(data_zt!="0"){
  172. winHandle=openSecondMessageWindow('只能删除“新建”状态的数据!',prjContextPath);
  173. return;
  174. }
  175. parent._confirm_msg_show( '是否删除此信息?' , this.window.name+'.deleteCarManagerCall(1,'+data_id+')');
  176. }
  177. //删除操作,用户做选择后回调函数
  178. function deleteCarManagerCall(btn,dataid){
  179. //如果点击确定
  180. if(btn == '1')
  181. {
  182. //删除人员前校验此人员是否被分配用户
  183. $.post(prjContextPath+"/xxbsAction!delete.action",{xxbs_id:dataid},function(json){
  184. if(json.success==1){
  185. winHandle=openSecondMessageWindow('删除成功!',prjContextPath);
  186. if(gridObj.options.curPageRowsNum==1){
  187. if(gridObj.options.curPage==1){
  188. gridObj.refreshPage();
  189. }else{
  190. gridObj.prevPage();
  191. }
  192. }else{
  193. gridObj.refreshPage();
  194. }
  195. }else{
  196. winHandle=openSecondMessageWindow('操作失败,请联系管理员!',prjContextPath);
  197. }
  198. });
  199. }else{
  200. gridObj.refreshPage();//刷新当前页
  201. }
  202. }
  203. function callBackForSelCout(json){
  204. //如果此人员被分配用户,则不允许直接删除
  205. if(json.success>0){
  206. person_win_handle=openSecondMessageWindow('此人员已被分配用户,请先删除被分配的用户!',prjContextPath);
  207. }else{
  208. $.post(prjContextPath+"/employeeAction!delete.action",{id:json.dataid},callBackFunFileDel);
  209. }
  210. }
  211. function callBackFunFileDel(json){
  212. if(json.success==1){
  213. winHandle=openSecondMessageWindow('删除成功!',prjContextPath);
  214. if(gridObj.options.curPageRowsNum==1){
  215. if(gridObj.options.curPage==1){
  216. gridObj.refreshPage();
  217. }else{
  218. gridObj.prevPage();
  219. }
  220. }else{
  221. gridObj.refreshPage();
  222. }
  223. }else{
  224. winHandle=openSecondMessageWindow('删除失败,请联系管理员!',prjContextPath);
  225. }
  226. }
  227. //弹出窗口关闭
  228. function close_handle(flg){
  229. //flg:0 刷新到首页(增加);flg:1 刷新当前页(修改、删除)
  230. if(flg==0){
  231. if(gridObj.options.curPage!=1)
  232. gridObj.firstPage();
  233. else
  234. gridObj.refreshPage();
  235. }else{
  236. gridObj.refreshPage();
  237. }
  238. if(person_win_handle!=null){
  239. person_win_handle.reset();
  240. }
  241. }
  242. //关闭消息框
  243. function closeSysMes(){
  244. if(winHandle!=null){
  245. winHandle.reset();
  246. }
  247. close_handle(1);
  248. }
  249. //弹出窗口关闭
  250. function closeWindow(){
  251. gridObj.firstPage();
  252. if(person_win_handle!=null){
  253. parent.person_win_handle();
  254. }
  255. }