xiansin 2 роки тому
батько
коміт
c2ac78bca3

+ 18 - 0
server/app/Admin/Controllers/AccountController.php

xqd
@@ -36,6 +36,24 @@ class AccountController extends AdminController
 
             $grid->disableViewButton();
 
+            $grid->export()
+                ->titles([
+                    'user_name'       => '用户名',
+                    'type_text'  => '用户类型',
+                    'account'  => '账号',
+                    'status_text'      => '状态',
+                    'remark' => '备注',
+                    'created_at'  => '添加时间',
+                ])->rows(function ($rows){
+                    foreach ($rows as  &$row) {
+                        $row['type_text']= config('global.user_type')[$row['type']];
+                        $row['status_text'] = config('global.user_status')[$row['status']];
+                    }
+                    return $rows;
+                })
+                ->xlsx()
+                ->disableExportSelectedRow();
+
         });
     }
 

+ 1 - 1
server/app/Models/Account.php

xqd
@@ -41,7 +41,7 @@ class Account extends Model
     protected $table = 'accounts';
 
     protected $hidden = [
-        'password','updated_at','created_at'
+        'password','updated_at'
     ];
 
     public function user(): BelongsTo