auditinguserpage.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="renderer" content="webkit|ie-comp|ie-stand">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="Cache-Control" content="no-siteapp" />
  9. <!--[if lt IE 9]>
  10. <script type="text/javascript" src="${ctx}/assets/lib/html5.js"></script>
  11. <script type="text/javascript" src="${ctx}/assets/lib/respond.min.js"></script>
  12. <script type="text/javascript" src="${ctx}/assets/lib/PIE_IE678.js"></script>
  13. <![endif]-->
  14. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui/css/H-ui.min.css" />
  15. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/H-ui.admin.css" />
  16. <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/Hui-iconfont/1.0.7/iconfont.css" />
  17. <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/icheck/icheck.css" />
  18. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/skin/default/skin.css" id="skin" />
  19. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/style.css" />
  20. <script type="text/ecmascript" src="${ctx}/assets/lib/jquery/1.9.1/jquery.js"></script>
  21. <script type="text/javascript" src="${ctx}/assets/static/h-ui/js/H-ui.js"></script>
  22. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqueryui/jquery-ui.css" />
  23. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqgrid/css/ui.jqgrid.css" />
  24. <script type="text/ecmascript" src="${ctx}/assets/lib/jqueryui/jquery-ui.js"></script>
  25. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/i18n/grid.locale-cn.js"></script>
  26. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/jquery.jqGrid.min.js"></script>
  27. <script type="text/javascript" src="${ctx}/assets/js/base.js"></script>
  28. <!--[if IE 6]>
  29. <script type="text/javascript" src="${ctx}/assets/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
  30. <script>DD_belatedPNG.fix('*');</script>
  31. <![endif]-->
  32. <script type="text/javascript">
  33. $(function() {
  34. $(window).resize(function(){
  35. $("#tree").setGridWidth($(window).width()-40); 
  36. });
  37. $("#tree").jqGrid({
  38. caption:'审批人员配置',
  39. url : '${ctx}/myconsole/complaint/approve/getAuditingUserPage',
  40. editurl:"${ctx}/myconsole/complaint/approve/saveUpdateAuditingUser",
  41. mtype : "POST",
  42. datatype : "json",
  43. sidx : "opttime",
  44. sord : "desc",
  45. prmNames : {
  46. id: "userid", 
  47. oper:"oper",    
  48. addoper:"add",
  49. editoper:"edit",
  50. deloper:"del" 
  51. },
  52. colModel : [{
  53. label : '送审人员编号',
  54. name : 'userid',
  55. editable: true,
  56. key : true,
  57. width : 60,
  58. formoptions:{
  59. elmsuffix:"<span style='color:red'>*<span>"
  60. },
  61. editrules:{required:true}
  62. },{
  63. label : '送审人员名称',
  64. name : 'username',
  65. width : 35,
  66. editable: true,
  67. edittype :"select",
  68. editoptions:{
  69. dataInit: function(elem){
  70. $(elem).width(160);
  71. },
  72. value:getUserOptions(),
  73. //添加
  74. dataEvents:[
  75. {
  76. type:'change',
  77. fn:function(e){
  78. //获取当前selectd的值
  79. var val = this.value;
  80. $.ajax({
  81. type:"post",
  82. async:false,
  83. data:{username:val},
  84. url:"${ctx}/myconsole/complaint/approve/getUserOptionsList",
  85. success:function(data){
  86. if (data != null) {
  87. console.log(data);
  88. $("#userid").val(data[0].userid);
  89. $("#orgid").val(data[0].orgid);
  90. $("#orgname").val(data[0].orgname);
  91. }
  92. }
  93. });
  94. }
  95. }
  96. ]
  97. }
  98. },{
  99. label : '送审人员单位编号 ',
  100. name : 'orgid',
  101. width : 80,
  102. editable: true,
  103. edittype:"text"
  104. },{
  105. label : '送审人员单位名称',
  106. name : 'orgname',
  107. width : 60,
  108. editable: true,
  109. edittype:"text"
  110. },{
  111. label : '审核人员编号',
  112. name : 'audituserid',
  113. width : 60,
  114. editable: true,
  115. edittype:"text",
  116. formoptions:{
  117. elmsuffix:"<span style='color:red'>*<span>"
  118. },
  119. editrules:{required:true}
  120. },{
  121. label : '审核人员名称',
  122. name : 'auditusername',
  123. width : 60,
  124. editable: true,
  125. edittype :"select",
  126. editoptions:{
  127. dataInit: function(elem){
  128. $(elem).width(160);
  129. },
  130. value:getUserOptions(),
  131. //添加
  132. dataEvents:[
  133. {
  134. type:'change',
  135. fn:function(e){
  136. //获取当前selectd的值
  137. var val = this.value;
  138. $.ajax({
  139. type:"post",
  140. async:false,
  141. data:{username:val},
  142. url:"${ctx}/myconsole/complaint/approve/getUserOptionsList",
  143. success:function(data){
  144. if (data != null) {
  145. $("#audituserid").val(data[0].userid);
  146. }
  147. }
  148. });
  149. }
  150. }
  151. ]
  152. }
  153. }],
  154. rownumbers : true,//添加左侧行号
  155. viewrecords : true,//是否在浏览导航栏显示记录总数
  156. rowNum : 10,//每页显示记录数
  157. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  158. autowidth : true,
  159. height : 'auto',
  160. pager : "#pager",
  161. });
  162. jQuery('#tree').navGrid('#pager',
  163. {
  164. edit : true,
  165. add : true,
  166. del : true,
  167. search : false,
  168. refresh : false,
  169. view : false,
  170. position : "left",
  171. cloneToTop : true
  172. },
  173. //点击编辑触发的区域
  174. {
  175. closeAfterEdit : true,
  176. recreateForm : true,
  177. width:600,
  178. //在表单显示后触发此方法
  179. beforeShowForm:function(formid){
  180. var usernameObj = formid.find('#username');
  181. var useridObj = formid.find('#userid');
  182. var orgidObj = formid.find('#orgid');
  183. var orgnameObj = formid.find('#orgname');
  184. var audituseridObj = formid.find('#audituserid');
  185. //设置输入框不可编辑和背景色
  186. usernameObj.attr('disabled',true);
  187. usernameObj.css({'background':'#cccccc'});
  188. orgidObj.attr('readOnly',true);
  189. orgidObj.css({'background':'#cccccc'});
  190. orgnameObj.attr('readOnly',true);
  191. orgnameObj.css({'background':'#cccccc'});
  192. audituseridObj.attr('readOnly',true);
  193. audituseridObj.css({'background':'#cccccc'});
  194. useridObj.attr('readOnly',true);
  195. useridObj.css({'background':'#cccccc'});
  196. },
  197. //在提交数据到服务器前触发
  198. beforeSubmit: function(postdata, formid){
  199. //获取组件主键 ID
  200. var userid = postdata.tree_id;
  201. $.each(postdata,function (index, value) {
  202. if(index!="oper"){
  203. modifyJosnKey(postdata,index,"auditingUser."+index);
  204. }
  205. })
  206. //重新为主键赋值
  207. postdata["keyid"]=userid;
  208. return [true,'']; //返回值必须这么写 目前没找到原因,用true 和 返回对象都不好使。待查
  209. },
  210. //在提交数据到服务器后触发
  211. afterSubmit: function(response,postdata) //
  212. {
  213. var res=eval('(' + response.responseText + ')');
  214. if(res.flag)
  215. {
  216. parent.layer.alert(res.message, {
  217. skin: 'layui-layer-molv' //样式类名
  218. ,closeBtn: 0
  219. });
  220. return [true,res.message,''];
  221. }else{
  222. parent.layer.alert(res.message, {
  223. skin: 'layui-layer-molv' //样式类名
  224. ,closeBtn: 0
  225. });
  226. return [false,res.message,''];
  227. }
  228. },
  229. errorTextFormat : function(data) {
  230. return 'Error: ' + data.responseText
  231. }
  232. },{
  233. //新建工作区
  234. closeAfterAdd : true, //添加完成后关闭
  235. width:600,
  236. serializeEditData: function(postdata) { //保存数据前,加工数据
  237. //获取组件主键 ID
  238. var userid = postdata.userid;
  239. $.each(postdata,function(index,value){
  240. if(index!="oper"){
  241. modifyJosnKey(postdata,index,"auditingUser."+index);
  242. }
  243. })
  244. postdata["keyid"] = userid;
  245. return postdata;
  246. },
  247. //在表单显示后触发此方法
  248. beforeShowForm:function(formid){
  249. var useridObj = formid.find('#userid');
  250. var orgidObj = formid.find('#orgid');
  251. var orgnameObj = formid.find('#orgname');
  252. var audituseridObj = formid.find('#audituserid');
  253. //设置输入框不可编辑和背景色
  254. orgidObj.attr('readOnly',true);
  255. orgidObj.css({'background':'#cccccc'});
  256. orgnameObj.attr('readOnly',true);
  257. orgnameObj.css({'background':'#cccccc'});
  258. audituseridObj.attr('readOnly',true);
  259. audituseridObj.css({'background':'#cccccc'});
  260. useridObj.attr('readOnly',true);
  261. useridObj.css({'background':'#cccccc'});
  262. },
  263. //在表单显示后触发,有一个参数为formid
  264. afterShowForm: function (formid){
  265. },
  266. //提交数据从服务器返回后触发
  267. afterSubmit: function(response,postdata) //
  268. {
  269. var res=eval('(' + response.responseText + ')');
  270. if(res.flag)
  271. {
  272. parent.layer.alert(res.message, {
  273. skin: 'layui-layer-molv' //样式类名
  274. ,closeBtn: 0
  275. });
  276. return [true,res.message,''];
  277. }else{
  278. parent.layer.alert(res.message, {
  279. skin: 'layui-layer-molv' //样式类名
  280. ,closeBtn: 0
  281. });
  282. return [false,res.message,''];
  283. }
  284. },
  285. errorTextFormat : function(data) {
  286. return 'Error: ' + data.responseText
  287. }
  288. },{
  289. //删除工作区
  290. //提交数据从服务器返回后触发
  291. //在提交数据到服务器前触发
  292. afterSubmit: function(response,postdata)
  293. {
  294. var res=eval('(' + response.responseText + ')');
  295. if(res.flag)
  296. {
  297. parent.layer.alert(res.message, {
  298. skin: 'layui-layer-molv' //样式类名
  299. ,closeBtn: 0
  300. });
  301. return [true,res.message,''];
  302. }else{
  303. parent.layer.alert(res.message, {
  304. skin: 'layui-layer-molv' //样式类名
  305. ,closeBtn: 0
  306. });
  307. return [false,res.message,''];
  308. }
  309. },
  310. errorTextFormat : function(data) {
  311. return 'Error: ' + data.responseText
  312. }
  313. },{
  314. // search options 这里支持多条件查询
  315. multipleSearch: true,
  316. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  317. afterSubmit: function(r, data) {
  318. var messageString = r.responseText;
  319. var mesObj = eval('(' + messageString + ')');
  320. return [mesObj.state, mesObj.message];
  321. }
  322. }
  323. );
  324. /* jQuery('#tree').jqGrid('bindKeys'); */
  325. })
  326. //获取系统所有用户列表
  327. function getUserOptions() {
  328. //动态生成select内容
  329. var str="";
  330. $.ajax({
  331. type:"post",
  332. async:false,
  333. url:"${ctx}/myconsole/complaint/approve/getUserOptionsList",
  334. success:function(data){
  335. if (data != null) {
  336. var jsonobj=eval(data);
  337. var length=jsonobj.length;
  338. for(var i=0;i<length;i++){
  339. if(i!=length-1){
  340. //这里是拼装option里面的 value
  341. str+=jsonobj[i].username+":"+jsonobj[i].username+";";
  342. }else{
  343. str+=jsonobj[i].username+":"+jsonobj[i].username;
  344. }
  345. }
  346. }
  347. }
  348. });
  349. return str;
  350. }
  351. </script>
  352. <title>我的桌面</title>
  353. </head>
  354. <body>
  355. <div class="page-container">
  356. <table id="tree"></table>
  357. <div id="pager"></div>
  358. </div>
  359. <footer class="footer mt-20">
  360. <div class="container">
  361. <p></p>
  362. </div>
  363. </footer>
  364. </body>
  365. </html>