punishment-section-list.jsp 12 KB

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