f65b0c9911b8afe4f361e5f3673fefd68135e4a6.svn-base 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <!--框架必需start-->
  6. <script type="text/javascript" src="../../libs/js/jquery.js"></script>
  7. <script type="text/javascript" src="../../libs/js/language/cn.js"></script>
  8. <script type="text/javascript" src="../../libs/js/framework.js"></script>
  9. <link href="../../libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
  10. <link rel="stylesheet" type="text/css" id="skin" prePath="../../"/>
  11. <link rel="stylesheet" type="text/css" id="customSkin"/>
  12. <!--框架必需end-->
  13. <!--数据表格start-->
  14. <script src="../../libs/js/table/quiGrid.js" type="text/javascript"></script>
  15. <!--数据表格end-->
  16. <!-- 日期控件start -->
  17. <script type="text/javascript" src="../../libs/js/form/datePicker/WdatePicker.js"></script>
  18. <!-- 日期控件end -->
  19. <!-- 表单验证start -->
  20. <script src="../../libs/js/form/validationRule.js" type="text/javascript"></script>
  21. <script src="../../libs/js/form/validation.js" type="text/javascript"></script>
  22. <!-- 表单验证end -->
  23. <style>
  24. .detailFormContainer{
  25. padding:5px 0 5px 10px;
  26. text-align:left;
  27. width:800px;
  28. }
  29. .detailFormTable{
  30. border:0;
  31. }
  32. .detailFormTable td{
  33. border:0;
  34. height:35px;
  35. }
  36. .detailFormTitle{
  37. height:30px;
  38. line-height:30px;
  39. font-size:16px;
  40. font-weight:bold;
  41. background-image: url(../../libs/images/formEle/groupTitle.jpg);
  42. background-repeat: no-repeat;
  43. background-position:0% 100%;
  44. padding:0 0 0 5px;
  45. }
  46. </style>
  47. </head>
  48. <body>
  49. <div class="padding_right5">
  50. <div id="maingrid"></div>
  51. </div>
  52. <script type="text/javascript">
  53. var testData={"pager.pageNo":1,"pager.totalRows":21,"rows":[{"orgName":"财务部","userEducation":"专科","userEmployTime":"2012-09-04","userId":15,"userLoginName":"zhuguan","userName":"财务部主管","userPassword":"123456","userSex":"女"},{"orgName":"南京分公司","userEducation":"专科","userEmployTime":"2012-09-03","userId":2,"userLoginName":"guest","userName":"访客","userPassword":"123456","userSex":"男"},{"orgName":"行政部","userEducation":"专科","userEmployTime":"2012-09-04","userId":16,"userLoginName":"fuzeren","userName":"行政部负责人","userPassword":"123456","userSex":"男"},{"orgName":"市场部","userEducation":"专科","userEmployTime":null,"userId":22,"userLoginName":"dd","userName":"点对点","userPassword":"111111","userSex":"女"},{"orgName":"南京分公司","userEducation":"专科","userEmployTime":"2013-12-17","userId":21,"userLoginName":"11a","userName":"是","userPassword":"111111","userSex":"女"},{"orgName":"市场部","userEducation":"专科","userEmployTime":"2012-09-12","userId":14,"userLoginName":"jingli","userName":"市场部经理","userPassword":"123456","userSex":"男"},{"orgName":"市场1组","userEducation":"本科","userEmployTime":"2012-07-24","userId":1,"userLoginName":"chen","userName":"小陈","userPassword":"123456","userSex":"男"},{"orgName":"市场1组","userEducation":"专科","userEmployTime":"2012-08-28","userId":7,"userLoginName":"qian","userName":"小钱","userPassword":"123456","userSex":"男"},{"orgName":"杭州办事处","userEducation":"专科","userEmployTime":"2012-09-03","userId":11,"userLoginName":"zheng","userName":"小郑","userPassword":"123456","userSex":"女"},{"orgName":"市场2组","userEducation":"博士","userEmployTime":"2012-09-04","userId":6,"userLoginName":"zhao","userName":"小赵","userPassword":"123456","userSex":"男"}]};
  54. var userEducationData={"list":[{"value":"专科","key":"专科"},{"value":"本科","key":"本科"},{"value":"硕士","key":"硕士"},{"value":"博士","key":"博士"}]};
  55. var sexData={"list":[{"value":"男","key":"男"},{"value":"女","key":"女"}]};
  56. var grid;
  57. function initComplete(){
  58. grid = $("#maingrid").quiGrid({
  59. columns:[
  60. { display: '姓名', name: 'userName', align: 'left', width: "20%"},
  61. { display: '所属部门', name: 'orgName', align: 'left', width: "20%"},
  62. { display: '性别', name: 'userSex', align: 'left', width: "20%"},
  63. { display: '入职时间', name: 'userEmployTime', align: 'left', width:"20%"} ,
  64. { display: '学历', name: 'userEducation', align: 'left', width:"20%"}
  65. ],
  66. data: testData,width:'100%', height:'100%',
  67. detail: { onShowDetail: showEmployees, height: 'auto' },
  68. onError: function (a, b){
  69. //错误事件
  70. }
  71. });
  72. };
  73. //显示所选部门下的员工
  74. function showEmployees(row, detailPanel,callback){
  75. var childGrid = document.createElement('div');
  76. $(detailPanel).append(childGrid);
  77. $(childGrid).addClass("detailFormContainer");
  78. var $table=$('<div class="detailFormTitle">本行编辑</div> <form id=form_'+row.userId+' method="post" action="" failAlert="表单填写不正确,请按要求填写!" showOnMouseOver="false">'+
  79. '<table class="detailFormTable" style="width:100%">'+
  80. '<tr><td width="100" class="ali03">姓名:</td><td><input type="text" id="inputa1" class="validate[required] float_left"/><span class="star float_left">*</span><div class="validation_info"></div><div class="clear"></div></td></tr>'+
  81. '<tr><td class="ali03">所属部门:</td><td><input type="text" id="inputa2" class="validate[required] float_left" /><span class="star float_left">*</span><div class="validation_info"></div><div class="clear"></div></td></tr> '+
  82. '<tr><td class="ali03">性别:</td><td><select id="inputa3" class="validate[required] float_left" prompt="请选择" ></select><span class="star float_left">*</span><div class="validation_info"></div><div class="clear"></div></td></tr> '+
  83. '<tr><td class="ali03">入职时间:</td><td><input type="text" id="inputa4" class="date validate[required] float_left"/><span class="star float_left">*</span><div class="validation_info"></div><div class="clear"></div></td></tr> '+
  84. '<tr><td class="ali03">学历:</td><td><select id="inputa5" class="validate[required] float_left" prompt="请选择" ></select><span class="star float_left">*</span><div class="validation_info"></div><div class="clear"></div></td></tr>'+
  85. '<tr><td colspan="2" class="ali01"><div style="padding-left:100px;"><input type="button" value="提交" id="inputa6" onclick=validateForm("#form_'+row.userId+'")>&nbsp;<input type="reset" value="重置" id="inputa7"/></div></td></tr>'+
  86. '</table></form>')
  87. $(childGrid).append($table);
  88. $table.find("#inputa1").val(row.userName);
  89. $table.find("#inputa1").render();
  90. $table.find("#inputa2").val(row.orgName);
  91. $table.find("#inputa2").render();
  92. $table.find("#inputa3").data("data",sexData);
  93. $table.find("#inputa3").attr("selectedValue",row.userSex);
  94. $table.find("#inputa3").render();
  95. $table.find("#inputa4").val(row.userEmployTime);
  96. $table.find("#inputa4").render();
  97. $table.find("#inputa5").data("data",userEducationData);
  98. $table.find("#inputa5").attr("selectedValue",row.userEducation);
  99. $table.find("#inputa5").render();
  100. $table.find("#inputa6").render();
  101. $table.find("#inputa7").render();
  102. $table.validationEngine({showOnMouseOver:false});
  103. }
  104. function validateForm(containerId){
  105. var valid = $(containerId).validationEngine({returnIsValid: true,showOnMouseOver:false});
  106. if(valid == true){
  107. top.Dialog.alert('进行提交处理,完成后刷新数据。',function(){
  108. grid.loadData();
  109. });
  110. }else{
  111. top.Dialog.alert('表单填写不正确,请按要求填写!');
  112. }
  113. }
  114. function clickHandler(str){
  115. top.Dialog.alert("弹出窗口操作“"+str+"”,完成后刷新数据。",function(){
  116. testData.rows[0].open=false;
  117. //第二个参数表示刷新数据时保持之前展开的子表
  118. grid.loadData(null,true);
  119. })
  120. }
  121. </script>
  122. </body>
  123. </html>