webman-admin
This commit is contained in:
parent
b676dad07d
commit
039314e2dd
19
composer.json
Normal file
19
composer.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "webman/admin",
|
||||||
|
"type": "library",
|
||||||
|
"license": "MIT",
|
||||||
|
"description": "Webman plugin webman/admin",
|
||||||
|
"require": {
|
||||||
|
"workerman/webman-framework": "^1.4",
|
||||||
|
"illuminate/database": ">=8.83",
|
||||||
|
"illuminate/pagination": ">=8.83",
|
||||||
|
"illuminate/events": ">=8.83",
|
||||||
|
"intervention/image": "^2.7",
|
||||||
|
"webman/event": "^1.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Webman\\Admin\\": "src"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
74
src/Install.php
Normal file
74
src/Install.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
namespace Webman\Admin;
|
||||||
|
|
||||||
|
class Install
|
||||||
|
{
|
||||||
|
const WEBMAN_PLUGIN = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected static $pathRelation = array (
|
||||||
|
'plugin/admin' => 'plugin/admin',
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function install()
|
||||||
|
{
|
||||||
|
static::installByRelation();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uninstall
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function uninstall()
|
||||||
|
{
|
||||||
|
self::uninstallByRelation();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* installByRelation
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function installByRelation()
|
||||||
|
{
|
||||||
|
foreach (static::$pathRelation as $source => $dest) {
|
||||||
|
if ($pos = strrpos($dest, '/')) {
|
||||||
|
$parent_dir = base_path().'/'.substr($dest, 0, $pos);
|
||||||
|
if (!is_dir($parent_dir)) {
|
||||||
|
mkdir($parent_dir, 0777, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//symlink(__DIR__ . "/$source", base_path()."/$dest");
|
||||||
|
copy_dir(__DIR__ . "/$source", base_path()."/$dest");
|
||||||
|
echo "Create $dest
|
||||||
|
";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uninstallByRelation
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function uninstallByRelation()
|
||||||
|
{
|
||||||
|
foreach (static::$pathRelation as $source => $dest) {
|
||||||
|
$path = base_path()."/$dest";
|
||||||
|
if (!is_dir($path) && !is_file($path)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
echo "Remove $dest
|
||||||
|
";
|
||||||
|
if (is_file($path) || is_link($path)) {
|
||||||
|
unlink($path);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
remove_dir($path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
73
src/plugin/admin/app/Admin.php
Normal file
73
src/plugin/admin/app/Admin.php
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
namespace plugin\admin\app;
|
||||||
|
|
||||||
|
use plugin\admin\app\model\AdminRole;
|
||||||
|
use plugin\admin\app\model\AdminRule;
|
||||||
|
|
||||||
|
class Admin
|
||||||
|
{
|
||||||
|
public static function canAccess($controller, $action, &$code = 0, &$msg = '')
|
||||||
|
{
|
||||||
|
// 获取控制器鉴权信息
|
||||||
|
$class = new \ReflectionClass($controller);
|
||||||
|
$properties = $class->getDefaultProperties();
|
||||||
|
$noNeedLogin = $properties['noNeedLogin'] ?? [];
|
||||||
|
$noNeedAuth = $properties['noNeedAuth'] ?? [];
|
||||||
|
|
||||||
|
// 不需要登录
|
||||||
|
if (in_array($action, $noNeedLogin)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取登录信息
|
||||||
|
$admin = admin();
|
||||||
|
if (!$admin) {
|
||||||
|
$msg = '请登录';
|
||||||
|
$code = 1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 不需要鉴权
|
||||||
|
if (in_array($action, $noNeedAuth)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当前管理员无角色
|
||||||
|
$roles = $admin['roles'] ? explode(',', $admin['roles']) : [];
|
||||||
|
if (!$roles) {
|
||||||
|
$msg = '无权限';
|
||||||
|
$code = 2;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 角色没有规则
|
||||||
|
$rules = AdminRole::whereIn('id', $roles)->pluck('rules');
|
||||||
|
$rule_ids = [];
|
||||||
|
foreach ($rules as $rule_string) {
|
||||||
|
if (!$rule_string) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$rule_ids = array_merge($rule_ids, explode(',', $rule_string));
|
||||||
|
}
|
||||||
|
if (!$rule_ids) {
|
||||||
|
$msg = '无权限';
|
||||||
|
$code = 2;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 超级管理员
|
||||||
|
if (in_array('*', $rule_ids)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 没有当前控制器的规则
|
||||||
|
$rule = AdminRule::where('name', $controller)->whereIn('id', $rule_ids)->first();
|
||||||
|
if (!$rule) {
|
||||||
|
$msg = '无权限';
|
||||||
|
$code = 2;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
130
src/plugin/admin/app/Util.php
Normal file
130
src/plugin/admin/app/Util.php
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app;
|
||||||
|
|
||||||
|
use Support\Exception\BusinessException;
|
||||||
|
|
||||||
|
class Util
|
||||||
|
{
|
||||||
|
static public function passwordHash($password, $algo = PASSWORD_DEFAULT)
|
||||||
|
{
|
||||||
|
return password_hash($password, $algo);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public function passwordVerify($password, $hash)
|
||||||
|
{
|
||||||
|
return password_verify($password, $hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public function checkTableName($table)
|
||||||
|
{
|
||||||
|
if (!preg_match('/^[a-zA-Z_0-9]+$/', $table)) {
|
||||||
|
throw new BusinessException('表名不合法');
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function camel($value)
|
||||||
|
{
|
||||||
|
static $cache = [];
|
||||||
|
$key = $value;
|
||||||
|
|
||||||
|
if (isset($cache[$key])) {
|
||||||
|
return $cache[$key];
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = ucwords(str_replace(['-', '_'], ' ', $value));
|
||||||
|
|
||||||
|
return $cache[$key] = str_replace(' ', '', $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function smCamel($value)
|
||||||
|
{
|
||||||
|
return lcfirst(static::camel($value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCommentFirstLine($comment)
|
||||||
|
{
|
||||||
|
if ($comment === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
foreach (explode("\n", $comment) as $str) {
|
||||||
|
if ($s = trim($str, "*/\ \t\n\r\0\x0B")) {
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function methodControlMap()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//method=>[控件]
|
||||||
|
'integer' => ['InputNumber'],
|
||||||
|
'string' => ['Input'],
|
||||||
|
'text' => ['InputTextArea'],
|
||||||
|
'date' => ['DatePicker'],
|
||||||
|
'enum' => ['Select'],
|
||||||
|
'float' => ['Input'],
|
||||||
|
|
||||||
|
'tinyInteger' => ['InputNumber'],
|
||||||
|
'smallInteger' => ['InputNumber'],
|
||||||
|
'mediumInteger' => ['InputNumber'],
|
||||||
|
'bigInteger' => ['InputNumber'],
|
||||||
|
|
||||||
|
'unsignedInteger' => ['InputNumber'],
|
||||||
|
'unsignedTinyInteger' => ['InputNumber'],
|
||||||
|
'unsignedSmallInteger' => ['InputNumber'],
|
||||||
|
'unsignedMediumInteger' => ['InputNumber'],
|
||||||
|
'unsignedBigInteger' => ['InputNumber'],
|
||||||
|
|
||||||
|
'decimal' => ['Input'],
|
||||||
|
'double' => ['Input'],
|
||||||
|
|
||||||
|
'mediumText' => ['InputTextArea'],
|
||||||
|
'longText' => ['InputTextArea'],
|
||||||
|
|
||||||
|
'dateTime' => ['DatePicker'],
|
||||||
|
|
||||||
|
'time' => ['DatePicker'],
|
||||||
|
'timestamp' => ['DatePicker'],
|
||||||
|
|
||||||
|
'char' => ['Input'],
|
||||||
|
|
||||||
|
'binary' => ['Input'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function typeToControl($type)
|
||||||
|
{
|
||||||
|
if (stripos($type, 'int') !== false) {
|
||||||
|
return 'InputNumber';
|
||||||
|
}
|
||||||
|
if (stripos($type, 'time') !== false || stripos($type, 'date') !== false) {
|
||||||
|
return 'DatePicker';
|
||||||
|
}
|
||||||
|
if (stripos($type, 'text') !== false) {
|
||||||
|
return 'InputTextArea';
|
||||||
|
}
|
||||||
|
if ($type === 'enum') {
|
||||||
|
return 'Select';
|
||||||
|
}
|
||||||
|
return 'Input';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function typeToMethod($type, $unsigned = false)
|
||||||
|
{
|
||||||
|
if (stripos($type, 'int') !== false) {
|
||||||
|
$type = str_replace('int', 'Integer', $type);
|
||||||
|
return $unsigned ? "unsigned" . ucfirst($type) : lcfirst($type);
|
||||||
|
}
|
||||||
|
$map = [
|
||||||
|
'int' => 'integer',
|
||||||
|
'varchar' => 'string',
|
||||||
|
'mediumtext' => 'mediumText',
|
||||||
|
'longtext' => 'longText',
|
||||||
|
'datetime' => 'dateTime',
|
||||||
|
];
|
||||||
|
return $map[$type] ?? $type;
|
||||||
|
}
|
||||||
|
}
|
30
src/plugin/admin/app/controller/Base.php
Normal file
30
src/plugin/admin/app/controller/Base.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\controller;
|
||||||
|
|
||||||
|
use plugin\admin\app\Util;
|
||||||
|
use support\Db;
|
||||||
|
use support\Request;
|
||||||
|
|
||||||
|
class Base
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无需登录的方法及鉴权
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $noNeedLogin = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需要登录无需鉴权的方法
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $noNeedAuth = [];
|
||||||
|
|
||||||
|
|
||||||
|
protected function json(int $code, string $msg = 'ok', array $data = [])
|
||||||
|
{
|
||||||
|
return json(['code' => $code, 'result' => $data, 'message' => $msg, 'type' => $code ? 'error' : 'success']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
284
src/plugin/admin/app/controller/Crud.php
Normal file
284
src/plugin/admin/app/controller/Crud.php
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\controller;
|
||||||
|
|
||||||
|
use plugin\admin\app\Util;
|
||||||
|
use support\Db;
|
||||||
|
use support\Model;
|
||||||
|
use support\Request;
|
||||||
|
|
||||||
|
trait Crud
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Model
|
||||||
|
*/
|
||||||
|
protected $model = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function select(Request $request)
|
||||||
|
{
|
||||||
|
$page = $request->get('page', 1);
|
||||||
|
$field = $request->get('field');
|
||||||
|
$order = $request->get('order', 'descend');
|
||||||
|
$format = $request->get('format', 'normal');
|
||||||
|
$page_size = $request->get('pageSize', $format === 'tree' ? 1000 : 10);
|
||||||
|
|
||||||
|
$table = $this->model->getTable();
|
||||||
|
|
||||||
|
$allow_column = Db::select("desc $table");
|
||||||
|
if (!$allow_column) {
|
||||||
|
return $this->json(2, '表不存在');
|
||||||
|
}
|
||||||
|
$allow_column = array_column($allow_column, 'Field', 'Field');
|
||||||
|
if (!in_array($field, $allow_column)) {
|
||||||
|
$field = current($allow_column);
|
||||||
|
}
|
||||||
|
$order = $order === 'ascend' ? 'asc' : 'desc';
|
||||||
|
$paginator = $this->model;
|
||||||
|
foreach ($request->get() as $column => $value) {
|
||||||
|
if (!$value) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (isset($allow_column[$column])) {
|
||||||
|
if (is_array($value)) {
|
||||||
|
if ($value[0] == 'undefined' || $value[1] == 'undefined') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$paginator = $paginator->whereBetween($column, $value);
|
||||||
|
} else {
|
||||||
|
$paginator = $paginator->where($column, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$paginator = $paginator->orderBy($field, $order)->paginate($page_size, '*', 'page', $page);
|
||||||
|
|
||||||
|
$items = $paginator->items();
|
||||||
|
if ($format == 'tree') {
|
||||||
|
$items_map = [];
|
||||||
|
foreach ($items as $item) {
|
||||||
|
$items_map[$item->id] = $item->toArray();
|
||||||
|
}
|
||||||
|
$formatted_items = [];
|
||||||
|
foreach ($items_map as $item) {
|
||||||
|
if ($item['pid'] && isset($items_map[$item['pid']])) {
|
||||||
|
$items_map[$item['pid']]['children'][] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($items_map as $item) {
|
||||||
|
if (!$item['pid']) {
|
||||||
|
$formatted_items[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$items = $formatted_items;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json(0, 'ok', [
|
||||||
|
'items' => $items,
|
||||||
|
'total' => $paginator->total()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function insert(Request $request)
|
||||||
|
{
|
||||||
|
$data = $request->post('data');
|
||||||
|
$table = $this->model->getTable();
|
||||||
|
$allow_column = Db::select("desc $table");
|
||||||
|
if (!$allow_column) {
|
||||||
|
return $this->json(2, '表不存在');
|
||||||
|
}
|
||||||
|
$columns = array_column($allow_column, 'Field', 'Field');
|
||||||
|
foreach ($data as $col => $item) {
|
||||||
|
if (is_array($item)) {
|
||||||
|
$data[$col] = implode(',', $item);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($col === 'password') {
|
||||||
|
$data[$col] = Util::passwordHash($item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$datetime = date('Y-m-d H:i:s');
|
||||||
|
if (isset($columns['created_at']) && !isset($data['created_at'])) {
|
||||||
|
$data['created_at'] = $datetime;
|
||||||
|
}
|
||||||
|
if (isset($columns['updated_at']) && !isset($data['updated_at'])) {
|
||||||
|
$data['updated_at'] = $datetime;
|
||||||
|
}
|
||||||
|
$id = $this->model->insertGetId($data);
|
||||||
|
return $this->json(0, $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
$column = $request->post('column');
|
||||||
|
$value = $request->post('value');
|
||||||
|
$data = $request->post('data');
|
||||||
|
$table = $this->model->getTable();
|
||||||
|
$allow_column = Db::select("desc $table");
|
||||||
|
if (!$allow_column) {
|
||||||
|
return $this->json(2, '表不存在');
|
||||||
|
}
|
||||||
|
$columns = array_column($allow_column, 'Field', 'Field');
|
||||||
|
foreach ($data as $col => $item) {
|
||||||
|
if (is_array($item)) {
|
||||||
|
$data[$col] = implode(',', $item);
|
||||||
|
}
|
||||||
|
if ($col === 'password') {
|
||||||
|
// 密码为空,则不更新密码
|
||||||
|
if ($item == '') {
|
||||||
|
unset($data[$col]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$data[$col] = Util::passwordHash($item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$datetime = date('Y-m-d H:i:s');
|
||||||
|
if (isset($columns['updated_at']) && !isset($data['updated_at'])) {
|
||||||
|
$data['updated_at'] = $datetime;
|
||||||
|
}
|
||||||
|
$this->model->where($column, $value)->update($data);
|
||||||
|
return $this->json(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
* @throws \Support\Exception\BusinessException
|
||||||
|
*/
|
||||||
|
public function delete(Request $request)
|
||||||
|
{
|
||||||
|
$column = $request->post('column');
|
||||||
|
$value = $request->post('value');
|
||||||
|
$this->model->where([$column => $value])->delete();
|
||||||
|
return $this->json(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摘要
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
* @throws \Support\Exception\BusinessException
|
||||||
|
*/
|
||||||
|
public function schema(Request $request)
|
||||||
|
{
|
||||||
|
$table = $this->model->getTable();
|
||||||
|
Util::checkTableName($table);
|
||||||
|
$schema = Db::connection('plugin.admin.mysql')->table('wa_options')->where('name', "table_form_schema_$table")->value('value');
|
||||||
|
$form_schema_map = $schema ? json_decode($schema, true) : [];
|
||||||
|
|
||||||
|
$data = $this->getSchema($table);
|
||||||
|
foreach ($data['forms'] as $field => $item) {
|
||||||
|
if (isset($form_schema_map[$field])) {
|
||||||
|
$data['forms'][$field] = $form_schema_map[$field];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json(0, 'ok', [
|
||||||
|
'table' => $data['table'],
|
||||||
|
'columns' => array_values($data['columns']),
|
||||||
|
'forms' => array_values($data['forms']),
|
||||||
|
'keys' => array_values($data['keys']),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getSchema($table, $section = null)
|
||||||
|
{
|
||||||
|
$database = config('database.connections')['plugin.admin.mysql']['database'];
|
||||||
|
$schema_raw = $section !== 'table' ? Db::select("select * from information_schema.COLUMNS where TABLE_SCHEMA = '$database' and table_name = '$table'") : [];
|
||||||
|
$forms = [];
|
||||||
|
$columns = [];
|
||||||
|
foreach ($schema_raw as $item) {
|
||||||
|
$field = $item->COLUMN_NAME;
|
||||||
|
$columns[$field] = [
|
||||||
|
'field' => $field,
|
||||||
|
'type' => Util::typeToMethod($item->DATA_TYPE, (bool)strpos($item->COLUMN_TYPE, 'unsigned')),
|
||||||
|
'comment' => $item->COLUMN_COMMENT,
|
||||||
|
'default' => $item->COLUMN_DEFAULT,
|
||||||
|
'length' => $this->getLengthValue($item),
|
||||||
|
'nullable' => $item->IS_NULLABLE !== 'NO',
|
||||||
|
'primary_key' => $item->COLUMN_KEY === 'PRI',
|
||||||
|
'auto_increment' => strpos($item->EXTRA, 'auto_increment') !== false
|
||||||
|
];
|
||||||
|
|
||||||
|
$forms[$field] = [
|
||||||
|
'field' => $field,
|
||||||
|
'comment' => $item->COLUMN_COMMENT,
|
||||||
|
'control' => Util::typeToControl($item->DATA_TYPE),
|
||||||
|
'form_show' => $item->COLUMN_KEY !== 'PRI',
|
||||||
|
'list_show' => true,
|
||||||
|
'enable_sort' => false,
|
||||||
|
'readonly' => $item->COLUMN_KEY === 'PRI',
|
||||||
|
'searchable' => false,
|
||||||
|
'search_type' => 'normal',
|
||||||
|
'control_args' => '',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$table_schema = $section == 'table' || !$section ? Db::select("SELECT TABLE_COMMENT FROM information_schema.`TABLES` WHERE TABLE_SCHEMA='$database' and TABLE_NAME='$table'") : [];
|
||||||
|
$indexes = $section == 'keys' || !$section ? Db::select("SHOW INDEX FROM $table") : [];
|
||||||
|
$keys = [];
|
||||||
|
foreach ($indexes as $index) {
|
||||||
|
$key_name = $index->Key_name;
|
||||||
|
if ($key_name == 'PRIMARY') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!isset($keys[$key_name])) {
|
||||||
|
$keys[$key_name] = [
|
||||||
|
'name' => $key_name,
|
||||||
|
'columns' => [],
|
||||||
|
'type' => $index->Non_unique == 0 ? 'unique' : 'normal'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$keys[$key_name]['columns'][] = $index->Column_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'table' => ['name' => $table, 'comment' => $table_schema[0]->TABLE_COMMENT ?? ''],
|
||||||
|
'columns' => $columns,
|
||||||
|
'forms' => $forms,
|
||||||
|
'keys' => array_reverse($keys, true)
|
||||||
|
];
|
||||||
|
return $section ? $data[$section] : $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getLengthValue($schema)
|
||||||
|
{
|
||||||
|
$type = $schema->DATA_TYPE;
|
||||||
|
if (in_array($type, ['float', 'decimal', 'double'])) {
|
||||||
|
return "{$schema->NUMERIC_PRECISION},{$schema->NUMERIC_SCALE}";
|
||||||
|
}
|
||||||
|
if ($type === 'enum') {
|
||||||
|
return implode(',', array_map(function($item){
|
||||||
|
return trim($item, "'");
|
||||||
|
}, explode(',', substr($schema->COLUMN_TYPE, 5, -1))));
|
||||||
|
}
|
||||||
|
if (in_array($type, ['varchar', 'text', 'char'])) {
|
||||||
|
return $schema->CHARACTER_MAXIMUM_LENGTH;
|
||||||
|
}
|
||||||
|
if (in_array($type, ['time', 'datetime', 'timestamp'])) {
|
||||||
|
return $schema->CHARACTER_MAXIMUM_LENGTH;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function json(int $code, string $msg = 'ok', array $data = [])
|
||||||
|
{
|
||||||
|
return json(['code' => $code, 'result' => $data, 'message' => $msg, 'type' => $code ? 'error' : 'success']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
24
src/plugin/admin/app/controller/IndexController.php
Normal file
24
src/plugin/admin/app/controller/IndexController.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\controller;
|
||||||
|
|
||||||
|
use plugin\admin\app\Util;
|
||||||
|
use support\Db;
|
||||||
|
use support\Request;
|
||||||
|
|
||||||
|
class IndexController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无需登录的方法
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $noNeedLogin = ['index'];
|
||||||
|
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return response()->file(base_path() . '/plugin/admin/public/index.html');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
118
src/plugin/admin/app/controller/auth/AdminController.php
Normal file
118
src/plugin/admin/app/controller/auth/AdminController.php
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\controller\auth;
|
||||||
|
|
||||||
|
use plugin\admin\app\controller\Base;
|
||||||
|
use plugin\admin\app\controller\Crud;
|
||||||
|
use plugin\admin\app\model\Admin;
|
||||||
|
use plugin\admin\app\Util;
|
||||||
|
use support\Db;
|
||||||
|
use support\Request;
|
||||||
|
use support\Response;
|
||||||
|
use function admin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员设置
|
||||||
|
*/
|
||||||
|
class AdminController extends Base
|
||||||
|
{
|
||||||
|
|
||||||
|
public $noNeedLogin = ['login', 'logout'];
|
||||||
|
|
||||||
|
public $noNeedAuth = ['info', 'getPermCode'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Admin
|
||||||
|
*/
|
||||||
|
protected $model = null;
|
||||||
|
|
||||||
|
use Crud;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->model = new Admin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
* @throws \Support\Exception\BusinessException
|
||||||
|
*/
|
||||||
|
public function delete(Request $request)
|
||||||
|
{
|
||||||
|
$column = $request->post('column');
|
||||||
|
$value = $request->post('value');
|
||||||
|
if ($value == admin_id()) {
|
||||||
|
return $this->json(1, '不能删除自己');
|
||||||
|
}
|
||||||
|
$this->model->where([$column => $value])->delete();
|
||||||
|
return $this->json(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录
|
||||||
|
* @param Request $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function login(Request $request)
|
||||||
|
{
|
||||||
|
$username = $request->post('username', '');
|
||||||
|
$password = $request->post('password', '');
|
||||||
|
$admin = Db::connection('plugin.admin.mysql')->table('wa_admins')->where('username', $username)->first();
|
||||||
|
if (!$admin || !Util::passwordVerify($password, $admin->password)) {
|
||||||
|
return $this->json(1, '账户不存在或密码错误');
|
||||||
|
}
|
||||||
|
$session = $request->session();
|
||||||
|
$session->set('admin_id', $admin->id);
|
||||||
|
return $this->json(0, '登录成功', [
|
||||||
|
'realName' => $admin->nickname,
|
||||||
|
'token' => $request->sessionId(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出
|
||||||
|
* @param Request $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function logout(Request $request)
|
||||||
|
{
|
||||||
|
$request->session()->delete('admin_id');
|
||||||
|
return $this->json(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取登录信息
|
||||||
|
* @param Request $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function info(Request $request)
|
||||||
|
{
|
||||||
|
$admin = admin();
|
||||||
|
if (!$admin) {
|
||||||
|
return $this->json(1);
|
||||||
|
}
|
||||||
|
$info = [
|
||||||
|
'realName' => $admin['nickname'],
|
||||||
|
'desc' => 'manager',
|
||||||
|
'avatar' => $admin['avatar'],
|
||||||
|
'token' => $request->sessionId(),
|
||||||
|
'userId' => $admin['id'],
|
||||||
|
'username' => $admin['username'],
|
||||||
|
'roles' => []
|
||||||
|
];
|
||||||
|
return $this->json(0, 'ok', $info);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取权限码
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function getPermCode()
|
||||||
|
{
|
||||||
|
return $this->json(0, 'ok', ['1000', '3000', '5000']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
178
src/plugin/admin/app/controller/auth/AdminRoleController.php
Normal file
178
src/plugin/admin/app/controller/auth/AdminRoleController.php
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\controller\auth;
|
||||||
|
|
||||||
|
use plugin\admin\app\controller\Base;
|
||||||
|
use plugin\admin\app\controller\Crud;
|
||||||
|
use plugin\admin\app\model\AdminRole;
|
||||||
|
use plugin\admin\app\model\AdminRule;
|
||||||
|
use support\Db;
|
||||||
|
use support\Request;
|
||||||
|
|
||||||
|
class AdminRoleController extends Base
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var AdminRole
|
||||||
|
*/
|
||||||
|
protected $model = null;
|
||||||
|
|
||||||
|
use Crud;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->model = new AdminRole;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function tree(Request $request)
|
||||||
|
{
|
||||||
|
$items = $this->model->where('status', 'normal')->get();
|
||||||
|
$items_map = [];
|
||||||
|
foreach ($items as $item) {
|
||||||
|
if ($item->hide_menu) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$items_map[$item->id] = [
|
||||||
|
'title' => $item->name,
|
||||||
|
'value' => $item->id,
|
||||||
|
'key' => $item->id,
|
||||||
|
'pid' => $item->pid,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$formatted_items = [];
|
||||||
|
foreach ($items_map as $index => $item) {
|
||||||
|
if ($item['pid'] && isset($items_map[$item['pid']])) {
|
||||||
|
$items_map[$item['pid']]['children'][] = &$items_map[$index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($items_map as $item) {
|
||||||
|
if (!$item['pid']) {
|
||||||
|
$formatted_items[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json(0, 'ok', $formatted_items);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function select(Request $request)
|
||||||
|
{
|
||||||
|
$page = $request->get('page', 1);
|
||||||
|
$field = $request->get('field');
|
||||||
|
$order = $request->get('order', 'descend');
|
||||||
|
$format = $request->get('format', 'normal');
|
||||||
|
$page_size = $request->get('pageSize', $format === 'tree' ? 1000 : 10);
|
||||||
|
|
||||||
|
$table = $this->model->getTable();
|
||||||
|
|
||||||
|
$allow_column = Db::select("desc $table");
|
||||||
|
if (!$allow_column) {
|
||||||
|
return $this->json(2, '表不存在');
|
||||||
|
}
|
||||||
|
$allow_column = array_column($allow_column, 'Field', 'Field');
|
||||||
|
if (!in_array($field, $allow_column)) {
|
||||||
|
$field = current($allow_column);
|
||||||
|
}
|
||||||
|
$order = $order === 'ascend' ? 'asc' : 'desc';
|
||||||
|
$paginator = $this->model;
|
||||||
|
// 不展示超级管理员角色
|
||||||
|
$paginator = $paginator->where('rules', '<>', '*');
|
||||||
|
foreach ($request->get() as $column => $value) {
|
||||||
|
if (!$value) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (isset($allow_column[$column])) {
|
||||||
|
if (is_array($value)) {
|
||||||
|
if ($value[0] == 'undefined' || $value[1] == 'undefined') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$paginator = $paginator->whereBetween($column, $value);
|
||||||
|
} else {
|
||||||
|
$paginator = $paginator->where($column, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$paginator = $paginator->orderBy($field, $order)->paginate($page_size, '*', 'page', $page);
|
||||||
|
|
||||||
|
$items = $paginator->items();
|
||||||
|
if ($format == 'tree') {
|
||||||
|
$items_map = [];
|
||||||
|
foreach ($items as $item) {
|
||||||
|
$items_map[$item->id] = $item->toArray();
|
||||||
|
}
|
||||||
|
$formatted_items = [];
|
||||||
|
foreach ($items_map as $item) {
|
||||||
|
if ($item['pid'] && isset($items_map[$item['pid']])) {
|
||||||
|
$items_map[$item['pid']]['children'][] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($items_map as $item) {
|
||||||
|
if (!$item['pid']) {
|
||||||
|
$formatted_items[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$items = $formatted_items;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json(0, 'ok', [
|
||||||
|
'items' => $items,
|
||||||
|
'total' => $paginator->total()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
$column = $request->post('column');
|
||||||
|
$value = $request->post('value');
|
||||||
|
$data = $request->post('data');
|
||||||
|
$table = $this->model->getTable();
|
||||||
|
$allow_column = Db::select("desc $table");
|
||||||
|
if (!$allow_column) {
|
||||||
|
return $this->json(2, '表不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['rules'] = (array)$data['rules'];
|
||||||
|
$pids = $data['rules'];
|
||||||
|
if ($pids) {
|
||||||
|
$pids = AdminRule::whereIn('id', $pids)->pluck('pid')->toArray();
|
||||||
|
$data['rules'] = array_merge($data['rules'], $pids);
|
||||||
|
}
|
||||||
|
$data['rules'] = array_unique($data['rules']);
|
||||||
|
|
||||||
|
$columns = array_column($allow_column, 'Field', 'Field');
|
||||||
|
foreach ($data as $col => $item) {
|
||||||
|
if (is_array($item)) {
|
||||||
|
$data[$col] = implode(',', $item);
|
||||||
|
}
|
||||||
|
if ($col === 'password') {
|
||||||
|
// 密码为空,则不更新密码
|
||||||
|
if ($item == '') {
|
||||||
|
unset($data[$col]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$data[$col] = Util::passwordHash($item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$datetime = date('Y-m-d H:i:s');
|
||||||
|
if (isset($columns['updated_at']) && !isset($data['updated_at'])) {
|
||||||
|
$data['updated_at'] = $datetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->model->where($column, $value)->update($data);
|
||||||
|
return $this->json(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
83
src/plugin/admin/app/controller/auth/AdminRuleController.php
Normal file
83
src/plugin/admin/app/controller/auth/AdminRuleController.php
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\controller\auth;
|
||||||
|
|
||||||
|
use plugin\admin\app\controller\Base;
|
||||||
|
use plugin\admin\app\controller\Crud;
|
||||||
|
use plugin\admin\app\model\AdminRule;
|
||||||
|
use support\Request;
|
||||||
|
|
||||||
|
class AdminRuleController extends Base
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var AdminRule
|
||||||
|
*/
|
||||||
|
protected $model = null;
|
||||||
|
|
||||||
|
use Crud;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->model = new AdminRule;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function tree(Request $request)
|
||||||
|
{
|
||||||
|
$items = $this->model->where('status', 'normal')->get();
|
||||||
|
$items_map = [];
|
||||||
|
foreach ($items as $item) {
|
||||||
|
if ($item->hide_menu) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$items_map[$item->id] = [
|
||||||
|
'title' => $item->title,
|
||||||
|
'value' => $item->id,
|
||||||
|
'key' => $item->id,
|
||||||
|
'pid' => $item->pid,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$formatted_items = [];
|
||||||
|
foreach ($items_map as $index => $item) {
|
||||||
|
if ($item['pid'] && isset($items_map[$item['pid']])) {
|
||||||
|
$items_map[$item['pid']]['children'][] = &$items_map[$index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($items_map as $item) {
|
||||||
|
if (!$item['pid']) {
|
||||||
|
$formatted_items[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json(0, 'ok', $formatted_items);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
* @throws \Support\Exception\BusinessException
|
||||||
|
*/
|
||||||
|
public function delete(Request $request)
|
||||||
|
{
|
||||||
|
$column = $request->post('column');
|
||||||
|
$value = $request->post('value');
|
||||||
|
$item = $this->model->where($column, $value)->first();
|
||||||
|
if (!$item) {
|
||||||
|
return $this->json(1, '记录不存在');
|
||||||
|
}
|
||||||
|
$delete_ids = $children_ids = [$item['id']];
|
||||||
|
while($children_ids) {
|
||||||
|
$children_ids = $this->model->whereIn('pid', $children_ids)->pluck('id')->toArray();
|
||||||
|
$delete_ids = array_merge($delete_ids, $children_ids);
|
||||||
|
}
|
||||||
|
$this->model->whereIn('id', $delete_ids)->delete();
|
||||||
|
return $this->json(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
511
src/plugin/admin/app/controller/auth/MenuController.php
Normal file
511
src/plugin/admin/app/controller/auth/MenuController.php
Normal file
@ -0,0 +1,511 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\controller\auth;
|
||||||
|
|
||||||
|
use plugin\admin\app\controller\Base;
|
||||||
|
use plugin\admin\app\controller\Crud;
|
||||||
|
use plugin\admin\app\model\AdminRole;
|
||||||
|
use plugin\admin\app\model\AdminRule;
|
||||||
|
use plugin\admin\app\model\Menu;
|
||||||
|
use plugin\admin\app\Util;
|
||||||
|
use support\Db;
|
||||||
|
use support\Request;
|
||||||
|
use function json;
|
||||||
|
|
||||||
|
class MenuController extends Base
|
||||||
|
{
|
||||||
|
public $noNeedAuth = ['get'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Menu
|
||||||
|
*/
|
||||||
|
protected $model = null;
|
||||||
|
|
||||||
|
use Crud;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->model = new Menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get()
|
||||||
|
{
|
||||||
|
$roles = admin('roles');
|
||||||
|
$roles = $roles ? explode(',', $roles) : [];
|
||||||
|
$rules_strings = $roles ? AdminRole::whereIn('id', $roles)->pluck('rules') : [];
|
||||||
|
$rules = [];
|
||||||
|
foreach ($rules_strings as $rule_string) {
|
||||||
|
if (!$rule_string) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$rules = array_merge($rules, explode(',', $rule_string));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('*', $rules)) {
|
||||||
|
$items = Db::connection('plugin.admin.mysql')->table('wa_admin_rules')->where('status', 'normal')->get();
|
||||||
|
} else {
|
||||||
|
$items = Db::connection('plugin.admin.mysql')->table('wa_admin_rules')->where('status', 'normal')->whereIn('id', $rules)->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
$items_map = [];
|
||||||
|
foreach ($items as $item) {
|
||||||
|
$items_map[$item->id] = (array)$item;
|
||||||
|
}
|
||||||
|
$formatted_items = [];
|
||||||
|
foreach ($items_map as $index => $item) {
|
||||||
|
foreach (['title', 'icon', 'hide_menu', 'frame_src'] as $name) {
|
||||||
|
$value = $item[$name];
|
||||||
|
unset($items_map[$index][$name]);
|
||||||
|
if (!$value) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$items_map[$index]['meta'][Util::smCamel($name)] = $value;
|
||||||
|
}
|
||||||
|
if ($item['pid'] && isset($items_map[$item['pid']])) {
|
||||||
|
$items_map[$item['pid']]['children'][] = $items_map[$index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($items_map as $item) {
|
||||||
|
if (!$item['pid']) {
|
||||||
|
$formatted_items[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->json(0, 'ok', $formatted_items);
|
||||||
|
}
|
||||||
|
|
||||||
|
function tree()
|
||||||
|
{
|
||||||
|
$items = Db::connection('plugin.admin.mysql')->table('wa_admin_rules')->where('status', 'normal')->get();
|
||||||
|
$items_map = [];
|
||||||
|
foreach ($items as $item) {
|
||||||
|
if ($item->hide_menu || !$item->is_menu) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$items_map[$item->id] = [
|
||||||
|
'title' => $item->title,
|
||||||
|
'value' => $item->id,
|
||||||
|
'key' => $item->id,
|
||||||
|
'pid' => $item->pid,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$formatted_items = [];
|
||||||
|
foreach ($items_map as $index => $item) {
|
||||||
|
if ($item['pid'] && isset($items_map[$item['pid']])) {
|
||||||
|
$items_map[$item['pid']]['children'][] = &$items_map[$index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($items_map as $item) {
|
||||||
|
if (!$item['pid']) {
|
||||||
|
$formatted_items[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->json(0, 'ok', $formatted_items);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(Request $request)
|
||||||
|
{
|
||||||
|
$table_name = $request->input('table');
|
||||||
|
Util::checkTableName($table_name);
|
||||||
|
$name = $request->post('name');
|
||||||
|
$pid = $request->post('pid');
|
||||||
|
$path = '';
|
||||||
|
|
||||||
|
if ($pid) {
|
||||||
|
$parent_menu = Menu::find($pid);
|
||||||
|
if (!$parent_menu) {
|
||||||
|
return $this->json(1, '父菜单不存在');
|
||||||
|
}
|
||||||
|
$path = $parent_menu['path'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$table_basename = strpos($table_name, 'wa_') === 0 ? substr($table_name, 3) : $table_name;
|
||||||
|
$model_class = rtrim(Util::camel($table_basename), 's');
|
||||||
|
// 创建model
|
||||||
|
$this->createModel($model_class, "plugin\\admin\\app\\model",
|
||||||
|
base_path() . "/plugin/admin/app/model/$model_class.php", $table_name);
|
||||||
|
|
||||||
|
$controller_class = $model_class . config('plugin.admin.app.controller_suffix');
|
||||||
|
$path = trim($path, '/');
|
||||||
|
$path_backslash = str_replace('/', '\\', $path);
|
||||||
|
if ($path_backslash) {
|
||||||
|
$controller_namespace = "plugin\\admin\\app\\controller\\$path_backslash";
|
||||||
|
} else {
|
||||||
|
$controller_namespace = "plugin\\admin\\app\\controller";
|
||||||
|
}
|
||||||
|
$file = base_path() . '/' . str_replace('\\', '/', $controller_namespace) . "/$controller_class.php";
|
||||||
|
// 创建controller
|
||||||
|
$this->createController($controller_class, $controller_namespace, $file, $model_class, $name);
|
||||||
|
|
||||||
|
// 创建vue
|
||||||
|
$menu_path = rtrim(str_replace('_', '-', $table_basename), 's');
|
||||||
|
$componet = $parent_menu['path'] . "/$menu_path/index";
|
||||||
|
$url_base = $path ? "/app/admin/$path/".strtolower($model_class) : "/app/admin/".strtolower($model_class);
|
||||||
|
$file = base_path() . "/plugin/admin/vue-vben-admin/src/views/$componet.vue";
|
||||||
|
$this->createVue($file, $url_base);
|
||||||
|
|
||||||
|
$reflection = new \ReflectionClass("$controller_namespace\\$controller_class");
|
||||||
|
$controller_class_with_nsp = $reflection->getName();
|
||||||
|
|
||||||
|
$menu = new Menu();
|
||||||
|
$menu->pid = $pid;
|
||||||
|
$menu->name = $controller_class_with_nsp;
|
||||||
|
$menu->path = $pid ? $menu_path : "/$menu_path";
|
||||||
|
$menu->component = $componet;
|
||||||
|
$menu->status = 'normal';
|
||||||
|
$menu->title = $name;
|
||||||
|
$menu->save();
|
||||||
|
|
||||||
|
/*
|
||||||
|
$pid = $menu->id;
|
||||||
|
$methods = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC);
|
||||||
|
foreach ($methods as $method) {
|
||||||
|
$method_name = $method->getName();
|
||||||
|
if (strpos($method_name, '__') !== false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$title = Util::getCommentFirstLine($method->getDocComment()) ?? $method_name;
|
||||||
|
$menu = new Menu();
|
||||||
|
$menu->pid = $pid;
|
||||||
|
$menu->name = "$controller_class_with_nsp@$method_name";
|
||||||
|
$menu->path = '';
|
||||||
|
$menu->component = '';
|
||||||
|
$menu->status = 'normal';
|
||||||
|
$menu->title = $title;
|
||||||
|
$menu->is_menu = 0;
|
||||||
|
$menu->save();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
return $this->json(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $class
|
||||||
|
* @param $namespace
|
||||||
|
* @param $file
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function createModel($class, $namespace, $file, $table)
|
||||||
|
{
|
||||||
|
$this->mkdir($file);
|
||||||
|
$table_val = "'$table'";
|
||||||
|
$pk = 'id';
|
||||||
|
$properties = '';
|
||||||
|
try {
|
||||||
|
$database = config('database.connections')['plugin.admin.mysql']['database'];
|
||||||
|
//plugin.admin.mysql
|
||||||
|
foreach (Db::connection('plugin.admin.mysql')->select("select COLUMN_NAME,DATA_TYPE,COLUMN_KEY,COLUMN_COMMENT from INFORMATION_SCHEMA.COLUMNS where table_name = '$table' and table_schema = '$database'") as $item) {
|
||||||
|
if ($item->COLUMN_KEY === 'PRI') {
|
||||||
|
$pk = $item->COLUMN_NAME;
|
||||||
|
$item->COLUMN_COMMENT .= "(主键)";
|
||||||
|
}
|
||||||
|
$type = $this->getType($item->DATA_TYPE);
|
||||||
|
$properties .= " * @property $type \${$item->COLUMN_NAME} {$item->COLUMN_COMMENT}\n";
|
||||||
|
}
|
||||||
|
} catch (\Throwable $e) {}
|
||||||
|
$properties = rtrim($properties) ?: ' *';
|
||||||
|
$model_content = <<<EOF
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace $namespace;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
$properties
|
||||||
|
*/
|
||||||
|
class $class extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected \$table = $table_val;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected \$primaryKey = '$pk';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
EOF;
|
||||||
|
file_put_contents($file, $model_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @param $namespace
|
||||||
|
* @param $file
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function createController($controller_class, $namespace, $file, $model_class, $name)
|
||||||
|
{
|
||||||
|
$this->mkdir($file);
|
||||||
|
$controller_content = <<<EOF
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace $namespace;
|
||||||
|
|
||||||
|
use plugin\admin\app\controller\Base;
|
||||||
|
use plugin\admin\app\controller\Crud;
|
||||||
|
use plugin\\admin\\app\\model\\$model_class;
|
||||||
|
use support\Request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $name
|
||||||
|
*/
|
||||||
|
class $controller_class extends Base
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 开启增删改查
|
||||||
|
*/
|
||||||
|
use Crud;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var $model_class
|
||||||
|
*/
|
||||||
|
protected \$model = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
\$this->model = new $model_class;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
EOF;
|
||||||
|
file_put_contents($file, $controller_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function mkdir($file)
|
||||||
|
{
|
||||||
|
$path = pathinfo($file, PATHINFO_DIRNAME);
|
||||||
|
if (!is_dir($path)) {
|
||||||
|
mkdir($path, 0777, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $type
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getType(string $type)
|
||||||
|
{
|
||||||
|
if (strpos($type, 'int') !== false) {
|
||||||
|
return 'integer';
|
||||||
|
}
|
||||||
|
switch ($type) {
|
||||||
|
case 'varchar':
|
||||||
|
case 'string':
|
||||||
|
case 'text':
|
||||||
|
case 'date':
|
||||||
|
case 'time':
|
||||||
|
case 'guid':
|
||||||
|
case 'datetimetz':
|
||||||
|
case 'datetime':
|
||||||
|
case 'decimal':
|
||||||
|
case 'enum':
|
||||||
|
return 'string';
|
||||||
|
case 'boolean':
|
||||||
|
return 'integer';
|
||||||
|
case 'float':
|
||||||
|
return 'float';
|
||||||
|
default:
|
||||||
|
return 'mixed';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function createVue($file, $url_base)
|
||||||
|
{
|
||||||
|
$this->mkdir($file);
|
||||||
|
$vue_content = <<<EOF
|
||||||
|
<template>
|
||||||
|
<div class="p-4">
|
||||||
|
<BasicTable @register="registerTable" showTableSetting>
|
||||||
|
<template #toolbar>
|
||||||
|
<a-button type="primary" @click="openRowModal">
|
||||||
|
添加记录
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
<template #action="{ record }">
|
||||||
|
<TableAction
|
||||||
|
:actions="[
|
||||||
|
{
|
||||||
|
label: '编辑',
|
||||||
|
onClick: handleEdit.bind(null, record),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '删除',
|
||||||
|
icon: 'ic:outline-delete-outline',
|
||||||
|
popConfirm: {
|
||||||
|
title: '是否删除?',
|
||||||
|
confirm: handleDelete.bind(null, record),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
|
||||||
|
<ModalInserOrEdit @register="register" :minHeight="300" @reload="reload" />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts">
|
||||||
|
import {defineComponent, h, onBeforeMount, ref} from 'vue';
|
||||||
|
import {BasicTable, useTable, TableAction, BasicColumn} from '/@/components/Table';
|
||||||
|
import {apiGet, apiPost, getApi} from "/@/api/common";
|
||||||
|
import { useModal } from '/@/components/Modal';
|
||||||
|
import ModalInserOrEdit from '/@/views/database/table/Update.vue';
|
||||||
|
import {useMessage} from "/@/hooks/web/useMessage";
|
||||||
|
import {error} from "/@/utils/log";
|
||||||
|
|
||||||
|
const selectUrl = '$url_base/select';
|
||||||
|
const insertUrl = '$url_base/insert';
|
||||||
|
const updateUrl = '$url_base/update';
|
||||||
|
const deleteUrl = '$url_base/delete';
|
||||||
|
const schemaUrl = '$url_base/schema';
|
||||||
|
|
||||||
|
const formSchemas = ref({schemas:[]});
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
components: {ModalInserOrEdit, BasicTable, TableAction },
|
||||||
|
setup() {
|
||||||
|
const {
|
||||||
|
createMessage
|
||||||
|
} = useMessage();
|
||||||
|
const {success} = createMessage;
|
||||||
|
const columns = ref([]);
|
||||||
|
const primaryKey = ref('');
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
const tableInfo = await apiGet(schemaUrl);
|
||||||
|
const schemas = tableInfo.columns;
|
||||||
|
for (let item of schemas) {
|
||||||
|
if (item.primary_key) {
|
||||||
|
primaryKey.value = item.field;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const forms = tableInfo.forms;
|
||||||
|
formSchemas.value.schemas = [];
|
||||||
|
for (let item of forms) {
|
||||||
|
if (item.searchable) {
|
||||||
|
if (item.search_type == 'between') {
|
||||||
|
formSchemas.value.schemas.push({
|
||||||
|
field: `\${item.field}[0]`,
|
||||||
|
component: 'Input',
|
||||||
|
label: item.comment || item.field,
|
||||||
|
colProps: {
|
||||||
|
offset: 1,
|
||||||
|
span: 5,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
formSchemas.value.schemas.push({
|
||||||
|
field: `\${item.field}[1]`,
|
||||||
|
component: 'Input',
|
||||||
|
label: ' 到',
|
||||||
|
colProps: {
|
||||||
|
span: 5,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
formSchemas.value.schemas.push({
|
||||||
|
field: item.field,
|
||||||
|
component: 'Input',
|
||||||
|
label: item.comment || item.field,
|
||||||
|
colProps: {
|
||||||
|
offset: 1,
|
||||||
|
span: 10,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (item.list_show) {
|
||||||
|
let column: BasicColumn = {
|
||||||
|
dataIndex: item.field,
|
||||||
|
title: item.comment || item.field,
|
||||||
|
sorter: item.enable_sort,
|
||||||
|
};
|
||||||
|
columns.value.push(column);
|
||||||
|
if (item.field == 'avatar') {
|
||||||
|
column.width = 50;
|
||||||
|
column.customRender = ({ record }) => {
|
||||||
|
return h('img', { src: record[item.field]});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const [register, { openModal: openModal }] = useModal();
|
||||||
|
const [registerTable, { reload }] = useTable({
|
||||||
|
api: getApi(selectUrl),
|
||||||
|
columns: columns,
|
||||||
|
useSearchForm: true,
|
||||||
|
bordered: true,
|
||||||
|
formConfig: formSchemas,
|
||||||
|
actionColumn: {
|
||||||
|
width: 250,
|
||||||
|
title: 'Action',
|
||||||
|
dataIndex: 'action',
|
||||||
|
slots: { customRender: 'action' },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleEdit(record: Recordable) {
|
||||||
|
if (!primaryKey.value) {
|
||||||
|
error('当前表没有主键,无法编辑');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
openModal(true, {
|
||||||
|
selectUrl,
|
||||||
|
insertUrl,
|
||||||
|
updateUrl,
|
||||||
|
schemaUrl,
|
||||||
|
column: primaryKey.value,
|
||||||
|
value: record[primaryKey.value]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(record: Recordable) {
|
||||||
|
if (!primaryKey.value) {
|
||||||
|
error('当前表没有主键,无法删除');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await apiPost(deleteUrl, {column: primaryKey.value, value:record[primaryKey.value]});
|
||||||
|
success('删除成功');
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
function openRowModal()
|
||||||
|
{
|
||||||
|
openModal(true, {
|
||||||
|
selectUrl,
|
||||||
|
insertUrl,
|
||||||
|
updateUrl,
|
||||||
|
schemaUrl
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
registerTable,
|
||||||
|
handleEdit,
|
||||||
|
handleDelete,
|
||||||
|
openRowModal,
|
||||||
|
register,
|
||||||
|
reload,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
EOF;
|
||||||
|
file_put_contents($file, $vue_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
67
src/plugin/admin/app/controller/common/AccountController.php
Normal file
67
src/plugin/admin/app/controller/common/AccountController.php
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\controller\common;
|
||||||
|
|
||||||
|
use plugin\admin\app\controller\Base;
|
||||||
|
use plugin\admin\app\model\Admin;
|
||||||
|
use plugin\admin\app\Util;
|
||||||
|
use support\Request;
|
||||||
|
|
||||||
|
class AccountController extends Base
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var Admin
|
||||||
|
*/
|
||||||
|
protected $model = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->model = new Admin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function info(Request $request)
|
||||||
|
{
|
||||||
|
return $this->json(0, 'ok', admin(['nickname', 'mobile', 'avatar', 'email']));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
$allow_column = [
|
||||||
|
'nickname',
|
||||||
|
'avatar',
|
||||||
|
'email',
|
||||||
|
'mobile',
|
||||||
|
];
|
||||||
|
|
||||||
|
$data = $request->post();
|
||||||
|
$update_data = [];
|
||||||
|
foreach ($allow_column as $column) {
|
||||||
|
if (isset($data[$column])) {
|
||||||
|
$update_data[$column] = $data[$column];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($update_data['password'])) {
|
||||||
|
$update_data['password'] = Util::passwordHash($update_data['password'], );
|
||||||
|
}
|
||||||
|
Admin::where('id', admin_id())->update($update_data);
|
||||||
|
return $this->json(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function password(Request $request)
|
||||||
|
{
|
||||||
|
$hash = admin('password');
|
||||||
|
$password = $request->post('password');
|
||||||
|
if (!$password) {
|
||||||
|
return $this->json(2, '密码不能为空');
|
||||||
|
}
|
||||||
|
if (!Util::passwordVerify($request->post('old_password'), $hash)) {
|
||||||
|
return $this->json(1, '原始密码不正确');
|
||||||
|
}
|
||||||
|
$update_data = [
|
||||||
|
'password' => Util::passwordHash($password)
|
||||||
|
];
|
||||||
|
Admin::where('id', admin_id())->update($update_data);
|
||||||
|
return $this->json(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
165
src/plugin/admin/app/controller/common/UploadController.php
Normal file
165
src/plugin/admin/app/controller/common/UploadController.php
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\controller\common;
|
||||||
|
|
||||||
|
use Intervention\Image\ImageManagerStatic as Image;
|
||||||
|
use plugin\admin\app\controller\Base;
|
||||||
|
use support\Request;
|
||||||
|
use function base_path;
|
||||||
|
use function json;
|
||||||
|
|
||||||
|
class UploadController extends Base
|
||||||
|
{
|
||||||
|
|
||||||
|
public function file(Request $request)
|
||||||
|
{
|
||||||
|
$file = current($request->file());
|
||||||
|
if (!$file || !$file->isValid()) {
|
||||||
|
return $this->json(1, '未找到文件');
|
||||||
|
}
|
||||||
|
$img_exts = [
|
||||||
|
'jpg',
|
||||||
|
'jpeg',
|
||||||
|
'png',
|
||||||
|
'gif'
|
||||||
|
];
|
||||||
|
if (in_array($file->getUploadExtension(), $img_exts)) {
|
||||||
|
return $this->image($request);
|
||||||
|
}
|
||||||
|
$data = $this->base($request, '/upload/files/'.date('Ymd'));
|
||||||
|
if ($data['code']) {
|
||||||
|
return $this->json($data['code'], $data['message']);
|
||||||
|
}
|
||||||
|
return json(['code' => 0, 'message' => 'ok', 'url' => $data['data']['src']]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function avatar(Request $request)
|
||||||
|
{
|
||||||
|
$file = current($request->file());
|
||||||
|
if ($file && $file->isValid()) {
|
||||||
|
$ext = strtolower($file->getUploadExtension());
|
||||||
|
if (!in_array($ext, ['jpg', 'jpeg', 'gif', 'png'])) {
|
||||||
|
return json(['code' => 2, 'msg' => '仅支持 jpg jpeg gif png格式']);
|
||||||
|
}
|
||||||
|
$image = Image::make($file);
|
||||||
|
$width = $image->width();
|
||||||
|
$height = $image->height();
|
||||||
|
$size = $width > $height ? $height : $width;
|
||||||
|
$relative_path = 'upload/avatar/' . date('Ym');
|
||||||
|
$real_path = base_path() . "/plugin/admin/public/$relative_path";
|
||||||
|
if (!is_dir($real_path)) {
|
||||||
|
mkdir($real_path, 0777, true);
|
||||||
|
}
|
||||||
|
$name = bin2hex(pack('Nn',time(), random_int(1, 65535)));
|
||||||
|
$ext = $file->getUploadExtension();
|
||||||
|
|
||||||
|
$image->crop($size, $size)->resize(300, 300);
|
||||||
|
$path = base_path() . "/plugin/admin/public/$relative_path/$name.lg.$ext";
|
||||||
|
$image->save($path);
|
||||||
|
|
||||||
|
$image->resize(120, 120);
|
||||||
|
$path = base_path() . "/plugin/admin/public/$relative_path/$name.md.$ext";
|
||||||
|
$image->save($path);
|
||||||
|
|
||||||
|
$image->resize(60, 60);
|
||||||
|
$path = base_path() . "/plugin/admin/public/$relative_path/$name.$ext";
|
||||||
|
$image->save($path);
|
||||||
|
|
||||||
|
$image->resize(30, 30);
|
||||||
|
$path = base_path() . "/plugin/admin/public/$relative_path/$name.sm.$ext";
|
||||||
|
$image->save($path);
|
||||||
|
|
||||||
|
return json([
|
||||||
|
'code' => 0,
|
||||||
|
'message' => 'upload success',
|
||||||
|
'url' => "/app/admin/$relative_path/$name.$ext"
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return json(['code' => 1, 'msg' => 'file not found']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function image(Request $request)
|
||||||
|
{
|
||||||
|
$data = $this->base($request, '/upload/img/'.date('Ymd'));
|
||||||
|
if ($data['code']) {
|
||||||
|
return json(['code' => $data['code'], 'message' => $data['msg']]);
|
||||||
|
}
|
||||||
|
$realpath = $data['data']['realpath'];
|
||||||
|
try {
|
||||||
|
$img = Image::make($realpath);
|
||||||
|
$max_height = 1170;
|
||||||
|
$max_width = 1170;
|
||||||
|
$width = $img->width();
|
||||||
|
$height = $img->height();
|
||||||
|
$ratio = 1;
|
||||||
|
if ($height > $max_height || $width > $max_width) {
|
||||||
|
$ratio = $width > $height ? $max_width / $width : $max_height / $height;
|
||||||
|
}
|
||||||
|
$img->resize($width*$ratio, $height*$ratio)->save($realpath);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
unlink($realpath);
|
||||||
|
return json( [
|
||||||
|
'code' => 500,
|
||||||
|
'message' => '处理图片发生错误'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return json( [
|
||||||
|
'code' => 1,
|
||||||
|
'message' => 'ok',
|
||||||
|
'url' => $data['data']['src']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function base(Request $request, $relative_dir)
|
||||||
|
{
|
||||||
|
$relative_dir = ltrim($relative_dir, '/');
|
||||||
|
$file = current($request->file());
|
||||||
|
if (!$file || !$file->isValid()) {
|
||||||
|
return ['code' => 400, 'message' => '未找到上传文件'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$base_dir = base_path() . '/plugin/admin/public/';
|
||||||
|
$full_dir = $base_dir . $relative_dir;
|
||||||
|
if (!is_dir($full_dir)) {
|
||||||
|
mkdir($full_dir, 0777, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ext = strtolower($file->getUploadExtension());
|
||||||
|
$ext_forbidden_map = ['php', 'php3', 'php5', 'css', 'js', 'html', 'htm', 'asp', 'jsp'];
|
||||||
|
if (in_array($ext, $ext_forbidden_map)) {
|
||||||
|
return ['code' => 400, 'message' => '不支持该格式的文件上传'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$relative_path = $relative_dir . '/' . bin2hex(pack('Nn',time(), random_int(1, 65535))) . ".$ext";
|
||||||
|
$full_path = $base_dir . $relative_path;
|
||||||
|
$file_size = $file->getSize();
|
||||||
|
$file_name = $file->getUploadName();
|
||||||
|
$file->move($full_path);
|
||||||
|
return [
|
||||||
|
'code' => 0,
|
||||||
|
'msg' => 'ok',
|
||||||
|
'data' => [
|
||||||
|
'src' => "/app/admin/$relative_path",
|
||||||
|
'name' => $file_name,
|
||||||
|
'realpath' => $full_path,
|
||||||
|
'size' => $this->formatSize($file_size)
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化文件大小
|
||||||
|
*
|
||||||
|
* @param $file_size
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function formatSize($file_size) {
|
||||||
|
$size = sprintf("%u", $file_size);
|
||||||
|
if($size == 0) {
|
||||||
|
return("0 Bytes");
|
||||||
|
}
|
||||||
|
$sizename = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
|
||||||
|
return round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $sizename[$i];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
701
src/plugin/admin/app/controller/database/TableController.php
Normal file
701
src/plugin/admin/app/controller/database/TableController.php
Normal file
@ -0,0 +1,701 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\controller\database;
|
||||||
|
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use plugin\admin\app\controller\Base;
|
||||||
|
use plugin\admin\App\Util;
|
||||||
|
use Support\Db;
|
||||||
|
use Support\Exception\BusinessException;
|
||||||
|
use Support\Request;
|
||||||
|
|
||||||
|
class TableController extends Base
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
public $noNeedAuth = ['types'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示说有表
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function show(Request $request)
|
||||||
|
{
|
||||||
|
$database = config('database.connections')['plugin.admin.mysql']['database'];
|
||||||
|
$field = $request->get('field', 'TABLE_NAME');
|
||||||
|
$order = $request->get('order', 'ascend');
|
||||||
|
$allow_column = ['TABLE_NAME','TABLE_COMMENT','ENGINE','TABLE_ROWS','CREATE_TIME','UPDATE_TIME','TABLE_COLLATION'];
|
||||||
|
if (!in_array($field, $allow_column)) {
|
||||||
|
$field = 'TABLE_NAME';
|
||||||
|
}
|
||||||
|
$order = $order === 'ascend' ? 'asc' : 'desc';
|
||||||
|
$tables = Db::select("SELECT TABLE_NAME,TABLE_COMMENT,ENGINE,TABLE_ROWS,CREATE_TIME,UPDATE_TIME,TABLE_COLLATION FROM information_schema.`TABLES` WHERE TABLE_SCHEMA='$database' order by $field $order");
|
||||||
|
|
||||||
|
if ($tables) {
|
||||||
|
$table_names = array_column($tables, 'TABLE_NAME');
|
||||||
|
$table_rows_count = [];
|
||||||
|
foreach ($table_names as $table_name) {
|
||||||
|
$table_rows_count[$table_name] = Db::connection('plugin.admin.mysql')->table($table_name)->count();
|
||||||
|
}
|
||||||
|
foreach ($tables as $key => $table) {
|
||||||
|
$tables[$key]->TABLE_ROWS = $table_rows_count[$table->TABLE_NAME] ?? $table->TABLE_ROWS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json(0, 'ok', $tables);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取某条记录
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function selectOne(Request $request)
|
||||||
|
{
|
||||||
|
$table = $request->get('table');
|
||||||
|
$column = $request->get('column');
|
||||||
|
$value = $request->get('value');
|
||||||
|
$data = (array)Db::connection('plugin.admin.mysql')->table($table)->where($column, $value)->first();
|
||||||
|
if (!$data) {
|
||||||
|
return $this->json(404, '记录不存在');
|
||||||
|
}
|
||||||
|
return $this->json(0, 'ok', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function select(Request $request)
|
||||||
|
{
|
||||||
|
$page = $request->get('page', 1);
|
||||||
|
$field = $request->get('field');
|
||||||
|
$order = $request->get('order', 'descend');
|
||||||
|
$table = $request->get('table');
|
||||||
|
$format = $request->get('format', 'normal');
|
||||||
|
$page_size = $request->get('pageSize', $format === 'tree' ? 1000 : 10);
|
||||||
|
|
||||||
|
if (!preg_match('/[a-zA-Z_0-9]+/', $table)) {
|
||||||
|
return $this->json(1, '表不存在');
|
||||||
|
}
|
||||||
|
$allow_column = Db::select("desc $table");
|
||||||
|
if (!$allow_column) {
|
||||||
|
return $this->json(2, '表不存在');
|
||||||
|
}
|
||||||
|
$allow_column = array_column($allow_column, 'Field', 'Field');
|
||||||
|
if (!in_array($field, $allow_column)) {
|
||||||
|
$field = current($allow_column);
|
||||||
|
}
|
||||||
|
$order = $order === 'ascend' ? 'asc' : 'desc';
|
||||||
|
$paginator = Db::connection('plugin.admin.mysql')->table($table);
|
||||||
|
foreach ($request->get() as $column => $value) {
|
||||||
|
if (!$value) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (isset($allow_column[$column])) {
|
||||||
|
if (is_array($value)) {
|
||||||
|
if ($value[0] == 'undefined' || $value[1] == 'undefined') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$paginator = $paginator->whereBetween($column, $value);
|
||||||
|
} else {
|
||||||
|
$paginator = $paginator->where($column, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$paginator = $paginator->orderBy($field, $order)->paginate($page_size, '*', 'page', $page);
|
||||||
|
|
||||||
|
$items = $paginator->items();
|
||||||
|
if ($format == 'tree') {
|
||||||
|
$items_map = [];
|
||||||
|
foreach ($items as $item) {
|
||||||
|
$items_map[$item->id] = (array)$item;
|
||||||
|
}
|
||||||
|
$formatted_items = [];
|
||||||
|
foreach ($items_map as $item) {
|
||||||
|
if ($item['pid'] && isset($items_map[$item['pid']])) {
|
||||||
|
$items_map[$item['pid']]['children'][] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($items_map as $item) {
|
||||||
|
if (!$item['pid']) {
|
||||||
|
$formatted_items[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$items = $formatted_items;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json(0, 'ok', [
|
||||||
|
'items' => $items,
|
||||||
|
'total' => $paginator->total()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function insert(Request $request)
|
||||||
|
{
|
||||||
|
$table = $request->input('table');
|
||||||
|
$data = $request->post('data');
|
||||||
|
$columns = $this->getSchema($table, 'columns');
|
||||||
|
foreach ($data as $col => $item) {
|
||||||
|
if (is_array($item)) {
|
||||||
|
$data[$col] = implode(',', $item);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($col === 'password') {
|
||||||
|
$data[$col] = Util::passwordHash($item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$datetime = date('Y-m-d H:i:s');
|
||||||
|
if (isset($columns['created_at']) && !isset($data['created_at'])) {
|
||||||
|
$data['created_at'] = $datetime;
|
||||||
|
}
|
||||||
|
if (isset($columns['updated_at']) && !isset($data['updated_at'])) {
|
||||||
|
$data['updated_at'] = $datetime;
|
||||||
|
}
|
||||||
|
$id = Db::connection('plugin.admin.mysql')->table($table)->insertGetId($data);
|
||||||
|
return $this->json(0, $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
* @throws BusinessException
|
||||||
|
*/
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
$table = $request->input('table');
|
||||||
|
$column = $request->post('column');
|
||||||
|
$value = $request->post('value');
|
||||||
|
$data = $request->post('data');
|
||||||
|
$columns = $this->getSchema($table, 'columns');
|
||||||
|
foreach ($data as $col => $item) {
|
||||||
|
if (is_array($item)) {
|
||||||
|
$data[$col] = implode(',', $item);
|
||||||
|
}
|
||||||
|
if ($col === 'password') {
|
||||||
|
// 密码为空,则不更新密码
|
||||||
|
if ($item == '') {
|
||||||
|
unset($data[$col]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$data[$col] = Util::passwordHash($item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$datetime = date('Y-m-d H:i:s');
|
||||||
|
if (isset($columns['updated_at']) && !isset($data['updated_at'])) {
|
||||||
|
$data['updated_at'] = $datetime;
|
||||||
|
}
|
||||||
|
var_export($data);
|
||||||
|
Util::checkTableName($table);
|
||||||
|
Db::connection('plugin.admin.mysql')->table($table)->where($column, $value)->update($data);
|
||||||
|
return $this->json(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
* @throws BusinessException
|
||||||
|
*/
|
||||||
|
public function delete(Request $request)
|
||||||
|
{
|
||||||
|
$table = $request->input('table');
|
||||||
|
$column = $request->post('column');
|
||||||
|
$value = $request->post('value');
|
||||||
|
Util::checkTableName($table);
|
||||||
|
Db::connection('plugin.admin.mysql')->table($table)->where([$column => $value])->delete();
|
||||||
|
return $this->json(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function create(Request $request)
|
||||||
|
{
|
||||||
|
$data = $request->post();
|
||||||
|
$table_name = $data['table']['name'];
|
||||||
|
$table_comment = $data['table']['comment'];
|
||||||
|
$columns = $data['columns'];
|
||||||
|
$keys = $data['keys'];
|
||||||
|
Db::schema()->create($table_name, function (Blueprint $table) use ($columns) {
|
||||||
|
$type_method_map = Util::methodControlMap();
|
||||||
|
foreach ($columns as $column) {
|
||||||
|
if (!isset($column['type'])) {
|
||||||
|
throw new BusinessException("请为{$column['field']}选择类型");
|
||||||
|
}
|
||||||
|
if (!isset($type_method_map[$column['type']])) {
|
||||||
|
throw new BusinessException("不支持的类型{$column['type']}");
|
||||||
|
}
|
||||||
|
$this->createColumn($column, $table);
|
||||||
|
}
|
||||||
|
$table->charset = 'utf8mb4';
|
||||||
|
$table->collation = 'utf8mb4_general_ci';
|
||||||
|
$table->engine = 'InnoDB';
|
||||||
|
});
|
||||||
|
// @todo 防注入
|
||||||
|
Db::statement("ALTER TABLE `$table_name` COMMENT '$table_comment'");
|
||||||
|
|
||||||
|
// 索引
|
||||||
|
Db::schema()->table($table_name, function (Blueprint $table) use ($keys) {
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
$name = $key['name'];
|
||||||
|
$columns = $key['columns'];
|
||||||
|
$type = $key['type'];
|
||||||
|
if ($type == 'unique') {
|
||||||
|
$table->unique($columns, $name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$table->index($columns, $name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$form_schema = $request->post('forms', []);
|
||||||
|
$form_schema_map = [];
|
||||||
|
foreach ($form_schema as $item) {
|
||||||
|
$form_schema_map[$item['field']] = $item;
|
||||||
|
}
|
||||||
|
$form_schema_map = json_encode($form_schema_map, JSON_UNESCAPED_UNICODE);
|
||||||
|
$option = Db::connection('plugin.admin.mysql')->table('wa_options')->where('name', "table_form_schema_$table_name")->first();
|
||||||
|
if ($option) {
|
||||||
|
Db::connection('plugin.admin.mysql')->table('wa_options')->where('name', "table_form_schema_$table_name")->update(['value' => $form_schema_map]);
|
||||||
|
} else {
|
||||||
|
Db::connection('plugin.admin.mysql')->table('wa_options')->insert(['name' => "table_form_schema_$table_name", 'value' => $form_schema_map]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json(0, 'ok');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改表
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
* @throws BusinessException
|
||||||
|
*/
|
||||||
|
public function modify(Request $request)
|
||||||
|
{
|
||||||
|
$data = $request->post();
|
||||||
|
$old_table_name = $data['table']['old_name'];
|
||||||
|
$table_name = $data['table']['name'];
|
||||||
|
$table_comment = $data['table']['comment'];
|
||||||
|
$columns = $data['columns'];
|
||||||
|
$keys = $data['keys'] ?? [];
|
||||||
|
// 改表名
|
||||||
|
if ($table_name != $old_table_name) {
|
||||||
|
Util::checkTableName($table_name);
|
||||||
|
Db::schema()->rename($old_table_name, $table_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
$old_columns = $this->getSchema($table_name, 'columns');
|
||||||
|
$type_method_map = Util::methodControlMap();
|
||||||
|
foreach ($columns as $column) {
|
||||||
|
if (!isset($type_method_map[$column['type']])) {
|
||||||
|
throw new BusinessException("不支持的类型{$column['type']}");
|
||||||
|
}
|
||||||
|
$field = $column['field'];
|
||||||
|
|
||||||
|
// 重命名的字段 mysql8才支持?
|
||||||
|
if (isset($column['old_field']) && $column['old_field'] !== $field) {
|
||||||
|
//Db::statement("ALTER TABLE $table_name RENAME COLUMN {$column['old_field']} to $field");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 类型更改
|
||||||
|
if (isset($old_columns[$field])) {
|
||||||
|
$this->modifyColumn($column, $table_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$table = $this->getSchema($table_name, 'table');
|
||||||
|
// @todo $table_comment 防止SQL注入
|
||||||
|
if ($table_comment !== $table['comment']) {
|
||||||
|
Db::statement("ALTER TABLE `$table_name` COMMENT '$table_comment'");
|
||||||
|
}
|
||||||
|
|
||||||
|
$old_columns = $this->getSchema($table_name, 'columns');
|
||||||
|
Db::schema()->table($table_name, function (Blueprint $table) use ($columns, $old_columns, $keys, $table_name) {
|
||||||
|
foreach ($columns as $column) {
|
||||||
|
$field = $column['field'];
|
||||||
|
// 新字段
|
||||||
|
if (!isset($old_columns[$field])) {
|
||||||
|
$this->createColumn($column, $table);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 更新索引名字
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
if (!empty($key['old_name']) && $key['old_name'] !== $key['name']) {
|
||||||
|
$table->renameIndex($key['old_name'], $key['name']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 找到删除的字段
|
||||||
|
$old_columns = $this->getSchema($table_name, 'columns');
|
||||||
|
$exists_column_names = array_column($columns, 'field', 'field');
|
||||||
|
$old_columns_names = array_column($old_columns, 'field');
|
||||||
|
$drop_column_names = array_diff($old_columns_names, $exists_column_names);
|
||||||
|
foreach ($drop_column_names as $drop_column_name) {
|
||||||
|
//$table->dropColumn($drop_column_name); 无法使用
|
||||||
|
Db::statement("ALTER TABLE $table_name DROP COLUMN $drop_column_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
$old_keys = $this->getSchema($table_name, 'keys');
|
||||||
|
Db::schema()->table($table_name, function (Blueprint $table) use ($keys, $old_keys, $table_name) {
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
$key_name = $key['name'];
|
||||||
|
$old_key = $old_keys[$key_name] ?? [];
|
||||||
|
// 如果索引有变动,则删除索引,重新建立索引
|
||||||
|
if ($old_key && ($key['type'] != $old_key['type'] || $key['columns'] != $old_key['columns'])) {
|
||||||
|
$old_key = [];
|
||||||
|
unset($old_keys[$key_name]);
|
||||||
|
$table->dropIndex($key_name);
|
||||||
|
}
|
||||||
|
// 重新建立索引
|
||||||
|
if (!$old_key) {
|
||||||
|
$name = $key['name'];
|
||||||
|
$columns = $key['columns'];
|
||||||
|
$type = $key['type'];
|
||||||
|
if ($type == 'unique') {
|
||||||
|
$table->unique($columns, $name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$table->index($columns, $name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 找到删除的索引
|
||||||
|
$exists_key_names = array_column($keys, 'name', 'name');
|
||||||
|
$old_keys_names = array_column($old_keys, 'name');
|
||||||
|
$drop_keys_names = array_diff($old_keys_names, $exists_key_names);
|
||||||
|
foreach ($drop_keys_names as $name) {
|
||||||
|
$table->dropIndex($name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$form_schema = $request->post('forms', []);
|
||||||
|
$form_schema_map = [];
|
||||||
|
foreach ($form_schema as $item) {
|
||||||
|
$form_schema_map[$item['field']] = $item;
|
||||||
|
}
|
||||||
|
$form_schema_map = json_encode($form_schema_map, JSON_UNESCAPED_UNICODE);
|
||||||
|
$option = Db::connection('plugin.admin.mysql')->table('wa_options')->where('name', "table_form_schema_$table_name")->first();
|
||||||
|
if ($option) {
|
||||||
|
Db::connection('plugin.admin.mysql')->table('wa_options')->where('name', "table_form_schema_$table_name")->update(['value' => $form_schema_map]);
|
||||||
|
} else {
|
||||||
|
Db::connection('plugin.admin.mysql')->table('wa_options')->insert(['name' => "table_form_schema_$table_name", 'value' => $form_schema_map]);
|
||||||
|
}
|
||||||
|
return $this->json(0,"table_form_schema_$table_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摘要
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
* @throws BusinessException
|
||||||
|
*/
|
||||||
|
public function schema(Request $request)
|
||||||
|
{
|
||||||
|
$table = $request->get('table');
|
||||||
|
Util::checkTableName($table);
|
||||||
|
$schema = Db::connection('plugin.admin.mysql')->table('wa_options')->where('name', "table_form_schema_$table")->value('value');
|
||||||
|
$form_schema_map = $schema ? json_decode($schema, true) : [];
|
||||||
|
|
||||||
|
$data = $this->getSchema($table);
|
||||||
|
foreach ($data['forms'] as $field => $item) {
|
||||||
|
if (isset($form_schema_map[$field])) {
|
||||||
|
$data['forms'][$field] = $form_schema_map[$field];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json(0, 'ok', [
|
||||||
|
'table' => $data['table'],
|
||||||
|
'columns' => array_values($data['columns']),
|
||||||
|
'forms' => array_values($data['forms']),
|
||||||
|
'keys' => array_values($data['keys']),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取摘要
|
||||||
|
*
|
||||||
|
* @param $table
|
||||||
|
* @param $section
|
||||||
|
* @return array|mixed
|
||||||
|
*/
|
||||||
|
protected function getSchema($table, $section = null)
|
||||||
|
{
|
||||||
|
$database = config('database.connections')['plugin.admin.mysql']['database'];
|
||||||
|
$schema_raw = $section !== 'table' ? Db::select("select * from information_schema.COLUMNS where TABLE_SCHEMA = '$database' and table_name = '$table'") : [];
|
||||||
|
$forms = [];
|
||||||
|
$columns = [];
|
||||||
|
foreach ($schema_raw as $item) {
|
||||||
|
$field = $item->COLUMN_NAME;
|
||||||
|
$columns[$field] = [
|
||||||
|
'field' => $field,
|
||||||
|
'type' => Util::typeToMethod($item->DATA_TYPE, (bool)strpos($item->COLUMN_TYPE, 'unsigned')),
|
||||||
|
'comment' => $item->COLUMN_COMMENT,
|
||||||
|
'default' => $item->COLUMN_DEFAULT,
|
||||||
|
'length' => $this->getLengthValue($item),
|
||||||
|
'nullable' => $item->IS_NULLABLE !== 'NO',
|
||||||
|
'primary_key' => $item->COLUMN_KEY === 'PRI',
|
||||||
|
'auto_increment' => strpos($item->EXTRA, 'auto_increment') !== false
|
||||||
|
];
|
||||||
|
|
||||||
|
$forms[$field] = [
|
||||||
|
'field' => $field,
|
||||||
|
'comment' => $item->COLUMN_COMMENT,
|
||||||
|
'control' => Util::typeToControl($item->DATA_TYPE),
|
||||||
|
'form_show' => $item->COLUMN_KEY !== 'PRI',
|
||||||
|
'list_show' => true,
|
||||||
|
'enable_sort' => false,
|
||||||
|
'readonly' => $item->COLUMN_KEY === 'PRI',
|
||||||
|
'searchable' => false,
|
||||||
|
'search_type' => 'normal',
|
||||||
|
'control_args' => '',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$table_schema = $section == 'table' || !$section ? Db::select("SELECT TABLE_COMMENT FROM information_schema.`TABLES` WHERE TABLE_SCHEMA='$database' and TABLE_NAME='$table'") : [];
|
||||||
|
$indexes = $section == 'keys' || !$section ? Db::select("SHOW INDEX FROM $table") : [];
|
||||||
|
$keys = [];
|
||||||
|
foreach ($indexes as $index) {
|
||||||
|
$key_name = $index->Key_name;
|
||||||
|
if ($key_name == 'PRIMARY') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!isset($keys[$key_name])) {
|
||||||
|
$keys[$key_name] = [
|
||||||
|
'name' => $key_name,
|
||||||
|
'columns' => [],
|
||||||
|
'type' => $index->Non_unique == 0 ? 'unique' : 'normal'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$keys[$key_name]['columns'][] = $index->Column_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'table' => ['name' => $table, 'comment' => $table_schema[0]->TABLE_COMMENT ?? ''],
|
||||||
|
'columns' => $columns,
|
||||||
|
'forms' => $forms,
|
||||||
|
'keys' => array_reverse($keys, true)
|
||||||
|
];
|
||||||
|
return $section ? $data[$section] : $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字段长度
|
||||||
|
*
|
||||||
|
* @param $schema
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getLengthValue($schema)
|
||||||
|
{
|
||||||
|
$type = $schema->DATA_TYPE;
|
||||||
|
if (in_array($type, ['float', 'decimal', 'double'])) {
|
||||||
|
return "{$schema->NUMERIC_PRECISION},{$schema->NUMERIC_SCALE}";
|
||||||
|
}
|
||||||
|
if ($type === 'enum') {
|
||||||
|
return implode(',', array_map(function($item){
|
||||||
|
return trim($item, "'");
|
||||||
|
}, explode(',', substr($schema->COLUMN_TYPE, 5, -1))));
|
||||||
|
}
|
||||||
|
if (in_array($type, ['varchar', 'text', 'char'])) {
|
||||||
|
return $schema->CHARACTER_MAXIMUM_LENGTH;
|
||||||
|
}
|
||||||
|
if (in_array($type, ['time', 'datetime', 'timestamp'])) {
|
||||||
|
return $schema->CHARACTER_MAXIMUM_LENGTH;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除表
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function drop(Request $request)
|
||||||
|
{
|
||||||
|
$table_name = $request->post('table');
|
||||||
|
if (!$table_name) {
|
||||||
|
return $this->json(0, 'not found');
|
||||||
|
}
|
||||||
|
$table_not_allow_drop = ['wa_admins', 'wa_users', 'wa_options', 'wa_admin_roles', 'wa_admin_rules'];
|
||||||
|
if (in_array($table_name, $table_not_allow_drop)) {
|
||||||
|
return $this->json(400, "$table_name 不允许删除");
|
||||||
|
}
|
||||||
|
Db::schema()->drop($table_name);
|
||||||
|
return $this->json(0, 'ok');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建字段
|
||||||
|
*
|
||||||
|
* @param $column
|
||||||
|
* @param Blueprint $table
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
protected function createColumn($column, Blueprint $table)
|
||||||
|
{
|
||||||
|
$method = $column['type'];
|
||||||
|
$args = [$column['field']];
|
||||||
|
if (stripos($method, 'int') !== false) {
|
||||||
|
// auto_increment 会自动成为主键
|
||||||
|
if ($column['auto_increment']) {
|
||||||
|
$column['nullable'] = false;
|
||||||
|
$column['default'] = '';
|
||||||
|
$args[] = true;
|
||||||
|
}
|
||||||
|
} elseif (in_array($method, ['string', 'char']) || stripos($method, 'time') !== false) {
|
||||||
|
if ($column['length']) {
|
||||||
|
$args[] = $column['length'];
|
||||||
|
}
|
||||||
|
} elseif ($method === 'enum') {
|
||||||
|
$args[] = array_map('trim', explode(',', $column['length']));
|
||||||
|
} elseif (in_array($method, ['float', 'decimal', 'double'])) {
|
||||||
|
if ($column['length']) {
|
||||||
|
$args = array_merge($args, array_map('trim', explode(',', $column['length'])));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$column['auto_increment'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$column_def = [$table, $method](...$args);
|
||||||
|
if (!empty($column['comment'])) {
|
||||||
|
$column_def = $column_def->comment($column['comment']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$column['auto_increment'] && $column['primary_key']) {
|
||||||
|
$column_def = $column_def->primary(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($column['auto_increment'] && !$column['primary_key']) {
|
||||||
|
$column_def = $column_def->primary(false);
|
||||||
|
}
|
||||||
|
$column_def = $column_def->nullable($column['nullable']);
|
||||||
|
|
||||||
|
if ($column['primary_key']) {
|
||||||
|
$column_def = $column_def->nullable(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($column['default'] && !in_array($method, ['text'])) {
|
||||||
|
$column_def->default($column['default']);
|
||||||
|
}
|
||||||
|
return $column_def;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更改字段
|
||||||
|
*
|
||||||
|
* @param $column
|
||||||
|
* @param Blueprint $table
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
protected function modifyColumn($column, $table)
|
||||||
|
{
|
||||||
|
$method = $column['type'];
|
||||||
|
$field = $column['field'];
|
||||||
|
$nullable = $column['nullable'];
|
||||||
|
$default = $column['default'];
|
||||||
|
$comment = $column['comment'];
|
||||||
|
$auto_increment = $column['auto_increment'];
|
||||||
|
$length = (int)$column['length'];
|
||||||
|
$primary_key = $column['primary_key'];
|
||||||
|
// @todo 防止SQL注入
|
||||||
|
if (isset($column['old_field']) && $column['old_field'] !== $field) {
|
||||||
|
$sql = "ALTER TABLE $table CHANGE COLUMN {$column['old_field']} $field ";
|
||||||
|
} else {
|
||||||
|
$sql = "ALTER TABLE $table MODIFY $field ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stripos($method, 'integer') !== false) {
|
||||||
|
$type = str_ireplace('integer', 'int', $method);
|
||||||
|
if (stripos($method, 'unsigned') !== false) {
|
||||||
|
$type = str_ireplace('unsigned', '', $type);
|
||||||
|
$sql .= "$type ";
|
||||||
|
$sql .= 'unsigned ';
|
||||||
|
} else {
|
||||||
|
$sql .= "$type ";
|
||||||
|
}
|
||||||
|
if ($auto_increment) {
|
||||||
|
$column['nullable'] = false;
|
||||||
|
$column['default'] = '';
|
||||||
|
$sql .= 'AUTO_INCREMENT ';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch ($method) {
|
||||||
|
case 'string':
|
||||||
|
$length = $length ?: 255
|
||||||
|
; $sql .= "varchar($length) ";
|
||||||
|
break;
|
||||||
|
case 'char':
|
||||||
|
case 'time':
|
||||||
|
$sql .= $length ? "$method($length) " : "$method ";
|
||||||
|
break;
|
||||||
|
case 'enum':
|
||||||
|
// @todo 防止SQL注入
|
||||||
|
$args = array_map('trim', explode(',', $column['length']));
|
||||||
|
$sql .= "enum('" . implode("','", $args) . "') ";
|
||||||
|
break;
|
||||||
|
case 'double':
|
||||||
|
case 'float':
|
||||||
|
case 'decimal':
|
||||||
|
if (trim($column['length'])) {
|
||||||
|
$args = array_map('intval', explode(',', $column['length']));
|
||||||
|
$args[1] = $args[1] ?? $args[0];
|
||||||
|
$sql .= "$method({$args[0]}, {$args[1]}) ";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$sql .= "$method ";
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
$sql .= "$method ";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$nullable) {
|
||||||
|
$sql .= "NOT NULL ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($default !== null && !in_array($method, ['text'])) {
|
||||||
|
$sql .= "DEFAULT '$default' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($comment !== null) {
|
||||||
|
$sql .= "COMMENT '$comment' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
Db::statement($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段类型列表
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \support\Response
|
||||||
|
*/
|
||||||
|
public function types(Request $request)
|
||||||
|
{
|
||||||
|
$types = Util::methodControlMap();
|
||||||
|
return $this->json(0, 'ok', $types);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
24
src/plugin/admin/app/controller/user/UserController.php
Normal file
24
src/plugin/admin/app/controller/user/UserController.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\controller\user;
|
||||||
|
|
||||||
|
use plugin\admin\app\controller\Base;
|
||||||
|
use plugin\admin\app\controller\Crud;
|
||||||
|
use plugin\admin\app\model\User;
|
||||||
|
use support\Request;
|
||||||
|
|
||||||
|
class UserController extends Base
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var User
|
||||||
|
*/
|
||||||
|
protected $model = null;
|
||||||
|
|
||||||
|
use Crud;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->model = new User;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
39
src/plugin/admin/app/exception/Handler.php
Normal file
39
src/plugin/admin/app/exception/Handler.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace plugin\admin\app\exception;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
|
use Webman\Http\Request;
|
||||||
|
use Webman\Http\Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Handler
|
||||||
|
* @package Support\Exception
|
||||||
|
*/
|
||||||
|
class Handler extends \Support\Exception\Handler
|
||||||
|
{
|
||||||
|
public function render(Request $request, Throwable $exception): Response
|
||||||
|
{
|
||||||
|
$code = $exception->getCode();
|
||||||
|
if ($request->expectsJson()) {
|
||||||
|
$json = ['code' => $code ? $code : 500, 'message' => $this->_debug ? $exception->getMessage() : 'Server internal error', 'type' => 'failed'];
|
||||||
|
$this->_debug && $json['traces'] = (string)$exception;
|
||||||
|
return new Response(200, ['Content-Type' => 'application/json'],
|
||||||
|
\json_encode($json, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||||
|
}
|
||||||
|
$error = $this->_debug ? \nl2br((string)$exception) : 'Server internal error';
|
||||||
|
return new Response(500, [], $error);
|
||||||
|
}
|
||||||
|
}
|
44
src/plugin/admin/app/functions.php
Normal file
44
src/plugin/admin/app/functions.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Here is your custom functions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use support\Db;
|
||||||
|
|
||||||
|
function admin_id()
|
||||||
|
{
|
||||||
|
return session('admin_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
function admin($column = null)
|
||||||
|
{
|
||||||
|
if (!$admin_id = admin_id()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ($column) {
|
||||||
|
if (!is_array($column)) {
|
||||||
|
return Db::connection('plugin.admin.mysql')->table('wa_admins')->where('id', $admin_id)->value($column);
|
||||||
|
}
|
||||||
|
return (array)Db::connection('plugin.admin.mysql')->table('wa_admins')->where('id', $admin_id)->select($column)->first();
|
||||||
|
}
|
||||||
|
return (array)Db::connection('plugin.admin.mysql')->table('wa_admins')->where('id', $admin_id)->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
function user_id()
|
||||||
|
{
|
||||||
|
return session('admin_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
function user($column = null)
|
||||||
|
{
|
||||||
|
if (!$user_id = user_id()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ($column) {
|
||||||
|
if (!is_array($column)) {
|
||||||
|
return Db::connection('plugin.admin.mysql')->table('wa_users')->where('id', $user_id)->value($column);
|
||||||
|
}
|
||||||
|
return (array)Db::connection('plugin.admin.mysql')->table('wa_users')->where('id', $user_id)->select($column)->first();
|
||||||
|
}
|
||||||
|
return (array)Db::connection('plugin.admin.mysql')->table('wa_users')->where('id', $user_id)->first();
|
||||||
|
}
|
33
src/plugin/admin/app/middleware/AccessControl.php
Normal file
33
src/plugin/admin/app/middleware/AccessControl.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
namespace plugin\admin\app\middleware;
|
||||||
|
|
||||||
|
use plugin\admin\app\Admin;
|
||||||
|
use Webman\MiddlewareInterface;
|
||||||
|
use Webman\Http\Response;
|
||||||
|
use Webman\Http\Request;
|
||||||
|
|
||||||
|
class AccessControl implements MiddlewareInterface
|
||||||
|
{
|
||||||
|
public function process(Request $request, callable $handler): Response
|
||||||
|
{
|
||||||
|
$controller = $request->controller;
|
||||||
|
$action = $request->action;
|
||||||
|
|
||||||
|
$code = 0;
|
||||||
|
$msg = '';
|
||||||
|
if (!Admin::canAccess($controller, $action, $code, $msg)) {
|
||||||
|
$response = json(['code' => $code, 'message' => $msg, 'type' => 'error']);
|
||||||
|
} else {
|
||||||
|
$response = $request->method() == 'OPTIONS' ? response('') : $handler($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response->withHeaders([
|
||||||
|
'Access-Control-Allow-Credentials' => 'true',
|
||||||
|
'Access-Control-Allow-Origin' => $request->header('Origin', '*'),
|
||||||
|
'Access-Control-Allow-Methods' => '*',
|
||||||
|
'Access-Control-Allow-Headers' => '*',
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
36
src/plugin/admin/app/model/Admin.php
Normal file
36
src/plugin/admin/app/model/Admin.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\model;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property integer $id ID(主键)
|
||||||
|
* @property string $username 用户名
|
||||||
|
* @property string $nickname 昵称
|
||||||
|
* @property string $password 密码
|
||||||
|
* @property string $avatar 头像
|
||||||
|
* @property string $email 邮箱
|
||||||
|
* @property string $mobile 手机
|
||||||
|
* @property string $created_at 创建时间
|
||||||
|
* @property string $updated_at 更新时间
|
||||||
|
* @property string $status 状态
|
||||||
|
* @property string $roles 角色
|
||||||
|
*/
|
||||||
|
class Admin extends Base
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'wa_admins';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
30
src/plugin/admin/app/model/AdminRole.php
Normal file
30
src/plugin/admin/app/model/AdminRole.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property integer $id 主键(主键)
|
||||||
|
* @property string $name 角色名
|
||||||
|
* @property string $rules 规则
|
||||||
|
* @property string $created_at 创建时间
|
||||||
|
* @property string $updated_at 更新时间
|
||||||
|
* @property string $status 状态
|
||||||
|
*/
|
||||||
|
class AdminRole extends Base
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'wa_admin_roles';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
37
src/plugin/admin/app/model/AdminRule.php
Normal file
37
src/plugin/admin/app/model/AdminRule.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property integer $id 主键(主键)
|
||||||
|
* @property string $title 标题
|
||||||
|
* @property string $name 名字
|
||||||
|
* @property integer $pid 上级id
|
||||||
|
* @property string $component 组件
|
||||||
|
* @property string $path 路径
|
||||||
|
* @property string $icon 图标
|
||||||
|
* @property string $status 状态
|
||||||
|
* @property string $created_at 创建时间
|
||||||
|
* @property string $updated_at 更新时间
|
||||||
|
* @property string $frame_src url
|
||||||
|
* @property integer $hide_menu 隐藏菜单
|
||||||
|
* @property integer $is_menu 是否菜单
|
||||||
|
*/
|
||||||
|
class AdminRule extends Base
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'wa_admin_rules';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
16
src/plugin/admin/app/model/Base.php
Normal file
16
src/plugin/admin/app/model/Base.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
|
||||||
|
class Base extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $connection = 'plugin.admin.mysql';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
37
src/plugin/admin/app/model/Menu.php
Normal file
37
src/plugin/admin/app/model/Menu.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property integer $id 主键(主键)
|
||||||
|
* @property string $name 名字
|
||||||
|
* @property integer $pid 上级id
|
||||||
|
* @property string $component 组件
|
||||||
|
* @property string $path 路径
|
||||||
|
* @property string $icon 图标
|
||||||
|
* @property string $title 标题
|
||||||
|
* @property string $status 状态
|
||||||
|
* @property string $created_at 创建时间
|
||||||
|
* @property string $updated_at 更新时间
|
||||||
|
* @property string $frame_src url
|
||||||
|
* @property integer $hide_menu 隐藏菜单
|
||||||
|
* @property integer $is_menu 隐藏菜单
|
||||||
|
*/
|
||||||
|
class Menu extends Base
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'wa_admin_rules';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
36
src/plugin/admin/app/model/Role.php
Normal file
36
src/plugin/admin/app/model/Role.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property integer $id 主键(主键)
|
||||||
|
* @property string $name 名字
|
||||||
|
* @property integer $pid 上级id
|
||||||
|
* @property string $component 组件
|
||||||
|
* @property string $path 路径
|
||||||
|
* @property string $icon 图标
|
||||||
|
* @property string $title 标题
|
||||||
|
* @property string $status 状态
|
||||||
|
* @property string $created_at 创建时间
|
||||||
|
* @property string $updated_at 更新时间
|
||||||
|
* @property string $frame_src url
|
||||||
|
* @property integer $hide_menu 隐藏菜单
|
||||||
|
*/
|
||||||
|
class Role extends Base
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'wa_admin_rules';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
45
src/plugin/admin/app/model/User.php
Normal file
45
src/plugin/admin/app/model/User.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace plugin\admin\app\model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property integer $id 主键(主键)
|
||||||
|
* @property string $username 用户名
|
||||||
|
* @property string $nickname 昵称
|
||||||
|
* @property string $password 密码
|
||||||
|
* @property string $sex 性别
|
||||||
|
* @property string $avatar 头像
|
||||||
|
* @property string $email 邮箱
|
||||||
|
* @property string $mobile 手机
|
||||||
|
* @property integer $level 等级
|
||||||
|
* @property string $birthday 生日
|
||||||
|
* @property integer $money 余额
|
||||||
|
* @property integer $score 积分
|
||||||
|
* @property string $last_time 上次登录时间
|
||||||
|
* @property string $last_ip 上次登录ip
|
||||||
|
* @property string $join_time 注册时间
|
||||||
|
* @property string $join_ip 注册ip
|
||||||
|
* @property string $status 状态
|
||||||
|
* @property string $token token
|
||||||
|
* @property string $created_at 创建时间
|
||||||
|
* @property string $updated_at 更新时间
|
||||||
|
* @property string $roles 更新时间
|
||||||
|
*/
|
||||||
|
class User extends Base
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'wa_users';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
21
src/plugin/admin/config/app.php
Normal file
21
src/plugin/admin/config/app.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
use support\Request;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'debug' => true,
|
||||||
|
'request_class' => Request::class,
|
||||||
|
'controller_suffix' => 'Controller',
|
||||||
|
];
|
19
src/plugin/admin/config/autoload.php
Normal file
19
src/plugin/admin/config/autoload.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
'files' => [
|
||||||
|
base_path() . '/plugin/admin/app/functions.php',
|
||||||
|
]
|
||||||
|
];
|
15
src/plugin/admin/config/bootstrap.php
Normal file
15
src/plugin/admin/config/bootstrap.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [];
|
15
src/plugin/admin/config/container.php
Normal file
15
src/plugin/admin/config/container.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
return new Webman\Container;
|
36
src/plugin/admin/config/database.php
Normal file
36
src/plugin/admin/config/database.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
// 默认数据库
|
||||||
|
'default' => 'mysql',
|
||||||
|
|
||||||
|
// 各种数据库配置
|
||||||
|
'connections' => [
|
||||||
|
'mysql' => [
|
||||||
|
'driver' => 'mysql',
|
||||||
|
'host' => '127.0.0.1',
|
||||||
|
'port' => 3306,
|
||||||
|
'database' => 'webman_admin',
|
||||||
|
'username' => 'root',
|
||||||
|
'password' => '密码',
|
||||||
|
'unix_socket' => '',
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
'collation' => 'utf8mb4_general_ci',
|
||||||
|
'prefix' => '',
|
||||||
|
'strict' => true,
|
||||||
|
'engine' => null,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
15
src/plugin/admin/config/dependence.php
Normal file
15
src/plugin/admin/config/dependence.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [];
|
5
src/plugin/admin/config/event.php
Normal file
5
src/plugin/admin/config/event.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
];
|
17
src/plugin/admin/config/exception.php
Normal file
17
src/plugin/admin/config/exception.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
'' => \plugin\admin\App\exception\Handler::class,
|
||||||
|
];
|
32
src/plugin/admin/config/log.php
Normal file
32
src/plugin/admin/config/log.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
'default' => [
|
||||||
|
'handlers' => [
|
||||||
|
[
|
||||||
|
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||||
|
'constructor' => [
|
||||||
|
runtime_path() . '/logs/webman.log',
|
||||||
|
7, //$maxFiles
|
||||||
|
Monolog\Logger::DEBUG,
|
||||||
|
],
|
||||||
|
'formatter' => [
|
||||||
|
'class' => Monolog\Formatter\LineFormatter::class,
|
||||||
|
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||||
|
],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
21
src/plugin/admin/config/middleware.php
Normal file
21
src/plugin/admin/config/middleware.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
use plugin\admin\app\middleware\AccessControl;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'' => [
|
||||||
|
AccessControl::class,
|
||||||
|
]
|
||||||
|
];
|
37
src/plugin/admin/config/process.php
Normal file
37
src/plugin/admin/config/process.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [];
|
||||||
|
return [
|
||||||
|
// File update detection and automatic reload
|
||||||
|
'monitor' => [
|
||||||
|
'handler' => process\Monitor::class,
|
||||||
|
'reloadable' => false,
|
||||||
|
'constructor' => [
|
||||||
|
// Monitor these directories
|
||||||
|
'monitor_dir' => [
|
||||||
|
app_path(),
|
||||||
|
config_path(),
|
||||||
|
base_path() . '/process',
|
||||||
|
base_path() . '/support',
|
||||||
|
base_path() . '/resource',
|
||||||
|
base_path() . '/.env',
|
||||||
|
],
|
||||||
|
// Files with these suffixes will be monitored
|
||||||
|
'monitor_extensions' => [
|
||||||
|
'php', 'html', 'htm', 'env'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
22
src/plugin/admin/config/redis.php
Normal file
22
src/plugin/admin/config/redis.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
'default' => [
|
||||||
|
'host' => '127.0.0.1',
|
||||||
|
'password' => null,
|
||||||
|
'port' => 6379,
|
||||||
|
'database' => 0,
|
||||||
|
],
|
||||||
|
];
|
23
src/plugin/admin/config/route.php
Normal file
23
src/plugin/admin/config/route.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Webman\Route;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Route::fallback(function (\support\Request $request) {
|
||||||
|
return response("url " . $request->path() . " not found", 404);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
30
src/plugin/admin/config/server.php
Normal file
30
src/plugin/admin/config/server.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
'listen' => 'http://0.0.0.0:8080',
|
||||||
|
'transport' => 'tcp',
|
||||||
|
'context' => [],
|
||||||
|
'name' => 'webman',
|
||||||
|
'count' => cpu_count() * 2,
|
||||||
|
'user' => '',
|
||||||
|
'group' => '',
|
||||||
|
'reusePort' => false,
|
||||||
|
'event_loop' => '',
|
||||||
|
'pid_file' => runtime_path() . '/webman.pid',
|
||||||
|
'status_file' => runtime_path() . '/webman.status',
|
||||||
|
'stdout_file' => runtime_path() . '/logs/stdout.log',
|
||||||
|
'log_file' => runtime_path() . '/logs/workerman.log',
|
||||||
|
'max_package_size' => 10 * 1024 * 1024
|
||||||
|
];
|
42
src/plugin/admin/config/session.php
Normal file
42
src/plugin/admin/config/session.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
'type' => 'file', // or redis or redis_cluster
|
||||||
|
|
||||||
|
'handler' => Webman\FileSessionHandler::class,
|
||||||
|
|
||||||
|
'config' => [
|
||||||
|
'file' => [
|
||||||
|
'save_path' => runtime_path() . '/sessions',
|
||||||
|
],
|
||||||
|
'redis' => [
|
||||||
|
'host' => '127.0.0.1',
|
||||||
|
'port' => 6379,
|
||||||
|
'auth' => '',
|
||||||
|
'timeout' => 2,
|
||||||
|
'database' => '',
|
||||||
|
'prefix' => 'redis_session_',
|
||||||
|
],
|
||||||
|
'redis_cluster' => [
|
||||||
|
'host' => ['127.0.0.1:7000', '127.0.0.1:7001', '127.0.0.1:7001'],
|
||||||
|
'timeout' => 2,
|
||||||
|
'auth' => '',
|
||||||
|
'prefix' => 'redis_session_',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'session_name' => 'PHPSID',
|
||||||
|
];
|
23
src/plugin/admin/config/static.php
Normal file
23
src/plugin/admin/config/static.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Static file settings
|
||||||
|
*/
|
||||||
|
return [
|
||||||
|
'enable' => true,
|
||||||
|
'middleware' => [ // Static file Middleware
|
||||||
|
//app\middleware\StaticFile::class,
|
||||||
|
],
|
||||||
|
];
|
31
src/plugin/admin/config/thinkorm.php
Normal file
31
src/plugin/admin/config/thinkorm.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'default' => 'mysql',
|
||||||
|
'connections' => [
|
||||||
|
'mysql' => [
|
||||||
|
// 数据库类型
|
||||||
|
'type' => 'mysql',
|
||||||
|
// 服务器地址
|
||||||
|
'hostname' => '127.0.0.1',
|
||||||
|
// 数据库名
|
||||||
|
'database' => 'webman_admin',
|
||||||
|
// 数据库用户名
|
||||||
|
'username' => 'root',
|
||||||
|
// 数据库密码
|
||||||
|
'password' => 'P@ssword',
|
||||||
|
// 数据库连接端口
|
||||||
|
'hostport' => '3306',
|
||||||
|
// 数据库连接参数
|
||||||
|
'params' => [],
|
||||||
|
// 数据库编码默认采用utf8
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
// 数据库表前缀
|
||||||
|
'prefix' => '',
|
||||||
|
// 断线重连
|
||||||
|
'break_reconnect' => true,
|
||||||
|
// 关闭SQL监听日志
|
||||||
|
'trigger_sql' => false,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
25
src/plugin/admin/config/translation.php
Normal file
25
src/plugin/admin/config/translation.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multilingual configuration
|
||||||
|
*/
|
||||||
|
return [
|
||||||
|
// Default language
|
||||||
|
'locale' => 'zh_CN',
|
||||||
|
// Fallback language
|
||||||
|
'fallback_locale' => ['zh_CN', 'en'],
|
||||||
|
// Folder where language files are stored
|
||||||
|
'path' => base_path() . '/resource/translations',
|
||||||
|
];
|
22
src/plugin/admin/config/view.php
Normal file
22
src/plugin/admin/config/view.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of webman.
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @author walkor<walkor@workerman.net>
|
||||||
|
* @copyright walkor<walkor@workerman.net>
|
||||||
|
* @link http://www.workerman.net/
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
use support\view\Raw;
|
||||||
|
use support\view\Twig;
|
||||||
|
use support\view\Blade;
|
||||||
|
use support\view\ThinkPHP;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'handler' => Raw::class
|
||||||
|
];
|
1
src/plugin/admin/public/_app.config.js
Normal file
1
src/plugin/admin/public/_app.config.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
window.__PRODUCTION__WEBMAN_ADMIN__CONF__={"VITE_GLOB_APP_TITLE":"WebmanAdmin","VITE_GLOB_APP_SHORT_NAME":"webman_admin","VITE_GLOB_API_URL":"","VITE_GLOB_UPLOAD_URL":"/upload","VITE_GLOB_API_URL_PREFIX":""};Object.freeze(window.__PRODUCTION__WEBMAN_ADMIN__CONF__);Object.defineProperty(window,"__PRODUCTION__WEBMAN_ADMIN__CONF__",{configurable:false,writable:false,});
|
1
src/plugin/admin/public/assets/AccountBind.28a911f6.css
Normal file
1
src/plugin/admin/public/assets/AccountBind.28a911f6.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
.avatar[data-v-ae72de0a]{font-size:40px!important}.extra[data-v-ae72de0a]{float:right;margin-top:10px;margin-right:30px;cursor:pointer}
|
1
src/plugin/admin/public/assets/AccountBind.cab778df.js
Normal file
1
src/plugin/admin/public/assets/AccountBind.cab778df.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{a as x,cB as I,aO as L,aP as C,aQ as e,o,aR as n,p as a,j as c,h as B,aW as k,F as y,aS as i,q as l,t as s,i as g}from"./index.0d073eaa.js";import{L as r}from"./index.f1c035de.js";/* empty css */import{c as h}from"./data.08d7c751.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./eagerComputed.156e81ff.js";const M=x({components:{CollapseContainer:I,List:r,ListItem:r.Item,ListItemMeta:r.Item.Meta,Icon:L},setup(){return{list:h}}});function N(p,V,$,A,D,E){const _=e("Icon"),u=e("a-button"),d=e("ListItemMeta"),m=e("ListItem"),f=e("List"),v=e("CollapseContainer");return o(),n(v,{title:"\u8D26\u53F7\u7ED1\u5B9A",canExpan:!1},{default:a(()=>[c(f,null,{default:a(()=>[(o(!0),B(y,null,k(p.list,t=>(o(),n(m,{key:t.key},{default:a(()=>[c(d,null,{avatar:a(()=>[t.avatar?(o(),n(_,{key:0,class:"avatar",icon:t.avatar,color:t.color},null,8,["icon","color"])):i("",!0)]),title:a(()=>[l(s(t.title)+" ",1),t.extra?(o(),n(u,{key:0,type:"link",size:"small",class:"extra"},{default:a(()=>[l(s(t.extra),1)]),_:2},1024)):i("",!0)]),description:a(()=>[g("div",null,s(t.description),1)]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})}var O=C(M,[["render",N],["__scopeId","data-v-ae72de0a"]]);export{O as default};
|
1
src/plugin/admin/public/assets/AccountDetail.01740fd5.js
Normal file
1
src/plugin/admin/public/assets/AccountDetail.01740fd5.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{aP as P,a as C,aC as h,aD as A,r as y,bR as D,aQ as s,o as p,aR as I,p as t,j as r,i,h as _,aW as b,t as f,F as k,aS as g,q as T}from"./index.0d073eaa.js";import{P as N}from"./index.566277e5.js";import{T as v}from"./index.78efd931.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useSize.bb4e5ce5.js";import"./eagerComputed.156e81ff.js";import"./useWindowSizeFn.ef20ece8.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";import"./useRefs.e81831e2.js";import"./PlusOutlined.64d8e001.js";const V=C({name:"AccountDetail",components:{PageWrapper:N,ATabs:v,ATabPane:v.TabPane},setup(){var a;const e=h(),n=A(),c=y((a=e.params)==null?void 0:a.id),u=y("detail"),{setTitle:m}=D();m("\u8BE6\u60C5\uFF1A\u7528\u6237"+c.value);function d(){n("/system/account")}return{userId:c,currentKey:u,goBack:d}}}),W=T(" \u7981\u7528\u8D26\u53F7 "),$=T(" \u4FEE\u6539\u5BC6\u7801 "),R={class:"pt-4 m-4 desc-wrap"};function w(e,n,c,u,m,d){const a=s("a-button"),l=s("a-tab-pane"),B=s("a-tabs"),K=s("PageWrapper");return p(),I(K,{title:"\u7528\u6237"+e.userId+"\u7684\u8D44\u6599",content:"\u8FD9\u662F\u7528\u6237\u8D44\u6599\u8BE6\u60C5\u9875\u9762\u3002\u672C\u9875\u9762\u4EC5\u7528\u4E8E\u6F14\u793A\u76F8\u540C\u8DEF\u7531\u5728tab\u4E2D\u6253\u5F00\u591A\u4E2A\u9875\u9762\u5E76\u4E14\u663E\u793A\u4E0D\u540C\u7684\u6570\u636E",contentBackground:"",onBack:e.goBack},{extra:t(()=>[r(a,{type:"primary",danger:""},{default:t(()=>[W]),_:1}),r(a,{type:"primary"},{default:t(()=>[$]),_:1})]),footer:t(()=>[r(B,{"default-active-key":"detail",activeKey:e.currentKey,"onUpdate:activeKey":n[0]||(n[0]=o=>e.currentKey=o)},{default:t(()=>[r(l,{key:"detail",tab:"\u7528\u6237\u8D44\u6599"}),r(l,{key:"logs",tab:"\u64CD\u4F5C\u65E5\u5FD7"})]),_:1},8,["activeKey"])]),default:t(()=>[i("div",R,[e.currentKey=="detail"?(p(),_(k,{key:0},b(10,o=>i("div",{key:o},"\u8FD9\u662F\u7528\u6237"+f(e.userId)+"\u8D44\u6599Tab",1)),64)):g("",!0),e.currentKey=="logs"?(p(),_(k,{key:1},b(10,o=>i("div",{key:o},"\u8FD9\u662F\u7528\u6237"+f(e.userId)+"\u64CD\u4F5C\u65E5\u5FD7Tab",1)),64)):g("",!0)])]),_:1},8,["title","onBack"])}var X=P(V,[["render",w]]);export{X as default};
|
1
src/plugin/admin/public/assets/AccountDetail.310f73e8.js
Normal file
1
src/plugin/admin/public/assets/AccountDetail.310f73e8.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{aP as P,a as C,aC as h,aD as A,r as y,bR as D,aQ as s,o as p,aR as I,p as t,j as r,i,h as _,aW as b,t as f,F as k,aS as g,q as T}from"./index.0d073eaa.js";import{P as N}from"./index.566277e5.js";import{T as v}from"./index.78efd931.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useSize.bb4e5ce5.js";import"./eagerComputed.156e81ff.js";import"./useWindowSizeFn.ef20ece8.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";import"./useRefs.e81831e2.js";import"./PlusOutlined.64d8e001.js";const V=C({name:"AccountDetail",components:{PageWrapper:N,ATabs:v,ATabPane:v.TabPane},setup(){var a;const e=h(),n=A(),c=y((a=e.params)==null?void 0:a.id),u=y("detail"),{setTitle:m}=D();m("\u8BE6\u60C5\uFF1A\u7528\u6237"+c.value);function d(){n("/system/account")}return{userId:c,currentKey:u,goBack:d}}}),W=T(" \u7981\u7528\u8D26\u53F7 "),$=T(" \u4FEE\u6539\u5BC6\u7801 "),R={class:"pt-4 m-4 desc-wrap"};function w(e,n,c,u,m,d){const a=s("a-button"),l=s("a-tab-pane"),B=s("a-tabs"),K=s("PageWrapper");return p(),I(K,{title:"\u7528\u6237"+e.userId+"\u7684\u8D44\u6599",content:"\u8FD9\u662F\u7528\u6237\u8D44\u6599\u8BE6\u60C5\u9875\u9762\u3002\u672C\u9875\u9762\u4EC5\u7528\u4E8E\u6F14\u793A\u76F8\u540C\u8DEF\u7531\u5728tab\u4E2D\u6253\u5F00\u591A\u4E2A\u9875\u9762\u5E76\u4E14\u663E\u793A\u4E0D\u540C\u7684\u6570\u636E",contentBackground:"",onBack:e.goBack},{extra:t(()=>[r(a,{type:"primary",danger:""},{default:t(()=>[W]),_:1}),r(a,{type:"primary"},{default:t(()=>[$]),_:1})]),footer:t(()=>[r(B,{"default-active-key":"detail",activeKey:e.currentKey,"onUpdate:activeKey":n[0]||(n[0]=o=>e.currentKey=o)},{default:t(()=>[r(l,{key:"detail",tab:"\u7528\u6237\u8D44\u6599"}),r(l,{key:"logs",tab:"\u64CD\u4F5C\u65E5\u5FD7"})]),_:1},8,["activeKey"])]),default:t(()=>[i("div",R,[e.currentKey=="detail"?(p(),_(k,{key:0},b(10,o=>i("div",{key:o},"\u8FD9\u662F\u7528\u6237"+f(e.userId)+"\u8D44\u6599Tab",1)),64)):g("",!0),e.currentKey=="logs"?(p(),_(k,{key:1},b(10,o=>i("div",{key:o},"\u8FD9\u662F\u7528\u6237"+f(e.userId)+"\u64CD\u4F5C\u65E5\u5FD7Tab",1)),64)):g("",!0)])]),_:1},8,["title","onBack"])}var X=P(V,[["render",w]]);export{X as default};
|
1
src/plugin/admin/public/assets/AccountModal.adc6b0ba.js
Normal file
1
src/plugin/admin/public/assets/AccountModal.adc6b0ba.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
var D=Object.defineProperty,M=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var g=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var B=(o,t,e)=>t in o?D(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,d=(o,t)=>{for(var e in t||(t={}))_.call(t,e)&&B(o,e,t[e]);if(g)for(var e of g(t))E.call(t,e)&&B(o,e,t[e]);return o},F=(o,t)=>M(o,P(t));var f=(o,t,e)=>new Promise((u,s)=>{var l=r=>{try{a(e.next(r))}catch(p){s(p)}},n=r=>{try{a(e.throw(r))}catch(p){s(p)}},a=r=>r.done?u(r.value):Promise.resolve(r.value).then(l,n);a((e=e.apply(o,t)).next())});import{B as k,a as I}from"./index.c05f9254.js";import{B as S}from"./BasicForm.d11b68fd.js";import{u as q}from"./useForm.868c8e81.js";import{i as y,b as R,a as L}from"./system.d37449cd.js";import{aP as $,a as N,r as b,k as m,f as T,aQ as h,o as U,aR as O,p as V,j,aU as x}from"./index.0d073eaa.js";import"./useWindowSizeFn.ef20ece8.js";import"./FullscreenOutlined.401a7bcd.js";/* empty css *//* empty css */import"./index.0fb15725.js";import"./index.965098be.js";import"./Checkbox.476f6e92.js";import"./index.1491cab6.js";import"./index.e317a008.js";import"./index.7075e2b7.js";import"./index.04f7e044.js";import"./index.e8daa066.js";import"./get.49a42f2e.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./index.2b5ea4f6.js";import"./_baseIteratee.3919e7cf.js";import"./DeleteOutlined.247d1f35.js";import"./index.a8c197b8.js";import"./useRefs.e81831e2.js";import"./Form.48352728.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./useSize.bb4e5ce5.js";import"./index.81899e8a.js";import"./index.ffb8ac7d.js";import"./index.dd1f987c.js";import"./uuid.2b29000c.js";import"./download.bb4c9304.js";import"./base64Conver.08b9f4ec.js";import"./index.31930d74.js";import"./index.1d29734e.js";import"./uniqBy.ac0f9c38.js";const G=[{field:"account",label:"\u7528\u6237\u540D",component:"Input",helpMessage:["\u672C\u5B57\u6BB5\u6F14\u793A\u5F02\u6B65\u9A8C\u8BC1","\u4E0D\u80FD\u8F93\u5165\u5E26\u6709admin\u7684\u7528\u6237\u540D"],rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u7528\u6237\u540D"},{validator(o,t){return new Promise((e,u)=>{y(t).then(()=>e()).catch(s=>{u(s.message||"\u9A8C\u8BC1\u5931\u8D25")})})}}]},{field:"pwd",label:"\u5BC6\u7801",component:"InputPassword",required:!0,ifShow:!1},{label:"\u89D2\u8272",field:"role",component:"ApiSelect",componentProps:{api:R,labelField:"roleName",valueField:"roleValue"},required:!0},{field:"dept",label:"\u6240\u5C5E\u90E8\u95E8",component:"TreeSelect",componentProps:{fieldNames:{label:"deptName",key:"id",value:"id"},getPopupContainer:()=>document.body},required:!0},{field:"nickname",label:"\u6635\u79F0",component:"Input",required:!0},{label:"\u90AE\u7BB1",field:"email",component:"Input",required:!0},{label:"\u5907\u6CE8",field:"remark",component:"InputTextArea"}],Q=N({name:"AccountModal",components:{BasicModal:k,BasicForm:S},emits:["success","register"],setup(o,{emit:t}){const e=b(!0),u=b(""),[s,{setFieldsValue:l,updateSchema:n,resetFields:a,validate:r}]=q({labelWidth:100,baseColProps:{span:24},schemas:G,showActionButtonGroup:!1,actionColOptions:{span:23}}),[p,{setModalProps:c,closeModal:C}]=I(i=>f(this,null,function*(){a(),c({confirmLoading:!1}),e.value=!!(i!=null&&i.isUpdate),m(e)&&(u.value=i.record.id,l(d({},i.record)));const A=yield L();n([{field:"pwd",show:!m(e)},{field:"dept",componentProps:{treeData:A}}])})),v=T(()=>m(e)?"\u7F16\u8F91\u8D26\u53F7":"\u65B0\u589E\u8D26\u53F7");function w(){return f(this,null,function*(){try{const i=yield r();c({confirmLoading:!0}),console.log(i),C(),t("success",{isUpdate:m(e),values:F(d({},i),{id:u.value})})}finally{c({confirmLoading:!1})}})}return{registerModal:p,registerForm:s,getTitle:v,handleSubmit:w}}});function W(o,t,e,u,s,l){const n=h("BasicForm"),a=h("BasicModal");return U(),O(a,x(o.$attrs,{onRegister:o.registerModal,title:o.getTitle,onOk:o.handleSubmit}),{default:V(()=>[j(n,{onRegister:o.registerForm},null,8,["onRegister"])]),_:1},16,["onRegister","title","onOk"])}var qe=$(Q,[["render",W]]);export{qe as default};
|
1
src/plugin/admin/public/assets/AccountModal.c863e28f.js
Normal file
1
src/plugin/admin/public/assets/AccountModal.c863e28f.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
var D=Object.defineProperty,_=Object.defineProperties;var v=Object.getOwnPropertyDescriptors;var F=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var B=(o,t,e)=>t in o?D(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,m=(o,t)=>{for(var e in t||(t={}))M.call(t,e)&&B(o,e,t[e]);if(F)for(var e of F(t))P.call(t,e)&&B(o,e,t[e]);return o},g=(o,t)=>_(o,v(t));var f=(o,t,e)=>new Promise((n,s)=>{var c=a=>{try{r(e.next(a))}catch(i){s(i)}},l=a=>{try{r(e.throw(a))}catch(i){s(i)}},r=a=>a.done?n(a.value):Promise.resolve(a.value).then(c,l);r((e=e.apply(o,t)).next())});import{B as E,a as k}from"./index.c05f9254.js";import{B as S}from"./BasicForm.d11b68fd.js";import{u as y}from"./useForm.868c8e81.js";import{i as x,b as q,a as R}from"./system.d37449cd.js";import{a as T,r as h,k as d,f as $,aP as L,aQ as b,o as O,aR as N,p as U,j,aU as V}from"./index.0d073eaa.js";const ee=[{title:"\u7528\u6237\u540D",dataIndex:"account",width:120},{title:"\u6635\u79F0",dataIndex:"nickname",width:120},{title:"\u90AE\u7BB1",dataIndex:"email",width:120},{title:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"createTime",width:180},{title:"\u89D2\u8272",dataIndex:"role",width:200},{title:"\u5907\u6CE8",dataIndex:"remark"}],oe=[{field:"account",label:"\u7528\u6237\u540D",component:"Input",colProps:{span:8}},{field:"nickname",label:"\u6635\u79F0",component:"Input",colProps:{span:8}}],z=[{field:"account",label:"\u7528\u6237\u540D",component:"Input",helpMessage:["\u672C\u5B57\u6BB5\u6F14\u793A\u5F02\u6B65\u9A8C\u8BC1","\u4E0D\u80FD\u8F93\u5165\u5E26\u6709admin\u7684\u7528\u6237\u540D"],rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u7528\u6237\u540D"},{validator(o,t){return new Promise((e,n)=>{x(t).then(()=>e()).catch(s=>{n(s.message||"\u9A8C\u8BC1\u5931\u8D25")})})}}]},{field:"pwd",label:"\u5BC6\u7801",component:"InputPassword",required:!0,ifShow:!1},{label:"\u89D2\u8272",field:"role",component:"ApiSelect",componentProps:{api:q,labelField:"roleName",valueField:"roleValue"},required:!0},{field:"dept",label:"\u6240\u5C5E\u90E8\u95E8",component:"TreeSelect",componentProps:{fieldNames:{label:"deptName",key:"id",value:"id"},getPopupContainer:()=>document.body},required:!0},{field:"nickname",label:"\u6635\u79F0",component:"Input",required:!0},{label:"\u90AE\u7BB1",field:"email",component:"Input",required:!0},{label:"\u5907\u6CE8",field:"remark",component:"InputTextArea"}],G=T({name:"AccountModal",components:{BasicModal:E,BasicForm:S},emits:["success","register"],setup(o,{emit:t}){const e=h(!0),n=h(""),[s,{setFieldsValue:c,updateSchema:l,resetFields:r,validate:a}]=y({labelWidth:100,baseColProps:{span:24},schemas:z,showActionButtonGroup:!1,actionColOptions:{span:23}}),[i,{setModalProps:p,closeModal:w}]=k(u=>f(this,null,function*(){r(),p({confirmLoading:!1}),e.value=!!(u!=null&&u.isUpdate),d(e)&&(n.value=u.record.id,c(m({},u.record)));const I=yield R();l([{field:"pwd",show:!d(e)},{field:"dept",componentProps:{treeData:I}}])})),A=$(()=>d(e)?"\u7F16\u8F91\u8D26\u53F7":"\u65B0\u589E\u8D26\u53F7");function C(){return f(this,null,function*(){try{const u=yield a();p({confirmLoading:!0}),console.log(u),w(),t("success",{isUpdate:d(e),values:g(m({},u),{id:n.value})})}finally{p({confirmLoading:!1})}})}return{registerModal:i,registerForm:s,getTitle:A,handleSubmit:C}}});function Q(o,t,e,n,s,c){const l=b("BasicForm"),r=b("BasicModal");return O(),N(r,V(o.$attrs,{onRegister:o.registerModal,title:o.getTitle,onOk:o.handleSubmit}),{default:U(()=>[j(l,{onRegister:o.registerForm},null,8,["onRegister"])]),_:1},16,["onRegister","title","onOk"])}var W=L(G,[["render",Q]]),te=Object.freeze(Object.defineProperty({__proto__:null,default:W},Symbol.toStringTag,{value:"Module"}));export{W as A,te as a,ee as c,oe as s};
|
1
src/plugin/admin/public/assets/Action.58034dbc.css
Normal file
1
src/plugin/admin/public/assets/Action.58034dbc.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
.scroll-wrap[data-v-0369ce10]{width:50%;height:300px;background-color:#fff}
|
1
src/plugin/admin/public/assets/Action.ed18cb0d.js
Normal file
1
src/plugin/admin/public/assets/Action.ed18cb0d.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{aP as f,a as E,bw as A,r as v,aQ as c,o as _,aR as C,p as s,i as a,j as l,h as k,aW as F,t as g,F as D,q as u,k as B}from"./index.0d073eaa.js";import{P as $}from"./index.566277e5.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useSize.bb4e5ce5.js";import"./eagerComputed.156e81ff.js";import"./useWindowSizeFn.ef20ece8.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";const w=E({components:{ScrollContainer:A,PageWrapper:$},setup(){const t=v(null),o=()=>{const r=B(t);if(!r)throw new Error("scroll is Null");return r};function i(r){o().scrollTo(r)}function p(){o().scrollBottom()}return{scrollTo:i,scrollRef:t,scrollBottom:p}}}),b={class:"my-4"},h=u(" \u6EDA\u52A8\u5230100px\u4F4D\u7F6E "),y=u(" \u6EDA\u52A8\u5230800px\u4F4D\u7F6E "),T=u(" \u6EDA\u52A8\u5230\u9876\u90E8 "),x=u(" \u6EDA\u52A8\u5230\u5E95\u90E8 "),P={class:"scroll-wrap"},S={class:"p-3"};function N(t,o,i,p,r,W){const n=c("a-button"),d=c("ScrollContainer"),m=c("PageWrapper");return _(),C(m,{title:"\u6EDA\u52A8\u7EC4\u4EF6\u51FD\u6570\u793A\u4F8B",content:"\u57FA\u4E8Eel-scrollbar"},{default:s(()=>[a("div",b,[l(n,{onClick:o[0]||(o[0]=e=>t.scrollTo(100)),class:"mr-2"},{default:s(()=>[h]),_:1}),l(n,{onClick:o[1]||(o[1]=e=>t.scrollTo(800)),class:"mr-2"},{default:s(()=>[y]),_:1}),l(n,{onClick:o[2]||(o[2]=e=>t.scrollTo(0)),class:"mr-2"},{default:s(()=>[T]),_:1}),l(n,{onClick:o[3]||(o[3]=e=>t.scrollBottom()),class:"mr-2"},{default:s(()=>[x]),_:1})]),a("div",P,[l(d,{class:"mt-4",ref:"scrollRef"},{default:s(()=>[a("ul",S,[(_(),k(D,null,F(100,e=>a("li",{key:e,class:"p-2",style:{border:"1px solid #eee"}},g(e),1)),64))])]),_:1},512)])]),_:1})}var K=f(w,[["render",N],["__scopeId","data-v-0369ce10"]]);export{K as default};
|
1
src/plugin/admin/public/assets/ActionTree.01124ff1.js
Normal file
1
src/plugin/admin/public/assets/ActionTree.01124ff1.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{_ as N}from"./index.9d5559d9.js";import{t as S}from"./data.ec134722.js";import{aP as v,a as A,r as F,aQ as c,o as K,aR as g,p as u,i as p,j as o,q as l,x as $,k as G}from"./index.0d073eaa.js";import{P as T}from"./index.566277e5.js";import"./fromPairs.84aabb58.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./useContextMenu.cd4142a5.js";import"./index.0fb15725.js";import"./get.49a42f2e.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useSize.bb4e5ce5.js";import"./useWindowSizeFn.ef20ece8.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";const b=A({components:{BasicTree:N,PageWrapper:T},setup(){const n=F(null),{createMessage:e}=$();function a(){const t=G(n);if(!t)throw new Error("tree is null!");return t}function f(t){a().filterByLevel(t)}function m(){a().setCheckedKeys(["0-0"])}function k(){const t=a().getCheckedKeys();e.success(JSON.stringify(t))}function s(){a().setSelectedKeys(["0-0"])}function i(){const t=a().getSelectedKeys();e.success(JSON.stringify(t))}function r(){const t=a().getSelectedKeys(),C=a().getSelectedNode(t[0]);e.success(C!==null?JSON.stringify(C):null)}function d(){a().setExpandedKeys(["0-0"])}function B(){const t=a().getExpandedKeys();e.success(JSON.stringify(t))}function _(t){a().checkAll(t)}function y(t){a().expandAll(t)}function h(t=null){a().insertNodeByKey({parentKey:t,node:{title:"\u65B0\u589E\u8282\u70B9",key:"2-2-2"},push:"push"})}function E(t){a().deleteNodeByKey(t)}function D(t){a().updateNodeByKey(t,{title:"parent2-new"})}return{treeData:S,treeRef:n,handleLevel:f,handleSetCheckData:m,handleGetCheckData:k,handleSetSelectData:s,handleGetSelectData:i,handleSetExpandData:d,handleGetExpandData:B,handleGetSelectNode:r,appendNodeByKey:h,deleteNodeByKey:E,updateNodeByKey:D,checkAll:_,expandAll:y}}}),P={class:"mb-4"},w=l(" \u5C55\u5F00\u5168\u90E8 "),J=l(" \u6298\u53E0\u5168\u90E8 "),L=l(" \u5168\u9009 "),O=l(" \u5168\u4E0D\u9009 "),R=l(" \u663E\u793A\u5230\u7B2C2\u7EA7 "),V=l(" \u663E\u793A\u5230\u7B2C1\u7EA7 "),W={class:"mb-4"},M=l(" \u8BBE\u7F6E\u52FE\u9009\u6570\u636E "),j=l(" \u83B7\u53D6\u52FE\u9009\u6570\u636E "),q=l(" \u8BBE\u7F6E\u9009\u4E2D\u6570\u636E "),Q=l(" \u83B7\u53D6\u9009\u4E2D\u6570\u636E "),z=l(" \u83B7\u53D6\u9009\u4E2D\u8282\u70B9 "),H=l(" \u8BBE\u7F6E\u5C55\u5F00\u6570\u636E "),I=l(" \u83B7\u53D6\u5C55\u5F00\u6570\u636E "),U={class:"mb-4"},X=l(" \u6DFB\u52A0\u6839\u8282\u70B9 "),Y=l(" \u6DFB\u52A0\u5728parent3\u5185\u6DFB\u52A0\u8282\u70B9 "),Z=l(" \u5220\u9664parent3\u8282\u70B9 "),x=l(" \u66F4\u65B0parent2\u8282\u70B9 ");function ee(n,e,a,f,m,k){const s=c("a-button"),i=c("BasicTree"),r=c("PageWrapper");return K(),g(r,{title:"Tree\u51FD\u6570\u64CD\u4F5C\u793A\u4F8B",contentBackground:"",contentClass:"p-4"},{default:u(()=>[p("div",P,[o(s,{onClick:e[0]||(e[0]=d=>n.expandAll(!0)),class:"mr-2"},{default:u(()=>[w]),_:1}),o(s,{onClick:e[1]||(e[1]=d=>n.expandAll(!1)),class:"mr-2"},{default:u(()=>[J]),_:1}),o(s,{onClick:e[2]||(e[2]=d=>n.checkAll(!0)),class:"mr-2"},{default:u(()=>[L]),_:1}),o(s,{onClick:e[3]||(e[3]=d=>n.checkAll(!1)),class:"mr-2"},{default:u(()=>[O]),_:1}),o(s,{onClick:e[4]||(e[4]=d=>n.handleLevel(2)),class:"mr-2"},{default:u(()=>[R]),_:1}),o(s,{onClick:e[5]||(e[5]=d=>n.handleLevel(1)),class:"mr-2"},{default:u(()=>[V]),_:1})]),p("div",W,[o(s,{onClick:n.handleSetCheckData,class:"mr-2"},{default:u(()=>[M]),_:1},8,["onClick"]),o(s,{onClick:n.handleGetCheckData,class:"mr-2"},{default:u(()=>[j]),_:1},8,["onClick"]),o(s,{onClick:n.handleSetSelectData,class:"mr-2"},{default:u(()=>[q]),_:1},8,["onClick"]),o(s,{onClick:n.handleGetSelectData,class:"mr-2"},{default:u(()=>[Q]),_:1},8,["onClick"]),o(s,{onClick:n.handleGetSelectNode,class:"mr-2"},{default:u(()=>[z]),_:1},8,["onClick"]),o(s,{onClick:n.handleSetExpandData,class:"mr-2"},{default:u(()=>[H]),_:1},8,["onClick"]),o(s,{onClick:n.handleGetExpandData,class:"mr-2"},{default:u(()=>[I]),_:1},8,["onClick"])]),p("div",U,[o(s,{onClick:e[6]||(e[6]=d=>n.appendNodeByKey(null)),class:"mr-2"},{default:u(()=>[X]),_:1}),o(s,{onClick:e[7]||(e[7]=d=>n.appendNodeByKey("2-2")),class:"mr-2"},{default:u(()=>[Y]),_:1}),o(s,{onClick:e[8]||(e[8]=d=>n.deleteNodeByKey("2-2")),class:"mr-2"},{default:u(()=>[Z]),_:1}),o(s,{onClick:e[9]||(e[9]=d=>n.updateNodeByKey("1-1")),class:"mr-2"},{default:u(()=>[x]),_:1})]),o(i,{treeData:n.treeData,title:"\u51FD\u6570\u64CD\u4F5C",ref:"treeRef",checkable:!0},null,8,["treeData"])]),_:1})}var ye=v(b,[["render",ee]]);export{ye as default};
|
1
src/plugin/admin/public/assets/AdvancedForm.eac21c97.js
Normal file
1
src/plugin/admin/public/assets/AdvancedForm.eac21c97.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{B as c}from"./BasicForm.d11b68fd.js";import{u as a}from"./useForm.868c8e81.js";import{aP as B,a as d,cB as f,aQ as r,o as P,aR as b,p as n,j as t}from"./index.0d073eaa.js";import{P as h}from"./index.566277e5.js";/* empty css *//* empty css */import"./index.0fb15725.js";import"./index.965098be.js";import"./Checkbox.476f6e92.js";import"./index.1491cab6.js";import"./index.e317a008.js";import"./index.7075e2b7.js";import"./index.04f7e044.js";import"./index.e8daa066.js";import"./get.49a42f2e.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./index.2b5ea4f6.js";import"./_baseIteratee.3919e7cf.js";import"./DeleteOutlined.247d1f35.js";import"./index.a8c197b8.js";import"./useRefs.e81831e2.js";import"./Form.48352728.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./useSize.bb4e5ce5.js";import"./index.81899e8a.js";import"./index.c05f9254.js";import"./useWindowSizeFn.ef20ece8.js";import"./FullscreenOutlined.401a7bcd.js";import"./index.ffb8ac7d.js";import"./index.dd1f987c.js";import"./uuid.2b29000c.js";import"./download.bb4c9304.js";import"./base64Conver.08b9f4ec.js";import"./index.31930d74.js";import"./index.1d29734e.js";import"./uniqBy.ac0f9c38.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";const s=()=>[{field:"field1",component:"Input",label:"\u5B57\u6BB51",colProps:{span:8},componentProps:{placeholder:"\u81EA\u5B9A\u4E49placeholder",onChange:o=>{console.log(o)}}},{field:"field2",component:"Input",label:"\u5B57\u6BB52",colProps:{span:8}},{field:"field3",component:"DatePicker",label:"\u5B57\u6BB53",colProps:{span:8}},{field:"field4",component:"Select",label:"\u5B57\u6BB54",colProps:{span:8},componentProps:{options:[{label:"\u9009\u98791",value:"1",key:"1"},{label:"\u9009\u98792",value:"2",key:"2"}]}},{field:"field5",component:"CheckboxGroup",label:"\u5B57\u6BB55",colProps:{span:8},componentProps:{options:[{label:"\u9009\u98791",value:"1"},{label:"\u9009\u98792",value:"2"}]}}];function C(){return[{field:"field10",component:"Input",label:"\u5B57\u6BB510",colProps:{span:8}},{field:"field11",component:"Input",label:"\u5B57\u6BB511",colProps:{span:8}},{field:"field12",component:"Input",label:"\u5B57\u6BB512",colProps:{span:8}},{field:"field13",component:"Input",label:"\u5B57\u6BB513",colProps:{span:8}}]}const F=d({components:{BasicForm:c,CollapseContainer:f,PageWrapper:h},setup(){const[o]=a({labelWidth:120,schemas:s(),actionColOptions:{span:24},compact:!0,showAdvancedButton:!0}),p=[];for(let e=14;e<30;e++)p.push({field:"field"+e,component:"Input",label:"\u5B57\u6BB5"+e,colProps:{span:8}});const[i]=a({labelWidth:120,schemas:[...s(),...C(),{field:"",component:"Divider",label:"\u66F4\u591A\u5B57\u6BB5"},...p],actionColOptions:{span:24},compact:!0,showAdvancedButton:!0,alwaysShowLines:2});return{register:o,register1:i}}});function g(o,p,i,e,_,A){const l=r("BasicForm"),u=r("CollapseContainer"),m=r("PageWrapper");return P(),b(m,{title:"\u53EF\u6298\u53E0\u8868\u5355\u793A\u4F8B"},{default:n(()=>[t(u,{title:"\u57FA\u7840\u6536\u7F29\u793A\u4F8B"},{default:n(()=>[t(l,{onRegister:o.register},null,8,["onRegister"])]),_:1}),t(u,{title:"\u8D85\u8FC73\u884C\u81EA\u52A8\u6536\u8D77\uFF0C\u6298\u53E0\u65F6\u4FDD\u75592\u884C",class:"mt-4"},{default:n(()=>[t(l,{onRegister:o.register1},null,8,["onRegister"])]),_:1})]),_:1})}var fo=B(F,[["render",g]]);export{fo as default};
|
1
src/plugin/admin/public/assets/AppendForm.67808ec8.js
Normal file
1
src/plugin/admin/public/assets/AppendForm.67808ec8.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
var B=(e,a,r)=>new Promise((l,i)=>{var t=o=>{try{p(r.next(o))}catch(m){i(m)}},n=o=>{try{p(r.throw(o))}catch(m){i(m)}},p=o=>o.done?l(o.value):Promise.resolve(o.value).then(t,n);p((r=r.apply(e,a)).next())});import{B as h}from"./BasicForm.d11b68fd.js";import{u as P}from"./useForm.868c8e81.js";import{aP as $,a as g,cB as k,I as _,dw as F,r as I,aQ as u,o as d,aR as f,p as s,j as b,aS as C,q as v}from"./index.0d073eaa.js";import{P as S}from"./index.566277e5.js";/* empty css *//* empty css */import"./index.0fb15725.js";import"./index.965098be.js";import"./Checkbox.476f6e92.js";import"./index.1491cab6.js";import"./index.e317a008.js";import"./index.7075e2b7.js";import"./index.04f7e044.js";import"./index.e8daa066.js";import"./get.49a42f2e.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./index.2b5ea4f6.js";import"./_baseIteratee.3919e7cf.js";import"./DeleteOutlined.247d1f35.js";import"./index.a8c197b8.js";import"./useRefs.e81831e2.js";import"./Form.48352728.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./useSize.bb4e5ce5.js";import"./index.81899e8a.js";import"./index.c05f9254.js";import"./useWindowSizeFn.ef20ece8.js";import"./FullscreenOutlined.401a7bcd.js";import"./index.ffb8ac7d.js";import"./index.dd1f987c.js";import"./uuid.2b29000c.js";import"./download.bb4c9304.js";import"./base64Conver.08b9f4ec.js";import"./index.31930d74.js";import"./index.1d29734e.js";import"./uniqBy.ac0f9c38.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";const y=g({components:{BasicForm:h,CollapseContainer:k,PageWrapper:S,[_.name]:_,Button:F},setup(){const[e,{appendSchemaByField:a,removeSchemaByFiled:r,validate:l}]=P({schemas:[{field:"field0a",component:"Input",label:"\u5B57\u6BB50",colProps:{span:8},required:!0},{field:"field0b",component:"Input",label:"\u5B57\u6BB50",colProps:{span:8},required:!0},{field:"0",component:"Input",label:" ",colProps:{span:8},slot:"add"}],labelWidth:100,actionColOptions:{span:24}});function i(){return B(this,null,function*(){try{const o=yield l();console.log(o)}catch(o){console.log(o)}})}const t=I(1);function n(){a({field:`field${t.value}a`,component:"Input",label:"\u5B57\u6BB5"+t.value,colProps:{span:8},required:!0},""),a({field:`field${t.value}b`,component:"Input",label:"\u5B57\u6BB5"+t.value,colProps:{span:8},required:!0},""),a({field:`${t.value}`,component:"Input",label:" ",colProps:{span:8},slot:"add"},""),t.value++}function p(o){r([`field${o}a`,`field${o}b`,`${o}`]),t.value--}return{register:e,handleSubmit:i,add:n,del:p}}}),q=v("+"),N=v("-");function W(e,a,r,l,i,t){const n=u("Button"),p=u("BasicForm"),o=u("CollapseContainer"),m=u("PageWrapper");return d(),f(m,{title:"\u8868\u5355\u589E\u5220\u793A\u4F8B"},{default:s(()=>[b(o,{title:"\u8868\u5355\u589E\u5220"},{default:s(()=>[b(p,{onRegister:e.register,onSubmit:e.handleSubmit},{add:s(({field:c})=>[Number(c)===0?(d(),f(n,{key:0,onClick:e.add},{default:s(()=>[q]),_:1},8,["onClick"])):C("",!0),c>0?(d(),f(n,{key:1,onClick:w=>e.del(c)},{default:s(()=>[N]),_:2},1032,["onClick"])):C("",!0)]),_:1},8,["onRegister","onSubmit"])]),_:1})]),_:1})}var Fo=$(y,[["render",W]]);export{Fo as default};
|
1
src/plugin/admin/public/assets/Application.d237f809.css
Normal file
1
src/plugin/admin/public/assets/Application.d237f809.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
.account-center-application__card{width:100%;margin-bottom:-12px}.account-center-application__card .ant-card-body{padding:16px}.account-center-application__card-title{margin-bottom:5px;font-size:16px;font-weight:500}.account-center-application__card-title .icon{margin-top:-5px;font-size:22px}.account-center-application__card-num{margin-left:24px;line-height:36px;color:#00000073}.account-center-application__card-num span{margin-left:5px;font-size:18px}.account-center-application__card-download{float:right;font-size:20px!important;color:#0960bd}
|
1
src/plugin/admin/public/assets/Application.f09f952f.js
Normal file
1
src/plugin/admin/public/assets/Application.f09f952f.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{a as v,aO as L,aP as $,aQ as a,o as e,aR as s,p as c,j as l,h as y,aW as I,F as k,n,i as r,aS as d,q as i,t as p}from"./index.0d073eaa.js";import{L as u}from"./index.f1c035de.js";/* empty css */import{C as B}from"./index.abdcab42.js";import"./index.78efd931.js";import{applicationList as F}from"./data.53a0f0fb.js";import{R as m,C as f}from"./index.1d29734e.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./eagerComputed.156e81ff.js";import"./index.aa6b7013.js";import"./useRefs.e81831e2.js";import"./PlusOutlined.64d8e001.js";const b=v({components:{List:u,ListItem:u.Item,Card:B,Icon:L,[m.name]:m,[f.name]:f},setup(){return{prefixCls:"account-center-application",list:F}}}),z=i(" \u6D3B\u8DC3\u7528\u6237\uFF1A"),A=i(" \u4E07 "),N=i(" \u65B0\u589E\u7528\u6237\uFF1A");function V(t,D,E,R,S,j){const _=a("Icon"),C=a("Card"),x=a("ListItem"),g=a("a-col"),h=a("a-row"),w=a("List");return e(),s(w,{class:n(t.prefixCls)},{default:c(()=>[l(h,{gutter:16},{default:c(()=>[(e(!0),y(k,null,I(t.list,o=>(e(),s(g,{key:o.title,span:6},{default:c(()=>[l(x,null,{default:c(()=>[l(C,{hoverable:!0,class:n(`${t.prefixCls}__card`)},{default:c(()=>[r("div",{class:n(`${t.prefixCls}__card-title`)},[o.icon?(e(),s(_,{key:0,class:"icon",icon:o.icon,color:o.color},null,8,["icon","color"])):d("",!0),i(" "+p(o.title),1)],2),r("div",{class:n(`${t.prefixCls}__card-num`)},[z,r("span",null,p(o.active),1),A],2),r("div",{class:n(`${t.prefixCls}__card-num`)},[N,r("span",null,p(o.new),1)],2),o.download?(e(),s(_,{key:0,class:n(`${t.prefixCls}__card-download`),icon:o.download},null,8,["class","icon"])):d("",!0)]),_:2},1032,["class"])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1},8,["class"])}var Y=$(b,[["render",V]]);export{Y as default};
|
1
src/plugin/admin/public/assets/ArrayExport.7e65f2ed.js
Normal file
1
src/plugin/admin/public/assets/ArrayExport.7e65f2ed.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{B as e}from"./TableImg.2aabef6a.js";import"./BasicForm.d11b68fd.js";import"./index.98e89309.js";import{c as u,d as n,a as s,b as c,e as l}from"./data.1c1e104e.js";import{P as d}from"./index.566277e5.js";import{aP as _,a as F,aQ as t,o as C,aR as f,p as r,j as p,q as B}from"./index.0d073eaa.js";import"./index.965098be.js";import"./Checkbox.476f6e92.js";import"./index.1491cab6.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./useForm.868c8e81.js";import"./index.7075e2b7.js";import"./index.04f7e044.js";import"./index.e317a008.js";import"./uuid.2b29000c.js";import"./index.2b5ea4f6.js";import"./_baseIteratee.3919e7cf.js";import"./get.49a42f2e.js";import"./DeleteOutlined.247d1f35.js";import"./index.a8c197b8.js";import"./useRefs.e81831e2.js";import"./Form.48352728.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./useSize.bb4e5ce5.js";import"./useWindowSizeFn.ef20ece8.js";import"./index.c05f9254.js";import"./FullscreenOutlined.401a7bcd.js";import"./index.0fb15725.js";import"./sortable.esm.2632adaa.js";import"./RedoOutlined.32117fb5.js";import"./index.dd1f987c.js";import"./fromPairs.84aabb58.js";import"./scrollTo.f8a2fd00.js";import"./index.2ed1a060.js";/* empty css *//* empty css */import"./index.e8daa066.js";import"./index.81899e8a.js";import"./index.ffb8ac7d.js";import"./download.bb4c9304.js";import"./base64Conver.08b9f4ec.js";import"./index.31930d74.js";import"./index.1d29734e.js";import"./uniqBy.ac0f9c38.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";const x=F({components:{BasicTable:e,PageWrapper:d},setup(){function o(){s({data:c,header:l,filename:"\u4E8C\u7EF4\u6570\u7EC4\u65B9\u5F0F\u5BFC\u51FAexcel.xlsx"})}return{aoaToExcel:o,columns:u,data:n}}}),E=B(" \u5BFC\u51FA ");function b(o,A,T,h,P,k){const a=t("a-button"),m=t("BasicTable"),i=t("PageWrapper");return C(),f(i,{title:"\u5BFC\u51FA\u793A\u4F8B",content:"\u6839\u636E\u6570\u7EC4\u683C\u5F0F\u7684\u6570\u636E\u8FDB\u884C\u5BFC\u51FA"},{default:r(()=>[p(m,{title:"\u57FA\u7840\u8868\u683C",columns:o.columns,dataSource:o.data},{toolbar:r(()=>[p(a,{onClick:o.aoaToExcel},{default:r(()=>[E]),_:1},8,["onClick"])]),_:1},8,["columns","dataSource"])]),_:1})}var ko=_(x,[["render",b]]);export{ko as default};
|
@ -0,0 +1 @@
|
|||||||
|
import{j as i,aG as l}from"./index.0d073eaa.js";var f={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"},u=f;function c(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(e);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(e).filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.forEach(function(a){d(r,a,e[a])})}return r}function d(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}var o=function(t,e){var n=c({},t,e.attrs);return i(l,c({},n,{icon:u}),null)};o.displayName="ArrowLeftOutlined";o.inheritAttrs=!1;var O=o;export{O as A};
|
1
src/plugin/admin/public/assets/Article.02f26a47.js
Normal file
1
src/plugin/admin/public/assets/Article.02f26a47.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{a as I,aO as L,aP as h,aQ as c,o as a,aR as l,p as r,h as p,aW as _,F as d,n as o,j as y,i as s,t as i,q as u,aS as $}from"./index.0d073eaa.js";import{L as m}from"./index.f1c035de.js";/* empty css */import{T as k}from"./index.e317a008.js";import{articleList as b,actions as T}from"./data.53a0f0fb.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./eagerComputed.156e81ff.js";const B=I({components:{List:m,ListItem:m.Item,ListItemMeta:m.Item.Meta,Tag:k,Icon:L},setup(){return{prefixCls:"account-center-article",list:b,actions:T}}});function M(t,N,V,z,A,F){const f=c("Tag"),v=c("ListItemMeta"),x=c("Icon"),g=c("ListItem"),C=c("List");return a(),l(C,{"item-layout":"vertical",class:o(t.prefixCls)},{default:r(()=>[(a(!0),p(d,null,_(t.list,n=>(a(),l(g,{key:n.title},{default:r(()=>[y(v,null,{description:r(()=>[s("div",{class:o(`${t.prefixCls}__content`)},i(n.content),3)]),title:r(()=>[s("p",{class:o(`${t.prefixCls}__title`)},i(n.title),3),s("div",null,[(a(!0),p(d,null,_(n.description,e=>(a(),l(f,{key:e,class:"mb-2"},{default:r(()=>[u(i(e),1)]),_:2},1024))),128))])]),_:2},1024),s("div",null,[(a(!0),p(d,null,_(t.actions,e=>(a(),p("div",{key:e.text,class:o(`${t.prefixCls}__action`)},[e.icon?(a(),l(x,{key:0,class:o(`${t.prefixCls}__action-icon`),icon:e.icon,color:e.color},null,8,["class","icon","color"])):$("",!0),u(" "+i(e.text),1)],2))),128)),s("span",{class:o(`${t.prefixCls}__time`)},i(n.time),3)])]),_:2},1024))),128))]),_:1},8,["class"])}var Q=h(B,[["render",M],["__scopeId","data-v-67062fde"]]);export{Q as default};
|
1
src/plugin/admin/public/assets/Article.bf5ad322.css
Normal file
1
src/plugin/admin/public/assets/Article.bf5ad322.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
.account-center-article__title[data-v-67062fde]{margin-bottom:12px;font-size:18px}.account-center-article__content[data-v-67062fde]{color:#000000a6}.account-center-article__action[data-v-67062fde]{display:inline-block;padding:0 16px;color:#00000073}.account-center-article__action[data-v-67062fde]:nth-child(1),.account-center-article__action[data-v-67062fde]:nth-child(2){border-right:1px solid rgba(206,206,206,.4)}.account-center-article__action-icon[data-v-67062fde]{margin-right:3px}.account-center-article__time[data-v-67062fde]{position:absolute;right:20px;color:#00000073}
|
1
src/plugin/admin/public/assets/AuthColumn.d3f7e8ee.js
Normal file
1
src/plugin/admin/public/assets/AuthColumn.d3f7e8ee.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{B as l}from"./TableImg.2aabef6a.js";import{j as s}from"./BasicForm.d11b68fd.js";import{u as d}from"./useTable.13a8b0ff.js";import{d as c}from"./table.5cb529f7.js";import{aP as F,a as h,aQ as r,o as b,h as f,j as a,p as A}from"./index.0d073eaa.js";import"./index.965098be.js";import"./Checkbox.476f6e92.js";import"./index.1491cab6.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./useForm.868c8e81.js";import"./index.566277e5.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useSize.bb4e5ce5.js";import"./useWindowSizeFn.ef20ece8.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";import"./index.7075e2b7.js";import"./index.04f7e044.js";import"./index.e317a008.js";import"./uuid.2b29000c.js";import"./index.2b5ea4f6.js";import"./_baseIteratee.3919e7cf.js";import"./get.49a42f2e.js";import"./DeleteOutlined.247d1f35.js";import"./index.a8c197b8.js";import"./useRefs.e81831e2.js";import"./Form.48352728.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./index.c05f9254.js";import"./FullscreenOutlined.401a7bcd.js";import"./index.0fb15725.js";import"./sortable.esm.2632adaa.js";import"./RedoOutlined.32117fb5.js";import"./index.dd1f987c.js";import"./fromPairs.84aabb58.js";import"./scrollTo.f8a2fd00.js";import"./index.2ed1a060.js";/* empty css *//* empty css */import"./index.e8daa066.js";import"./index.81899e8a.js";import"./index.ffb8ac7d.js";import"./download.bb4c9304.js";import"./base64Conver.08b9f4ec.js";import"./index.31930d74.js";import"./index.1d29734e.js";import"./uniqBy.ac0f9c38.js";const B=[{title:"\u7F16\u53F7",dataIndex:"no",width:100},{title:"\u59D3\u540D",dataIndex:"name",auth:"test"},{title:"\u72B6\u6001",dataIndex:"status"},{title:"\u5730\u5740",dataIndex:"address",auth:"super",ifShow:t=>!0},{title:"\u5F00\u59CB\u65F6\u95F4",dataIndex:"beginTime"},{title:"\u7ED3\u675F\u65F6\u95F4",dataIndex:"endTime",width:200}],C=h({components:{BasicTable:l,TableAction:s},setup(){const[t]=d({title:"TableAction\u7EC4\u4EF6\u53CA\u56FA\u5B9A\u5217\u793A\u4F8B",api:c,columns:B,bordered:!0,actionColumn:{width:250,title:"Action",dataIndex:"action",slots:{customRender:"action"}}});function e(i){console.log("\u70B9\u51FB\u4E86\u7F16\u8F91",i)}function u(i){console.log("\u70B9\u51FB\u4E86\u5220\u9664",i)}function n(i){console.log("\u70B9\u51FB\u4E86\u542F\u7528",i)}return{registerTable:t,handleEdit:e,handleDelete:u,handleOpen:n}}}),T={class:"p-4"};function _(t,e,u,n,i,w){const p=r("TableAction"),m=r("BasicTable");return b(),f("div",T,[a(m,{onRegister:t.registerTable},{action:A(({record:o})=>[a(p,{actions:[{label:"\u7F16\u8F91",onClick:t.handleEdit.bind(null,o),auth:"other"},{label:"\u5220\u9664",icon:"ic:outline-delete-outline",onClick:t.handleDelete.bind(null,o),auth:"super"}],dropDownActions:[{label:"\u542F\u7528",popConfirm:{title:"\u662F\u5426\u542F\u7528\uFF1F",confirm:t.handleOpen.bind(null,o)},ifShow:E=>o.status!=="enable"},{label:"\u7981\u7528",popConfirm:{title:"\u662F\u5426\u7981\u7528\uFF1F",confirm:t.handleOpen.bind(null,o)},ifShow:()=>o.status==="enable"},{label:"\u540C\u65F6\u63A7\u5236",popConfirm:{title:"\u662F\u5426\u52A8\u6001\u663E\u793A\uFF1F",confirm:t.handleOpen.bind(null,o)},auth:"super",ifShow:()=>!0}]},null,8,["actions","dropDownActions"])]),_:1},8,["onRegister"])])}var wt=F(C,[["render",_]]);export{wt as default};
|
1
src/plugin/admin/public/assets/AuthPageA.3142217e.css
Normal file
1
src/plugin/admin/public/assets/AuthPageA.3142217e.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
.auth-page[data-v-94210940]{display:flex;height:300px;font-size:24px;color:#fff;background-color:#409efe;border-radius:12px;justify-content:center;align-items:center}
|
1
src/plugin/admin/public/assets/AuthPageA.923d76c1.js
Normal file
1
src/plugin/admin/public/assets/AuthPageA.923d76c1.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{aP as e,a as t,o as a,h as o}from"./index.0d073eaa.js";const n=t({}),r={class:"m-10 auth-page"};function s(c,_,p,u,d,i){return a(),o("div",r,"Super \u89D2\u8272\u53EF\u89C1")}var l=e(n,[["render",s],["__scopeId","data-v-94210940"]]);export{l as default};
|
1
src/plugin/admin/public/assets/AuthPageB.2e76b2e3.js
Normal file
1
src/plugin/admin/public/assets/AuthPageB.2e76b2e3.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{aP as e,a as t,o as a,h as o}from"./index.0d073eaa.js";const s=t({}),n={class:"m-10 auth-page"};function c(r,_,d,p,u,i){return a(),o("div",n,"Test \u89D2\u8272\u53EF\u89C1")}var l=e(s,[["render",c],["__scopeId","data-v-6dbc4a90"]]);export{l as default};
|
1
src/plugin/admin/public/assets/AuthPageB.8ad6d38e.css
Normal file
1
src/plugin/admin/public/assets/AuthPageB.8ad6d38e.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
.auth-page[data-v-6dbc4a90]{display:flex;height:300px;font-size:24px;color:#fff;background-color:#409efe;border-radius:12px;justify-content:center;align-items:center}
|
1
src/plugin/admin/public/assets/Baidu.1796ebc1.js
Normal file
1
src/plugin/admin/public/assets/Baidu.1796ebc1.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
var u=(e,s,t)=>new Promise((o,n)=>{var r=a=>{try{p(t.next(a))}catch(c){n(c)}},i=a=>{try{p(t.throw(a))}catch(c){n(c)}},p=a=>a.done?o(a.value):Promise.resolve(a.value).then(r,i);p((t=t.apply(e,s)).next())});import{u as l}from"./useScript.77b2b9d3.js";import{aP as d,a as f,r as m,H as h,o as w,h as B,bc as _,af as M,k as g}from"./index.0d073eaa.js";const v="https://api.map.baidu.com/getscript?v=3.0&ak=OaBvYmKX3pjF7YFUFeeBCeGdy9Zp7xB2&services=&t=20210201100830&s=1",y=f({name:"BaiduMap",props:{width:{type:String,default:"100%"},height:{type:String,default:"calc(100vh - 78px)"}},setup(){const e=m(null),{toPromise:s}=l({src:v});function t(){return u(this,null,function*(){yield s(),yield M();const o=g(e);if(!o)return;const n=window.BMap,r=new n.Map(o),i=new n.Point(116.404,39.915);r.centerAndZoom(i,15),r.enableScrollWheelZoom(!0)})}return h(()=>{t()}),{wrapRef:e}}});function k(e,s,t,o,n,r){return w(),B("div",{ref:"wrapRef",style:_({height:e.height,width:e.width})},null,4)}var $=d(y,[["render",k]]);export{$ as default};
|
1
src/plugin/admin/public/assets/BaseSetting.04e842fb.css
Normal file
1
src/plugin/admin/public/assets/BaseSetting.04e842fb.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
.change-avatar img[data-v-249137cb]{display:block;margin-bottom:15px;border-radius:50%}
|
1
src/plugin/admin/public/assets/BaseSetting.0d83702d.js
Normal file
1
src/plugin/admin/public/assets/BaseSetting.0d83702d.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
var d=(o,s,r)=>new Promise((c,i)=>{var l=e=>{try{a(r.next(e))}catch(m){i(m)}},t=e=>{try{a(r.throw(e))}catch(m){i(m)}},a=e=>e.done?c(e.value):Promise.resolve(e.value).then(l,t);a((r=r.apply(o,s)).next())});import{a as C,cB as g,B as h,l as B,H as F,f as b,aP as A,x as I,aQ as p,o as S,aR as w,p as u,j as n,i as _,fa as y,fb as R,q as k}from"./index.0d073eaa.js";/* empty css */import{B as x}from"./BasicForm.d11b68fd.js";import{u as E}from"./useForm.868c8e81.js";import{a as U}from"./index.f4f1f088.js";import{h as V}from"./header.d801b988.js";import{a as $}from"./account.0cff3e42.js";import{b as M}from"./data.08d7c751.js";import{u as N}from"./upload.1645cad7.js";import{R as P,C as T}from"./index.1d29734e.js";/* empty css */import"./index.0fb15725.js";import"./index.965098be.js";import"./Checkbox.476f6e92.js";import"./index.1491cab6.js";import"./index.e317a008.js";import"./index.7075e2b7.js";import"./index.04f7e044.js";import"./index.e8daa066.js";import"./get.49a42f2e.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./index.2b5ea4f6.js";import"./_baseIteratee.3919e7cf.js";import"./DeleteOutlined.247d1f35.js";import"./index.a8c197b8.js";import"./useRefs.e81831e2.js";import"./Form.48352728.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./useSize.bb4e5ce5.js";import"./index.81899e8a.js";import"./index.c05f9254.js";import"./useWindowSizeFn.ef20ece8.js";import"./FullscreenOutlined.401a7bcd.js";import"./index.ffb8ac7d.js";import"./index.dd1f987c.js";import"./uuid.2b29000c.js";import"./download.bb4c9304.js";import"./base64Conver.08b9f4ec.js";import"./index.31930d74.js";import"./uniqBy.ac0f9c38.js";import"./index.0972fd96.js";import"./index.8680e4c4.js";const j=C({components:{BasicForm:x,CollapseContainer:g,Button:h,ARow:P,ACol:T,CropperAvatar:U},setup(){const{createMessage:o}=I(),s=B(),[r,{setFieldsValue:c}]=E({labelWidth:120,schemas:M,showActionButtonGroup:!1});F(()=>d(this,null,function*(){const t=yield $();c(t)}));const i=b(()=>{const{avatar:t}=s.getUserInfo;return t||V});function l(t){const a=s.getUserInfo;a.avatar=t,s.setUserInfo(a)}return{avatar:i,register:r,uploadApi:N,updateAvatar:l,handleSubmit:()=>{o.success("\u66F4\u65B0\u6210\u529F\uFF01")}}}}),q=o=>(y("data-v-249137cb"),o=o(),R(),o),G={class:"change-avatar"},H=q(()=>_("div",{class:"mb-2"},"\u5934\u50CF",-1)),Q=k(" \u66F4\u65B0\u57FA\u672C\u4FE1\u606F ");function W(o,s,r,c,i,l){const t=p("BasicForm"),a=p("a-col"),e=p("CropperAvatar"),m=p("a-row"),f=p("Button"),v=p("CollapseContainer");return S(),w(v,{title:"\u57FA\u672C\u8BBE\u7F6E",canExpan:!1},{default:u(()=>[n(m,{gutter:24},{default:u(()=>[n(a,{span:14},{default:u(()=>[n(t,{onRegister:o.register},null,8,["onRegister"])]),_:1}),n(a,{span:10},{default:u(()=>[_("div",G,[H,n(e,{uploadApi:o.uploadApi,value:o.avatar,btnText:"\u66F4\u6362\u5934\u50CF",btnProps:{preIcon:"ant-design:cloud-upload-outlined"},onChange:o.updateAvatar,width:"150"},null,8,["uploadApi","value","onChange"])])]),_:1})]),_:1}),n(f,{type:"primary",onClick:o.handleSubmit},{default:u(()=>[Q]),_:1},8,["onClick"])]),_:1})}var Po=A(j,[["render",W],["__scopeId","data-v-249137cb"]]);export{Po as default};
|
1
src/plugin/admin/public/assets/BaseSetting.78f0d902.js
Normal file
1
src/plugin/admin/public/assets/BaseSetting.78f0d902.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
var _=(o,l,t)=>new Promise((a,n)=>{var s=e=>{try{r(t.next(e))}catch(u){n(u)}},m=e=>{try{r(t.throw(e))}catch(u){n(u)}},r=e=>e.done?a(e.value):Promise.resolve(e.value).then(s,m);r((t=t.apply(o,l)).next())});import{aP as B,r as C,a as g,cB as b,B as F,l as v,H as S,aQ as c,o as y,aR as E,p as i,j as p,q as h}from"./index.0d073eaa.js";/* empty css */import{B as A}from"./BasicForm.d11b68fd.js";import{u as k}from"./useForm.868c8e81.js";import{a as w}from"./index.f4f1f088.js";import{a as R,b as I}from"./account.01c01e42.js";import{R as x,C as P}from"./index.1d29734e.js";const L=[{key:"1",name:"\u57FA\u672C\u8BBE\u7F6E",component:"BaseSetting"},{key:"2",name:"\u5B89\u5168\u8BBE\u7F6E",component:"SecureSetting"}],$=[{field:"nickname",component:"Input",label:"\u6635\u79F0",colProps:{span:18}},{field:"email",component:"Input",label:"\u90AE\u7BB1",colProps:{span:18}},{field:"mobile",component:"Input",label:"\u8054\u7CFB\u7535\u8BDD",colProps:{span:18}}];const d=C(null),U=g({components:{BasicForm:A,CollapseContainer:b,Button:F,ARow:x,ACol:P,CropperAvatar:w},setup(){const o=v(),[l,{setFieldsValue:t}]=k({labelWidth:120,schemas:$,showActionButtonGroup:!1});return S(()=>_(this,null,function*(){const a=yield R();t(a)})),{register:l,formElRef:d,handleSubmit:()=>_(this,null,function*(){var s;let a=yield(s=d.value)==null?void 0:s.validate();yield I(a);const n=o.getUserInfo;n.realName=a.nickname,o.setUserInfo(n)})}}}),j=h(" \u66F4\u65B0\u57FA\u672C\u4FE1\u606F ");function N(o,l,t,a,n,s){const m=c("BasicForm"),r=c("a-col"),e=c("a-row"),u=c("Button"),f=c("CollapseContainer");return y(),E(f,{title:"\u57FA\u672C\u8BBE\u7F6E",canExpan:!1},{default:i(()=>[p(e,{gutter:24},{default:i(()=>[p(r,{span:14},{default:i(()=>[p(m,{onRegister:o.register,ref:"formElRef"},null,8,["onRegister"])]),_:1})]),_:1}),p(u,{type:"primary",onClick:o.handleSubmit},{default:i(()=>[j]),_:1},8,["onClick"])]),_:1})}var V=B(U,[["render",N],["__scopeId","data-v-616db874"]]),Q=Object.freeze(Object.defineProperty({__proto__:null,default:V},Symbol.toStringTag,{value:"Module"}));export{V as B,Q as a,L as s};
|
1
src/plugin/admin/public/assets/BaseSetting.96f123cb.css
Normal file
1
src/plugin/admin/public/assets/BaseSetting.96f123cb.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
.change-avatar img[data-v-616db874]{display:block;margin-bottom:15px;border-radius:50%}
|
1
src/plugin/admin/public/assets/Basic.979a9cd6.js
Normal file
1
src/plugin/admin/public/assets/Basic.979a9cd6.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{B}from"./TableImg.2aabef6a.js";import"./BasicForm.d11b68fd.js";import{getBasicColumns as h,getBasicData as b}from"./tableData.f7682e9a.js";import{aP as v,a as A,r as e,aQ as c,o as E,h as k,j as i,p as r,q as u,t as l}from"./index.0d073eaa.js";import"./index.965098be.js";import"./Checkbox.476f6e92.js";import"./index.1491cab6.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./useForm.868c8e81.js";import"./index.566277e5.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useSize.bb4e5ce5.js";import"./useWindowSizeFn.ef20ece8.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";import"./index.7075e2b7.js";import"./index.04f7e044.js";import"./index.e317a008.js";import"./uuid.2b29000c.js";import"./index.2b5ea4f6.js";import"./_baseIteratee.3919e7cf.js";import"./get.49a42f2e.js";import"./DeleteOutlined.247d1f35.js";import"./index.a8c197b8.js";import"./useRefs.e81831e2.js";import"./Form.48352728.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./index.c05f9254.js";import"./FullscreenOutlined.401a7bcd.js";import"./index.0fb15725.js";import"./sortable.esm.2632adaa.js";import"./RedoOutlined.32117fb5.js";import"./index.dd1f987c.js";import"./fromPairs.84aabb58.js";import"./scrollTo.f8a2fd00.js";import"./index.2ed1a060.js";/* empty css *//* empty css */import"./index.e8daa066.js";import"./index.81899e8a.js";import"./index.ffb8ac7d.js";import"./download.bb4c9304.js";import"./base64Conver.08b9f4ec.js";import"./index.31930d74.js";import"./index.1d29734e.js";import"./uniqBy.ac0f9c38.js";const y=A({components:{BasicTable:B},setup(){const o=e(!1),a=e(!1),n=e(!0),p=e(!0),m=e(!1);function d(){o.value=!o.value}function t(){n.value=!n.value}function s(){a.value=!0,setTimeout(()=>{a.value=!1,m.value={pageSize:20}},3e3)}function g(){p.value=!p.value}function C(f){console.log("ColumnChanged",f)}return{columns:h(),data:b(),canResize:o,loading:a,striped:n,border:p,toggleStriped:t,toggleCanResize:d,toggleLoading:s,toggleBorder:g,pagination:m,handleColumnChange:C}}}),z={class:"p-4"},F=u(" \u5F00\u542Floading ");function R(o,a,n,p,m,d){const t=c("a-button"),s=c("BasicTable");return E(),k("div",z,[i(s,{title:"\u57FA\u7840\u793A\u4F8B",titleHelpMessage:"\u6E29\u99A8\u63D0\u9192",columns:o.columns,dataSource:o.data,canResize:o.canResize,loading:o.loading,striped:o.striped,bordered:o.border,showTableSetting:"",pagination:o.pagination,onColumnsChange:o.handleColumnChange},{toolbar:r(()=>[i(t,{type:"primary",onClick:o.toggleCanResize},{default:r(()=>[u(l(o.canResize?"\u53D6\u6D88\u81EA\u9002\u5E94":"\u81EA\u9002\u5E94\u9AD8\u5EA6"),1)]),_:1},8,["onClick"]),i(t,{type:"primary",onClick:o.toggleBorder},{default:r(()=>[u(l(o.border?"\u9690\u85CF\u8FB9\u6846":"\u663E\u793A\u8FB9\u6846"),1)]),_:1},8,["onClick"]),i(t,{type:"primary",onClick:o.toggleLoading},{default:r(()=>[F]),_:1},8,["onClick"]),i(t,{type:"primary",onClick:o.toggleStriped},{default:r(()=>[u(l(o.striped?"\u9690\u85CF\u6591\u9A6C\u7EB9":"\u663E\u793A\u6591\u9A6C\u7EB9"),1)]),_:1},8,["onClick"])]),_:1},8,["columns","dataSource","canResize","loading","striped","bordered","pagination","onColumnsChange"])])}var Fo=v(y,[["render",R]]);export{Fo as default};
|
1
src/plugin/admin/public/assets/BasicForm.913136bc.css
Normal file
1
src/plugin/admin/public/assets/BasicForm.913136bc.css
Normal file
File diff suppressed because one or more lines are too long
14
src/plugin/admin/public/assets/BasicForm.d11b68fd.js
Normal file
14
src/plugin/admin/public/assets/BasicForm.d11b68fd.js
Normal file
File diff suppressed because one or more lines are too long
1
src/plugin/admin/public/assets/Breadcrumb.45a81991.css
Normal file
1
src/plugin/admin/public/assets/Breadcrumb.45a81991.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
.vben-layout-breadcrumb{display:flex;padding:0 8px;align-items:center}.vben-layout-breadcrumb .ant-breadcrumb-link .anticon{margin-right:4px;margin-bottom:2px}.vben-layout-breadcrumb--light .ant-breadcrumb-link{color:#999}.vben-layout-breadcrumb--light .ant-breadcrumb-link a{color:#000000a6}.vben-layout-breadcrumb--light .ant-breadcrumb-link a:hover{color:#0960bd}.vben-layout-breadcrumb--light .ant-breadcrumb-separator{color:#999}.vben-layout-breadcrumb--dark .ant-breadcrumb-link{color:#fff9}.vben-layout-breadcrumb--dark .ant-breadcrumb-link a{color:#fffc}.vben-layout-breadcrumb--dark .ant-breadcrumb-link a:hover{color:#fff}.vben-layout-breadcrumb--dark .ant-breadcrumb-separator,.vben-layout-breadcrumb--dark .anticon{color:#fffc}
|
1
src/plugin/admin/public/assets/Breadcrumb.85433b87.js
Normal file
1
src/plugin/admin/public/assets/Breadcrumb.85433b87.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
var x=Object.defineProperty,O=Object.defineProperties;var T=Object.getOwnPropertyDescriptors;var $=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var P=(e,a,r)=>a in e?x(e,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[a]=r,_=(e,a)=>{for(var r in a||(a={}))V.call(a,r)&&P(e,r,a[r]);if($)for(var r of $(a))q.call(a,r)&&P(e,r,a[r]);return e},C=(e,a)=>O(e,T(a));var E=(e,a,r)=>new Promise((p,d)=>{var h=i=>{try{m(r.next(i))}catch(s){d(s)}},f=i=>{try{m(r.throw(i))}catch(s){d(s)}},m=i=>i.done?p(i.value):Promise.resolve(i.value).then(h,f);m((r=r.apply(e,a)).next())});import{aP as L,a as j,aO as z,aK as G,r as K,b0 as Q,b as Z,bu as F,aD as H,E as J,aQ as B,o as g,h as M,j as U,p as S,aR as w,aS as W,t as A,q as X,n as Y,c as ee,b2 as ae,bq as te,a_ as ne,eZ as re,cv as oe}from"./index.0d073eaa.js";import{B as D}from"./index.e9a84cba.js";const ce=j({name:"LayoutBreadcrumb",components:{Icon:z,[D.name]:D},props:{theme:G.oneOf(["dark","light"])},setup(){const e=K([]),{currentRoute:a}=Q(),{prefixCls:r}=Z("layout-breadcrumb"),{getShowBreadCrumbIcon:p}=F(),d=H(),{t:h}=ee();J(()=>E(this,null,function*(){var y,I,R;if(a.value.name===ae)return;const o=yield te(),t=a.value.matched,n=t==null?void 0:t[t.length-1];let c=a.value.path;n&&((y=n==null?void 0:n.meta)==null?void 0:y.currentActiveMenu)&&(c=n.meta.currentActiveMenu);const l=ne(o,c),b=o.filter(N=>N.path===l[0]),u=f(b,l);if(!u||u.length===0)return;const k=m(u);(I=a.value.meta)!=null&&I.currentActiveMenu&&k.push(C(_({},a.value),{name:((R=a.value.meta)==null?void 0:R.title)||a.value.name})),e.value=k}));function f(o,t){const n=[];return o.forEach(c=>{var l,b;t.includes(c.path)&&n.push(C(_({},c),{name:((l=c.meta)==null?void 0:l.title)||c.name})),(b=c.children)!=null&&b.length&&n.push(...f(c.children,t))}),n}function m(o){return re(o,t=>{const{meta:n,name:c}=t;if(!n)return!!c;const{title:l,hideBreadcrumb:b,hideMenu:u}=n;return!(!l||b||u)}).filter(t=>{var n;return!((n=t.meta)!=null&&n.hideBreadcrumb)})}function i(o,t,n){n==null||n.preventDefault();const{children:c,redirect:l,meta:b}=o;if((c==null?void 0:c.length)&&!l){n==null||n.stopPropagation();return}if(!(b!=null&&b.carryParam))if(l&&oe(l))d(l);else{let u="";t.length===1?u=t[0]:u=`${t.slice(1).pop()||""}`,u=/^\//.test(u)?u:`/${u}`,d(u)}}function s(o,t){return o.indexOf(t)!==o.length-1}function v(o){var t;return o.icon||((t=o.meta)==null?void 0:t.icon)}return{routes:e,t:h,prefixCls:r,getIcon:v,getShowBreadCrumbIcon:p,handleClick:i,hasRedirect:s}}}),se={key:1};function ue(e,a,r,p,d,h){const f=B("Icon"),m=B("router-link"),i=B("a-breadcrumb");return g(),M("div",{class:Y([e.prefixCls,`${e.prefixCls}--${e.theme}`])},[U(i,{routes:e.routes},{itemRender:S(({route:s,routes:v,paths:o})=>[e.getShowBreadCrumbIcon&&e.getIcon(s)?(g(),w(f,{key:0,icon:e.getIcon(s)},null,8,["icon"])):W("",!0),e.hasRedirect(v,s)?(g(),w(m,{key:2,to:"",onClick:t=>e.handleClick(s,o,t)},{default:S(()=>[X(A(e.t(s.name||s.meta.title)),1)]),_:2},1032,["onClick"])):(g(),M("span",se,A(e.t(s.name||s.meta.title)),1))]),_:1},8,["routes"])],2)}var me=L(ce,[["render",ue]]);export{me as default};
|
1
src/plugin/admin/public/assets/Btn.27eeae44.css
Normal file
1
src/plugin/admin/public/assets/Btn.27eeae44.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
.demo[data-v-a5cca872]{background-color:#fff}
|
1
src/plugin/admin/public/assets/Btn.5ba7c6bf.css
Normal file
1
src/plugin/admin/public/assets/Btn.5ba7c6bf.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
.demo[data-v-7809ec10]{background-color:#fff}
|
1
src/plugin/admin/public/assets/Btn.f3e8a2b4.js
Normal file
1
src/plugin/admin/public/assets/Btn.f3e8a2b4.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{aP as v,a as y,dq as B,l as P,fr as c,f as C,aQ as r,bK as T,o as n,aR as a,p as e,j as t,i as d,t as F,q as o,aS as _,w as f}from"./index.0d073eaa.js";import{A as g}from"./index.ffb8ac7d.js";import{D as U}from"./index.0fb15725.js";import{S as k}from"./index.81899e8a.js";import $ from"./CurrentPermissionMode.ded9592f.js";import{A as b}from"./index.0932c76c.js";import{P as w}from"./index.566277e5.js";import"./useFlexGapSupport.474c31b7.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useSize.bb4e5ce5.js";import"./eagerComputed.156e81ff.js";import"./useWindowSizeFn.ef20ece8.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";const N=y({components:{Alert:g,PageWrapper:w,Space:k,CurrentPermissionMode:$,Divider:U,Authority:b},setup(){const{changeRole:u,hasPermission:l}=B(),E=P();return{userStore:E,RoleEnum:c,isSuper:C(()=>E.getRoleList.includes(c.SUPER)),isTest:C(()=>E.getRoleList.includes(c.TEST)),changeRole:u,hasPermission:l}}}),V=o(" \u5F53\u524D\u89D2\u8272: "),L={class:"mt-4"},M=o(" \u6743\u9650\u5207\u6362(\u8BF7\u5148\u5207\u6362\u6743\u9650\u6A21\u5F0F\u4E3A\u524D\u7AEF\u89D2\u8272\u6743\u9650\u6A21\u5F0F): "),W=o("\u7EC4\u4EF6\u65B9\u5F0F\u5224\u65AD\u6743\u9650(\u6709\u9700\u8981\u53EF\u4EE5\u81EA\u884C\u5168\u5C40\u6CE8\u518C)"),q=o(" \u62E5\u6709super\u89D2\u8272\u6743\u9650\u53EF\u89C1 "),j=o(" \u62E5\u6709test\u89D2\u8272\u6743\u9650\u53EF\u89C1 "),I=o(" \u62E5\u6709[test,super]\u89D2\u8272\u6743\u9650\u53EF\u89C1 "),K=o("\u51FD\u6570\u65B9\u5F0F\u65B9\u5F0F\u5224\u65AD\u6743\u9650(\u9002\u7528\u4E8E\u51FD\u6570\u5185\u90E8\u8FC7\u6EE4)"),Q=o(" \u62E5\u6709super\u89D2\u8272\u6743\u9650\u53EF\u89C1 "),z=o(" \u62E5\u6709test\u89D2\u8272\u6743\u9650\u53EF\u89C1 "),G=o(" \u62E5\u6709[test,super]\u89D2\u8272\u6743\u9650\u53EF\u89C1 "),H=o("\u6307\u4EE4\u65B9\u5F0F\u65B9\u5F0F\u5224\u65AD\u6743\u9650(\u8BE5\u65B9\u5F0F\u4E0D\u80FD\u52A8\u6001\u4FEE\u6539\u6743\u9650.)"),J=o(" \u62E5\u6709super\u89D2\u8272\u6743\u9650\u53EF\u89C1 "),O=o(" \u62E5\u6709test\u89D2\u8272\u6743\u9650\u53EF\u89C1 "),X=o(" \u62E5\u6709[test,super]\u89D2\u8272\u6743\u9650\u53EF\u89C1 ");function Y(u,l,E,Z,x,uu){const D=r("CurrentPermissionMode"),R=r("Alert"),s=r("a-button"),S=r("Space"),i=r("Divider"),m=r("Authority"),A=r("PageWrapper"),p=T("auth");return n(),a(A,{title:"\u524D\u7AEF\u6743\u9650\u6309\u94AE\u793A\u4F8B",contentBackground:"",contentClass:"p-4",content:"\u7531\u4E8E\u5237\u65B0\u7684\u65F6\u5019\u4F1A\u8BF7\u6C42\u7528\u6237\u4FE1\u606F\u63A5\u53E3\uFF0C\u4F1A\u6839\u636E\u63A5\u53E3\u91CD\u7F6E\u89D2\u8272\u4FE1\u606F\uFF0C\u6240\u4EE5\u5237\u65B0\u540E\u754C\u9762\u4F1A\u6062\u590D\u539F\u6837\uFF0C\u5982\u679C\u4E0D\u9700\u8981\uFF0C\u53EF\u4EE5\u6CE8\u91CA src/layout/default/index\u5185\u7684\u83B7\u53D6\u7528\u6237\u4FE1\u606F\u63A5\u53E3"},{default:e(()=>[t(D),d("p",null,[V,d("a",null,F(u.userStore.getRoleList),1)]),t(R,{class:"mt-4",type:"info",message:"\u70B9\u51FB\u540E\u8BF7\u67E5\u770B\u6309\u94AE\u53D8\u5316","show-icon":""}),d("div",L,[M,t(S,null,{default:e(()=>[t(s,{onClick:l[0]||(l[0]=h=>u.changeRole(u.RoleEnum.SUPER)),type:u.isSuper?"primary":"default"},{default:e(()=>[o(F(u.RoleEnum.SUPER),1)]),_:1},8,["type"]),t(s,{onClick:l[1]||(l[1]=h=>u.changeRole(u.RoleEnum.TEST)),type:u.isTest?"primary":"default"},{default:e(()=>[o(F(u.RoleEnum.TEST),1)]),_:1},8,["type"])]),_:1})]),t(i,null,{default:e(()=>[W]),_:1}),t(m,{value:u.RoleEnum.SUPER},{default:e(()=>[t(s,{type:"primary",class:"mx-4"},{default:e(()=>[q]),_:1})]),_:1},8,["value"]),t(m,{value:u.RoleEnum.TEST},{default:e(()=>[t(s,{color:"success",class:"mx-4"},{default:e(()=>[j]),_:1})]),_:1},8,["value"]),t(m,{value:[u.RoleEnum.TEST,u.RoleEnum.SUPER]},{default:e(()=>[t(s,{color:"error",class:"mx-4"},{default:e(()=>[I]),_:1})]),_:1},8,["value"]),t(i,null,{default:e(()=>[K]),_:1}),u.hasPermission(u.RoleEnum.SUPER)?(n(),a(s,{key:0,type:"primary",class:"mx-4"},{default:e(()=>[Q]),_:1})):_("",!0),u.hasPermission(u.RoleEnum.TEST)?(n(),a(s,{key:1,color:"success",class:"mx-4"},{default:e(()=>[z]),_:1})):_("",!0),u.hasPermission([u.RoleEnum.TEST,u.RoleEnum.SUPER])?(n(),a(s,{key:2,color:"error",class:"mx-4"},{default:e(()=>[G]),_:1})):_("",!0),t(i,null,{default:e(()=>[H]),_:1}),f((n(),a(s,{type:"primary",class:"mx-4"},{default:e(()=>[J]),_:1})),[[p,u.RoleEnum.SUPER]]),f((n(),a(s,{color:"success",class:"mx-4"},{default:e(()=>[O]),_:1})),[[p,u.RoleEnum.TEST]]),f((n(),a(s,{color:"error",class:"mx-4"},{default:e(()=>[X]),_:1})),[[p,[u.RoleEnum.TEST,u.RoleEnum.SUPER]]])]),_:1})}var Cu=v(N,[["render",Y],["__scopeId","data-v-a5cca872"]]);export{Cu as default};
|
1
src/plugin/admin/public/assets/Btn.f647f2ab.js
Normal file
1
src/plugin/admin/public/assets/Btn.f647f2ab.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
var C=(t,n,c)=>new Promise((l,_)=>{var E=i=>{try{r(c.next(i))}catch(e){_(e)}},p=i=>{try{r(c.throw(i))}catch(e){_(e)}},r=i=>i.done?l(i.value):Promise.resolve(i.value).then(E,p);r((c=c.apply(t,n)).next())});import{aP as k,a as P,dq as v,bo as g,by as b,l as M,f as S,aQ as m,bK as w,o as a,aR as d,p as u,j as o,i as A,t as x,h as T,aS as f,w as h,F as $,fs as N,q as s}from"./index.0d073eaa.js";import{A as V}from"./index.ffb8ac7d.js";import{D as W}from"./index.0fb15725.js";import j from"./CurrentPermissionMode.ded9592f.js";import{A as q}from"./index.0932c76c.js";import{P as I}from"./index.566277e5.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useSize.bb4e5ce5.js";import"./eagerComputed.156e81ff.js";import"./useWindowSizeFn.ef20ece8.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";const K=P({components:{Alert:V,PageWrapper:I,CurrentPermissionMode:j,Divider:W,Authority:q},setup(){const{hasPermission:t}=v(),n=g(),c=b(),l=M(),_=S(()=>c.getProjectConfig.permissionMode===N.BACK);function E(p){return C(this,null,function*(){const r="fakeToken"+p;l.setToken(r),l.getUserInfoAction(),n.changePermissionCode()})}return{hasPermission:t,permissionStore:n,switchToken:E,isBackPermissionMode:_}}}),U=s(" \u5F53\u524D\u62E5\u6709\u7684code\u5217\u8868: "),L=s(" \u70B9\u51FB\u5207\u6362\u6309\u94AE\u6743\u9650(\u7528\u6237id\u4E3A2) "),Q=s(" \u70B9\u51FB\u5207\u6362\u6309\u94AE\u6743\u9650(\u7528\u6237id\u4E3A1,\u9ED8\u8BA4) "),R=s("\u7EC4\u4EF6\u65B9\u5F0F\u5224\u65AD\u6743\u9650"),z=s(" \u62E5\u6709code ['1000']\u6743\u9650\u53EF\u89C1 "),G=s(" \u62E5\u6709code ['2000']\u6743\u9650\u53EF\u89C1 "),H=s(" \u62E5\u6709code ['1000','2000']\u89D2\u8272\u6743\u9650\u53EF\u89C1 "),J=s("\u51FD\u6570\u65B9\u5F0F\u65B9\u5F0F\u5224\u65AD\u6743\u9650"),O=s(" \u62E5\u6709code ['1000']\u6743\u9650\u53EF\u89C1 "),X=s(" \u62E5\u6709code ['2000']\u6743\u9650\u53EF\u89C1 "),Y=s(" \u62E5\u6709code ['1000','2000']\u89D2\u8272\u6743\u9650\u53EF\u89C1 "),Z=s("\u6307\u4EE4\u65B9\u5F0F\u65B9\u5F0F\u5224\u65AD\u6743\u9650(\u8BE5\u65B9\u5F0F\u4E0D\u80FD\u52A8\u6001\u4FEE\u6539\u6743\u9650.)"),uu=s(" \u62E5\u6709code ['1000']\u6743\u9650\u53EF\u89C1 "),eu=s(" \u62E5\u6709code ['2000']\u6743\u9650\u53EF\u89C1 "),ou=s(" \u62E5\u6709code ['1000','2000']\u89D2\u8272\u6743\u9650\u53EF\u89C1 ");function su(t,n,c,l,_,E){const p=m("CurrentPermissionMode"),r=m("Divider"),i=m("Alert"),e=m("a-button"),F=m("Authority"),y=m("PageWrapper"),B=w("auth");return a(),d(y,{contentBackground:"",title:"\u6309\u94AE\u6743\u9650\u63A7\u5236",contentClass:"p-4"},{default:u(()=>[o(p),A("p",null,[U,A("a",null,x(t.permissionStore.getPermCodeList),1)]),o(r),o(i,{class:"mt-4",type:"info",message:"\u70B9\u51FB\u540E\u8BF7\u67E5\u770B\u6309\u94AE\u53D8\u5316(\u5FC5\u987B\u5904\u4E8E\u540E\u53F0\u6743\u9650\u6A21\u5F0F\u624D\u53EF\u6D4B\u8BD5\u6B64\u9875\u9762\u6240\u5C55\u793A\u7684\u529F\u80FD)","show-icon":""}),o(r),o(e,{type:"primary",class:"mr-2",onClick:n[0]||(n[0]=D=>t.switchToken(2)),disabled:!t.isBackPermissionMode},{default:u(()=>[L]),_:1},8,["disabled"]),o(e,{type:"primary",onClick:n[1]||(n[1]=D=>t.switchToken(1)),disabled:!t.isBackPermissionMode},{default:u(()=>[Q]),_:1},8,["disabled"]),t.isBackPermissionMode?(a(),T($,{key:0},[o(r,null,{default:u(()=>[R]),_:1}),o(F,{value:"1000"},{default:u(()=>[o(e,{type:"primary",class:"mx-4"},{default:u(()=>[z]),_:1})]),_:1}),o(F,{value:"2000"},{default:u(()=>[o(e,{color:"success",class:"mx-4"},{default:u(()=>[G]),_:1})]),_:1}),o(F,{value:["1000","2000"]},{default:u(()=>[o(e,{color:"error",class:"mx-4"},{default:u(()=>[H]),_:1})]),_:1}),o(r,null,{default:u(()=>[J]),_:1}),t.hasPermission("1000")?(a(),d(e,{key:0,type:"primary",class:"mx-4"},{default:u(()=>[O]),_:1})):f("",!0),t.hasPermission("2000")?(a(),d(e,{key:1,color:"success",class:"mx-4"},{default:u(()=>[X]),_:1})):f("",!0),t.hasPermission(["1000","2000"])?(a(),d(e,{key:2,color:"error",class:"mx-4"},{default:u(()=>[Y]),_:1})):f("",!0),o(r,null,{default:u(()=>[Z]),_:1}),h((a(),d(e,{type:"primary",class:"mx-4"},{default:u(()=>[uu]),_:1})),[[B,"1000"]]),h((a(),d(e,{color:"success",class:"mx-4"},{default:u(()=>[eu]),_:1})),[[B,"2000"]]),h((a(),d(e,{color:"error",class:"mx-4"},{default:u(()=>[ou]),_:1})),[[B,["1000","2000"]]])],64)):f("",!0)]),_:1})}var Cu=k(K,[["render",su],["__scopeId","data-v-7809ec10"]]);export{Cu as default};
|
1
src/plugin/admin/public/assets/Checkbox.476f6e92.js
Normal file
1
src/plugin/admin/public/assets/Checkbox.476f6e92.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{a as M,al as H,r as h,a1 as I,H as L,af as R,_ as u,L as z,M as x,j as b,N as G,y as J}from"./index.0d073eaa.js";var Q=globalThis&&globalThis.__rest||function(o,e){var r={};for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&e.indexOf(n)<0&&(r[n]=o[n]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,n=Object.getOwnPropertySymbols(o);t<n.length;t++)e.indexOf(n[t])<0&&Object.prototype.propertyIsEnumerable.call(o,n[t])&&(r[n[t]]=o[n[t]]);return r},U={prefixCls:String,name:String,id:String,type:String,defaultChecked:{type:[Boolean,Number],default:void 0},checked:{type:[Boolean,Number],default:void 0},disabled:Boolean,tabindex:{type:[Number,String]},readonly:Boolean,autofocus:Boolean,value:J.any,required:Boolean},X=M({name:"Checkbox",inheritAttrs:!1,props:H(U,{prefixCls:"rc-checkbox",type:"checkbox",defaultChecked:!1}),emits:["click","change"],setup:function(e,r){var n=r.attrs,t=r.emit,m=r.expose,i=h(e.checked===void 0?e.defaultChecked:e.checked),d=h();I(function(){return e.checked},function(){i.value=e.checked}),L(function(){R(function(){})}),m({focus:function(){var a;(a=d.value)===null||a===void 0||a.focus()},blur:function(){var a;(a=d.value)===null||a===void 0||a.blur()}});var s=h(),p=function(a){if(!e.disabled){e.checked===void 0&&(i.value=a.target.checked),a.shiftKey=s.value;var f={target:u(u({},e),{checked:a.target.checked}),stopPropagation:function(){a.stopPropagation()},preventDefault:function(){a.preventDefault()},nativeEvent:a};e.checked!==void 0&&(d.value.checked=!!e.checked),t("change",f),s.value=!1}},C=function(a){t("click",a),s.value=a.shiftKey};return function(){var c,a=e.prefixCls,f=e.name,v=e.id,K=e.type,y=e.disabled,P=e.readonly,O=e.tabindex,S=e.autofocus,B=e.value,_=e.required,j=Q(e,["prefixCls","name","id","type","disabled","readonly","tabindex","autofocus","value","required"]),N=n.class,w=n.onFocus,q=n.onBlur,D=n.onKeydown,T=n.onKeypress,A=n.onKeyup,k=u(u({},j),n),F=Object.keys(k).reduce(function(g,l){return(l.substr(0,5)==="aria-"||l.substr(0,5)==="data-"||l==="role")&&(g[l]=k[l]),g},{}),V=z(a,N,(c={},x(c,"".concat(a,"-checked"),i.value),x(c,"".concat(a,"-disabled"),y),c)),E=u(u({name:f,id:v,type:K,readonly:P,disabled:y,tabindex:O,class:"".concat(a,"-input"),checked:!!i.value,autofocus:S,value:B},F),{onChange:p,onClick:C,onFocus:w,onBlur:q,onKeydown:D,onKeypress:T,onKeyup:A,required:_});return b("span",{class:V},[b("input",G({ref:d},E),null),b("span",{class:"".concat(a,"-inner")},null)])}}});export{X as V};
|
1
src/plugin/admin/public/assets/ChildrenList.71ea94b3.js
Normal file
1
src/plugin/admin/public/assets/ChildrenList.71ea94b3.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{P as u}from"./index.566277e5.js";import{aP as a,a as n,aQ as e,o as p,aR as i,p as t,j as s,q as c}from"./index.0d073eaa.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useSize.bb4e5ce5.js";import"./eagerComputed.156e81ff.js";import"./useWindowSizeFn.ef20ece8.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";const m=n({components:{PageWrapper:u}}),_=c(" \u8FDB\u5165\u5B50\u7EA7\u8BE6\u60C5\u9875 ");function d(l,f,C,B,A,h){const o=e("router-link"),r=e("PageWrapper");return p(),i(r,{title:"\u5C42\u7EA7\u9762\u5305\u5C51\u793A\u4F8B",content:"\u5B50\u7EA7\u9875\u9762\u9762\u5305\u5C51\u4F1A\u6DFB\u52A0\u5230\u5F53\u524D\u5C42\u7EA7\u540E\u9762"},{default:t(()=>[s(o,{to:"/feat/breadcrumb/children/childrenDetail"},{default:t(()=>[_]),_:1})]),_:1})}var N=a(m,[["render",d]]);export{N as default};
|
@ -0,0 +1 @@
|
|||||||
|
import{P as t}from"./index.566277e5.js";import{aP as e,a as r,aQ as a,o as p,aR as i,p as s,i as n}from"./index.0d073eaa.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useSize.bb4e5ce5.js";import"./eagerComputed.156e81ff.js";import"./useWindowSizeFn.ef20ece8.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";const u=r({components:{PageWrapper:t}}),m=n("div",null,"\u5B50\u7EA7\u8BE6\u60C5\u9875\u5185\u5BB9\u5728\u6B64",-1);function c(_,d,l,B,f,C){const o=a("PageWrapper");return p(),i(o,{title:"\u5B50\u7EA7\u8BE6\u60C5\u9875"},{default:s(()=>[m]),_:1})}var D=e(u,[["render",c]]);export{D as default};
|
1
src/plugin/admin/public/assets/Col.a2eadc78.js
Normal file
1
src/plugin/admin/public/assets/Col.a2eadc78.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{D as K,f as l,Z as M,ae as P,a as F,C as I,r as T,H as V,ap as A,S as y,G as W,aq as G,L as B,M as o,j as L,_ as O}from"./index.0d073eaa.js";import{u as $}from"./useFlexGapSupport.474c31b7.js";var E=Symbol("rowContextKey"),q=function(r){M(E,r)},D=function(){return K(E,{gutter:l(function(){}),wrap:l(function(){}),supportFlexGap:l(function(){})})};P("top","middle","bottom","stretch");P("start","end","center","space-around","space-between");var H=function(){return{align:String,justify:String,prefixCls:String,gutter:{type:[Number,Array,Object],default:0},wrap:{type:Boolean,default:void 0}}},U=F({name:"ARow",props:H(),setup:function(r,C){var g=C.slots,v=I("row",r),d=v.prefixCls,h=v.direction,j,x=T({xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0,xxxl:!0}),w=$();V(function(){j=A.subscribe(function(e){var t=r.gutter||0;(!Array.isArray(t)&&y(t)==="object"||Array.isArray(t)&&(y(t[0])==="object"||y(t[1])==="object"))&&(x.value=e)})}),W(function(){A.unsubscribe(j)});var S=l(function(){var e=[0,0],t=r.gutter,n=t===void 0?0:t,s=Array.isArray(n)?n:[n,0];return s.forEach(function(i,b){if(y(i)==="object")for(var a=0;a<G.length;a++){var p=G[a];if(x.value[p]&&i[p]!==void 0){e[b]=i[p];break}}else e[b]=i||0}),e});q({gutter:S,supportFlexGap:w,wrap:l(function(){return r.wrap})});var R=l(function(){var e;return B(d.value,(e={},o(e,"".concat(d.value,"-no-wrap"),r.wrap===!1),o(e,"".concat(d.value,"-").concat(r.justify),r.justify),o(e,"".concat(d.value,"-").concat(r.align),r.align),o(e,"".concat(d.value,"-rtl"),h.value==="rtl"),e))}),_=l(function(){var e=S.value,t={},n=e[0]>0?"".concat(e[0]/-2,"px"):void 0,s=e[1]>0?"".concat(e[1]/-2,"px"):void 0;return n&&(t.marginLeft=n,t.marginRight=n),w.value?t.rowGap="".concat(e[1],"px"):s&&(t.marginTop=s,t.marginBottom=s),t});return function(){var e;return L("div",{class:R.value,style:_.value},[(e=g.default)===null||e===void 0?void 0:e.call(g)])}}}),X=U;function Z(c){return typeof c=="number"?"".concat(c," ").concat(c," auto"):/^\d+(\.\d+)?(px|em|rem|%)$/.test(c)?"0 0 ".concat(c):c}var k=function(){return{span:[String,Number],order:[String,Number],offset:[String,Number],push:[String,Number],pull:[String,Number],xs:{type:[String,Number,Object],default:void 0},sm:{type:[String,Number,Object],default:void 0},md:{type:[String,Number,Object],default:void 0},lg:{type:[String,Number,Object],default:void 0},xl:{type:[String,Number,Object],default:void 0},xxl:{type:[String,Number,Object],default:void 0},xxxl:{type:[String,Number,Object],default:void 0},prefixCls:String,flex:[String,Number]}},Y=F({name:"ACol",props:k(),setup:function(r,C){var g=C.slots,v=D(),d=v.gutter,h=v.supportFlexGap,j=v.wrap,x=I("col",r),w=x.prefixCls,S=x.direction,R=l(function(){var e,t=r.span,n=r.order,s=r.offset,i=r.push,b=r.pull,a=w.value,p={};return["xs","sm","md","lg","xl","xxl","xxxl"].forEach(function(m){var f,u={},N=r[m];typeof N=="number"?u.span=N:y(N)==="object"&&(u=N||{}),p=O(O({},p),(f={},o(f,"".concat(a,"-").concat(m,"-").concat(u.span),u.span!==void 0),o(f,"".concat(a,"-").concat(m,"-order-").concat(u.order),u.order||u.order===0),o(f,"".concat(a,"-").concat(m,"-offset-").concat(u.offset),u.offset||u.offset===0),o(f,"".concat(a,"-").concat(m,"-push-").concat(u.push),u.push||u.push===0),o(f,"".concat(a,"-").concat(m,"-pull-").concat(u.pull),u.pull||u.pull===0),o(f,"".concat(a,"-rtl"),S.value==="rtl"),f))}),B(a,(e={},o(e,"".concat(a,"-").concat(t),t!==void 0),o(e,"".concat(a,"-order-").concat(n),n),o(e,"".concat(a,"-offset-").concat(s),s),o(e,"".concat(a,"-push-").concat(i),i),o(e,"".concat(a,"-pull-").concat(b),b),e),p)}),_=l(function(){var e=r.flex,t=d.value,n={};if(t&&t[0]>0){var s="".concat(t[0]/2,"px");n.paddingLeft=s,n.paddingRight=s}if(t&&t[1]>0&&!h.value){var i="".concat(t[1]/2,"px");n.paddingTop=i,n.paddingBottom=i}return e&&(n.flex=Z(e),j.value===!1&&!n.minWidth&&(n.minWidth=0)),n});return function(){var e;return L("div",{class:R.value,style:_.value},[(e=g.default)===null||e===void 0?void 0:e.call(g)])}}});export{Y as C,X as R};
|
1
src/plugin/admin/public/assets/CopyOutlined.02d1bfa6.js
Normal file
1
src/plugin/admin/public/assets/CopyOutlined.02d1bfa6.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{j as i,aG as l}from"./index.0d073eaa.js";var u={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"}}]},name:"copy",theme:"outlined"},p=u;function o(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?Object(arguments[t]):{},n=Object.keys(e);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(e).filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.forEach(function(a){f(r,a,e[a])})}return r}function f(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}var c=function(t,e){var n=o({},t,e.attrs);return i(l,o({},n,{icon:p}),null)};c.displayName="CopyOutlined";c.inheritAttrs=!1;var d=c;export{d as C};
|
1
src/plugin/admin/public/assets/CreateMenu.9f2036a2.js
Normal file
1
src/plugin/admin/public/assets/CreateMenu.9f2036a2.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
var c=(r,n,e)=>new Promise((m,s)=>{var l=t=>{try{a(e.next(t))}catch(o){s(o)}},i=t=>{try{a(e.throw(t))}catch(o){s(o)}},a=t=>t.done?m(t.value):Promise.resolve(t.value).then(l,i);a((e=e.apply(r,n)).next())});import{B}from"./BasicForm.d11b68fd.js";import{aP as _,r as h,a as g,I as d,dw as C,aQ as f,o as M,aR as b,p as F,i as v,j as E,aU as P,ft as w,fu as y,x as I}from"./index.0d073eaa.js";import{C as R}from"./index.abdcab42.js";import"./index.78efd931.js";/* empty css */import{B as S,a as $}from"./index.c05f9254.js";/* empty css */import"./index.0fb15725.js";import"./index.965098be.js";import"./Checkbox.476f6e92.js";import"./index.1491cab6.js";import"./index.e317a008.js";import"./index.7075e2b7.js";import"./index.04f7e044.js";import"./index.e8daa066.js";import"./get.49a42f2e.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./index.2b5ea4f6.js";import"./_baseIteratee.3919e7cf.js";import"./DeleteOutlined.247d1f35.js";import"./index.a8c197b8.js";import"./useRefs.e81831e2.js";import"./Form.48352728.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./useSize.bb4e5ce5.js";import"./index.81899e8a.js";import"./index.ffb8ac7d.js";import"./index.dd1f987c.js";import"./uuid.2b29000c.js";import"./download.bb4c9304.js";import"./base64Conver.08b9f4ec.js";import"./index.31930d74.js";import"./index.1d29734e.js";import"./uniqBy.ac0f9c38.js";import"./index.aa6b7013.js";import"./PlusOutlined.64d8e001.js";import"./useWindowSizeFn.ef20ece8.js";import"./FullscreenOutlined.401a7bcd.js";const u=h(null),k=g({components:{BasicForm:B,[d.name]:d,Button:C,Card:R,BasicModal:S},emits:["reload","register"],setup(r,{emit:n}){const e=h(""),m=[{field:"name",component:"Input",label:"\u540D\u5B57",colProps:{span:24},required:!0},{field:"pid",component:"ApiTreeSelect",label:"\u4E0A\u7EA7\u83DC\u5355",componentProps:{api:w,resultField:"list"},colProps:{span:24}}],[s,{closeModal:l}]=$(o=>c(this,null,function*(){var p;e.value=o.table,(p=u.value)==null||p.appendSchemaByField({field:"table",component:"Input",label:"",colProps:{span:0},componentProps:{hidden:!0},defaultValue:e},"")})),{createMessage:i}=I(),{success:a}=i;return{formElRef:u,handleSubmit:()=>c(this,null,function*(){try{const o=u.value;if(!o)return;const p=yield o.validate();yield y(p),console.log(p),l(),a("\u64CD\u4F5C\u6210\u529F"),n("reload")}catch(o){console.log(o)}}),schemas:m,register:s}}}),A={class:"mt-3"};function D(r,n,e,m,s,l){const i=f("BasicForm"),a=f("BasicModal");return M(),b(a,P(r.$attrs,{destroyOnClose:"",onRegister:r.register,title:"\u4E00\u952E\u751F\u6210\u83DC\u5355",onOk:r.handleSubmit}),{default:F(()=>[v("div",A,[E(i,{schemas:r.schemas,ref:"formElRef",labelWidth:75,showActionButtonGroup:!1},null,8,["schemas"])])]),_:1},16,["onRegister","onOk"])}var vo=_(k,[["render",D]]);export{vo as default};
|
@ -0,0 +1 @@
|
|||||||
|
import{a as m,by as p,f as c,dq as d,fs as _,aP as l,aQ as u,o as f,h as F,j as o,p as r,q as s,t as C}from"./index.0d073eaa.js";import{D as M}from"./index.0fb15725.js";const P=m({name:"CurrentPermissionMode",components:{Divider:M},setup(){const e=p(),t=c(()=>e.getProjectConfig.permissionMode),{togglePermissionMode:n}=d();return{permissionMode:t,PermissionModeEnum:_,togglePermissionMode:n}}}),A={class:"mt-2"},D=s(" \u5F53\u524D\u6743\u9650\u6A21\u5F0F\uFF1A "),g=s(" \u5207\u6362\u6743\u9650\u6A21\u5F0F ");function h(e,t,n,v,k,y){const i=u("a-button"),a=u("Divider");return f(),F("div",A,[D,o(i,{type:"link"},{default:r(()=>[s(C(e.permissionMode===e.PermissionModeEnum.BACK?"\u540E\u53F0\u6743\u9650\u6A21\u5F0F":"\u524D\u7AEF\u89D2\u8272\u6743\u9650\u6A21\u5F0F"),1)]),_:1}),o(i,{class:"ml-4",onClick:e.togglePermissionMode,type:"primary"},{default:r(()=>[g]),_:1},8,["onClick"]),o(a)])}var b=l(P,[["render",h]]);export{b as default};
|
1
src/plugin/admin/public/assets/CustomExport.4bf7fbaa.js
Normal file
1
src/plugin/admin/public/assets/CustomExport.4bf7fbaa.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{B as d}from"./TableImg.2aabef6a.js";import"./BasicForm.d11b68fd.js";import{E as f}from"./index.98e89309.js";import{c as _,d as s,j as E}from"./data.1c1e104e.js";import{b as C}from"./index.c05f9254.js";import{P as F}from"./index.566277e5.js";import{aP as B,a as x,aQ as t,o as b,aR as g,p as r,j as p,q as M}from"./index.0d073eaa.js";import"./index.965098be.js";import"./Checkbox.476f6e92.js";import"./index.1491cab6.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./useForm.868c8e81.js";import"./index.7075e2b7.js";import"./index.04f7e044.js";import"./index.e317a008.js";import"./uuid.2b29000c.js";import"./index.2b5ea4f6.js";import"./_baseIteratee.3919e7cf.js";import"./get.49a42f2e.js";import"./DeleteOutlined.247d1f35.js";import"./index.a8c197b8.js";import"./useRefs.e81831e2.js";import"./Form.48352728.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./useSize.bb4e5ce5.js";import"./useWindowSizeFn.ef20ece8.js";import"./index.0fb15725.js";import"./sortable.esm.2632adaa.js";import"./RedoOutlined.32117fb5.js";import"./FullscreenOutlined.401a7bcd.js";import"./index.dd1f987c.js";import"./fromPairs.84aabb58.js";import"./scrollTo.f8a2fd00.js";import"./index.2ed1a060.js";/* empty css *//* empty css */import"./index.e8daa066.js";import"./index.81899e8a.js";import"./index.ffb8ac7d.js";import"./download.bb4c9304.js";import"./base64Conver.08b9f4ec.js";import"./index.31930d74.js";import"./index.1d29734e.js";import"./uniqBy.ac0f9c38.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";const A=x({components:{BasicTable:d,ExpExcelModal:f,PageWrapper:F},setup(){function o({filename:m,bookType:a}){E({data:s,filename:m,write2excelOpts:{bookType:a}})}const[e,{openModal:i}]=C();return{defaultHeader:o,columns:_,data:s,register:e,openModal:i}}}),P=M(" \u5BFC\u51FA ");function S(o,e,i,m,a,T){const n=t("a-button"),u=t("BasicTable"),c=t("ExpExcelModal"),l=t("PageWrapper");return b(),g(l,{title:"\u5BFC\u51FA\u793A\u4F8B",content:"\u53EF\u4EE5\u9009\u62E9\u5BFC\u51FA\u683C\u5F0F"},{default:r(()=>[p(u,{title:"\u57FA\u7840\u8868\u683C",columns:o.columns,dataSource:o.data},{toolbar:r(()=>[p(n,{onClick:o.openModal},{default:r(()=>[P]),_:1},8,["onClick"])]),_:1},8,["columns","dataSource"]),p(c,{onRegister:o.register,onSuccess:o.defaultHeader},null,8,["onRegister","onSuccess"])]),_:1})}var To=B(A,[["render",S]]);export{To as default};
|
1
src/plugin/admin/public/assets/CustomerCell.8c887377.js
Normal file
1
src/plugin/admin/public/assets/CustomerCell.8c887377.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{B as _,T as E}from"./TableImg.2aabef6a.js";import"./BasicForm.d11b68fd.js";import{u as T}from"./useTable.13a8b0ff.js";import{aP as k,a as y,aQ as u,o as t,h as c,j as A,p as m,F as C,q as p,t as s,aS as i,aR as r}from"./index.0d073eaa.js";import{T as f}from"./index.e317a008.js";import{A as B}from"./index.0972fd96.js";import{d as I}from"./table.5cb529f7.js";import"./index.965098be.js";import"./Checkbox.476f6e92.js";import"./index.1491cab6.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./useForm.868c8e81.js";import"./index.566277e5.js";import"./index.e9a84cba.js";import"./useWindowSizeFn.ef20ece8.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./useSize.bb4e5ce5.js";import"./transButton.8c1b1a4f.js";import"./index.7075e2b7.js";import"./index.04f7e044.js";import"./uuid.2b29000c.js";import"./index.2b5ea4f6.js";import"./_baseIteratee.3919e7cf.js";import"./get.49a42f2e.js";import"./DeleteOutlined.247d1f35.js";import"./index.a8c197b8.js";import"./useRefs.e81831e2.js";import"./Form.48352728.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./index.c05f9254.js";import"./FullscreenOutlined.401a7bcd.js";import"./index.0fb15725.js";import"./sortable.esm.2632adaa.js";import"./RedoOutlined.32117fb5.js";import"./index.dd1f987c.js";import"./fromPairs.84aabb58.js";import"./scrollTo.f8a2fd00.js";import"./index.2ed1a060.js";/* empty css *//* empty css */import"./index.e8daa066.js";import"./index.81899e8a.js";import"./index.ffb8ac7d.js";import"./download.bb4c9304.js";import"./base64Conver.08b9f4ec.js";import"./index.31930d74.js";import"./index.1d29734e.js";import"./uniqBy.ac0f9c38.js";const b=[{title:"ID",dataIndex:"id"},{title:"\u5934\u50CF",dataIndex:"avatar",width:100},{title:"\u5206\u7C7B",dataIndex:"category",width:80,align:"center",defaultHidden:!0},{title:"\u59D3\u540D",dataIndex:"name",width:120},{title:"\u56FE\u7247\u5217\u88681",dataIndex:"imgArr",helpMessage:["\u8FD9\u662F\u7B80\u5355\u6A21\u5F0F\u7684\u56FE\u7247\u5217\u8868","\u53EA\u4F1A\u663E\u793A\u4E00\u5F20\u5728\u8868\u683C\u4E2D","\u4F46\u70B9\u51FB\u53EF\u9884\u89C8\u591A\u5F20\u56FE\u7247"],width:140},{title:"\u7167\u7247\u5217\u88682",dataIndex:"imgs",width:160},{title:"\u5730\u5740",dataIndex:"address"},{title:"\u7F16\u53F7",dataIndex:"no"},{title:"\u5F00\u59CB\u65F6\u95F4",dataIndex:"beginTime"},{title:"\u7ED3\u675F\u65F6\u95F4",dataIndex:"endTime"}],x=y({components:{BasicTable:_,TableImg:E,Tag:f,Avatar:B},setup(){const[a]=T({title:"\u81EA\u5B9A\u4E49\u5217\u5185\u5BB9",titleHelpMessage:"\u8868\u683C\u4E2D\u6240\u6709\u5934\u50CF\u3001\u56FE\u7247\u5747\u4E3Amock\u751F\u6210\uFF0C\u4EC5\u7528\u4E8E\u6F14\u793A\u56FE\u7247\u5360\u4F4D",api:I,columns:b,bordered:!0,showTableSetting:!0});return{registerTable:a}}}),h={class:"p-4"};function D(a,v,w,L,S,$){const n=u("Tag"),F=u("Avatar"),d=u("TableImg"),g=u("BasicTable");return t(),c("div",h,[A(g,{onRegister:a.registerTable},{bodyCell:m(({column:e,record:o,text:l})=>[e.key==="id"?(t(),c(C,{key:0},[p(" ID: "+s(o.id),1)],64)):i("",!0),e.key==="no"?(t(),r(n,{key:1,color:"green"},{default:m(()=>[p(s(o.no),1)]),_:2},1024)):i("",!0),e.key==="avatar"?(t(),r(F,{key:2,size:60,src:o.avatar},null,8,["src"])):i("",!0),e.key==="imgArr"?(t(),r(d,{key:3,size:60,simpleShow:!0,imgList:l},null,8,["imgList"])):i("",!0),e.key==="imgs"?(t(),r(d,{key:4,size:60,imgList:l},null,8,["imgList"])):i("",!0),e.key==="category"?(t(),r(n,{key:5,color:"green"},{default:m(()=>[p(s(o.no),1)]),_:2},1024)):i("",!0)]),_:1},8,["onRegister"])])}var St=k(x,[["render",D]]);export{St as default};
|
1
src/plugin/admin/public/assets/CustomerForm.cbd99e55.js
Normal file
1
src/plugin/admin/public/assets/CustomerForm.cbd99e55.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{B as C}from"./BasicForm.d11b68fd.js";import{u as B}from"./useForm.868c8e81.js";import{aP as g,a as E,cB as F,I as n,aQ as e,o as h,aR as b,p,j as i,bM as v,x as A}from"./index.0d073eaa.js";import{P}from"./index.566277e5.js";/* empty css *//* empty css */import"./index.0fb15725.js";import"./index.965098be.js";import"./Checkbox.476f6e92.js";import"./index.1491cab6.js";import"./index.e317a008.js";import"./index.7075e2b7.js";import"./index.04f7e044.js";import"./index.e8daa066.js";import"./get.49a42f2e.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./index.2b5ea4f6.js";import"./_baseIteratee.3919e7cf.js";import"./DeleteOutlined.247d1f35.js";import"./index.a8c197b8.js";import"./useRefs.e81831e2.js";import"./Form.48352728.js";import"./Col.a2eadc78.js";import"./useFlexGapSupport.474c31b7.js";import"./useSize.bb4e5ce5.js";import"./index.81899e8a.js";import"./index.c05f9254.js";import"./useWindowSizeFn.ef20ece8.js";import"./FullscreenOutlined.401a7bcd.js";import"./index.ffb8ac7d.js";import"./index.dd1f987c.js";import"./uuid.2b29000c.js";import"./download.bb4c9304.js";import"./base64Conver.08b9f4ec.js";import"./index.31930d74.js";import"./index.1d29734e.js";import"./uniqBy.ac0f9c38.js";import"./index.e9a84cba.js";import"./index.0972fd96.js";import"./useContentViewHeight.01b9d1c6.js";import"./ArrowLeftOutlined.90d2e05e.js";import"./index.8680e4c4.js";import"./transButton.8c1b1a4f.js";const u=[{field:"field1",component:"Input",label:"render\u65B9\u5F0F",colProps:{span:8},rules:[{required:!0}],render:({model:o,field:t})=>v(n,{placeholder:"\u8BF7\u8F93\u5165",value:o[t],onChange:r=>{o[t]=r.target.value}})},{field:"field2",component:"Input",label:"render\u7EC4\u4EF6slot",colProps:{span:8},rules:[{required:!0}],renderComponentContent:()=>({suffix:()=>"suffix"})},{field:"field3",component:"Input",label:"\u81EA\u5B9A\u4E49Slot",slot:"f3",colProps:{span:8},rules:[{required:!0}]}],S=E({components:{BasicForm:C,CollapseContainer:F,PageWrapper:P,[n.name]:n},setup(){const{createMessage:o}=A(),[t,{setProps:r}]=B({labelWidth:120,schemas:u,actionColOptions:{span:24}});return{register:t,schemas:u,handleSubmit:a=>{o.success("click search,values:"+JSON.stringify(a))},setProps:r}}});function x(o,t,r,a,I,W){const l=e("a-input"),c=e("BasicForm"),d=e("CollapseContainer"),f=e("PageWrapper");return h(),b(f,{title:"\u81EA\u5B9A\u4E49\u7EC4\u4EF6\u793A\u4F8B"},{default:p(()=>[i(d,{title:"\u81EA\u5B9A\u4E49\u8868\u5355"},{default:p(()=>[i(c,{onRegister:o.register,onSubmit:o.handleSubmit},{f3:p(({model:s,field:m})=>[i(l,{value:s[m],"onUpdate:value":_=>s[m]=_,placeholder:"\u81EA\u5B9A\u4E49slot"},null,8,["value","onUpdate:value"])]),_:1},8,["onRegister","onSubmit"])]),_:1})]),_:1})}var ho=g(S,[["render",x]]);export{ho as default};
|
@ -0,0 +1 @@
|
|||||||
|
import{j as i,aG as u}from"./index.0d073eaa.js";var o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"},f=o;function c(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?Object(arguments[e]):{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(l){return Object.getOwnPropertyDescriptor(t,l).enumerable}))),n.forEach(function(l){v(r,l,t[l])})}return r}function v(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}var a=function(e,t){var n=c({},e,t.attrs);return i(u,c({},n,{icon:f}),null)};a.displayName="DeleteOutlined";a.inheritAttrs=!1;var s=a;export{s as D};
|
1
src/plugin/admin/public/assets/DeptModal.94926f9b.js
Normal file
1
src/plugin/admin/public/assets/DeptModal.94926f9b.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
var M=Object.defineProperty;var d=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var m=(t,o,e)=>o in t?M(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,f=(t,o)=>{for(var e in o||(o={}))_.call(o,e)&&m(t,e,o[e]);if(d)for(var e of d(o))v.call(o,e)&&m(t,e,o[e]);return t};var p=(t,o,e)=>new Promise((n,s)=>{var c=a=>{try{r(e.next(a))}catch(u){s(u)}},i=a=>{try{r(e.throw(a))}catch(u){s(u)}},r=a=>a.done?n(a.value):Promise.resolve(a.value).then(c,i);r((e=e.apply(t,o)).next())});import{B as P,a as D}from"./index.c05f9254.js";import{B as C}from"./BasicForm.d11b68fd.js";import{u as I}from"./useForm.868c8e81.js";import{bM as N,a as S,r as k,k as b,f as w,aP as y,aQ as g,o as T,aR as R,p as x,j as $,aU as A}from"./index.0d073eaa.js";import{T as q}from"./index.e317a008.js";import{a as L}from"./system.d37449cd.js";const X=[{title:"\u90E8\u95E8\u540D\u79F0",dataIndex:"deptName",width:160,align:"left"},{title:"\u6392\u5E8F",dataIndex:"orderNo",width:50},{title:"\u72B6\u6001",dataIndex:"status",width:80,customRender:({record:t})=>{const e=~~t.status===0,n=e?"green":"red",s=e?"\u542F\u7528":"\u505C\u7528";return N(q,{color:n},()=>s)}},{title:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"createTime",width:180},{title:"\u5907\u6CE8",dataIndex:"remark"}],Y=[{field:"deptName",label:"\u90E8\u95E8\u540D\u79F0",component:"Input",colProps:{span:8}},{field:"status",label:"\u72B6\u6001",component:"Select",componentProps:{options:[{label:"\u542F\u7528",value:"0"},{label:"\u505C\u7528",value:"1"}]},colProps:{span:8}}],O=[{field:"deptName",label:"\u90E8\u95E8\u540D\u79F0",component:"Input",required:!0},{field:"parentDept",label:"\u4E0A\u7EA7\u90E8\u95E8",component:"TreeSelect",componentProps:{fieldNames:{label:"deptName",key:"id",value:"id"},getPopupContainer:()=>document.body},required:!0},{field:"orderNo",label:"\u6392\u5E8F",component:"InputNumber",required:!0},{field:"status",label:"\u72B6\u6001",component:"RadioButtonGroup",defaultValue:"0",componentProps:{options:[{label:"\u542F\u7528",value:"0"},{label:"\u505C\u7528",value:"1"}]},required:!0},{label:"\u5907\u6CE8",field:"remark",component:"InputTextArea"}],j=S({name:"DeptModal",components:{BasicModal:P,BasicForm:C},emits:["success","register"],setup(t,{emit:o}){const e=k(!0),[n,{resetFields:s,setFieldsValue:c,updateSchema:i,validate:r}]=I({labelWidth:100,baseColProps:{span:24},schemas:O,showActionButtonGroup:!1}),[a,{setModalProps:u,closeModal:F}]=D(l=>p(this,null,function*(){s(),u({confirmLoading:!1}),e.value=!!(l!=null&&l.isUpdate),b(e)&&c(f({},l.record));const h=yield L();i({field:"parentDept",componentProps:{treeData:h}})})),E=w(()=>b(e)?"\u7F16\u8F91\u90E8\u95E8":"\u65B0\u589E\u90E8\u95E8");function B(){return p(this,null,function*(){try{const l=yield r();u({confirmLoading:!0}),console.log(l),F(),o("success")}finally{u({confirmLoading:!1})}})}return{registerModal:a,registerForm:n,getTitle:E,handleSubmit:B}}});function U(t,o,e,n,s,c){const i=g("BasicForm"),r=g("BasicModal");return T(),R(r,A(t.$attrs,{onRegister:t.registerModal,title:t.getTitle,onOk:t.handleSubmit}),{default:x(()=>[$(i,{onRegister:t.registerForm},null,8,["onRegister"])]),_:1},16,["onRegister","title","onOk"])}var V=y(j,[["render",U]]),Z=Object.freeze(Object.defineProperty({__proto__:null,default:V},Symbol.toStringTag,{value:"Module"}));export{V as D,Z as a,X as c,Y as s};
|
1
src/plugin/admin/public/assets/DeptModal.c1142834.js
Normal file
1
src/plugin/admin/public/assets/DeptModal.c1142834.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
var M=Object.defineProperty;var d=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var m=(t,o,e)=>o in t?M(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,f=(t,o)=>{for(var e in o||(o={}))_.call(o,e)&&m(t,e,o[e]);if(d)for(var e of d(o))v.call(o,e)&&m(t,e,o[e]);return t};var p=(t,o,e)=>new Promise((n,s)=>{var c=a=>{try{r(e.next(a))}catch(u){s(u)}},i=a=>{try{r(e.throw(a))}catch(u){s(u)}},r=a=>a.done?n(a.value):Promise.resolve(a.value).then(c,i);r((e=e.apply(t,o)).next())});import{B as P,a as D}from"./index.c05f9254.js";import{B as C}from"./BasicForm.d11b68fd.js";import{u as I}from"./useForm.868c8e81.js";import{bM as N,aP as S,a as k,r as w,k as b,f as y,aQ as g,o as T,aR as R,p as x,j as $,aU as A}from"./index.0d073eaa.js";import{T as q}from"./index.e317a008.js";import{a as L}from"./system.d37449cd.js";const X=[{title:"\u90E8\u95E8\u540D\u79F0",dataIndex:"deptName",width:160,align:"left"},{title:"\u6392\u5E8F",dataIndex:"orderNo",width:50},{title:"\u72B6\u6001",dataIndex:"status",width:80,customRender:({record:t})=>{const e=~~t.status===0,n=e?"green":"red",s=e?"\u542F\u7528":"\u505C\u7528";return N(q,{color:n},()=>s)}},{title:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"createTime",width:180},{title:"\u5907\u6CE8",dataIndex:"remark"}],Y=[{field:"deptName",label:"\u90E8\u95E8\u540D\u79F0",component:"Input",colProps:{span:8}},{field:"status",label:"\u72B6\u6001",component:"Select",componentProps:{options:[{label:"\u542F\u7528",value:"0"},{label:"\u505C\u7528",value:"1"}]},colProps:{span:8}}],O=[{field:"deptName",label:"\u90E8\u95E8\u540D\u79F0",component:"Input",required:!0},{field:"parentDept",label:"\u4E0A\u7EA7\u90E8\u95E8",component:"TreeSelect",componentProps:{fieldNames:{label:"deptName",key:"id",value:"id"},getPopupContainer:()=>document.body},required:!0},{field:"orderNo",label:"\u6392\u5E8F",component:"InputNumber",required:!0},{field:"status",label:"\u72B6\u6001",component:"RadioButtonGroup",defaultValue:"0",componentProps:{options:[{label:"\u542F\u7528",value:"0"},{label:"\u505C\u7528",value:"1"}]},required:!0},{label:"\u5907\u6CE8",field:"remark",component:"InputTextArea"}],j=k({name:"DeptModal",components:{BasicModal:P,BasicForm:C},emits:["success","register"],setup(t,{emit:o}){const e=w(!0),[n,{resetFields:s,setFieldsValue:c,updateSchema:i,validate:r}]=I({labelWidth:100,baseColProps:{span:24},schemas:O,showActionButtonGroup:!1}),[a,{setModalProps:u,closeModal:F}]=D(l=>p(this,null,function*(){s(),u({confirmLoading:!1}),e.value=!!(l!=null&&l.isUpdate),b(e)&&c(f({},l.record));const h=yield L();i({field:"parentDept",componentProps:{treeData:h}})})),E=y(()=>b(e)?"\u7F16\u8F91\u90E8\u95E8":"\u65B0\u589E\u90E8\u95E8");function B(){return p(this,null,function*(){try{const l=yield r();u({confirmLoading:!0}),console.log(l),F(),o("success")}finally{u({confirmLoading:!1})}})}return{registerModal:a,registerForm:n,getTitle:E,handleSubmit:B}}});function U(t,o,e,n,s,c){const i=g("BasicForm"),r=g("BasicModal");return T(),R(r,A(t.$attrs,{onRegister:t.registerModal,title:t.getTitle,onOk:t.handleSubmit}),{default:x(()=>[$(i,{onRegister:t.registerForm},null,8,["onRegister"])]),_:1},16,["onRegister","title","onOk"])}var V=S(j,[["render",U]]),Z=Object.freeze(Object.defineProperty({__proto__:null,default:V},Symbol.toStringTag,{value:"Module"}));export{V as D,Z as a,X as c,Y as s};
|
1
src/plugin/admin/public/assets/DeptTree.378f40df.js
Normal file
1
src/plugin/admin/public/assets/DeptTree.378f40df.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
var m=(a,r,e)=>new Promise((n,o)=>{var s=t=>{try{i(e.next(t))}catch(p){o(p)}},c=t=>{try{i(e.throw(t))}catch(p){o(p)}},i=t=>t.done?n(t.value):Promise.resolve(t.value).then(s,c);i((e=e.apply(a,r)).next())});import{_ as l}from"./index.9d5559d9.js";import{a as d}from"./system.d37449cd.js";import{a as f,r as u,H as _,aP as h,aQ as D,o as T,h as v,j as B}from"./index.0d073eaa.js";import"./fromPairs.84aabb58.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./useContextMenu.cd4142a5.js";import"./index.0fb15725.js";import"./get.49a42f2e.js";const $=f({name:"DeptTree",components:{BasicTree:l},emits:["select"],setup(a,{emit:r}){const e=u([]);function n(){return m(this,null,function*(){e.value=yield d()})}function o(s){r("select",s[0])}return _(()=>{n()}),{treeData:e,handleSelect:o}}}),k={class:"m-4 mr-0 overflow-hidden bg-white"};function w(a,r,e,n,o,s){const c=D("BasicTree");return T(),v("div",k,[B(c,{title:"\u90E8\u95E8\u5217\u8868",toolbar:"",search:"",clickRowToExpand:!1,treeData:a.treeData,fieldNames:{key:"id",title:"deptName"},onSelect:a.handleSelect},null,8,["treeData","onSelect"])])}var L=h($,[["render",w]]);export{L as default};
|
1
src/plugin/admin/public/assets/DeptTree.67db3f00.js
Normal file
1
src/plugin/admin/public/assets/DeptTree.67db3f00.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
var m=(a,r,e)=>new Promise((n,o)=>{var s=t=>{try{i(e.next(t))}catch(p){o(p)}},c=t=>{try{i(e.throw(t))}catch(p){o(p)}},i=t=>t.done?n(t.value):Promise.resolve(t.value).then(s,c);i((e=e.apply(a,r)).next())});import{_ as l}from"./index.9d5559d9.js";import{a as d}from"./system.d37449cd.js";import{aP as f,a as u,r as _,H as h,aQ as D,o as T,h as v,j as B}from"./index.0d073eaa.js";import"./fromPairs.84aabb58.js";import"./index.e8b360cf.js";import"./eagerComputed.156e81ff.js";import"./useContextMenu.cd4142a5.js";import"./index.0fb15725.js";import"./get.49a42f2e.js";const $=u({name:"DeptTree",components:{BasicTree:l},emits:["select"],setup(a,{emit:r}){const e=_([]);function n(){return m(this,null,function*(){e.value=yield d()})}function o(s){r("select",s[0])}return h(()=>{n()}),{treeData:e,handleSelect:o}}}),k={class:"m-4 mr-0 overflow-hidden bg-white"};function w(a,r,e,n,o,s){const c=D("BasicTree");return T(),v("div",k,[B(c,{title:"\u90E8\u95E8\u5217\u8868",toolbar:"",search:"",clickRowToExpand:!1,treeData:a.treeData,fieldNames:{key:"id",title:"deptName"},onSelect:a.handleSelect},null,8,["treeData","onSelect"])])}var L=f($,[["render",w]]);export{L as default};
|
1
src/plugin/admin/public/assets/DetailModal.3a3743ca.js
Normal file
1
src/plugin/admin/public/assets/DetailModal.3a3743ca.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{B as s}from"./index.c05f9254.js";import{D as i}from"./index.86cf6e90.js";import{a as n,c as m,o as c,aR as p,p as l,j as f,k as t,aU as u}from"./index.0d073eaa.js";import{getDescSchema as d}from"./data.524013e4.js";import{u as g}from"./useDescription.c3993c39.js";import"./useWindowSizeFn.ef20ece8.js";import"./FullscreenOutlined.401a7bcd.js";import"./index.875b4490.js";import"./get.49a42f2e.js";import"./index.e317a008.js";const C=n({__name:"DetailModal",props:{info:{type:Object,default:null}},setup(e){const{t:o}=m(),[r]=g({column:2,schema:d()});return(a,D)=>(c(),p(t(s),u({width:800,title:t(o)("sys.errorLog.tableActionDesc")},a.$attrs),{default:l(()=>[f(t(i),{data:e.info,onRegister:t(r)},null,8,["data","onRegister"])]),_:1},16,["title"]))}});export{C as default};
|
1
src/plugin/admin/public/assets/Drawer1.3dbcbba8.js
Normal file
1
src/plugin/admin/public/assets/Drawer1.3dbcbba8.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{B as a}from"./index.c4338a98.js";import{a as t,aP as o,aQ as s,o as n,aR as c,p,aU as i,q as m}from"./index.0d073eaa.js";import"./index.c9bfdeac.js";import"./ArrowLeftOutlined.90d2e05e.js";const _=t({components:{BasicDrawer:a},setup(){return{}}}),f=m(" Drawer Info. ");function d(e,w,l,u,B,D){const r=s("BasicDrawer");return n(),c(r,i(e.$attrs,{title:"Drawer Title",width:"50%"}),{default:p(()=>[f]),_:1},16)}var k=o(_,[["render",d]]);export{k as default};
|
1
src/plugin/admin/public/assets/Drawer2.43ad8a06.js
Normal file
1
src/plugin/admin/public/assets/Drawer2.43ad8a06.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{B as c,a as i}from"./index.c4338a98.js";import{a as p,aP as _,aQ as t,o as u,aR as m,p as o,j as d,aU as l,q as a}from"./index.0d073eaa.js";import"./index.c9bfdeac.js";import"./ArrowLeftOutlined.90d2e05e.js";const w=p({components:{BasicDrawer:c},setup(){const[e,{closeDrawer:r}]=i();return{register:e,closeDrawer:r}}}),f=a(" Drawer Info. "),D=a(" \u5185\u90E8\u5173\u95EDdrawer ");function B(e,r,g,h,C,$){const s=t("a-button"),n=t("BasicDrawer");return u(),m(n,l(e.$attrs,{onRegister:e.register,title:"Drawer Title",width:"50%"}),{default:o(()=>[f,d(s,{type:"primary",onClick:e.closeDrawer},{default:o(()=>[D]),_:1},8,["onClick"])]),_:1},16,["onRegister"])}var x=_(w,[["render",B]]);export{x as default};
|
1
src/plugin/admin/public/assets/Drawer3.95656e00.js
Normal file
1
src/plugin/admin/public/assets/Drawer3.95656e00.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import{B as u}from"./index.c4338a98.js";import{a as p,aP as d,aQ as s,o as r,aR as i,p as e,j as t,h as _,aW as m,i as f,F as h,aU as k,q as a}from"./index.0d073eaa.js";import"./index.c9bfdeac.js";import"./ArrowLeftOutlined.90d2e05e.js";const B=p({components:{BasicDrawer:u},setup(){return{handleOk:()=>{console.log("====================="),console.log("ok"),console.log("======================")}}}}),w=a(" btn"),F=a(" btn2"),E=a(" btn3");function b(n,g,D,$,C,O){const o=s("a-button"),c=s("BasicDrawer");return r(),i(c,k(n.$attrs,{title:"Modal Title",width:"50%",showFooter:"",onOk:n.handleOk}),{insertFooter:e(()=>[t(o,null,{default:e(()=>[w]),_:1})]),centerFooter:e(()=>[t(o,null,{default:e(()=>[F]),_:1})]),appendFooter:e(()=>[t(o,null,{default:e(()=>[E]),_:1})]),default:e(()=>[(r(),_(h,null,m(40,l=>f("p",{class:"h-20",key:l},"\u6839\u636E\u5C4F\u5E55\u9AD8\u5EA6\u81EA\u9002\u5E94")),64))]),_:1},16,["onOk"])}var v=d(B,[["render",b]]);export{v as default};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user