import-data-file-list.jsp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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" type="text/css"/>
  10. <link rel="stylesheet" type="text/css" id="skin" prePath="${ctx}/qui/"/>
  11. <link rel="stylesheet" type="text/css" id="customSkin"/>
  12. <!--框架必需end-->
  13. <!--数据表格start-->
  14. <script src="${ctx}/qui/libs/js/table/quiGrid.js" type="text/javascript"></script>
  15. <!--数据表格end-->
  16. <!--箭头分页start-->
  17. <script type="text/javascript" src="${ctx}/qui/libs/js/nav/pageArrow.js"></script>
  18. <!--箭头分页end-->
  19. <!--表单异步提交start-->
  20. <script src="${ctx}/qui/libs/js/form/form.js" type="text/javascript"></script>
  21. <!--表单异步提交end-->
  22. <script type="text/javascript">
  23. var g_pageNo = 1;
  24. var g_pageSize = 10;
  25. //刷新记忆
  26. var checkedArray = [];
  27. //定时刷新页面
  28. // var iID=setInterval("searchHandler()",5000);
  29. //数据表格使用
  30. var g;
  31. var gridData;
  32. function initComplete(){
  33. g = $("#maingrid").quiGrid({
  34. columns: [
  35. { display: '文件名', name: 'fileName', align: 'center', width: "16%"},
  36. { display: '文件大小', name: 'fileSize', align: 'center', width: "5%"},
  37. { display: '导入类型', name: 'showImportType', align: 'center', width: "8%"},
  38. { display: '上传时间', name: 'uploadTime', align: 'center', width: "5%"},
  39. { display: '数据年度信息', name: 'year', align: 'center', width: "8%"},
  40. { display: '数据状态', name: 'showImportStatus', align: 'center', width: "8%"},
  41. { display: '状态描述', name: 'statusDescription', align: 'center', width: "20%"
  42. ,render: function (rowdata, rowindex, value, column){
  43. if(rowdata.dataStatus=='in_import'){
  44. return '<span>'+value+'<img src="${ctx}/image/loading.gif" style="height:15px;width:15px;vertical-align:middel;"></span>';
  45. }else{
  46. return value;
  47. }
  48. }
  49. },
  50. { display: '创建人', name: 'showCreater', align: 'center', width: "5%"},
  51. { display: '创建时间', name: 'createTime', align: 'center', width: "8%"},
  52. { display: '操作', isAllowHide: false, align: 'center', width:"10%"
  53. ,render: function (rowdata, rowindex, value, column){
  54. var str =
  55. '<div class="padding_top4 padding_left20">'
  56. <@pop_perm url="/import/delete.do">
  57. + '<a href="#" onclick="onDelete('+ rowdata.importId+')"><span class="icon_remove">删除</span></a>'
  58. </@pop_perm>
  59. '</div>';
  60. if(rowdata.importType=='user_water_info'){
  61. str =
  62. '<div class="padding_top4 padding_left20">'
  63. <@pop_perm url="/import/delete.do">
  64. + '<a href="#" onclick="onDelete('+ rowdata.importId+')"><span class="icon_remove">删除</span></a>'
  65. </@pop_perm>
  66. <@pop_perm url="/import/delThisImport.do">
  67. + '<a href="#" onclick="delThisImport('+ rowdata.importId+')"><span class="icon_delete">删除数据</span></a>'
  68. </@pop_perm>
  69. '</div>';
  70. }
  71. return str;
  72. }
  73. }
  74. ],
  75. toolbar:{
  76. items:[
  77. <@pop_perm url="/import/importOrgInfo.do">
  78. {line:true},
  79. {text:'导入单位基本信息',click:importOrgInfo, iconClass:'icon_add'},
  80. </@pop_perm>
  81. <@pop_perm url="/import/importUserWaterInfo.do">
  82. {line:true},
  83. {text:'导入单位月用水量信息',click:importUserWaterInfo, iconClass:'icon_add'},
  84. {line:true},
  85. {text:'同步oracle单位信息',click:importOracleOrgData, iconClass:'icon_add'},
  86. {line:true},
  87. {text:'同步oracle抄表',click:importOracleWaterData, iconClass:'icon_add'},
  88. </@pop_perm>
  89. <@pop_perm url="/import/delete.do">
  90. {line:true},
  91. {text:'批量删除',click:batchDelete, iconClass:'icon_delete'},
  92. </@pop_perm>
  93. {line:true}
  94. ]
  95. },
  96. data:[], sortName: 'importId',rownumbers:true,checkbox:true,usePager: false,height: '100%', width:"100%",heightDiff:-40,pageSize:g_pageSize,
  97. onChangeSort : function(){
  98. getData(g.options.sortName,g.options.sortOrder,g_pageNo,g_pageSize);
  99. return false;
  100. },isChecked:checkedHandler,onCheckRow: checkRowHandler, onCheckAllRow: checkAllRowHandler
  101. });
  102. //点击分页触发
  103. }
  104. $(function(){
  105. getData(g_pageNo,g_pageSize);
  106. })
  107. /**初始时通过向后台传递排序id、排序顺序、初始页码、每页条数**/
  108. function getData(pageNo,pageSize){
  109. jQuery.post("${ctx}/import/listPage.do",
  110. getFormParams(pageNo,pageSize),
  111. function(result){
  112. gridData = result;
  113. //刷新表格
  114. g.loadData(gridData);
  115. //设置左边内容页
  116. var content ="共有" + gridData["pager.totalRows"] + "条记录";
  117. $("#letfContent").html("");
  118. $("#letfContent").html(content);
  119. //取得分页组件
  120. var pager=$("#pager");
  121. //设置总页页数
  122. pager.attr("total",gridData["pager.totalRows"]);
  123. pager.render();
  124. //绑定翻页事件
  125. pager.unbind("pageChange");
  126. pager.bind("pageChange",function(e,index){
  127. g_pageNo = index + 1;
  128. getData(g_pageNo,g_pageSize);
  129. });
  130. //绑定选择每页显示记录数事件
  131. pager.bind("sizeChange",function(e,num){
  132. g_pageSize = num;
  133. getData(g_pageNo,g_pageSize);
  134. });
  135. },"json");
  136. }
  137. //查询
  138. function searchHandler(){
  139. // checkedArray.length = 0;
  140. //重新加载数据,设置当前页面为1
  141. getData(g_pageNo,g_pageSize);
  142. }
  143. /**获得查询表单的提交查询的值**/
  144. function getFormParams(pageNo,pageSize){
  145. $("#pageNo").val(pageNo);
  146. $("#pageSize").val(pageSize);
  147. return $("#searchForm").formToArray();
  148. }
  149. /**重置于查询表单,然后重新加载表格数据**/
  150. function resetSearch(){
  151. $("#searchForm")[0].reset();
  152. //重新加载数据,设置当前页面为1
  153. getData(g_pageNo,g_pageSize);
  154. }
  155. //单条记录删除
  156. function onDelete(rowid){
  157. top.Dialog.confirm("确定要删除该记录吗?",function(){
  158. //删除记录
  159. jQuery.post("${ctx}/import/delete.do",
  160. {"ids":rowid},
  161. function(responseText){
  162. if(responseText.status=="y"){
  163. top.Dialog.alert(responseText.info);
  164. resetSearch();
  165. }else{
  166. top.Dialog.alert(responseText.info);
  167. }
  168. },
  169. "json");
  170. });
  171. }
  172. //删除该批次下导入的数据
  173. function delThisImport(rowid){
  174. top.Dialog.confirm("确定要删除数据吗?",function(){
  175. //删除记录
  176. jQuery.post("${ctx}/import/delThisImport.do",
  177. {"ids":rowid},
  178. function(responseText){
  179. if(responseText.status=="y"){
  180. top.Dialog.alert(responseText.info);
  181. resetSearch();
  182. }else{
  183. top.Dialog.alert(responseText.info);
  184. }
  185. },
  186. "json");
  187. });
  188. }
  189. //批量删除
  190. function batchDelete() {
  191. var rows = g.getSelectedRows();
  192. var rowsLength = rows.length;
  193. if(rowsLength == 0) {
  194. top.Dialog.alert("请选中要删除的记录!");
  195. return;
  196. }
  197. top.Dialog.confirm("确定要删除吗?",function(){
  198. jQuery.post("${ctx}/import/delete.do",
  199. //获取所有选中行
  200. getSelectId(g),
  201. function(responseText){
  202. if(responseText.status=="y"){
  203. top.Dialog.alert(responseText.info);
  204. resetSearch();
  205. }else{
  206. top.Dialog.alert(responseText.info);
  207. return false;
  208. }
  209. },
  210. "json");
  211. });
  212. //获取所有选中行获取选中行的id 格式为 ids=1&ids=2
  213. function getSelectId(grid) {
  214. var selectedRows = grid.getSelectedRows();
  215. var selectedRowsLength = selectedRows.length;
  216. var ids = "";
  217. for(var i = 0;i<selectedRowsLength;i++) {
  218. ids += selectedRows[i].importId + ",";
  219. }
  220. return {"ids":ids};
  221. }
  222. }
  223. function importOrgInfo(){
  224. top.Dialog.open({
  225. URL:"${ctx}/import/importOrgInfo.do",
  226. Title:"导入单位基本信息",
  227. Width:750,
  228. Height:200
  229. });
  230. }
  231. function importOracleOrgData(){
  232. // alert("?");
  233. top.Dialog.open({
  234. URL:"${ctx}/import/importOracleOrgData.do",
  235. Title:"导入oracle单位信息",
  236. Width:750,
  237. Height:200
  238. });
  239. }
  240. function importOracleWaterData(){
  241. top.Dialog.open({
  242. URL:"${ctx}/import/importOracleWaterData.do",
  243. Title:"导入oracle抄表信息",
  244. Width:750,
  245. Height:200
  246. });
  247. }
  248. function importUserWaterInfo(){
  249. //alert("??");
  250. top.Dialog.open({
  251. URL:"${ctx}/import/importUserWaterInfo.do",
  252. Title:"导入单位月用水量信息",
  253. Width:750,
  254. Height:200
  255. });
  256. }
  257. function findCheckedArray(id){
  258. for(var i =0;i<checkedArray.length;i++){
  259. if(checkedArray[i] == id) return i;
  260. }
  261. return -1;
  262. }
  263. function addCheckedArray(id,name){
  264. if(findCheckedArray(id) == -1){
  265. checkedArray.push(id);
  266. }
  267. }
  268. function removeCheckedArray(id){
  269. var i = findCheckedArray(id);
  270. if(i==-1) return;
  271. checkedArray.splice(i,1);
  272. }
  273. function checkedHandler(rowdata){
  274. if (findCheckedArray(rowdata.importId) == -1)
  275. return false;
  276. return true;
  277. }
  278. function checkRowHandler(checked, data){
  279. if (checked) addCheckedArray(data.importId,data.name);
  280. else removeCheckedArray(data.importId,data.name);
  281. }
  282. function checkAllRowHandler(checked){
  283. for (var rowid in this.records){
  284. if(checked){
  285. addCheckedArray(this.records[rowid]['importId'],this.records[rowid]['name']);
  286. }else{
  287. removeCheckedArray(this.records[rowid]['importId'],this.records[rowid]['name']);
  288. }
  289. }
  290. }
  291. </script>
  292. </head>
  293. <body>
  294. <div style="display:none;">
  295. <form action="" id="searchForm" method="post">
  296. <input type="hidden" id="pageNo" name="pageNo" value="1"/>
  297. <input type="hidden" id="pageSize" name="pageSize" value="10"/>
  298. </form>
  299. </div>
  300. <div id="scrollContent">
  301. <div class="padding_right5">
  302. <div id="maingrid"></div>
  303. </div>
  304. </div>
  305. <!-- 分页组件 -->
  306. <div style="height:35px;">
  307. <div id="letfContent" class="float_left padding5"></div>
  308. <div class="float_right padding5">
  309. <div id="pager" total="0" class="pageArrow" showSelect="true" inputPosition="right"></div>
  310. </div>
  311. <div class="clear"></div>
  312. </div>
  313. </body>
  314. </html>