mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-31 23:10:45 +00:00
优化路由表数据获取
更新安装sql 处理权限页面添加逻辑 优化权限表数据
This commit is contained in:
parent
b361986c0d
commit
43d5988c59
@ -83,32 +83,33 @@ class SystemRouteServices extends BaseServices
|
||||
*/
|
||||
public function getTreeList(array $where, string $appName = 'adminapi')
|
||||
{
|
||||
$list = app()->make(SystemRouteCateServices::class)
|
||||
->selectList(['app_name' => $appName], '*', 0, 0, 'id asc,sort desc', [
|
||||
'children' => function ($query) use ($where) {
|
||||
$query->where('app_name', $where['app_name'])
|
||||
->when('' !== $where['name_like'], function ($q) use ($where) {
|
||||
$q->where('name|path', 'LIKE', '%' . $where['name_like'] . '%');
|
||||
});
|
||||
}
|
||||
])
|
||||
->toArray();
|
||||
return $this->cacheDriver()->remember('ROUTE_LIST', function () use ($where, $appName) {
|
||||
$list = app()->make(SystemRouteCateServices::class)
|
||||
->selectList(['app_name' => $appName], '*', 0, 0, 'id asc,sort desc', [
|
||||
'children' => function ($query) use ($where) {
|
||||
$query->where('app_name', $where['app_name'])
|
||||
->when('' !== $where['name_like'], function ($q) use ($where) {
|
||||
$q->where('name|path', 'LIKE', '%' . $where['name_like'] . '%');
|
||||
});
|
||||
}
|
||||
])
|
||||
->toArray();
|
||||
|
||||
foreach ($list as $key => $item) {
|
||||
if (!empty($item['children'])) {
|
||||
foreach ($item['children'] as $k => $v) {
|
||||
if (isset($v['cate_id']) && isset($v['method'])) {
|
||||
if ($v['method'] === 'DELETE') {
|
||||
$v['method'] = 'DEL';
|
||||
foreach ($list as $key => $item) {
|
||||
if (!empty($item['children'])) {
|
||||
foreach ($item['children'] as $k => $v) {
|
||||
if (isset($v['cate_id']) && isset($v['method'])) {
|
||||
if ($v['method'] === 'DELETE') {
|
||||
$v['method'] = 'DEL';
|
||||
}
|
||||
$v['pid'] = $v['cate_id'];
|
||||
$list[$key]['children'][$k] = $v;
|
||||
}
|
||||
$v['pid'] = $v['cate_id'];
|
||||
$list[$key]['children'][$k] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return get_tree_children($list);
|
||||
return get_tree_children($list);
|
||||
}, 600);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -69,7 +69,7 @@
|
||||
<Input v-model="formValidate.unique_auth" placeholder="请输入权限标识"></Input>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col v-bind="grid" v-show="authType">
|
||||
<Col v-bind="grid" v-if="authType">
|
||||
<FormItem label="图标:">
|
||||
<Input
|
||||
v-model="formValidate.icon"
|
||||
@ -85,7 +85,7 @@
|
||||
<Input type="number" v-model="formValidate.sort" placeholder="请输入排序" number></Input>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col v-bind="grid" v-show="authType">
|
||||
<!-- <Col v-bind="grid" v-show="authType">
|
||||
<FormItem label="隐藏菜单:">
|
||||
<RadioGroup v-model="formValidate.is_show_path">
|
||||
<Radio :label="item.value" v-for="(item, i) in isShowPathRadio" :key="i">
|
||||
@ -94,7 +94,7 @@
|
||||
</Radio>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Col> -->
|
||||
<Col v-bind="grid">
|
||||
<FormItem label="状态:">
|
||||
<RadioGroup v-model="formValidate.is_show">
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
</Row>
|
||||
<Row type="flex">
|
||||
<Col v-bind="grid">
|
||||
<Button v-auth="['setting-system_menus-add']" type="primary" @click="menusAdd('添加规则')" icon="md-add"
|
||||
<Button type="primary" @click="menusAdd('添加规则')" icon="md-add"
|
||||
>添加规则
|
||||
</Button>
|
||||
</Col>
|
||||
@ -43,10 +43,14 @@
|
||||
:data="tableData"
|
||||
row-id="id"
|
||||
>
|
||||
<vxe-table-column field="id" title="ID" tooltip min-width="70"></vxe-table-column>
|
||||
<vxe-table-column field="menu_name" tree-node title="按钮名称" min-width="100"></vxe-table-column>
|
||||
<vxe-table-column field="unique_auth" title="前端权限" min-width="200"></vxe-table-column>
|
||||
<vxe-table-column field="menu_path" title="页面路由" min-width="240" tooltip="true"></vxe-table-column>
|
||||
<vxe-table-column field="menu_path" title="路由" min-width="240" tooltip="true">
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="row.auth_type == 1">页面:{{row.menu_path}}</span>
|
||||
<span v-if="row.auth_type == 2">接口:[{{row.methods}}]{{row.api_url}}</span>
|
||||
</template>
|
||||
</vxe-table-column>
|
||||
<vxe-table-column field="flag" title="规则状态" min-width="120">
|
||||
<template v-slot="{ row }">
|
||||
<i-switch
|
||||
@ -62,9 +66,9 @@
|
||||
</i-switch>
|
||||
</template>
|
||||
</vxe-table-column>
|
||||
<vxe-table-column field="date" title="操作" align="center" width="250" fixed="right">
|
||||
<vxe-table-column field="date" title="操作" align="right" width="250" fixed="right">
|
||||
<template v-slot="{ row }">
|
||||
<span v-auth="['setting-system_menus-add']">
|
||||
<span>
|
||||
<a @click="addRoute(row)" v-if="row.auth_type === 1">添加权限</a>
|
||||
<Divider type="vertical" v-if="row.auth_type === 1" />
|
||||
<a @click="addE(row, '添加子菜单')" v-if="row.auth_type === 1">添加子菜单</a>
|
||||
@ -384,7 +388,7 @@ export default {
|
||||
this.$modalSure(delfromData)
|
||||
.then((res) => {
|
||||
this.$Message.success(res.msg);
|
||||
this.getData();
|
||||
// this.getData();
|
||||
this.getMenusUnique();
|
||||
// this.$store.dispatch('menus/getMenusNavList');
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user