punishment-section-list.jsp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>奖罚区间</title>
  6. <!--框架必需start-->
  7. <script type="text/javascript" src="${ctx}/qui/libs/js/jquery.js"></script>
  8. <script type="text/javascript" src="${ctx}/qui/libs/js/framework.js"></script>
  9. <link href="${ctx}/qui/libs/css/import_basic.css" rel="stylesheet"
  10. type="text/css" />
  11. <link rel="stylesheet" type="text/css" id="skin" prePath="${ctx}/qui/" />
  12. <link rel="stylesheet" type="text/css" id="customSkin" />
  13. <!--框架必需end-->
  14. <!--数据表格start-->
  15. <script src="${ctx}/qui/libs/js/table/quiGrid.js" type="text/javascript"></script>
  16. <!--数据表格end-->
  17. <!--箭头分页start-->
  18. <script type="text/javascript" src="${ctx}/qui/libs/js/nav/pageArrow.js"></script>
  19. <!--箭头分页end-->
  20. <!--表单异步提交start-->
  21. <script src="${ctx}/qui/libs/js/form/form.js" type="text/javascript"></script>
  22. <!--表单异步提交end-->
  23. <style type="text/css">
  24. .position{
  25. margin:5px 0px 5px 20px;
  26. }
  27. </style>
  28. <script type="text/javascript">
  29. var g_pageNo = 1;
  30. var g_pageSize = 10;
  31. //数据表格使用
  32. var g;
  33. var gridData;
  34. var gridArray=[];
  35. function initComplete(){
  36. g = $("#maingrid").quiGrid({
  37. columns: [
  38. { display: '区间类别', name: '', align: 'center', width: "8%",
  39. render : function(rowdata, rowindex, value, column){
  40. return "惩罚区间";
  41. }
  42. },
  43. { display: '用户类型', name: 'userType', align: 'center', width: "8%",
  44. render : function(rowdata, rowindex, value, column){
  45. if("1"==value)
  46. return "自来水户";
  47. if("2"==value)
  48. return "取水户";
  49. }
  50. },
  51. { display: '考核区间类别', name: 'sectionType', align: 'center', width: "8%",
  52. render : function(rowdata, rowindex, value, column){
  53. if("quarter"==value)
  54. return "季度考核";
  55. if("month"==value)
  56. return "月份考核";
  57. if("yearhf"==value)
  58. return "半年考核";
  59. }
  60. },
  61. { display: '状态', name: 'status', align: 'center', width: "8%",
  62. render : function(rowdata, rowindex, value, column){
  63. if("0"==value)
  64. return "<font color=red>禁用</font>";
  65. if("1"==value)
  66. return "<font color=blue>启用</font>";
  67. }
  68. },
  69. { display: '创建人', name: 'userName', align: 'center', width: "10%"},
  70. { display: '创建时间', name: 'createDate', align: 'center', width: "10%"},
  71. { display: '备注', name: 'remark', align: 'center', width: "20%"},
  72. { display: '操作', isAllowHide: false, align: 'left', width:"15%",
  73. render: function (rowdata, rowindex, value, column){
  74. return '<div class="padding_top4 padding_left20">'
  75. +'<a href="#" onclick="onEdit(' + rowdata.punishmentId +')"><span class="icon_edit">修改</span></a>'
  76. +'<a href="#" onclick="onDelete(' + rowdata.punishmentId +')"><span class="icon_remove">删除</span></a>'
  77. + '</div>';
  78. }
  79. }
  80. ],
  81. toolbar:{
  82. items:[
  83. <@pop_perm url="/punishmentSection/editPunishSection.do">
  84. {text:'新增',click:addUnit,iconClass:'icon_add'},
  85. </@pop_perm>
  86. {line:true}
  87. ]
  88. },
  89. data:[],rownumbers:true,dataAction:'local',checkbox:false,usePager: false,isScroll: false, frozen:false,
  90. height: '100%', width:"100%",heightDiff:-40,detail: { onShowDetail: showBaseSection, height: 'auto' }
  91. });
  92. //显示所选惩罚区间下的区段
  93. function showBaseSection(row, detailPanel,callback){
  94. $.post('${ctx}/section/listSection.do',{punishmentId:row.punishmentId},function(result){
  95. if(result.rows.length > 0){
  96. var childGrid = document.createElement('div');
  97. $(detailPanel).append(childGrid);
  98. var childGrid=$(childGrid).css('margin','5px 0px 5px 55px').quiGrid({
  99. columns: [
  100. { display: '区间段', name: 'section', align: 'center',width: "8%"},
  101. { display: '区间上限', name: 'sectionUpLimit', align: 'center',width: "10%"},
  102. { display: '区间下限', name: 'sectionLowerLimit', align: 'center',width: "10%"},
  103. { display: '是否包含上限', name: 'containUp', align: 'center',width: "10%",
  104. render : function(rowdata, rowindex, value, column){
  105. if("0"==value)
  106. return "否";
  107. if("1"==value)
  108. return "是";
  109. }
  110. } ,
  111. { display: '是否包含下限', name: 'containLower', align: 'center',width: "10%",
  112. render : function(rowdata, rowindex, value, column){
  113. if("0"==value)
  114. return "否";
  115. if("1"==value)
  116. return "是";
  117. }
  118. },
  119. { display: '罚款比例', name: 'fineProportion', align: 'center',width: "10%"},
  120. { display: '创建人', name: 'userName', align: 'center',width: "12%"},
  121. { display: '创建时间', name: 'createTime', align: 'center',width: "10%"},
  122. { display: '操作', isAllowHide: false, align: 'center', width:"13%",
  123. render: function (rowdata, rowindex, value, column){
  124. return '<div class="padding_top4 padding_left20">'
  125. +'<a href="#" onclick="onEditSection(' + rowdata.sectionId +')"><span class="icon_edit">修改</span></a>'
  126. +'<a href="#" onclick="onDeleteSection(' + rowdata.sectionId +','+row.punishmentId+')"><span class="icon_remove">删除</span></a>'
  127. + '</div>';
  128. }
  129. }
  130. ],
  131. toolbar:{
  132. items:[
  133. <@pop_perm url="/section/edit.do">
  134. {text:'新增',click:function(){addSection(row.punishmentId)},iconClass:'icon_add'},
  135. </@pop_perm>
  136. {line:true}
  137. ]
  138. },
  139. isScroll: false,width: '80%', columnWidth: 120,usePager:false,
  140. url: '${ctx}/section/listSection.do?punishmentId='+ row.punishmentId,
  141. data: result,
  142. //onAfterShowData可以自定义回调
  143. onAfterShowData: callback
  144. });
  145. var obj={};
  146. obj.id=row.punishmentId;
  147. obj.g=childGrid;
  148. gridArray.push(obj);
  149. }
  150. },"json");
  151. }
  152. }
  153. //点击分页触发
  154. $(function(){
  155. getData(g_pageNo,g_pageSize);
  156. })
  157. /**初始时通过向后台传递排序id、排序顺序、初始页码、每页条数**/
  158. function getData(pageNo,pageSize){
  159. jQuery.post("${ctx}/punishmentSection/listPage.do",
  160. getFormParams(pageNo,pageSize),
  161. function(result){
  162. gridData = result;
  163. //刷新表格
  164. g.loadData(gridData);
  165. //设置左边内容页
  166. var content ="共有" + gridData["pager.totalRows"] + "条记录";
  167. $("#letfContent").html("");
  168. $("#letfContent").html(content);
  169. //取得分页组件
  170. var pager=$("#pager");
  171. //设置总页页数
  172. pager.attr("total",gridData["pager.totalRows"]);
  173. pager.render();
  174. //绑定翻页事件
  175. pager.unbind("pageChange");
  176. pager.bind("pageChange",function(e,index){
  177. g_pageNo = index + 1;
  178. getData(g_pageNo,g_pageSize);
  179. });
  180. //绑定选择每页显示记录数事件
  181. pager.bind("sizeChange",function(e,num){
  182. g_pageSize = num;
  183. getData(g_pageNo,g_pageSize);
  184. });
  185. },"json");
  186. }
  187. //查询
  188. function searchHandler(){
  189. //重新加载数据,设置当前页面为1
  190. getData(1,g_pageSize);
  191. }
  192. /**获得查询表单的提交查询的值**/
  193. function getFormParams(pageNo,pageSize){
  194. $("#pageNo").val(pageNo);
  195. $("#pageSize").val(pageSize);
  196. return $("#searchForm").formToArray();
  197. }
  198. /**重置于查询表单,然后重新加载表格数据**/
  199. function resetSearch(){
  200. $("#searchForm")[0].reset();
  201. //重新加载数据,设置当前页面为1
  202. getData(1,g_pageSize);
  203. }
  204. //编辑惩罚区间
  205. function onEdit(rowId) {
  206. top.Dialog.open({
  207. URL : "${ctx}/punishmentSection/editPunishSection.do?punishmentId="+rowId,
  208. Title : "编辑惩罚区间",
  209. Width : 670,
  210. Height : 600
  211. });
  212. }
  213. //新增惩罚区间
  214. function addUnit() {
  215. top.Dialog.open({
  216. URL : "${ctx}/punishmentSection/editPunishSection.do",
  217. Title : "新增惩罚区间",
  218. Width : 670,
  219. Height : 600
  220. });
  221. }
  222. //单条记录删除(惩罚区间)
  223. function onDelete(rowid){
  224. top.Dialog.confirm("确定要删除该记录吗?",function(){
  225. //删除记录
  226. jQuery.post("${ctx}/punishmentSection/delete.do",
  227. {"ids":rowid},
  228. function(responseText){
  229. if(responseText.status=="y"){
  230. top.Dialog.alert(responseText.info);
  231. resetSearch();
  232. }else{
  233. top.Dialog.alert(responseText.info);
  234. }
  235. },
  236. "json");
  237. });
  238. }
  239. //新增区间
  240. function addSection(punishmentId) {
  241. top.Dialog.open({
  242. URL : "${ctx}/section/edit.do?punishmentId="+punishmentId,
  243. Title : "新增区间",
  244. Width : 650,
  245. Height : 240
  246. });
  247. }
  248. //编辑区间
  249. function onEditSection(rowId) {
  250. top.Dialog.open({
  251. URL : "${ctx}/section/edit.do?sectionId="+rowId,
  252. Title : "编辑区间",
  253. Width : 650,
  254. Height : 240
  255. });
  256. }
  257. //单条记录删除(区间)
  258. function onDeleteSection(rowid,punishmentId){
  259. top.Dialog.confirm("确定要删除该记录吗?",function(){
  260. //删除记录
  261. jQuery.post("${ctx}/section/delete.do",
  262. {"ids":rowid},
  263. function(responseText){
  264. if(responseText.status=="y"){
  265. handleResult(punishmentId);
  266. }else{
  267. top.Dialog.alert(responseText.info);
  268. }
  269. },
  270. "json");
  271. });
  272. }
  273. //删除后的提示
  274. function handleResult(punishmentId){
  275. top.Dialog.alert("删除成功!");
  276. //只刷新当前子表
  277. var childGrid;
  278. $.each(gridArray,function(idx,item){
  279. if(item.id==punishmentId){
  280. childGrid=item.g;
  281. }
  282. })
  283. childGrid.loadData();
  284. }
  285. //只刷新当前子表
  286. function refreshChild(punishmentId){
  287. var childGrid;
  288. $.each(gridArray,function(idx,item){
  289. if(item.id==punishmentId){
  290. childGrid=item.g;
  291. }
  292. })
  293. if(childGrid){
  294. childGrid.loadData();
  295. }
  296. }
  297. </script>
  298. </head>
  299. <body>
  300. <div>
  301. <form action="" id="searchForm" method="post">
  302. <input type="hidden" id="pageNo" name="pageNo" value="1" /> <input
  303. type="hidden" id="pageSize" name="pageSize" value="10" />
  304. </form>
  305. </div>
  306. <div id="scrollContent">
  307. <div class="padding_right5">
  308. <div id="maingrid"></div>
  309. </div>
  310. </div>
  311. <!-- 分页组件 -->
  312. <div style="height: 35px;">
  313. <div id="letfContent" class="float_left padding5"></div>
  314. <div class="float_right padding5">
  315. <div id="pager" total="0" class="pageArrow" showSelect="true"
  316. inputPosition="right"></div>
  317. </div>
  318. <div class="clear"></div>
  319. </div>
  320. </body>
  321. </html>