reportManageZdtty.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>报表管理</title>
  6. <script src="../../js/min-loader-next.js"></script>
  7. </head>
  8. <body class="content">
  9. <div class="order-body">
  10. <div class="order-tiaojian back-gray">
  11. <div class="tiaojian-part1" id = "conditions">
  12. <div class="fl f12-gray4-op">所选条件:</div>
  13. </div>
  14. <div class="tiaojian-part2 fr demoTable">
  15. <button class="order-bnt1 layui-btn" onclick="reloadSearch()" >查询</button>
  16. <button class="layui-btn order-bnt2" onclick="reset()">重置</button>
  17. <button class="order-bnt2 layui-btn" onclick="uploadExcel()">报表生成</button>
  18. <a href="#" id="toggle" class="top">收起</a>
  19. </div>
  20. </div>
  21. <form class="layui-form" action="" id = "formRole">
  22. <div class="order-select back-border" id="content">
  23. <div class="d-dashed" style="margin: 10px 0;"></div>
  24. <div class="layui-inline">
  25. <label class="f12-gray4">生成日期:</label>
  26. <div class="layui-input-inline" style="position: relative;">
  27. <input type="text" class="layui-input" id="date" placeholder="请选择日期" readOnly/>
  28. </div>
  29. </div>
  30. <div class="layui-inline">
  31. <label class="f12-gray4">文件名称:</label>
  32. <input name="fileName" id ="fileName" autocomplete="off" placeholder="请输入文件名称" class="search-select" onchange = "changeSelectCon(1,this,'inp')">
  33. </div>
  34. </div>
  35. </form>
  36. </div>
  37. <div class="shadow-content" style="margin:1.5rem;">
  38. <table id="tableTest" lay-filter="tableFilter"></table>
  39. </div>
  40. <script type="text/html" id="barDemo">
  41. <a class="layui-btn layui-btn-xs" lay-event="detail">详情查看</a>
  42. <a class="layui-btn layui-btn-xs" lay-event="downLoad">下载</a>
  43. <a class="layui-btn layui-btn-xs" lay-event="delete">删除</a>
  44. </script>
  45. <script type="text/html" id="algorithmBar">
  46. <a class="layui-btn layui-btn-xs" lay-event="algorithmDetail">查看</a>
  47. </script>
  48. <script>
  49. $("#toggle").click(function() {
  50. $(this).html($("#content").is(":hidden") ? "收起" + "<i class='iconfont up iconSelect_drop-down'/></i>" : "展开" +
  51. "<i class='iconfont up iconSelect_drop-down'/></i>");
  52. $("#content").slideToggle();
  53. });
  54. var pageId = "230000";
  55. // 终端投托运报表
  56. var reportType = "ZDTTYBB";
  57. var timeType = getQueryString("timeType");// 00日报01周报02月报
  58. var table;
  59. var form;
  60. layui.use(['table','laydate','form'], function(){
  61. var laydate = layui.laydate;
  62. laydate.render({
  63. elem: '#date'
  64. ,type: 'date'
  65. ,range: true
  66. ,done: function(value, date, endDate){
  67. changeSelectCon(0,"date",'date',value)
  68. }
  69. });
  70. table = layui.table;
  71. // 加载数据
  72. table.render({
  73. id: 'tableTest'
  74. ,elem: '#tableTest'
  75. ,limit:10
  76. ,url: 'ReportManageAction/reportInfQuery' //数据接口
  77. ,method: 'post'
  78. ,where:{MINView:"JSON", timeType : timeType, reportType : reportType}
  79. ,page: true //开启分页
  80. ,cols: [[ //表头
  81. {field:'num', title: '序号',width:'5%', type:'numbers', align: 'center'}
  82. ,{field: 'uploadDate', title: '生成时间', width:'15%', sort: true}
  83. ,{field: 'fileName', title: '报表名称', width:'30%'}
  84. ,{field: 'algorith', title: '算法', width: '10%', toolbar: '#algorithmBar'}
  85. ,{field: 'operate', title: '操作', width: '40%', toolbar: '#barDemo', fixed : 'right'}
  86. ]]
  87. ,done: function(res, curr, count){
  88. }
  89. ,even: true //开启隔行背景
  90. });
  91. // 监听工具条(操作)
  92. table.on('tool(tableFilter)', function(obj){ //注:tool是工具条事件名,tableFilter是table原始容器的属性 lay-filter="对应的值"
  93. var data = obj.data; //获得当前行数据
  94. var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
  95. var tr = obj.tr; //获得当前行 tr 的DOM对象
  96. if (layEvent === 'detail'){ //查看
  97. showDetail(data);
  98. } else if(layEvent === 'downLoad'){
  99. window.open("../../ReportManageAction/reportDownLoad?reportId=" + data.id);
  100. } else if(layEvent === 'delete'){
  101. layer.confirm('确认删除?', function(index){
  102. layer.close(index);
  103. $.request({
  104. action : 'ReportManageAction/reportInfDelete',
  105. data : {
  106. reportId : data.id
  107. },
  108. success : function(data1) {
  109. $.SuccAlert("操作成功!");
  110. reloadSearch();
  111. },
  112. error : function(data2) {
  113. $.ErrorAlert(data2.MINErrorMessage);
  114. }
  115. });
  116. });
  117. } else if (layEvent === 'algorithmDetail'){ // 算法查看
  118. algorithmDetail(data);
  119. }
  120. });
  121. });
  122. function reloadSearch (t) {
  123. var fileName = $("#fileName").val();
  124. var date = $("#date").val();
  125. //执行重载
  126. table.reload('tableTest', {
  127. page: {
  128. curr: 1 //重新从第 1 页开始
  129. }
  130. ,where: {
  131. date : date,
  132. fileName : fileName
  133. }
  134. });
  135. if (t == 1) {
  136. $.Alert("修改成功");
  137. }
  138. }
  139. function reset(){
  140. $('#formRole')[0].reset();
  141. $("#conditions").html('<div class="fl f12-gray4-op">所选条件:</div>');
  142. }
  143. function uploadExcel(){
  144. var openPageId = pageId + "-01";
  145. openMainTabPage(openPageId, "导入", "zdtty/reportProduceZdtty.html?pageId="+openPageId+"&reportType="+reportType, '', pageId, reloadSearch);
  146. }
  147. function showDetail(data){
  148. var openPageId = pageId + "-02";
  149. openMainTabPage(openPageId, "详情查看", "zdtty/reportManageDetailZdtty.html?pageId="+openPageId+"&reportId="+data.id+"&type="+data.type+"&typeId="+data.typeId+"&fileName="+chineseUrlEncode(data.fileName), '', pageId, null);
  150. }
  151. function algorithmDetail(data){
  152. var openPageId = pageId + "-04";
  153. openMainTabPage(openPageId, "算法详情", "reprotManage/reportAlgorithm.html?pageId="+openPageId+"&reportTypeId="+data.typeId, '', pageId, null);
  154. }
  155. function changeSelectCon(index, t, type, dateValue){
  156. if (type == "date") {
  157. if (isEmpty(dateValue)) {
  158. $("#search" + index).remove();
  159. } else {
  160. $("#search" + index).remove();
  161. if (isEmpty($("#search" + index).attr("name"))) {
  162. $("#conditions").append(getSelectConHtml(index, t, type,dateValue));
  163. }
  164. }
  165. } else if (type == 'inp') {
  166. if (isEmpty($(t).val())) {
  167. $("#search" + index).remove();
  168. } else {
  169. $("#search" + index).remove();
  170. if (isEmpty($("#search" + index).attr("name"))) {
  171. $("#conditions").append(getSelectConHtml(index, t, type));
  172. }
  173. }
  174. } else {
  175. if (isEmpty($(t).val())) {
  176. $("#search" + index).remove();
  177. } else {
  178. $("#search" + index).remove();
  179. if (isEmpty($("#search" + index).attr("name"))) {
  180. $(t).attr("id","subjects");
  181. $("#conditions").append(getSelectConHtml(index, t, type));
  182. }
  183. }
  184. }
  185. }
  186. var array = new Array('生成日期','文件名称');
  187. function getSelectConHtml(index, t, type,dateValue){
  188. var name;
  189. if (type == "date") {
  190. name = $("#"+t).attr("id");
  191. } else {
  192. name = $(t).attr("id");
  193. }
  194. var value;
  195. if(type == "inp"){
  196. value = t.value.substr(0,5)+"..";
  197. }
  198. if (type == "date") {
  199. value = dateValue;
  200. }
  201. if(type == "sel"){
  202. value = $("#stateDiv").find("option:selected").text();
  203. }
  204. var html = '<div class="fl xuanzhong-active" id = "search' + index + '" name = "' + name + '" onclick = "removeSearch(this)">' +
  205. '<div class="fl">' + array[index] + '</div>' +
  206. ':<span>'+value+'</span>' +
  207. '<svg class="icon" aria-hidden="true">' +
  208. '<use xlink:href="#iconicon_close1"></use>' +
  209. '</svg>' +
  210. '</div>';
  211. return html;
  212. }
  213. function removeSearch(t) {
  214. if ($(t).attr("name") == 'subjects') {
  215. initSelect('stateDiv', "COMPANY_STATE", "state", '', true);
  216. form.render();
  217. $(t).remove();
  218. } else {
  219. $("#"+$(t).attr("name")).val('');
  220. $(t).remove();
  221. }
  222. }
  223. </script>
  224. </body>
  225. </html>