czyhList.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. var czyh = new Object();
  2. czyh.loadSearchModule = function(p) {
  3. var $div = $("#" + p.id);
  4. if ($div.length > 0) {
  5. $div.load('czyhSearchModule.htm', {
  6. from : p.from,
  7. callBackFunName : p.callBackFunName,
  8. 'czyhSearchGrid' : $("#czyhSearchGrid").val()
  9. }, function() {
  10. });
  11. }
  12. };
  13. /**
  14. * 加载操作用户查询模块
  15. */
  16. czyh.loadSearchModule({
  17. id : 'czyhSearchModule',
  18. from : 'czyh',
  19. callBackFunName : 'searchCzyhCallBack'
  20. });
  21. /**
  22. * 搜索条件回调函数
  23. *
  24. * @param {搜索条件对象}
  25. * data
  26. * @param {分隔符}
  27. * fgf
  28. */
  29. function searchCzyhCallBack(data, fgf) {
  30. huimv.searchGrid("czyhGrid", {
  31. url : 'getCzyhList.htm',
  32. params : [{
  33. name : 'param',
  34. value : data
  35. }, {
  36. name : 'fgf',
  37. value : fgf
  38. }]
  39. }, '<b>操作用户搜索结果</b>');
  40. }
  41. /**
  42. * 加载操作用户列表数据
  43. */
  44. function loadCzyhGrid(czyhSearchGrid) {
  45. var xtwh_czyh_fpjs = $("#xtwh_czyh_fpjs").val();
  46. var xtwh_czyh_czmm = $("#xtwh_czyh_czmm").val();
  47. jQuery("#czyhGrid").flexigrid({
  48. url : 'getCzyhList.htm',
  49. dataType : 'json',
  50. method : 'post',
  51. params : [{
  52. name : 'czyhSearchGrid',
  53. value : $('#czyhSearchGrid').val()
  54. }, {
  55. name : 'from',
  56. value : $("#from").val()
  57. }],
  58. title : '<b>操作用户浏览</b>',
  59. usepager : true,
  60. useRp : true,
  61. rp : 10,
  62. singleSelect : true,
  63. hidehead : false,
  64. showInputPage : true,
  65. showSelectRp : false,
  66. showTableToggleBtn : false,
  67. width : '790',
  68. resizable : false,
  69. height : '335',
  70. cache : false,// 清除缓存
  71. colModel : [{
  72. display : '行号',
  73. name : 'hh',
  74. width : 25,
  75. sortable : false,
  76. align : 'center',
  77. process : function(col, record, d) {
  78. jQuery(col).html(d + 1);
  79. }
  80. }, {
  81. display : '所属企业',
  82. name : 'qymc',
  83. width : 160,
  84. sortable : false,
  85. align : 'center'
  86. }, {
  87. display : '所属牧场',
  88. name : 'mcmc',
  89. width : 160,
  90. sortable : true,
  91. align : 'center'
  92. }, {
  93. display : '工号',
  94. name : 'gh',
  95. width : 80,
  96. sortable : true,
  97. align : 'center'
  98. }, {
  99. display : '姓名',
  100. name : 'yhxm',
  101. width : 100,
  102. sortable : false,
  103. align : 'center'
  104. }, {
  105. display : '职务',
  106. name : 'zwmc',
  107. width : 90,
  108. sortable : false,
  109. align : 'center'
  110. }, {
  111. display : '联系电话',
  112. name : 'lxdh',
  113. width : 90,
  114. sortable : false,
  115. align : 'center'
  116. }, {
  117. display : '操作',
  118. name : '',
  119. width : 150,
  120. sortable : false,
  121. align : 'center',
  122. process : function(col, record, postion, pid) {
  123. jQuery(col).addClass('s');
  124. var str = '<a onclick="viewCzyh(\'' + record.id + '\')">查看</a>&nbsp;&nbsp;';
  125. if (xtwh_czyh_czmm == "true") {
  126. str += '<a onclick="resetPW(\'' + record.id + '\')">重置密码</a>&nbsp;&nbsp;';
  127. }
  128. if (xtwh_czyh_fpjs == "true") {
  129. str += '<a onclick="setJsxx(\'' + record.id + '\')">分配角色</a>';
  130. }
  131. jQuery(col).html(str);
  132. }
  133. }]
  134. });
  135. }
  136. loadCzyhGrid($('#czyhSearchGrid'));
  137. /**
  138. * 加载操作用户查看页面
  139. * @param id
  140. */
  141. function viewCzyh(id) {
  142. huimv.loadPage('czyhRight', 'viewCzyh.htm', {
  143. "id" : id
  144. });
  145. }
  146. /**
  147. * 加载操作用户编辑页面
  148. * @param id
  149. */
  150. function editCzyh(id, from) {
  151. huimv.loadPage('czyhRight', 'editCzyh.htm', {
  152. "id" : id,
  153. "from" : from
  154. });
  155. }
  156. function resetPW(id) {
  157. jQuery.ajax({
  158. url: "resetPW.htm",
  159. dataType: "json",
  160. type: "post",
  161. async: false,
  162. data : {"id" : id},
  163. success: function(data){
  164. if (data.returnCode > 0) {
  165. Dialogs.alert("用户密码已重置为系统默认密码!", {
  166. title : '提示信息',
  167. width : 250,
  168. height : 80,
  169. top : 150
  170. });
  171. }
  172. }
  173. });
  174. }
  175. /**
  176. * 编辑完成后回调函数
  177. *
  178. * @param {} lx
  179. * @param {} data
  180. */
  181. function processAfterEditCzyh() {
  182. Dialogs.close();
  183. huimv.reloadGrid('czyhGrid');
  184. }
  185. /**
  186. * 给指定的用户分配角色信息
  187. * @param id
  188. */
  189. function setJsxx(yhid) {
  190. // var x = e.offsetLeft, y = e.offsetTop;
  191. // while (e = e.offsetParent) {
  192. // x += e.offsetLeft;
  193. // y += e.offsetTop;
  194. // }
  195. // x = x-600;
  196. // y = y-50;
  197. Dialogs.load('setJsxx.htm', {"yhid" : yhid}, {
  198. // 对话框基本配置选项
  199. draggable: true,//是否拖动
  200. autosize: false,//是否自适应大小
  201. resizable: true,//是否可以改变大小
  202. maximizable: true,//是否显示最大化最小化
  203. autopos: 'fixed',// 窗口是否(自动剧中,fixed)页面 默认’fixed’
  204. title: "分配角色",//窗口标题
  205. lightbox: true,//窗口应用时是否禁用其他操作
  206. width: 470,//窗口宽度
  207. height: 300,//窗口高度
  208. // top: y,
  209. // left: x,
  210. button: {
  211. ok: ['确定',function(){
  212. setYhqx();
  213. }],
  214. cancel: ['取消',function(){
  215. this.close();
  216. }]
  217. }
  218. });
  219. }