| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>报表管理</title>
- <script src="../../js/min-loader-next.js"></script>
- </head>
- <body class="content">
- <div class="order-body">
- <div class="order-tiaojian back-gray">
- <div class="tiaojian-part1" id = "conditions">
- <div class="fl f12-gray4-op">所选条件:</div>
- </div>
- <div class="tiaojian-part2 fr demoTable">
- <button class="order-bnt1 layui-btn" onclick="reloadSearch()" >查询</button>
- <button class="layui-btn order-bnt2" onclick="reset()">重置</button>
- <button class="order-bnt2 layui-btn" onclick="uploadExcel()">报表生成</button>
- <a href="#" id="toggle" class="top">收起</a>
- </div>
- </div>
- <form class="layui-form" action="" id = "formRole">
- <div class="order-select back-border" id="content">
- <div class="d-dashed" style="margin: 10px 0;"></div>
- <div class="layui-inline">
- <label class="f12-gray4">生成日期:</label>
- <div class="layui-input-inline" style="position: relative;">
- <input type="text" class="layui-input" id="date" placeholder="请选择日期" readOnly/>
- </div>
- </div>
- <div class="layui-inline">
- <label class="f12-gray4">文件名称:</label>
- <input name="fileName" id ="fileName" autocomplete="off" placeholder="请输入文件名称" class="search-select" onchange = "changeSelectCon(1,this,'inp')">
- </div>
- </div>
- </form>
- </div>
- <div class="shadow-content" style="margin:1.5rem;">
- <table id="tableTest" lay-filter="tableFilter"></table>
- </div>
- <script type="text/html" id="barDemo">
- <a class="layui-btn layui-btn-xs" lay-event="detail">详情查看</a>
- <a class="layui-btn layui-btn-xs" lay-event="downLoad">下载</a>
- <a class="layui-btn layui-btn-xs" lay-event="delete">删除</a>
- </script>
- <script type="text/html" id="algorithmBar">
- <a class="layui-btn layui-btn-xs" lay-event="algorithmDetail">查看</a>
- </script>
- <script>
-
-
- $("#toggle").click(function() {
- $(this).html($("#content").is(":hidden") ? "收起" + "<i class='iconfont up iconSelect_drop-down'/></i>" : "展开" +
- "<i class='iconfont up iconSelect_drop-down'/></i>");
- $("#content").slideToggle();
- });
- var pageId = "230000";
- // 终端投托运报表
- var reportType = "ZDTTYBB";
-
- var timeType = getQueryString("timeType");// 00日报01周报02月报
-
- var table;
- var form;
- layui.use(['table','laydate','form'], function(){
- var laydate = layui.laydate;
- laydate.render({
- elem: '#date'
- ,type: 'date'
- ,range: true
- ,done: function(value, date, endDate){
- changeSelectCon(0,"date",'date',value)
- }
- });
-
- table = layui.table;
-
- // 加载数据
- table.render({
- id: 'tableTest'
- ,elem: '#tableTest'
- ,limit:10
- ,url: 'ReportManageAction/reportInfQuery' //数据接口
- ,method: 'post'
- ,where:{MINView:"JSON", timeType : timeType, reportType : reportType}
- ,page: true //开启分页
- ,cols: [[ //表头
- {field:'num', title: '序号',width:'5%', type:'numbers', align: 'center'}
- ,{field: 'uploadDate', title: '生成时间', width:'15%', sort: true}
- ,{field: 'fileName', title: '报表名称', width:'30%'}
- ,{field: 'algorith', title: '算法', width: '10%', toolbar: '#algorithmBar'}
- ,{field: 'operate', title: '操作', width: '40%', toolbar: '#barDemo', fixed : 'right'}
- ]]
- ,done: function(res, curr, count){
- }
- ,even: true //开启隔行背景
- });
-
- // 监听工具条(操作)
- table.on('tool(tableFilter)', function(obj){ //注:tool是工具条事件名,tableFilter是table原始容器的属性 lay-filter="对应的值"
- var data = obj.data; //获得当前行数据
- var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
- var tr = obj.tr; //获得当前行 tr 的DOM对象
- if (layEvent === 'detail'){ //查看
- showDetail(data);
- } else if(layEvent === 'downLoad'){
- window.open("../../ReportManageAction/reportDownLoad?reportId=" + data.id);
- } else if(layEvent === 'delete'){
- layer.confirm('确认删除?', function(index){
- layer.close(index);
- $.request({
- action : 'ReportManageAction/reportInfDelete',
- data : {
- reportId : data.id
- },
- success : function(data1) {
- $.SuccAlert("操作成功!");
- reloadSearch();
- },
- error : function(data2) {
- $.ErrorAlert(data2.MINErrorMessage);
- }
- });
- });
- } else if (layEvent === 'algorithmDetail'){ // 算法查看
- algorithmDetail(data);
- }
- });
- });
-
- function reloadSearch (t) {
- var fileName = $("#fileName").val();
- var date = $("#date").val();
- //执行重载
- table.reload('tableTest', {
- page: {
- curr: 1 //重新从第 1 页开始
- }
- ,where: {
- date : date,
- fileName : fileName
- }
- });
- if (t == 1) {
- $.Alert("修改成功");
- }
- }
-
- function reset(){
- $('#formRole')[0].reset();
- $("#conditions").html('<div class="fl f12-gray4-op">所选条件:</div>');
- }
-
- function uploadExcel(){
- var openPageId = pageId + "-01";
- openMainTabPage(openPageId, "导入", "zdtty/reportProduceZdtty.html?pageId="+openPageId+"&reportType="+reportType, '', pageId, reloadSearch);
- }
-
- function showDetail(data){
- var openPageId = pageId + "-02";
- openMainTabPage(openPageId, "详情查看", "zdtty/reportManageDetailZdtty.html?pageId="+openPageId+"&reportId="+data.id+"&type="+data.type+"&typeId="+data.typeId+"&fileName="+chineseUrlEncode(data.fileName), '', pageId, null);
- }
- function algorithmDetail(data){
- var openPageId = pageId + "-04";
- openMainTabPage(openPageId, "算法详情", "reprotManage/reportAlgorithm.html?pageId="+openPageId+"&reportTypeId="+data.typeId, '', pageId, null);
- }
-
- function changeSelectCon(index, t, type, dateValue){
- if (type == "date") {
- if (isEmpty(dateValue)) {
- $("#search" + index).remove();
- } else {
- $("#search" + index).remove();
- if (isEmpty($("#search" + index).attr("name"))) {
- $("#conditions").append(getSelectConHtml(index, t, type,dateValue));
- }
- }
- } else if (type == 'inp') {
- if (isEmpty($(t).val())) {
- $("#search" + index).remove();
- } else {
- $("#search" + index).remove();
- if (isEmpty($("#search" + index).attr("name"))) {
- $("#conditions").append(getSelectConHtml(index, t, type));
- }
- }
- } else {
- if (isEmpty($(t).val())) {
- $("#search" + index).remove();
- } else {
- $("#search" + index).remove();
- if (isEmpty($("#search" + index).attr("name"))) {
- $(t).attr("id","subjects");
- $("#conditions").append(getSelectConHtml(index, t, type));
- }
- }
- }
- }
-
- var array = new Array('生成日期','文件名称');
- function getSelectConHtml(index, t, type,dateValue){
- var name;
- if (type == "date") {
- name = $("#"+t).attr("id");
- } else {
- name = $(t).attr("id");
- }
- var value;
- if(type == "inp"){
- value = t.value.substr(0,5)+"..";
- }
- if (type == "date") {
- value = dateValue;
- }
- if(type == "sel"){
- value = $("#stateDiv").find("option:selected").text();
- }
- var html = '<div class="fl xuanzhong-active" id = "search' + index + '" name = "' + name + '" onclick = "removeSearch(this)">' +
- '<div class="fl">' + array[index] + '</div>' +
- ':<span>'+value+'</span>' +
- '<svg class="icon" aria-hidden="true">' +
- '<use xlink:href="#iconicon_close1"></use>' +
- '</svg>' +
- '</div>';
- return html;
- }
- function removeSearch(t) {
- if ($(t).attr("name") == 'subjects') {
- initSelect('stateDiv', "COMPANY_STATE", "state", '', true);
- form.render();
- $(t).remove();
- } else {
- $("#"+$(t).attr("name")).val('');
- $(t).remove();
- }
- }
- </script>
- </body>
- </html>
|