|
|
@@ -38,8 +38,12 @@
|
|
|
</el-col>
|
|
|
<el-col :span="12" class="text-right">
|
|
|
<el-form-item label-width="0">
|
|
|
- <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
|
|
- <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
|
|
+ <el-button type="primary" icon="el-icon-search" @click="handleQuery"
|
|
|
+ >搜索</el-button
|
|
|
+ >
|
|
|
+ <el-button icon="el-icon-refresh" @click="resetQuery"
|
|
|
+ >重置</el-button
|
|
|
+ >
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -54,7 +58,8 @@
|
|
|
icon="el-icon-plus"
|
|
|
size="mini"
|
|
|
@click="handleAdd"
|
|
|
- >新增</el-button>
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
|
@@ -63,7 +68,8 @@
|
|
|
icon="el-icon-sort"
|
|
|
size="mini"
|
|
|
@click="toggleExpandAll"
|
|
|
- >展开/折叠</el-button>
|
|
|
+ >展开/折叠</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
|
|
|
</el-row>
|
|
|
@@ -74,7 +80,7 @@
|
|
|
:data="menuList"
|
|
|
row-key="id"
|
|
|
:default-expand-all="isExpandAll"
|
|
|
- :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
+ :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
|
|
border
|
|
|
>
|
|
|
<el-table-column
|
|
|
@@ -83,35 +89,29 @@
|
|
|
:show-overflow-tooltip="true"
|
|
|
width="250"
|
|
|
/>
|
|
|
- <el-table-column
|
|
|
- prop="componentName"
|
|
|
- label="Vue组件Name"
|
|
|
- width="150"
|
|
|
- />
|
|
|
+ <el-table-column prop="componentName" label="Vue组件Name" width="150" />
|
|
|
<el-table-column
|
|
|
prop="activeMenu"
|
|
|
label="高亮菜单"
|
|
|
:show-overflow-tooltip="true"
|
|
|
width="150"
|
|
|
/>
|
|
|
- <el-table-column
|
|
|
- prop="icon"
|
|
|
- label="图标"
|
|
|
- align="center"
|
|
|
- width="100"
|
|
|
- >
|
|
|
+ <el-table-column prop="icon" label="图标" align="center" width="100">
|
|
|
<template slot-scope="scope">
|
|
|
<svg-icon :icon-class="scope.row.icon" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column prop="sort" align="center" label="排序" width="60" />
|
|
|
<el-table-column
|
|
|
- prop="sort"
|
|
|
- align="center"
|
|
|
- label="排序"
|
|
|
- width="60"
|
|
|
+ prop="permission"
|
|
|
+ label="权限标识"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="component"
|
|
|
+ label="组件路径"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
/>
|
|
|
- <el-table-column prop="permission" label="权限标识" :show-overflow-tooltip="true" />
|
|
|
- <el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true" />
|
|
|
<el-table-column prop="status" label="状态" width="80">
|
|
|
<template slot-scope="scope">
|
|
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
|
|
@@ -127,12 +127,7 @@
|
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="操作"
|
|
|
- align="center"
|
|
|
- fixed="right"
|
|
|
- width="200"
|
|
|
- >
|
|
|
+ <el-table-column label="操作" align="center" fixed="right" width="200">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
v-hasPermi="['system:menu:update']"
|
|
|
@@ -140,14 +135,16 @@
|
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
- >修改</el-button>
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
v-hasPermi="['system:menu:create']"
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-plus"
|
|
|
@click="handleAdd(scope.row)"
|
|
|
- >新增</el-button>
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
v-hasPermi="['system:menu:delete']"
|
|
|
size="mini"
|
|
|
@@ -155,24 +152,15 @@
|
|
|
icon="el-icon-delete"
|
|
|
class="text-danger"
|
|
|
@click="handleDelete(scope.row)"
|
|
|
- >删除</el-button>
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
<!-- 添加或修改菜单对话框 -->
|
|
|
- <el-dialog
|
|
|
- :title="title"
|
|
|
- :visible.sync="open"
|
|
|
- width="680px"
|
|
|
- append-to-body
|
|
|
- >
|
|
|
- <el-form
|
|
|
- ref="form"
|
|
|
- :model="form"
|
|
|
- :rules="rules"
|
|
|
- label-width="100px"
|
|
|
- >
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="680px" append-to-body>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
<el-row :gutter="15">
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="上级菜单">
|
|
|
@@ -188,8 +176,13 @@
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="菜单类型" prop="type">
|
|
|
<el-radio-group v-model="form.type">
|
|
|
- <el-radio v-for="dict in menuTypeDictDatas" :key="parseInt(dict.value)" :label="parseInt(dict.value)">
|
|
|
- {{ dict.label }}</el-radio>
|
|
|
+ <el-radio
|
|
|
+ v-for="dict in menuTypeDictDatas"
|
|
|
+ :key="parseInt(dict.value)"
|
|
|
+ :label="parseInt(dict.value)"
|
|
|
+ >
|
|
|
+ {{ dict.label }}</el-radio
|
|
|
+ >
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -213,9 +206,13 @@
|
|
|
slot="prefix"
|
|
|
:icon-class="form.icon"
|
|
|
class="el-input__icon"
|
|
|
- style="height: 32px;width: 16px;"
|
|
|
+ style="height: 32px; width: 16px"
|
|
|
+ />
|
|
|
+ <i
|
|
|
+ v-else
|
|
|
+ slot="prefix"
|
|
|
+ class="el-icon-search el-input__icon"
|
|
|
/>
|
|
|
- <i v-else slot="prefix" class="el-icon-search el-input__icon" />
|
|
|
</el-input>
|
|
|
</el-popover>
|
|
|
</el-form-item>
|
|
|
@@ -238,7 +235,10 @@
|
|
|
<el-col :span="12">
|
|
|
<el-form-item v-if="form.type !== 3" label="路由地址" prop="path">
|
|
|
<span slot="label">
|
|
|
- <el-tooltip content="访问的路由地址,如:`user`。如需外网地址时,则以 `http(s)://` 开头" placement="top">
|
|
|
+ <el-tooltip
|
|
|
+ content="访问的路由地址,如:`user`。如需外网地址时,则以 `http(s)://` 开头"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
<i class="el-icon-question" />
|
|
|
</el-tooltip>
|
|
|
路由地址
|
|
|
@@ -254,47 +254,74 @@
|
|
|
<el-col v-if="form.type === 2" :span="12">
|
|
|
<el-form-item label="组件Name" prop="componentName">
|
|
|
<span slot="label">
|
|
|
- <el-tooltip content="该name为Vue组件中name属性的值,用做页面缓存使用。" placement="top">
|
|
|
+ <el-tooltip
|
|
|
+ content="该name为Vue组件中name属性的值,用做页面缓存使用。"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
<i class="el-icon-question" />
|
|
|
</el-tooltip>
|
|
|
组件Name
|
|
|
</span>
|
|
|
- <el-input v-model="form.componentName" placeholder="请输入组件Name" />
|
|
|
+ <el-input
|
|
|
+ v-model="form.componentName"
|
|
|
+ placeholder="请输入组件Name"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col v-if="form.type === 2" :span="12">
|
|
|
<el-form-item label="高亮菜单" prop="activeMenu">
|
|
|
- <el-input v-model="form.activeMenu" placeholder="请输入高亮菜单Path" />
|
|
|
+ <el-input
|
|
|
+ v-model="form.activeMenu"
|
|
|
+ placeholder="请输入高亮菜单Path"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item v-if="form.type !== 1" label="权限标识">
|
|
|
<span slot="label">
|
|
|
- <el-tooltip content="Controller 方法上的权限字符,如:@PreAuthorize(`@ss.hasPermission('system:user:list')`)" placement="top">
|
|
|
+ <el-tooltip
|
|
|
+ content="Controller 方法上的权限字符,如:@PreAuthorize(`@ss.hasPermission('system:user:list')`)"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
<i class="el-icon-question" />
|
|
|
</el-tooltip>
|
|
|
权限字符
|
|
|
</span>
|
|
|
- <el-input v-model="form.permission" placeholder="请权限标识" maxlength="50" />
|
|
|
+ <el-input
|
|
|
+ v-model="form.permission"
|
|
|
+ placeholder="请权限标识"
|
|
|
+ maxlength="50"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="菜单状态" prop="status">
|
|
|
<span slot="label">
|
|
|
- <el-tooltip content="选择停用时,路由将不会出现在侧边栏,也不能被访问" placement="top">
|
|
|
+ <el-tooltip
|
|
|
+ content="选择停用时,路由将不会出现在侧边栏,也不能被访问"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
<i class="el-icon-question" />
|
|
|
</el-tooltip>
|
|
|
菜单状态
|
|
|
</span>
|
|
|
<el-radio-group v-model="form.status">
|
|
|
- <el-radio v-for="dict in getDictDatas(DICT_TYPE.COMMON_STATUS)" :key="dict.value" :label="parseInt(dict.value)">{{ dict.label }}</el-radio>
|
|
|
+ <el-radio
|
|
|
+ v-for="dict in getDictDatas(DICT_TYPE.COMMON_STATUS)"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="parseInt(dict.value)"
|
|
|
+ >{{ dict.label }}</el-radio
|
|
|
+ >
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item v-if="form.type !== 3" label="显示状态">
|
|
|
<span slot="label">
|
|
|
- <el-tooltip content="选择隐藏时,路由将不会出现在侧边栏,但仍然可以访问" placement="top">
|
|
|
+ <el-tooltip
|
|
|
+ content="选择隐藏时,路由将不会出现在侧边栏,但仍然可以访问"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
<i class="el-icon-question" />
|
|
|
</el-tooltip>
|
|
|
是否显示
|
|
|
@@ -308,7 +335,10 @@
|
|
|
<el-col :span="12">
|
|
|
<el-form-item v-if="form.type === 2" label="显示状态">
|
|
|
<span slot="label">
|
|
|
- <el-tooltip content="选择缓存时,则会被 `keep-alive` 缓存,需要匹配组件的 `name` 和路由地址保持一致" placement="top">
|
|
|
+ <el-tooltip
|
|
|
+ content="选择缓存时,则会被 `keep-alive` 缓存,需要匹配组件的 `name` 和路由地址保持一致"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
<i class="el-icon-question" />
|
|
|
</el-tooltip>
|
|
|
是否缓存
|
|
|
@@ -323,7 +353,11 @@
|
|
|
<!-- 区域选择 -->
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="所属区域" prop="zone">
|
|
|
- <DictSelect v-model="form.zone" placeholder="请选择菜单区域" dict-type="SYS_ZONE" />
|
|
|
+ <DictSelect
|
|
|
+ v-model="form.zone"
|
|
|
+ placeholder="请选择菜单区域"
|
|
|
+ dict-type="SYS_ZONE"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<!-- 业务模型选择 -->
|
|
|
@@ -359,13 +393,24 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col v-if="form.type === 2" :span="12">
|
|
|
+ <el-form-item label="查询页面" prop="queryManageId">
|
|
|
+ <QueryManage
|
|
|
+ ref="queryManage"
|
|
|
+ v-model="form.queryManageId"
|
|
|
+ filterable
|
|
|
+ placeholder="请选择查询页面"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
<el-col :span="12" class="text-right">
|
|
|
<el-button
|
|
|
v-if="form.type === 2"
|
|
|
type="warning"
|
|
|
plain
|
|
|
@click="handleToEncode"
|
|
|
- >编码规则</el-button>
|
|
|
+ >编码规则</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
@@ -377,30 +422,37 @@
|
|
|
|
|
|
<!-- 流程发布 -->
|
|
|
<PublishProcess ref="publishProcess" />
|
|
|
-
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listMenu, getMenu, delMenu, addMenu, updateMenu } from '@/api/system/menu'
|
|
|
-import Treeselect from '@riophae/vue-treeselect'
|
|
|
-import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
-import IconSelect from '@/components/IconSelect'
|
|
|
-import { SystemMenuTypeEnum, CommonStatusEnum } from '@/utils/constants'
|
|
|
-import { getDictDatas, DICT_TYPE } from '@/utils/dict'
|
|
|
-import { isExternal } from '@/utils/validate'
|
|
|
-import ReportSelect from './component/ReportSelect'
|
|
|
-import PublishProcess from './component/PublishProcess.vue'
|
|
|
-import BusinessSelect from './component/BusinessSelect.vue'
|
|
|
+import {
|
|
|
+ listMenu,
|
|
|
+ getMenu,
|
|
|
+ delMenu,
|
|
|
+ addMenu,
|
|
|
+ updateMenu,
|
|
|
+} from "@/api/system/menu";
|
|
|
+import Treeselect from "@riophae/vue-treeselect";
|
|
|
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
+import IconSelect from "@/components/IconSelect";
|
|
|
+import { SystemMenuTypeEnum, CommonStatusEnum } from "@/utils/constants";
|
|
|
+import { getDictDatas, DICT_TYPE } from "@/utils/dict";
|
|
|
+import { isExternal } from "@/utils/validate";
|
|
|
+import ReportSelect from "./component/ReportSelect";
|
|
|
+import QueryManage from "./component/QueryManage";
|
|
|
+import PublishProcess from "./component/PublishProcess.vue";
|
|
|
+import BusinessSelect from "./component/BusinessSelect.vue";
|
|
|
|
|
|
export default {
|
|
|
- name: 'Menu',
|
|
|
+ name: "Menu",
|
|
|
components: {
|
|
|
Treeselect,
|
|
|
IconSelect,
|
|
|
ReportSelect,
|
|
|
+ QueryManage,
|
|
|
PublishProcess,
|
|
|
- BusinessSelect
|
|
|
+ BusinessSelect,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -413,7 +465,7 @@ export default {
|
|
|
// 菜单树选项
|
|
|
menuOptions: [],
|
|
|
// 弹出层标题
|
|
|
- title: '',
|
|
|
+ title: "",
|
|
|
// 是否显示弹出层
|
|
|
open: false,
|
|
|
// 是否展开,默认全部折叠
|
|
|
@@ -423,24 +475,22 @@ export default {
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
name: undefined,
|
|
|
- visible: undefined
|
|
|
+ visible: undefined,
|
|
|
},
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
name: [
|
|
|
- { required: true, message: '菜单名称不能为空', trigger: 'blur' }
|
|
|
+ { required: true, message: "菜单名称不能为空", trigger: "blur" },
|
|
|
],
|
|
|
sort: [
|
|
|
- { required: true, message: '菜单顺序不能为空', trigger: 'blur' }
|
|
|
+ { required: true, message: "菜单顺序不能为空", trigger: "blur" },
|
|
|
],
|
|
|
path: [
|
|
|
- { required: true, message: '路由地址不能为空', trigger: 'blur' }
|
|
|
+ { required: true, message: "路由地址不能为空", trigger: "blur" },
|
|
|
],
|
|
|
- status: [
|
|
|
- { required: true, message: '状态不能为空', trigger: 'blur' }
|
|
|
- ]
|
|
|
+ status: [{ required: true, message: "状态不能为空", trigger: "blur" }],
|
|
|
},
|
|
|
|
|
|
// 枚举
|
|
|
@@ -448,49 +498,49 @@ export default {
|
|
|
CommonStatusEnum: CommonStatusEnum,
|
|
|
// 数据字典
|
|
|
menuTypeDictDatas: getDictDatas(DICT_TYPE.SYSTEM_MENU_TYPE),
|
|
|
- statusDictDatas: getDictDatas(DICT_TYPE.COMMON_STATUS)
|
|
|
- }
|
|
|
+ statusDictDatas: getDictDatas(DICT_TYPE.COMMON_STATUS),
|
|
|
+ };
|
|
|
},
|
|
|
created() {
|
|
|
- this.getList()
|
|
|
+ this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
// 选择图标
|
|
|
selected(name) {
|
|
|
- this.form.icon = name
|
|
|
+ this.form.icon = name;
|
|
|
},
|
|
|
/** 查询菜单列表 */
|
|
|
getList() {
|
|
|
- this.loading = true
|
|
|
- listMenu(this.queryParams).then(response => {
|
|
|
- this.menuList = this.handleTree(response.data, 'id')
|
|
|
- this.loading = false
|
|
|
- })
|
|
|
+ this.loading = true;
|
|
|
+ listMenu(this.queryParams).then((response) => {
|
|
|
+ this.menuList = this.handleTree(response.data, "id");
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
},
|
|
|
/** 转换菜单数据结构 */
|
|
|
normalizer(node) {
|
|
|
if (node.children && !node.children.length) {
|
|
|
- delete node.children
|
|
|
+ delete node.children;
|
|
|
}
|
|
|
return {
|
|
|
id: node.id,
|
|
|
label: node.name,
|
|
|
- children: node.children
|
|
|
- }
|
|
|
+ children: node.children,
|
|
|
+ };
|
|
|
},
|
|
|
/** 查询菜单下拉树结构 */
|
|
|
getTreeselect() {
|
|
|
- listMenu().then(response => {
|
|
|
- this.menuOptions = []
|
|
|
- const menu = { id: 0, name: '主类目', children: [] }
|
|
|
- menu.children = this.handleTree(response.data, 'id')
|
|
|
- this.menuOptions.push(menu)
|
|
|
- })
|
|
|
+ listMenu().then((response) => {
|
|
|
+ this.menuOptions = [];
|
|
|
+ const menu = { id: 0, name: "主类目", children: [] };
|
|
|
+ menu.children = this.handleTree(response.data, "id");
|
|
|
+ this.menuOptions.push(menu);
|
|
|
+ });
|
|
|
},
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
|
- this.open = false
|
|
|
- this.reset()
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
},
|
|
|
// 表单重置
|
|
|
reset() {
|
|
|
@@ -504,101 +554,110 @@ export default {
|
|
|
status: CommonStatusEnum.ENABLE,
|
|
|
visible: true,
|
|
|
keepAlive: true,
|
|
|
- activeMenu: undefined
|
|
|
- }
|
|
|
- this.resetForm('form')
|
|
|
+ activeMenu: undefined,
|
|
|
+ };
|
|
|
+ this.resetForm("form");
|
|
|
},
|
|
|
/** 搜索按钮操作 */
|
|
|
handleQuery() {
|
|
|
- this.getList()
|
|
|
+ this.getList();
|
|
|
},
|
|
|
/** 重置按钮操作 */
|
|
|
resetQuery() {
|
|
|
- this.resetForm('queryForm')
|
|
|
- this.handleQuery()
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.handleQuery();
|
|
|
},
|
|
|
/** 展开/折叠操作 */
|
|
|
toggleExpandAll() {
|
|
|
- this.refreshTable = false
|
|
|
- this.isExpandAll = !this.isExpandAll
|
|
|
+ this.refreshTable = false;
|
|
|
+ this.isExpandAll = !this.isExpandAll;
|
|
|
this.$nextTick(() => {
|
|
|
- this.refreshTable = true
|
|
|
- })
|
|
|
+ this.refreshTable = true;
|
|
|
+ });
|
|
|
},
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd(row) {
|
|
|
- this.reset()
|
|
|
- this.getTreeselect()
|
|
|
+ this.reset();
|
|
|
+ this.getTreeselect();
|
|
|
if (row != null && row.id) {
|
|
|
- this.form.parentId = row.id
|
|
|
+ this.form.parentId = row.id;
|
|
|
} else {
|
|
|
- this.form.parentId = 0
|
|
|
+ this.form.parentId = 0;
|
|
|
}
|
|
|
- this.open = true
|
|
|
- this.title = '添加菜单'
|
|
|
+ this.open = true;
|
|
|
+ this.title = "添加菜单";
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
- this.reset()
|
|
|
- this.getTreeselect()
|
|
|
- getMenu(row.id).then(response => {
|
|
|
- this.form = response.data
|
|
|
- console.log(this.form)
|
|
|
- this.open = true
|
|
|
- this.title = '修改菜单'
|
|
|
- })
|
|
|
+ this.reset();
|
|
|
+ this.getTreeselect();
|
|
|
+ getMenu(row.id).then((response) => {
|
|
|
+ this.form = response.data;
|
|
|
+ console.log(this.form);
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改菜单";
|
|
|
+ });
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
- submitForm: function() {
|
|
|
- this.$refs['form'].validate(valid => {
|
|
|
+ submitForm: function () {
|
|
|
+ this.$refs["form"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
// 若权限类型为目录或者菜单时,进行 path 的校验,避免后续拼接出来的路由无法跳转
|
|
|
- if (this.form.type === SystemMenuTypeEnum.DIR ||
|
|
|
- this.form.type === SystemMenuTypeEnum.MENU) {
|
|
|
+ if (
|
|
|
+ this.form.type === SystemMenuTypeEnum.DIR ||
|
|
|
+ this.form.type === SystemMenuTypeEnum.MENU
|
|
|
+ ) {
|
|
|
// 如果是外链,则不进行校验
|
|
|
- const path = this.form.path
|
|
|
+ const path = this.form.path;
|
|
|
if (!isExternal(path)) {
|
|
|
// 父权限为根节点,path 必须以 / 开头
|
|
|
- if (this.form.parentId === 0 && path.charAt(0) !== '/') {
|
|
|
- this.$modal.msgSuccess('前端必须以 / 开头')
|
|
|
- return
|
|
|
- } else if (this.form.parentId !== 0 && path.charAt(0) === '/') {
|
|
|
- this.$modal.msgSuccess('前端不能以 / 开头')
|
|
|
- return
|
|
|
+ if (this.form.parentId === 0 && path.charAt(0) !== "/") {
|
|
|
+ this.$modal.msgSuccess("前端必须以 / 开头");
|
|
|
+ return;
|
|
|
+ } else if (this.form.parentId !== 0 && path.charAt(0) === "/") {
|
|
|
+ this.$modal.msgSuccess("前端不能以 / 开头");
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 提交
|
|
|
if (this.form.id !== undefined) {
|
|
|
- updateMenu(this.form).then(response => {
|
|
|
- this.$modal.msgSuccess('修改成功')
|
|
|
- this.open = false
|
|
|
- this.getList()
|
|
|
- })
|
|
|
+ updateMenu(this.form).then((response) => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
} else {
|
|
|
- addMenu(this.form).then(response => {
|
|
|
- this.$modal.msgSuccess('新增成功')
|
|
|
- this.open = false
|
|
|
- this.getList()
|
|
|
- })
|
|
|
+ addMenu(this.form).then((response) => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
- this.$modal.confirm('是否确认删除名称为"' + row.name + '"的数据项?').then(function() {
|
|
|
- return delMenu(row.id)
|
|
|
- }).then(() => {
|
|
|
- this.getList()
|
|
|
- this.$modal.msgSuccess('删除成功')
|
|
|
- }).catch(() => {})
|
|
|
+ this.$modal
|
|
|
+ .confirm('是否确认删除名称为"' + row.name + '"的数据项?')
|
|
|
+ .then(function () {
|
|
|
+ return delMenu(row.id);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
// 跳转到编码规则
|
|
|
handleToEncode() {
|
|
|
- this.$router.push({ path: '/system/encode', query: { menuId: this.form.id }})
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+ this.$router.push({
|
|
|
+ path: "/system/encode",
|
|
|
+ query: { menuId: this.form.id },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|