Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a36fa86d8d | ||
![]() |
66f19d8ef1 | ||
![]() |
560e1bab5b | ||
![]() |
be1307db94 | ||
![]() |
a6c879ce09 | ||
![]() |
ff14f46fe0 | ||
![]() |
03ea4759af |
@@ -8,7 +8,6 @@ use Exception;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Modules\Develop\Support\Generate\Create\Schema;
|
use Modules\Develop\Support\Generate\Create\Schema;
|
||||||
use Illuminate\Support\Facades\Schema as SchemaFacade;
|
|
||||||
|
|
||||||
class Schemas extends CatchModel
|
class Schemas extends CatchModel
|
||||||
{
|
{
|
||||||
@@ -108,22 +107,4 @@ class Schemas extends CatchModel
|
|||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* delete
|
|
||||||
*
|
|
||||||
* @param $id
|
|
||||||
* @param bool $force
|
|
||||||
* @return bool|null
|
|
||||||
*/
|
|
||||||
public function deleteBy($id, bool $force = false): ?bool
|
|
||||||
{
|
|
||||||
$schema = parent::firstBy($id);
|
|
||||||
|
|
||||||
if ($schema->delete()) {
|
|
||||||
SchemaFacade::dropIfExists($schema->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -22,6 +22,16 @@
|
|||||||
required: true,
|
required: true,
|
||||||
message: '模块名称必须填写',
|
message: '模块名称必须填写',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
validator: (rule: any, value: any, callback: any) => {
|
||||||
|
if (! /^[A-Za-z]+$/.test(value)) {
|
||||||
|
callback('模块名称只允许大小字母组合')
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<el-input v-model="formData.title" />
|
<el-input v-model="formData.title" />
|
||||||
|
@@ -64,7 +64,7 @@ const schemaVisible = ref<boolean>(false)
|
|||||||
const api = 'schema'
|
const api = 'schema'
|
||||||
|
|
||||||
const { data, query, search, reset, loading } = useGetList(api)
|
const { data, query, search, reset, loading } = useGetList(api)
|
||||||
const { destroy, deleted } = useDestroy('确认删除吗? 将会删除数据库的 Schema,请提前做好备份,一旦删除,将无法恢复!')
|
const { destroy, deleted } = useDestroy('确认删除吗? 删除后数据表将会保留,如需删除相关表,请手动进行删除!')
|
||||||
const { open, close, title, visible, id } = useOpen()
|
const { open, close, title, visible, id } = useOpen()
|
||||||
|
|
||||||
const tableData = computed(() => data.value?.data)
|
const tableData = computed(() => data.value?.data)
|
||||||
|
@@ -41,11 +41,9 @@ class RolesController extends Controller
|
|||||||
public function store(RoleRequest $request)
|
public function store(RoleRequest $request)
|
||||||
{
|
{
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
|
$data['data_range'] = (int) $data['data_range'];
|
||||||
if ($request->get('data_range') && ! DataRange::Personal_Choose->assert($data['data_range'])) {
|
if (!$data['data_range'] || !DataRange::Personal_Choose->assert($data['data_range'])) {
|
||||||
$data['departments'] = [];
|
$data['departments'] = [];
|
||||||
} else {
|
|
||||||
$data['data_range'] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->model->storeBy($data);
|
return $this->model->storeBy($data);
|
||||||
@@ -80,11 +78,9 @@ class RolesController extends Controller
|
|||||||
public function update($id, RoleRequest $request)
|
public function update($id, RoleRequest $request)
|
||||||
{
|
{
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
|
$data['data_range'] = (int) $data['data_range'];
|
||||||
if ($request->get('data_range') && ! DataRange::Personal_Choose->assert($data['data_range'])) {
|
if (!$data['data_range'] || !DataRange::Personal_Choose->assert($data['data_range'])) {
|
||||||
$data['departments'] = [];
|
$data['departments'] = [];
|
||||||
} else {
|
|
||||||
$data['data_range'] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->model->updateBy($id, $data);
|
return $this->model->updateBy($id, $data);
|
||||||
|
@@ -58,16 +58,16 @@ trait UserRelations
|
|||||||
|
|
||||||
/* @var Permissions $permissionsModel */
|
/* @var Permissions $permissionsModel */
|
||||||
$permissionsModel = app($this->getPermissionsModel());
|
$permissionsModel = app($this->getPermissionsModel());
|
||||||
|
|
||||||
if ($this->isSuperAdmin()) {
|
if ($this->isSuperAdmin()) {
|
||||||
$permissions = $permissionsModel->get();
|
$permissions = $permissionsModel->get();
|
||||||
} else {
|
} else {
|
||||||
$permissions = Collection::make();
|
$permissionIds = Collection::make();
|
||||||
$this->roles()->with('permissions')->get()
|
$this->roles()->with('permissions')->get()
|
||||||
->each(function ($role) use (&$permissions) {
|
->each(function ($role) use (&$permissionIds) {
|
||||||
$permissions = $permissions->concat($role->permissions);
|
$permissionIds = $permissionIds->concat($role->permissions?->pluck('id'));
|
||||||
});
|
});
|
||||||
$permissions = $permissions->unique();
|
|
||||||
|
$permissions = $permissionsModel->whereIn('id', $permissionIds->unique())->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setAttribute('permissions', $permissions->each(fn ($permission) => $permission->setAttribute('hidden', $permission->isHidden())));
|
$this->setAttribute('permissions', $permissions->each(fn ($permission) => $permission->setAttribute('hidden', $permission->isHidden())));
|
||||||
|
@@ -96,7 +96,7 @@ class User extends Model implements AuthenticatableContract
|
|||||||
*/
|
*/
|
||||||
public function updateBy($id, array $data): mixed
|
public function updateBy($id, array $data): mixed
|
||||||
{
|
{
|
||||||
if (isset($data['password']) && ! $data['password']) {
|
if (empty($data['password'])) {
|
||||||
unset($data['password']);
|
unset($data['password']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,13 +13,16 @@
|
|||||||
<el-icon>
|
<el-icon>
|
||||||
<Icon :name="menu?.meta?.icon" v-if="menu?.meta?.icon" class="text-sm" />
|
<Icon :name="menu?.meta?.icon" v-if="menu?.meta?.icon" class="text-sm" />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span>{{ menu?.meta?.title }}</span>
|
<span v-if="menu?.path.indexOf('https://') !== -1 || menu?.path.indexOf('http://') !== -1">
|
||||||
|
<span @click="openUrl(menu?.path as string)">{{ menu?.meta?.title }}</span>
|
||||||
|
</span>
|
||||||
|
<span v-else>{{ menu?.meta?.title }}</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" name="MenuItem" setup>
|
<script lang="ts" setup>
|
||||||
import { Menu } from '/admin/types/Menu'
|
import { Menu } from '/admin/types/Menu'
|
||||||
import { onMounted, PropType, ref } from 'vue'
|
import { PropType } from 'vue'
|
||||||
import { useAppStore } from '/admin/stores/modules/app'
|
import { useAppStore } from '/admin/stores/modules/app'
|
||||||
import { isMiniScreen } from '/admin/support/helper'
|
import { isMiniScreen } from '/admin/support/helper'
|
||||||
|
|
||||||
@@ -37,6 +40,12 @@ defineProps({
|
|||||||
require: true,
|
require: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const openUrl = (path: string) => {
|
||||||
|
const start = path.indexOf('https://') || path.indexOf('http://')
|
||||||
|
window.open(path.substring(start))
|
||||||
|
return false
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
@@ -7,22 +7,15 @@
|
|||||||
:collapse="!appStore.isExpand"
|
:collapse="!appStore.isExpand"
|
||||||
:collapse-transition="false"
|
:collapse-transition="false"
|
||||||
:router="true"
|
:router="true"
|
||||||
@select="selectMenu"
|
|
||||||
:unique-opened="true"
|
:unique-opened="true"
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="menus">
|
<script lang="ts" setup>
|
||||||
import { useAppStore } from '/admin/stores/modules/app'
|
import { useAppStore } from '/admin/stores/modules/app'
|
||||||
|
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
|
|
||||||
const selectMenu = (index: string) => {
|
|
||||||
if (index.startsWith('http') || index.startsWith('https')) {
|
|
||||||
window.open(index)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
Reference in New Issue
Block a user