Commit 1b436efc8c5ac7ff246ccc090b997fd13c77722b
1 parent
455e1f72
Exists in
master
app-ht(v0.0.1 build 6)
1.厂商,项目,机器型号,生产日期管理添加数据导出功能
Showing
13 changed files
with
374 additions
and
9 deletions
Show diff stats
app-ht/config/params.php
... | ... | @@ -3,5 +3,5 @@ return [ |
3 | 3 | 'adminEmail' => 'tech@jiwork.com', |
4 | 4 | 'DINGTALKL_URL' => 'https://tdd.jiwork.com/', //在钉钉端用系统扫码之后跳转到钉钉对应的界面,里面要指定钉钉的网址 |
5 | 5 | 'BAIDU_MAP_BROWSER_KEY' => 'UzLG5fpQtralY2hXO3wvVFzvlCmw6Rue', |
6 | - 'VERSION' => 'v0.0.1 build 5', | |
6 | + 'VERSION' => 'v0.0.1 build 6', | |
7 | 7 | ]; |
8 | 8 | \ No newline at end of file | ... | ... |
app-ht/modules/manufacturer/controllers/ManufacturerController.php
... | ... | @@ -67,7 +67,7 @@ class ManufacturerController extends BaseController |
67 | 67 | $where[] = ['<=', 'm.created_at', $endTime]; |
68 | 68 | } |
69 | 69 | if ($type == 0) { |
70 | - $pageList = ManufacturerRepository::getPageList($where); | |
70 | + $pageList = ManufacturerRepository::getPageList($where, 0 , 0); | |
71 | 71 | $pages = null; |
72 | 72 | } else { |
73 | 73 | $pageSize = 20; |
... | ... | @@ -215,4 +215,13 @@ class ManufacturerController extends BaseController |
215 | 215 | return $this->renderJson($msg); |
216 | 216 | } |
217 | 217 | |
218 | + /** | |
219 | + * 导出厂商数据 | |
220 | + * @return string | |
221 | + */ | |
222 | + public function actionExport() | |
223 | + { | |
224 | + $params = $this->dataList(0); | |
225 | + return $this->renderPartial('export', $params); | |
226 | + } | |
218 | 227 | } |
219 | 228 | \ No newline at end of file | ... | ... |
app-ht/modules/manufacturer/views/manufacturer/export.php
0 → 100644
... | ... | @@ -0,0 +1,55 @@ |
1 | +<?php | |
2 | +header('Content-Type: application/vnd.ms-excel;charset=utf-8'); | |
3 | +$title = date('Y-m-d') . '_厂商数据'; | |
4 | +$name = $title . ".xls"; | |
5 | +header('Content-Disposition: attachment;filename=' . $name . ''); | |
6 | +header('Cache-Control: max-age=0'); | |
7 | +$fp = fopen('php://output', 'a'); | |
8 | +$limit = 10000; | |
9 | +$cnt = 0; | |
10 | +?> | |
11 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
12 | + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
13 | +<html xmlns:o="urn:schemas-microsoft-com:office:office" | |
14 | + xmlns:x="urn:schemas-microsoft-com:office:excel" | |
15 | + xmlns="http://www.w3.org/TR/REC-html40"> | |
16 | + | |
17 | +<head> | |
18 | + <meta http-equiv=Content-Type content="text/html; charset=utf-8"> | |
19 | + | |
20 | +</head> | |
21 | +<body> | |
22 | +<div id="Classeur1_16681" align='center' x:publishsource="Excel"> | |
23 | + <table border='1' cellpadding='0' cellspacing='0' width='100%' style="border-collapse: collapse"> | |
24 | + <thead> | |
25 | + <tr> | |
26 | + <th width="10%">厂商名称</th> | |
27 | + <th width="10%">联系电话</th> | |
28 | + <th width="10%">账号</th> | |
29 | + <th width="10%">密码</th> | |
30 | + <th width="10%">注册时间</th> | |
31 | + </tr> | |
32 | + </thead> | |
33 | + <tbody> | |
34 | + <?php foreach ($listdata as $key => $item) : ?> | |
35 | + <tr> | |
36 | + <td style="padding:12px;"><?= (isset($item["name"]) ? $item["name"] : "") ?> | |
37 | + <td style="padding:12px;"><?= (isset($item["phone"]) ? $item["phone"] : "") ?></td> | |
38 | + <td style="padding:12px;"><?= (isset($item["username"]) ? $item["username"] : "") ?></td> | |
39 | + <td style="padding:12px;"><?= (isset($item["password"]) ? $item["password"] : "******") ?></td> | |
40 | + <td style="padding:12px;"><?= isset($item['created_at']) ? date("Y-m-d H:i:s", $item['created_at']) : "" ?></td> | |
41 | + </tr> | |
42 | + <?php | |
43 | + $cnt++; | |
44 | + if (1000 == $cnt) { //刷新一下输出buffer,防止由于数据过多造成问题 | |
45 | + ob_flush(); | |
46 | + flush(); | |
47 | + $cnt = 0; | |
48 | + } | |
49 | + ?> | |
50 | + <?php endforeach; ?> | |
51 | + </tbody> | |
52 | + </table> | |
53 | +</div> | |
54 | +</body> | |
55 | +</html> | |
0 | 56 | \ No newline at end of file | ... | ... |
app-ht/modules/manufacturer/views/manufacturer/index.php
... | ... | @@ -33,6 +33,7 @@ $this->params['breadcrumbs'][] = $this->title; |
33 | 33 | <td colspan="6" class="text-center"> |
34 | 34 | <button type="submit" class="btn btn-primary btncls" id="search"><i class="glyphicon glyphicon-search"></i> 查 询 </button> |
35 | 35 | <a class="btn btn-default btncls" href="<?=Url::toRoute(["/manufacturer/manufacturer/index"])?>">重 置</a> |
36 | + <a class="btn btn-default" style="float: right;" href="javascript:void(0)" id="btn-export"> 导出数据 </a> | |
36 | 37 | </td> |
37 | 38 | </tr> |
38 | 39 | </tbody> |
... | ... | @@ -95,6 +96,16 @@ $this->params['breadcrumbs'][] = $this->title; |
95 | 96 | </div> |
96 | 97 | </div> |
97 | 98 | <script> |
99 | + window.queryParams = function(params) { | |
100 | + $("#search-form").find('input[name]').each(function () { | |
101 | + var val = $(this).val(); | |
102 | + var name = $(this).attr('name'); | |
103 | + if(val){ | |
104 | + params[name] = val; | |
105 | + } | |
106 | + }); | |
107 | + return params; | |
108 | + } | |
98 | 109 | $(document).ready(function () { |
99 | 110 | $(".btn_del").bind("click",function () { |
100 | 111 | if (confirm("确定要删除该厂商吗?对应厂商的登录账号也会一并删除,请谨慎操作")){ |
... | ... | @@ -122,6 +133,20 @@ $this->params['breadcrumbs'][] = $this->title; |
122 | 133 | } |
123 | 134 | }); |
124 | 135 | } |
125 | - }) ; | |
136 | + }); | |
137 | + $('#btn-export').click(function(e){ | |
138 | + var params = {}; | |
139 | + window.queryParams(params); | |
140 | + | |
141 | + $strQuery = "?"; | |
142 | + if (params) { | |
143 | + for (var p in params) { | |
144 | + $strQuery += p + "=" + params[p] + "&"; | |
145 | + } | |
146 | + } | |
147 | + $strQuery = $strQuery.substring(0, $strQuery.length-1); | |
148 | + window.location.href = "export" + $strQuery; | |
149 | + return false; | |
150 | + }) | |
126 | 151 | }); |
127 | 152 | </script> |
128 | 153 | \ No newline at end of file | ... | ... |
app-ht/modules/model/controllers/ModelController.php
... | ... | @@ -56,7 +56,7 @@ class ModelController extends BaseController |
56 | 56 | $where[] = ['like', 'm.name', $name]; |
57 | 57 | } |
58 | 58 | if ($type == 0) { |
59 | - $pageList = ModelRepository::getPageList($where); | |
59 | + $pageList = ModelRepository::getPageList($where, 0 , 0); | |
60 | 60 | $pages = null; |
61 | 61 | } else { |
62 | 62 | $pageSize = 20; |
... | ... | @@ -183,4 +183,13 @@ class ModelController extends BaseController |
183 | 183 | return $this->renderJson($msg); |
184 | 184 | } |
185 | 185 | |
186 | + /** | |
187 | + * 导出机器型号数据 | |
188 | + * @return string | |
189 | + */ | |
190 | + public function actionExport() | |
191 | + { | |
192 | + $params = $this->dataList(0); | |
193 | + return $this->renderPartial('export', $params); | |
194 | + } | |
186 | 195 | } |
187 | 196 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,58 @@ |
1 | +<?php | |
2 | +header('Content-Type: application/vnd.ms-excel;charset=utf-8'); | |
3 | +$title = date('Y-m-d').'_机器型号数据'; | |
4 | +$name = $title.".xls"; | |
5 | +header('Content-Disposition: attachment;filename='.$name.''); | |
6 | +header('Cache-Control: max-age=0'); | |
7 | +$fp = fopen('php://output', 'a'); | |
8 | +$limit = 5000; | |
9 | +$cnt=0; | |
10 | +ini_set('memory_limit','512M'); | |
11 | +ini_set('max_execution_time',0); | |
12 | +ob_end_clean(); | |
13 | +ob_start(); | |
14 | +?> | |
15 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
16 | +<html xmlns:o="urn:schemas-microsoft-com:office:office" | |
17 | + xmlns:x="urn:schemas-microsoft-com:office:excel" | |
18 | + xmlns="http://www.w3.org/TR/REC-html40"> | |
19 | + | |
20 | +<head> | |
21 | + <meta http-equiv=Content-Type content="text/html; charset=utf-8"> | |
22 | + | |
23 | +</head> | |
24 | +<body> | |
25 | +<div id="Classeur1_16681" align='center' x:publishsource="Excel"> | |
26 | + <table x:str border='1' cellpadding='0' cellspacing='0' width='100%' style="border-collapse: collapse"> | |
27 | + <thead> | |
28 | + <tr> | |
29 | + <th width="15%">编号</th> | |
30 | + <th width="25%">机器型号</th> | |
31 | + <th width="25%">创建时间</th> | |
32 | + </tr> | |
33 | + </thead> | |
34 | + <tbody> | |
35 | + <?php foreach ($listdata as $item) : ?> | |
36 | + <tr> | |
37 | + <td style="padding:12px;"><?= (isset($item["model_no"]) ? $item["model_no"] : "") ?></td> | |
38 | + <td style="padding:12px;"><?= (isset($item["name"]) ? $item["name"] : "") ?> | |
39 | + <td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['created_at'])?></td> | |
40 | + </tr> | |
41 | + <?php | |
42 | + $cnt ++; | |
43 | + if (500 == $cnt) { //刷新一下输出buffer,防止由于数据过多造成问题 | |
44 | + ob_flush(); | |
45 | + flush(); | |
46 | + $cnt = 0; | |
47 | + } | |
48 | + ?> | |
49 | + <?php endforeach;?> | |
50 | + <?php ob_flush(); | |
51 | + flush(); | |
52 | + ob_end_clean(); | |
53 | + ?> | |
54 | + </tbody> | |
55 | + </table> | |
56 | +</div> | |
57 | +</body> | |
58 | +</html> | |
0 | 59 | \ No newline at end of file | ... | ... |
app-ht/modules/model/views/model/index.php
... | ... | @@ -32,6 +32,7 @@ $this->params['breadcrumbs'][] = $this->title; |
32 | 32 | <td colspan="4" class="text-center"> |
33 | 33 | <button type="submit" class="btn btn-primary btncls" id="search"><i class="glyphicon glyphicon-search"></i> 查 询 </button> |
34 | 34 | <a class="btn btn-default btncls" href="<?=Url::toRoute(["/model/model/index"])?>">重 置</a> |
35 | + <a class="btn btn-default" style="float: right;" href="javascript:void(0)" id="btn-export"> 导出数据 </a> | |
35 | 36 | </td> |
36 | 37 | </tr> |
37 | 38 | </tbody> |
... | ... | @@ -89,6 +90,16 @@ $this->params['breadcrumbs'][] = $this->title; |
89 | 90 | </div> |
90 | 91 | </div> |
91 | 92 | <script> |
93 | + window.queryParams = function(params) { | |
94 | + $("#search-form").find('input[name]').each(function () { | |
95 | + var val = $(this).val(); | |
96 | + var name = $(this).attr('name'); | |
97 | + if(val){ | |
98 | + params[name] = val; | |
99 | + } | |
100 | + }); | |
101 | + return params; | |
102 | + } | |
92 | 103 | $(document).ready(function () { |
93 | 104 | $(".btn_del").bind("click",function () { |
94 | 105 | if (confirm("确定要删除该机器型号吗?")){ |
... | ... | @@ -116,6 +127,20 @@ $this->params['breadcrumbs'][] = $this->title; |
116 | 127 | } |
117 | 128 | }); |
118 | 129 | } |
119 | - }) ; | |
130 | + }); | |
131 | + $('#btn-export').click(function(e){ | |
132 | + var params = {}; | |
133 | + window.queryParams(params); | |
134 | + | |
135 | + $strQuery = "?"; | |
136 | + if (params) { | |
137 | + for (var p in params) { | |
138 | + $strQuery += p + "=" + params[p] + "&"; | |
139 | + } | |
140 | + } | |
141 | + $strQuery = $strQuery.substring(0, $strQuery.length-1); | |
142 | + window.location.href = "export" + $strQuery; | |
143 | + return false; | |
144 | + }) | |
120 | 145 | }); |
121 | 146 | </script> |
122 | 147 | \ No newline at end of file | ... | ... |
app-ht/modules/production/controllers/ProductionController.php
... | ... | @@ -63,7 +63,7 @@ class ProductionController extends BaseController |
63 | 63 | $where[] = ['<=', 'p.name', $productionEndTime]; |
64 | 64 | } |
65 | 65 | if ($type == 0) { |
66 | - $pageList = ProductionRepository::getPageList($where); | |
66 | + $pageList = ProductionRepository::getPageList($where, 0 , 0); | |
67 | 67 | $pages = null; |
68 | 68 | } else { |
69 | 69 | $pageSize = 20; |
... | ... | @@ -190,4 +190,13 @@ class ProductionController extends BaseController |
190 | 190 | return $this->renderJson($msg); |
191 | 191 | } |
192 | 192 | |
193 | + /** | |
194 | + * 导出厂商数据 | |
195 | + * @return string | |
196 | + */ | |
197 | + public function actionExport() | |
198 | + { | |
199 | + $params = $this->dataList(0); | |
200 | + return $this->renderPartial('export', $params); | |
201 | + } | |
193 | 202 | } |
194 | 203 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,58 @@ |
1 | +<?php | |
2 | +header('Content-Type: application/vnd.ms-excel;charset=utf-8'); | |
3 | +$title = date('Y-m-d').'_生成日期数据'; | |
4 | +$name = $title.".xls"; | |
5 | +header('Content-Disposition: attachment;filename='.$name.''); | |
6 | +header('Cache-Control: max-age=0'); | |
7 | +$fp = fopen('php://output', 'a'); | |
8 | +$limit = 5000; | |
9 | +$cnt=0; | |
10 | +ini_set('memory_limit','512M'); | |
11 | +ini_set('max_execution_time',0); | |
12 | +ob_end_clean(); | |
13 | +ob_start(); | |
14 | +?> | |
15 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
16 | +<html xmlns:o="urn:schemas-microsoft-com:office:office" | |
17 | + xmlns:x="urn:schemas-microsoft-com:office:excel" | |
18 | + xmlns="http://www.w3.org/TR/REC-html40"> | |
19 | + | |
20 | +<head> | |
21 | + <meta http-equiv=Content-Type content="text/html; charset=utf-8"> | |
22 | + | |
23 | +</head> | |
24 | +<body> | |
25 | +<div id="Classeur1_16681" align='center' x:publishsource="Excel"> | |
26 | + <table x:str border='1' cellpadding='0' cellspacing='0' width='100%' style="border-collapse: collapse"> | |
27 | + <thead> | |
28 | + <tr> | |
29 | + <th width="15%">编号</th> | |
30 | + <th width="25%">生产日期</th> | |
31 | + <th width="25%">创建时间</th> | |
32 | + </tr> | |
33 | + </thead> | |
34 | + <tbody> | |
35 | + <?php foreach ($listdata as $item) : ?> | |
36 | + <tr> | |
37 | + <td style="padding:12px;"><?= (isset($item["production_no"]) ? $item["production_no"] : "") ?></td> | |
38 | + <td style="padding:12px;"><?= (isset($item["name"]) ? $item["name"] : "") ?> | |
39 | + <td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['created_at'])?></td> | |
40 | + </tr> | |
41 | + <?php | |
42 | + $cnt ++; | |
43 | + if (500 == $cnt) { //刷新一下输出buffer,防止由于数据过多造成问题 | |
44 | + ob_flush(); | |
45 | + flush(); | |
46 | + $cnt = 0; | |
47 | + } | |
48 | + ?> | |
49 | + <?php endforeach;?> | |
50 | + <?php ob_flush(); | |
51 | + flush(); | |
52 | + ob_end_clean(); | |
53 | + ?> | |
54 | + </tbody> | |
55 | + </table> | |
56 | +</div> | |
57 | +</body> | |
58 | +</html> | |
0 | 59 | \ No newline at end of file | ... | ... |
app-ht/modules/production/views/production/index.php
... | ... | @@ -33,6 +33,7 @@ $this->params['breadcrumbs'][] = $this->title; |
33 | 33 | <td colspan="4" class="text-center"> |
34 | 34 | <button type="submit" class="btn btn-primary btncls" id="search"><i class="glyphicon glyphicon-search"></i> 查 询 </button> |
35 | 35 | <a class="btn btn-default btncls" href="<?=Url::toRoute(["/production/production/index"])?>">重 置</a> |
36 | + <a class="btn btn-default" style="float: right;" href="javascript:void(0)" id="btn-export"> 导出数据 </a> | |
36 | 37 | </td> |
37 | 38 | </tr> |
38 | 39 | </tbody> |
... | ... | @@ -90,6 +91,16 @@ $this->params['breadcrumbs'][] = $this->title; |
90 | 91 | </div> |
91 | 92 | </div> |
92 | 93 | <script> |
94 | + window.queryParams = function(params) { | |
95 | + $("#search-form").find('input[name]').each(function () { | |
96 | + var val = $(this).val(); | |
97 | + var name = $(this).attr('name'); | |
98 | + if(val){ | |
99 | + params[name] = val; | |
100 | + } | |
101 | + }); | |
102 | + return params; | |
103 | + } | |
93 | 104 | $(document).ready(function () { |
94 | 105 | $(".btn_del").bind("click",function () { |
95 | 106 | if (confirm("确定要删除该生产日期吗?")){ |
... | ... | @@ -117,6 +128,20 @@ $this->params['breadcrumbs'][] = $this->title; |
117 | 128 | } |
118 | 129 | }); |
119 | 130 | } |
120 | - }) ; | |
131 | + }); | |
132 | + $('#btn-export').click(function(e){ | |
133 | + var params = {}; | |
134 | + window.queryParams(params); | |
135 | + | |
136 | + $strQuery = "?"; | |
137 | + if (params) { | |
138 | + for (var p in params) { | |
139 | + $strQuery += p + "=" + params[p] + "&"; | |
140 | + } | |
141 | + } | |
142 | + $strQuery = $strQuery.substring(0, $strQuery.length-1); | |
143 | + window.location.href = "export" + $strQuery; | |
144 | + return false; | |
145 | + }) | |
121 | 146 | }); |
122 | 147 | </script> |
123 | 148 | \ No newline at end of file | ... | ... |
app-ht/modules/project/controllers/ProjectController.php
... | ... | @@ -56,7 +56,7 @@ class ProjectController extends BaseController |
56 | 56 | $where[] = ['like', 'p.name', $name]; |
57 | 57 | } |
58 | 58 | if ($type == 0) { |
59 | - $pageList = ProjectRepository::getPageList($where); | |
59 | + $pageList = ProjectRepository::getPageList($where, 0, 0); | |
60 | 60 | $pages = null; |
61 | 61 | } else { |
62 | 62 | $pageSize = 20; |
... | ... | @@ -183,4 +183,13 @@ class ProjectController extends BaseController |
183 | 183 | return $this->renderJson($msg); |
184 | 184 | } |
185 | 185 | |
186 | + /** | |
187 | + * 导出厂商数据 | |
188 | + * @return string | |
189 | + */ | |
190 | + public function actionExport() | |
191 | + { | |
192 | + $params = $this->dataList(0); | |
193 | + return $this->renderPartial('export', $params); | |
194 | + } | |
186 | 195 | } |
187 | 196 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,58 @@ |
1 | +<?php | |
2 | +header('Content-Type: application/vnd.ms-excel;charset=utf-8'); | |
3 | +$title = date('Y-m-d').'_项目数据'; | |
4 | +$name = $title.".xls"; | |
5 | +header('Content-Disposition: attachment;filename='.$name.''); | |
6 | +header('Cache-Control: max-age=0'); | |
7 | +$fp = fopen('php://output', 'a'); | |
8 | +$limit = 5000; | |
9 | +$cnt=0; | |
10 | +ini_set('memory_limit','512M'); | |
11 | +ini_set('max_execution_time',0); | |
12 | +ob_end_clean(); | |
13 | +ob_start(); | |
14 | +?> | |
15 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
16 | +<html xmlns:o="urn:schemas-microsoft-com:office:office" | |
17 | + xmlns:x="urn:schemas-microsoft-com:office:excel" | |
18 | + xmlns="http://www.w3.org/TR/REC-html40"> | |
19 | + | |
20 | +<head> | |
21 | + <meta http-equiv=Content-Type content="text/html; charset=utf-8"> | |
22 | + | |
23 | +</head> | |
24 | +<body> | |
25 | +<div id="Classeur1_16681" align='center' x:publishsource="Excel"> | |
26 | + <table x:str border='1' cellpadding='0' cellspacing='0' width='100%' style="border-collapse: collapse"> | |
27 | + <thead> | |
28 | + <tr> | |
29 | + <th width="15%">编号</th> | |
30 | + <th width="25%">项目名称</th> | |
31 | + <th width="25%">创建时间</th> | |
32 | + </tr> | |
33 | + </thead> | |
34 | + <tbody> | |
35 | + <?php foreach ($listdata as $item) : ?> | |
36 | + <tr> | |
37 | + <td style="padding:12px;"><?= (isset($item["project_no"]) ? $item["project_no"] : "") ?></td> | |
38 | + <td style="padding:12px;"><?= (isset($item["name"]) ? $item["name"] : "") ?> | |
39 | + <td style="padding:12px;"><?= date("Y-m-d H:i:s", $item['created_at'])?></td> | |
40 | + </tr> | |
41 | + <?php | |
42 | + $cnt ++; | |
43 | + if (500 == $cnt) { //刷新一下输出buffer,防止由于数据过多造成问题 | |
44 | + ob_flush(); | |
45 | + flush(); | |
46 | + $cnt = 0; | |
47 | + } | |
48 | + ?> | |
49 | + <?php endforeach;?> | |
50 | + <?php ob_flush(); | |
51 | + flush(); | |
52 | + ob_end_clean(); | |
53 | + ?> | |
54 | + </tbody> | |
55 | + </table> | |
56 | +</div> | |
57 | +</body> | |
58 | +</html> | |
0 | 59 | \ No newline at end of file | ... | ... |
app-ht/modules/project/views/project/index.php
... | ... | @@ -32,6 +32,7 @@ $this->params['breadcrumbs'][] = $this->title; |
32 | 32 | <td colspan="4" class="text-center"> |
33 | 33 | <button type="submit" class="btn btn-primary btncls" id="search"><i class="glyphicon glyphicon-search"></i> 查 询 </button> |
34 | 34 | <a class="btn btn-default btncls" href="<?=Url::toRoute(["/project/project/index"])?>">重 置</a> |
35 | + <a class="btn btn-default" style="float: right;" href="javascript:void(0)" id="btn-export"> 导出数据 </a> | |
35 | 36 | </td> |
36 | 37 | </tr> |
37 | 38 | </tbody> |
... | ... | @@ -89,6 +90,16 @@ $this->params['breadcrumbs'][] = $this->title; |
89 | 90 | </div> |
90 | 91 | </div> |
91 | 92 | <script> |
93 | + window.queryParams = function(params) { | |
94 | + $("#search-form").find('input[name]').each(function () { | |
95 | + var val = $(this).val(); | |
96 | + var name = $(this).attr('name'); | |
97 | + if(val){ | |
98 | + params[name] = val; | |
99 | + } | |
100 | + }); | |
101 | + return params; | |
102 | + } | |
92 | 103 | $(document).ready(function () { |
93 | 104 | $(".btn_del").bind("click",function () { |
94 | 105 | if (confirm("确定要删除该项目吗?")){ |
... | ... | @@ -116,6 +127,20 @@ $this->params['breadcrumbs'][] = $this->title; |
116 | 127 | } |
117 | 128 | }); |
118 | 129 | } |
119 | - }) ; | |
130 | + }); | |
131 | + $('#btn-export').click(function(e){ | |
132 | + var params = {}; | |
133 | + window.queryParams(params); | |
134 | + | |
135 | + $strQuery = "?"; | |
136 | + if (params) { | |
137 | + for (var p in params) { | |
138 | + $strQuery += p + "=" + params[p] + "&"; | |
139 | + } | |
140 | + } | |
141 | + $strQuery = $strQuery.substring(0, $strQuery.length-1); | |
142 | + window.location.href = "export" + $strQuery; | |
143 | + return false; | |
144 | + }) | |
120 | 145 | }); |
121 | 146 | </script> |
122 | 147 | \ No newline at end of file | ... | ... |