rabin 1 년 전
부모
커밋
bb778395fd
4개의 변경된 파일32개의 추가작업 그리고 7개의 파일을 삭제
  1. 1 1
      assets/layadmin/html/inc/script.html
  2. 2 0
      assets/layadmin/html/project/database/update.html
  3. 27 6
      src/Database.php
  4. 2 0
      template/layadmin/project/database/update.php

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

@@ -41,4 +41,4 @@
 <script type="text/javascript" src="../script/lib/layui/xm-select/xm-select.js"></script>
 
 <!-- 加载主要js,很乱,后续优化 -->
-<script type="text/javascript" src="../script/lib/manage/main.js?726"></script>
+<script type="text/javascript" src="../script/lib/manage/main.js?728"></script>

+ 2 - 0
assets/layadmin/html/project/database/update.html

@@ -58,6 +58,8 @@
     <input type="hidden" name="fast" id="fast" />
     <input type="hidden" name="dever_submit" id="dever_submit" />
     <input type="hidden" name="menu_id" id="menu_id" />
+    <input type="hidden" name="mul_ids" id="mul_ids" />
+    <input type="hidden" name="mul_load" id="mul_load" />
     <input type="hidden" name="update_where_id" id="update_where_id"/>
     <input type="hidden" name="copy_num" id="copy_num" value="0"/>
     <iframe id="f1" name="f1" style="display:none;"></iframe>

+ 27 - 6
src/Database.php

@@ -514,6 +514,8 @@ class Database
             'parent' => '',
             'parent_value' => Dever::input('parent'),
             'alias' => Dever::input('alias'),
+            'mul_ids' => Dever::input('mul_ids'),
+            'mul_load' => Dever::input('mul_load'),
         );
 
         if ($this->parent) {
@@ -1457,12 +1459,15 @@ class Database
                     $url .= '&manage_log=update.' . $this->project . '.' . $this->table . '&manage_oper=' . $k;
                     $result .= '&nbsp;&nbsp;<a class="btn btn-default layui-btn layuiadmin-btn-list layui-btn-danger" href="javascript:;" onclick="load(\'' . $url . '\', \'' . $content . '\', \'' . $title . '\')">' . $k . '</a>';
                 } elseif ($v[0] == 'oper_mul') {
-                    $url = Dever::url($v[1]);
-                    if (!isset($v[2])) {
-                        $v[2] = 1;
+                    if (isset($v[2])) {
+                        $url = $this->url($v[1], false, false, $suffix);
+                        $result .= '&nbsp;&nbsp;<a class="btn btn-default layui-btn layuiadmin-btn-list" href="javascript:;" onclick="fastEdit($(this),\''.$url.'\',\''.$k.'\', \''.$v[2].'\', false, false, 1, \''.$v[3].'\')">' . $k . '</a>';
+                        //$result .= '&nbsp;&nbsp;<a class="btn btn-default layui-btn layuiadmin-btn-list layui-btn-danger" href="javascript:;" onclick="$(\'#form1\').attr(\'action\', \'' . $this->url('list', false, false, $suffix) . '\');list_mul($(this), 1, \''.$url.'\')">' . $k . '</a>';
+                    } else {
+                        $url = Dever::url($v[1]);
+                        $result .= '&nbsp;&nbsp;<a class="btn btn-default layui-btn layuiadmin-btn-list layui-btn-danger" href="javascript:;" onclick="$(\'#form1\').attr(\'action\', \'' . $this->url('list', false, false, $suffix) . '\');list_mul($(this), 1, \''.$url.'\')">' . $k . '</a>';
                     }
-                    //$url .= '&manage_log=update.' . $this->project . '.' . $this->table . '&manage_oper=' . $k;
-                    $result .= '&nbsp;&nbsp;<a class="btn btn-default layui-btn layuiadmin-btn-list layui-btn-danger" href="javascript:;" onclick="$(\'#form1\').attr(\'action\', \'' . $this->url('list', false, false, $suffix) . '\');list_mul($(this), 1, \''.$url.'\')">' . $k . '</a>';
+                    
                 } elseif ($v[0] == 'show') {
                     $url = Dever::url($v[1]);
                     $submit = '';
@@ -3293,6 +3298,7 @@ class Database
 
             $this->list_search_select($result, $mul, $prefix . 'type' . '" id="' . $prefix . 'type', '请选择要批量操作的数据', $option, $default);
 
+            $state = false;
             foreach ($config['struct'] as $k => $v) {
                 if ($k == 'state' && (!isset($config['manage']['delete']) || (isset($config['manage']['delete']) && $config['manage']['delete']))) {
                     $v['option'] = Dever::config('base')->state;
@@ -3307,6 +3313,7 @@ class Database
                 $select = false;
                 if (isset($v['mul'])) {
                     $select = $v['mul'];
+                    $state = true;
                 } elseif (isset($v['edit'])) {
                     $select = $v['edit'];
                 }
@@ -3322,7 +3329,11 @@ class Database
                 }
             }
 
-            $result .= $btn . $node[1];
+            if ($state) {
+                $result .= $btn . $node[1];
+            } else {
+                $result = '';
+            }
         }
 
         //print_r($result);die;
@@ -4435,6 +4446,7 @@ class Database
      */
     public function update_action_commit_api()
     {
+        $mul_ids = Dever::input('mul_ids');
         $key = Dever::input('dever_submit_key');
         $col = Dever::input('col');
         $value = Dever::input('value');
@@ -4778,6 +4790,15 @@ class Database
             //print_r($update_other);die;
             //print_r($config['struct']);die;
 
+            if ($mul_ids) {
+                $mul_load = Dever::input('mul_load');
+                if ($mul_load) {
+                    Dever::load($mul_load, $mul_ids, '', $update[0]);
+                }
+                Dever::out('yes');
+                return;
+            }
+
             $this->checkSpec($config);
             # 增加复制的数量
             $copy_num = Dever::input('copy_num');

+ 2 - 0
template/layadmin/project/database/update.php

@@ -22,6 +22,8 @@ $view
 ->fetch('#project@value',		'manage/database.info#project')
 ->fetch('#table@value',		'manage/database.info#table') 
 ->fetch('#menu_id@value',		'manage/database.info#menu_id') 
+->fetch('#mul_ids@value',       'manage/database.info#mul_ids') 
+->fetch('#mul_load@value',       'manage/database.info#mul_load') 
 ->fetch('#update_where_id@value',	'manage/database.info#id')
 ->fetch('#url@value',		'manage/database.info#submit')
 ->fetch('#alias@value',		'manage/database.info#alias')