feat:系统模块初始化

This commit is contained in:
JaguarJack
2023-05-15 13:23:32 +08:00
parent b8c4c90da7
commit 2a6d65d4e7
13 changed files with 812 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('system_dictionary', function (Blueprint $table) {
$table->id();
$table->string('name', 100)->comment('字典名称');
$table->string('key')->comment('字典 key');
$table->tinyInteger('status')->default(1)->comment('状态 1 启用 2 禁用');
$table->string('description', 1000)->comment('备注')->default('');
$table->creatorId();
$table->createdAt();
$table->updatedAt();
$table->deletedAt();
$table->engine='InnoDB';
$table->comment('字段管理');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('system_dictionary');
}
};

View File

@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('system_dictionary_values', function (Blueprint $table) {
$table->id();
$table->integer('dic_id')->comment('字典ID');
$table->string('label')->comment('值名称');
$table->tinyInteger('value')->comment('对应值');
$table->integer('sort')->default(0)->comment('排序');
$table->tinyInteger('status')->default(1)->comment('状态 1 正常 2 禁用');
$table->string('description', 1000)->comment('描述')->default('');
$table->creatorId();
$table->createdAt();
$table->updatedAt();
$table->deletedAt();
$table->engine='InnoDB';
$table->comment('字典对应值');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('system_dictionary_values');
}
};

View File

@@ -0,0 +1,193 @@
<?php
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
return new class extends Seeder
{
/**
* Run the seeder.
*
* @return void
*/
public function run(): void
{
$menus = $this->menus();
importTreeData($menus, 'permissions');
}
public function menus(): array
{
return array (
0 =>
array (
'id' => 96,
'parent_id' => 0,
'permission_name' => '系统管理',
'route' => '/system',
'icon' => 'server-stack',
'module' => 'system',
'permission_mark' => '',
'component' => '',
'redirect' => NULL,
'keepalive' => 1,
'type' => 1,
'hidden' => 1,
'sort' => 1,
'active_menu' => '',
'creator_id' => 1,
'created_at' => 1683535826,
'updated_at' => 1683535826,
'deleted_at' => 0,
),
1 =>
array (
'id' => 97,
'parent_id' => 96,
'permission_name' => '字典管理',
'route' => 'dictionary',
'icon' => '',
'module' => 'system',
'permission_mark' => 'dictionary',
'component' => '/System/views/dictionary/index.vue',
'redirect' => '',
'keepalive' => 1,
'type' => 2,
'hidden' => 1,
'sort' => 1,
'active_menu' => '',
'creator_id' => 1,
'created_at' => 1683535863,
'updated_at' => 1683535874,
'deleted_at' => 0,
),
2 =>
array (
'id' => 103,
'parent_id' => 97,
'permission_name' => '删除',
'route' => '',
'icon' => '',
'module' => 'system',
'permission_mark' => 'dictionary@destroy',
'component' => '',
'redirect' => '',
'keepalive' => 1,
'type' => 3,
'hidden' => 1,
'sort' => 5,
'active_menu' => '',
'creator_id' => 1,
'created_at' => 1683535980,
'updated_at' => 1683535980,
'deleted_at' => 0,
),
3 =>
array (
'id' => 99,
'parent_id' => 97,
'permission_name' => '列表',
'route' => '',
'icon' => '',
'module' => 'system',
'permission_mark' => 'dictionary@index',
'component' => '',
'redirect' => '',
'keepalive' => 1,
'type' => 3,
'hidden' => 1,
'sort' => 1,
'active_menu' => '',
'creator_id' => 1,
'created_at' => 1683535980,
'updated_at' => 1683535980,
'deleted_at' => 0,
),
4 =>
array (
'id' => 101,
'parent_id' => 97,
'permission_name' => '读取',
'route' => '',
'icon' => '',
'module' => 'system',
'permission_mark' => 'dictionary@show',
'component' => '',
'redirect' => '',
'keepalive' => 1,
'type' => 3,
'hidden' => 1,
'sort' => 3,
'active_menu' => '',
'creator_id' => 1,
'created_at' => 1683535980,
'updated_at' => 1683535980,
'deleted_at' => 0,
),
5 =>
array (
'id' => 100,
'parent_id' => 97,
'permission_name' => '新增',
'route' => '',
'icon' => '',
'module' => 'system',
'permission_mark' => 'dictionary@store',
'component' => '',
'redirect' => '',
'keepalive' => 1,
'type' => 3,
'hidden' => 1,
'sort' => 2,
'active_menu' => '',
'creator_id' => 1,
'created_at' => 1683535980,
'updated_at' => 1683535980,
'deleted_at' => 0,
),
6 =>
array (
'id' => 102,
'parent_id' => 97,
'permission_name' => '更新',
'route' => '',
'icon' => '',
'module' => 'system',
'permission_mark' => 'dictionary@update',
'component' => '',
'redirect' => '',
'keepalive' => 1,
'type' => 3,
'hidden' => 1,
'sort' => 4,
'active_menu' => '',
'creator_id' => 1,
'created_at' => 1683535980,
'updated_at' => 1683535980,
'deleted_at' => 0,
),
7 =>
array (
'id' => 98,
'parent_id' => 96,
'permission_name' => '字典值管理',
'route' => 'dictionary/values/:id',
'icon' => '',
'module' => 'system',
'permission_mark' => 'dictionaryValues',
'component' => '/System/views/dictionaryValues/index.vue',
'redirect' => '',
'keepalive' => 2,
'type' => 2,
'hidden' => 2,
'sort' => 1,
'active_menu' => '/system/dictionary',
'creator_id' => 1,
'created_at' => 1683535961,
'updated_at' => 1683593856,
'deleted_at' => 0,
),
);
}
};