dever 7 年之前
父節點
當前提交
40f9c700fe
共有 3 個文件被更改,包括 30 次插入4 次删除
  1. 1 1
      assets/moltran/html/inc/script.html
  2. 19 1
      assets/public/main.js
  3. 10 2
      src/Database.php

+ 1 - 1
assets/moltran/html/inc/script.html

@@ -41,7 +41,7 @@
 <script type="text/javascript" src="../public/highlight/highlight.min.js"></script>
 
 <!-- 加载主要js,很乱,后续优化 -->
-<script type="text/javascript" src="../public/main.js?v3"></script>
+<script type="text/javascript" src="../public/main.js?v4"></script>
 
 <!-- 加载一些模板自带效果 -->
 <script>

+ 19 - 1
assets/public/main.js

@@ -33,6 +33,20 @@ function init()
 	table();
 }
 
+function formData(form)
+{
+	var d = {};
+    var t = $(form).serializeArray();
+    var u = '';
+    $.each(t, function() {
+    	if (this.name.indexOf('search_') != -1) {
+    		d[this.name] = this.value;
+    		u += '&' + this.name + '=' + this.value;
+    	}
+    });
+    return [d,u];
+}
+
 function initMenu()
 {
 	if(typeof(config.layout) != "undefined")
@@ -1096,8 +1110,12 @@ function load(href)
 /**
  *  处理特殊加载的按钮
  */
-function jump(href)
+function jump(href, form)
 {
+	if (form) {
+		var param = formData(form);
+		href += param[1];
+	}
 	location.href = href;
 }
 

+ 10 - 2
src/Database.php

@@ -810,12 +810,20 @@ class Database
 
         # 增加主动统计按钮
         if (isset($config['manage']['stat'])) {
-            $config['manage']['button']['数据统计'] = $this->url('stat');
+            $name = '数据统计';
+            if (is_string($config['manage']['stat'])) {
+                $name = $config['manage']['stat'];
+            }
+            $config['manage']['button'][$name] = $this->url('stat');
         }
 
         # 增加下载报表按钮
         if (isset($config['manage']['excel'])) {
-            $config['manage']['button']['导出数据'] = 'onclick="location.href=\''.$this->url('excel').'\'"';
+            $name = '导出数据';
+            if (is_string($config['manage']['excel'])) {
+                $name = $config['manage']['excel'];
+            }
+            $config['manage']['button'][$name] = 'onclick="jump(\''.$this->url('excel').'\', \'#form1\')"';
         }
         # 增加回收站
         if (isset($config['struct']['state']) && (!isset($config['manage']['delete']) || (isset($config['manage']['delete']) && $config['manage']['delete'] && isset($config['manage']['_list']['value']['delete'])))) {