punishment-section-list.jsp 12 KB

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