From 07558b9594e3f5953b98050e2f0dcb3d75bb34ae Mon Sep 17 00:00:00 2001 From: hdm Date: Thu, 29 Dec 2022 22:26:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=BC=E5=87=BA=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/article/view/index/index.html | 2 +- app/article/view/index/list.html | 1 + app/project/view/document/index.html | 1 + app/project/view/index/index.html | 23 ++++++++++++++++------- app/project/view/task/index.html | 27 +++++++++++++++++++-------- app/project/view/task/task_time.html | 20 +++++++++++++++++++- 6 files changed, 57 insertions(+), 17 deletions(-) diff --git a/app/article/view/index/index.html b/app/article/view/index/index.html index 48a014d..0cb5977 100644 --- a/app/article/view/index/index.html +++ b/app/article/view/index/index.html @@ -34,7 +34,7 @@ layui.pageTable = table.render({ elem: '#test', title: '文章列表', - toolbar: '#toolbarDemo', + defaultToolbar: false, url: "/article/index/index", //数据接口 cellMinWidth: 360, page: true, //开启分页 diff --git a/app/article/view/index/list.html b/app/article/view/index/list.html index aa3e5b8..6dbe5be 100644 --- a/app/article/view/index/list.html +++ b/app/article/view/index/list.html @@ -46,6 +46,7 @@ elem: '#test', title: '文章列表', toolbar: '#toolbarDemo', + defaultToolbar: false, url: "/article/index/list", //数据接口 cellMinWidth: 300, page: true, //开启分页 diff --git a/app/project/view/document/index.html b/app/project/view/document/index.html index dfac7d1..e45741d 100644 --- a/app/project/view/document/index.html +++ b/app/project/view/document/index.html @@ -47,6 +47,7 @@ elem: '#document', title: '文档列表', toolbar: '#toolbarDemo', + defaultToolbar: false, cellMinWidth: 240, url: "/project/document/index", page: true, //开启分页 diff --git a/app/project/view/index/index.html b/app/project/view/index/index.html index 3021275..e889e3d 100644 --- a/app/project/view/index/index.html +++ b/app/project/view/index/index.html @@ -21,8 +21,9 @@ layui.pageTable = table.render({ elem: '#projectList', toolbar: '#toolbarDemo', + defaultToolbar:['filter', {title:'导出EXCEL',layEvent: 'LAYTABLE_EXCEL',icon: 'layui-icon-export'}], title: '项目列表', - cellMinWidth: 220, + cellMinWidth: 80, page: true, //开启分页 limit: 20, height: 'full-24', @@ -59,12 +60,20 @@ //触发事件 table.on('toolbar(project)', function(obj){ - var checkStatus = table.checkStatus(obj.config.id); - switch(obj.event){ - case 'add': - tool.side('/project/index/add'); - break; - }; + if(obj.event === 'LAYTABLE_EXCEL'){ + $.ajax({ + url: '/project/index/index', + data: {limit:99999}, + success:function(res){ + table.exportFile('projectList', res.data,'xls'); + } + }); + return; + } + else if(obj.event === 'add'){ + tool.side('/project/index/add'); + return; + } }); } diff --git a/app/project/view/task/index.html b/app/project/view/task/index.html index 9889336..1142cce 100644 --- a/app/project/view/task/index.html +++ b/app/project/view/task/index.html @@ -10,7 +10,7 @@ {block name="body"}
-
+
@@ -79,11 +79,13 @@ layui.scheduleTable = table.render({ elem: '#test' ,toolbar: '#toolbarDemo' + ,defaultToolbar:['filter', {title:'导出EXCEL',layEvent: 'LAYTABLE_EXCEL',icon: 'layui-icon-export'}] ,title:'工时列表' ,url: "/project/task/task_time" ,page: true //开启分页 ,limit: 20 ,cellMinWidth: 80 + ,height: 'full-88' ,cols: [[ //表头 {field: 'id', title: '序号',fixed: 'left', width:80, align:'center'} ,{field: 'labor_type_string', title: '工作类型', align:'center',width:90,templet:function(d){ @@ -119,6 +121,22 @@ }} ]] }); + + //触发事件 + table.on('toolbar(test)', function(obj){ + if(obj.event === 'LAYTABLE_EXCEL'){ + var formSelect = form.val('barsearchform'); + formSelect.limit=99999; + $.ajax({ + url: '/project/task/task_time', + data: formSelect, + success:function(res){ + table.exportFile('test', res.data,'xls'); + } + }); + return; + } + }); //更改工时 table.on('tool(test)', function(obj){