chore: 优化权限菜单
This commit is contained in:
@@ -24,8 +24,13 @@ class Components implements OptionInterface
|
||||
$components = File::glob(CatchAdmin::getModuleViewsPath($module).'*'.DIRECTORY_SEPARATOR.'*.vue');
|
||||
|
||||
foreach ($components as $component) {
|
||||
$_component = Str::of($component)
|
||||
->replace(CatchAdmin::moduleRootPath(), '')
|
||||
->explode(DIRECTORY_SEPARATOR);
|
||||
$_component->shift(2);
|
||||
|
||||
$this->components[] = [
|
||||
'label' => Str::of($component)->explode(DIRECTORY_SEPARATOR)->pop(2)->pop(),
|
||||
'label' => Str::of($_component->implode('/'))->replace('.vue', ''),
|
||||
|
||||
'value' => Str::of($component)->replace(CatchAdmin::moduleRootPath(), '')->prepend('/')
|
||||
];
|
||||
|
BIN
modules/Permissions/.DS_Store
vendored
Normal file
BIN
modules/Permissions/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -9,6 +9,7 @@ use Catch\CatchAdmin;
|
||||
use Catch\Enums\Status;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\Permissions\Enums\MenuStatus;
|
||||
use Modules\Permissions\Enums\MenuType;
|
||||
|
||||
@@ -156,11 +157,11 @@ class Permissions extends Model
|
||||
/**
|
||||
*
|
||||
* @param array $data
|
||||
* @return bool
|
||||
* @throws \ReflectionException
|
||||
* @return mixed
|
||||
*/
|
||||
public function storeBy(array $data): bool
|
||||
public function storeBy(array $data): mixed
|
||||
{
|
||||
return DB::transaction(function () use ($data){
|
||||
if ($data['actions'] ?? false) {
|
||||
/* @var static $parentMenu */
|
||||
$parentMenu = $this->firstBy(value: $data['parent_id'], field: 'id');
|
||||
@@ -199,6 +200,7 @@ class Permissions extends Model
|
||||
}
|
||||
|
||||
return parent::storeBy($data);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
BIN
modules/Permissions/views/.DS_Store
vendored
Normal file
BIN
modules/Permissions/views/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -21,7 +21,7 @@
|
||||
<el-input v-model="formData.permission_name" name="permission_name" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属模块" prop="module" :rules="[{ required: true, message: '所属模块必须填写' }]" v-if="!isAction">
|
||||
<Select v-model="formData.module" api="modules" @clear="clearModule" />
|
||||
<Select v-model="formData.module" api="modules" allow-create @clear="clearModule" />
|
||||
</el-form-item>
|
||||
<el-form-item label="路由Path" prop="route" :rules="[{ required: true, message: '路由Path必须填写' }]" v-if="!isAction">
|
||||
<el-input v-model="formData.route" name="route" clearable />
|
||||
|
Reference in New Issue
Block a user