rabin 2 年 前
コミット
f907f89484
2 ファイル変更72 行追加43 行削除
  1. 1 0
      database/admin.php
  2. 71 43
      src/Database.php

+ 1 - 0
database/admin.php

@@ -833,6 +833,7 @@ return array
 		'list_button' => array
 		(
 			'add' => array('新增子分类', '"{category}" == -1 ? "category&option_category={id}" : "category&option_category={category},{id}"'),
+			'list' => array('商品清单', 'store_goods&parent=info.store&search_option_carrier_store_id={id}'),
 		),*/
 		# 表格使用js模式,默认是html渲染模式
         //'list_table' => 'js',

+ 71 - 43
src/Database.php

@@ -181,7 +181,7 @@ class Database
             'update'            => 'project/database/update?{param}' . $id,
             # 增加快捷更新
             'edit'            => 'project/database/update?{param}' . $id,
-            'updateAction'      => 'database.update_action',
+            'updateAction'      => 'database.update_action_commit',
             'url'               => '',
             'delete'      => 'database.delete_action?{param}' . $id,
             'recovery'    => 'database.recovery_action?{param}' . $id,
@@ -445,43 +445,8 @@ class Database
             'search_param' => '',
         );
 
-        # 此处为了兼容旧版本的一些设置
-        $this->info['parent'] = Dever::input('oper_table', Dever::input('oper_parent'));
-
-        # 返回上一页
-        if ($this->info['parent']) {
-            $oper = Dever::preInput('oper_');
-            if ($oper) {
-                $this->info['parent'] .= '&' . str_replace('oper_', '', http_build_query($oper));
-            }
-            $search = Dever::preInput('search_');
-            if ($search) {
-                $this->info['parent'] .= '&' . http_build_query($search);
-            }
-            $send = Dever::preInput('send_');
-            if ($send) {
-                $this->info['parent'] .= '&' . http_build_query($send);
-            }
-            $top = Dever::preInput('top_');
-            if ($top) {
-                $top_query = http_build_query($top);
-                if (strstr($top_query, '.')) {
-                    foreach ($top as $k => $v) {
-                        $temp = explode('.', $v);
-                        $k = str_replace('top_', '', $k);
-                        $this->info['parent'] .= '&oper_' . $k . '=' . $temp[0];
-                        if (isset($temp[1])) {
-                            $this->info['parent'] .= '&top_' . $k . '=' . $temp[1];
-                        }
-                    }
-                } else {
-                    $this->info['parent'] .= '&' . str_replace('top_', 'oper_', $top_query);
-                }
-            }
-            $this->info['parent_project'] = Dever::input('oper_project');
-
-            $this->info['parent'] = $this->url(Dever::input('oper_index', 'listData'), 0, $this->info['parent'], '', $this->info['parent_project']);
-        }
+        $this->parent();
+        
         # 保存页面
         $this->info['save'] = Dever::input('oper_save_table', Dever::input('oper_save_jump'));
         if ($this->info['save']) {
@@ -511,6 +476,70 @@ class Database
         return $this->info;
     }
 
+    private function parent()
+    {
+        # 返回上一页
+        $this->info['parent'] = '';
+        $this->info['parent_project'] = '';
+        $parent = Dever::input('parent');
+        if ($parent) {
+            $parent = explode('.', $parent);
+            $cur = array_pop($parent);
+            if (strstr($cur, '/')) {
+                $temp = explode('/', $cur);
+                $cur = $temp[1];
+                $this->info['parent_project'] = $temp[2];
+            }
+            $parent = implode('.', $parent);
+            $search = Dever::preInput('search_');
+            $oper_parent = $cur . '&parent=' . $parent;
+            if ($search) {
+                $oper_parent .= '&' . http_build_query($search);
+            }
+            $send = Dever::preInput('send_');
+            if ($send) {
+                $oper_parent .= '&' . http_build_query($send);
+            }
+            $this->info['parent'] = $this->url(Dever::input('oper_index', 'listData'), 0, $oper_parent, '', $this->info['parent_project']);
+        } else {
+            # 此处为了兼容旧版本的一些设置 这里后续废弃
+            $oper_parent = Dever::input('oper_table', Dever::input('oper_parent'));
+            if ($oper_parent) {
+                $oper = Dever::preInput('oper_');
+                if ($oper) {
+                    $oper_parent .= '&' . str_replace('oper_', '', http_build_query($oper));
+                }
+                $search = Dever::preInput('search_');
+                if ($search) {
+                    $oper_parent .= '&' . http_build_query($search);
+                }
+                $send = Dever::preInput('send_');
+                if ($send) {
+                    $oper_parent .= '&' . http_build_query($send);
+                }
+                $top = Dever::preInput('top_');
+                if ($top) {
+                    $top_query = http_build_query($top);
+                    if (strstr($top_query, '.')) {
+                        foreach ($top as $k => $v) {
+                            $temp = explode('.', $v);
+                            $k = str_replace('top_', '', $k);
+                            $oper_parent .= '&oper_' . $k . '=' . $temp[0];
+                            if (isset($temp[1])) {
+                                $oper_parent .= '&top_' . $k . '=' . $temp[1];
+                            }
+                        }
+                    } else {
+                        $oper_parent .= '&' . str_replace('top_', 'oper_', $top_query);
+                    }
+                }
+                $this->info['parent_project'] = Dever::input('oper_project');
+
+                $this->info['parent'] = $this->url(Dever::input('oper_index', 'listData'), 0, $oper_parent, '', $this->info['parent_project']);
+            }
+        }
+    }
+
     /**
      * 获取表名
      *
@@ -1315,7 +1344,6 @@ class Database
             $result .= '<button type="button" class="btn btn-primary save-data layui-btn layuiadmin-btn-list"><i class="fa fa-save"></i> '.$save_name.'</button>';
         }
 
-
         $close_name = '放弃保存';
 
         if (isset($config['manage']['update_close']) && !$config['manage']['update_close']) {
@@ -1323,7 +1351,7 @@ class Database
         }
 
         if ($close_name) {
-            $result .= '<a href="' . $info['list'] . '" class="btn btn-danger layui-btn layuiadmin-btn-list layui-btn-danger" onclicks="msg({status:1,msg:\'yes\'})">'.$close_name.'</a>';
+            $result .= '<a href="' . ($info['parent'] ? $info['parent'] : $info['list']) . '" class="btn btn-danger layui-btn layuiadmin-btn-list layui-btn-danger" onclicks="msg({status:1,msg:\'yes\'})">'.$close_name.'</a>';
         }
 
         if (isset($config['manage']['update_button']) && $config['manage']['update_button']) {
@@ -4268,7 +4296,7 @@ class Database
      *
      * @return array
      */
-    public function update_action_api()
+    public function update_action_commit_api()
     {
         $key = Dever::input('dever_submit_key');
         $col = Dever::input('col');
@@ -4634,9 +4662,9 @@ class Database
                     foreach ($update_check as $k1 => $v1) {
                         if (strstr($v1, '-')) {
                             $t = explode('-', $v1);
-                            $k1 = $t[0] . '/' . $t[1];
+                            $v1 = $t[0] . '/' . $t[1];
                         }
-                        if (isset($config['struct'][$v1]) && !isset($update_id[$k][$k1])) {
+                        if (isset($config['struct'][$v1]) && !isset($update_id[$k][$v1])) {
                             Dever::alert($config['struct'][$v1]['name'] . '不能为空');
                         }
                     }