fix:修复部分bug
This commit is contained in:
parent
6c958c1363
commit
d8c0694830
@ -106,7 +106,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 删除
|
// 删除
|
||||||
handleDelete (id) {
|
handleDelete (id) {
|
||||||
this.$confirm(`确定对[id=${id}]进行[删除]操作?`, '提示', {
|
this.$confirm(`确定删除该菜单吗?该菜单下面所有内容都将被删除。`, '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
|
|||||||
@ -1,19 +1,41 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:title="!dataForm.id ? '新增' : '编辑'"
|
:title="!dataForm.id ? '新增菜单' : '编辑菜单'"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:visible.sync="visible">
|
:visible.sync="visible"
|
||||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="handleConfirm()" label-width="80px">
|
>
|
||||||
|
<el-form
|
||||||
|
:model="dataForm"
|
||||||
|
:rules="dataRule"
|
||||||
|
ref="dataForm"
|
||||||
|
@keyup.enter.native="handleConfirm()"
|
||||||
|
label-width="80px"
|
||||||
|
>
|
||||||
<el-form-item label="类型" prop="type">
|
<el-form-item label="类型" prop="type">
|
||||||
<el-radio-group v-model="dataForm.type">
|
<el-radio-group v-model="dataForm.type">
|
||||||
<el-radio v-for="(type, index) in dataForm.typeList" :label="index" :key="index">{{ type }}</el-radio>
|
<el-radio
|
||||||
|
v-for="(type, index) in dataForm.typeList"
|
||||||
|
:label="index"
|
||||||
|
:key="index"
|
||||||
|
>{{ type }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="dataForm.typeList[dataForm.type] + '名称'" prop="name">
|
<el-form-item :label="dataForm.typeList[dataForm.type] + '名称'" prop="name">
|
||||||
<el-input v-model="dataForm.name" :placeholder="dataForm.typeList[dataForm.type] + '名称'"></el-input>
|
<el-input
|
||||||
|
maxlength="20"
|
||||||
|
show-word-limit
|
||||||
|
clearable
|
||||||
|
v-model="dataForm.name"
|
||||||
|
:placeholder="dataForm.typeList[dataForm.type] + '名称'"
|
||||||
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="上级菜单" prop="parentName">
|
<el-form-item v-if="dataForm.type !== 0" label="上级菜单" prop="parentName">
|
||||||
<el-popover ref="menuListPopover" placement="bottom-start" trigger="click">
|
<el-popover
|
||||||
|
v-model="visiblePopover"
|
||||||
|
ref="menuListPopover"
|
||||||
|
placement="bottom-start"
|
||||||
|
trigger="click"
|
||||||
|
>
|
||||||
<el-tree
|
<el-tree
|
||||||
:data="menuList"
|
:data="menuList"
|
||||||
:props="menuListTreeProps"
|
:props="menuListTreeProps"
|
||||||
@ -22,41 +44,69 @@
|
|||||||
@current-change="menuListTreeCurrentChangeHandle"
|
@current-change="menuListTreeCurrentChangeHandle"
|
||||||
:default-expand-all="true"
|
:default-expand-all="true"
|
||||||
:highlight-current="true"
|
:highlight-current="true"
|
||||||
:expand-on-click-node="false">
|
:expand-on-click-node="false"
|
||||||
</el-tree>
|
></el-tree>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
<el-input v-model="dataForm.parentName" v-popover:menuListPopover :readonly="true" placeholder="点击选择上级菜单" class="menu-list__input"></el-input>
|
<el-input
|
||||||
|
v-model="dataForm.parentName"
|
||||||
|
v-popover:menuListPopover
|
||||||
|
:readonly="true"
|
||||||
|
placeholder="点击选择上级菜单"
|
||||||
|
class="menu-list__input"
|
||||||
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="dataForm.type === 1" label="菜单路由" prop="url">
|
<el-form-item v-if="dataForm.type === 1" label="菜单URL" prop="url">
|
||||||
<el-input v-model="dataForm.url" placeholder="菜单路由"></el-input>
|
<el-input
|
||||||
</el-form-item>
|
type="textarea"
|
||||||
<el-form-item v-if="dataForm.type !== 0" label="授权标识" prop="perms">
|
maxlength="100"
|
||||||
<el-input v-model="dataForm.perms" placeholder="多个用逗号分隔, 如: user:list,user:create"></el-input>
|
show-word-limit
|
||||||
|
v-model="dataForm.url"
|
||||||
|
placeholder="菜单URL"
|
||||||
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="dataForm.type !== 2" label="排序号" prop="orderNum">
|
<el-form-item v-if="dataForm.type !== 2" label="排序号" prop="orderNum">
|
||||||
<el-input-number v-model="dataForm.orderNum" controls-position="right" :min="0" label="排序号"></el-input-number>
|
<el-input-number v-model="dataForm.orderNum" controls-position="right" :min="0" label="排序号"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item v-if="dataForm.type !== 2" label="菜单图标" prop="icon">
|
<el-form-item v-if="dataForm.type !== 2" label="菜单图标" prop="icon">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="22">
|
<el-col :span="22">
|
||||||
<el-popover ref="iconListPopover" placement="bottom-start" trigger="click" popper-class="mod-menu__icon-popover">
|
<el-popover
|
||||||
|
ref="iconListPopover"
|
||||||
|
placement="bottom-start"
|
||||||
|
trigger="click"
|
||||||
|
popper-class="mod-menu__icon-popover"
|
||||||
|
>
|
||||||
<div class="mod-menu__icon-inner">
|
<div class="mod-menu__icon-inner">
|
||||||
<div class="mod-menu__icon-list">
|
<div class="mod-menu__icon-list">
|
||||||
<el-button
|
<el-button
|
||||||
v-for="(item, index) in iconList"
|
v-for="(item, index) in iconList"
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="iconActiveHandle(item)"
|
@click="iconActiveHandle(item)"
|
||||||
:class="{ 'is-active': item === dataForm.icon }">
|
:class="{ 'is-active': item === dataForm.icon }"
|
||||||
|
>
|
||||||
<icon-svg :name="item"></icon-svg>
|
<icon-svg :name="item"></icon-svg>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
<el-input v-model="dataForm.icon" v-popover:iconListPopover :readonly="true" placeholder="菜单图标名称" class="icon-list__input"></el-input>
|
<el-input
|
||||||
|
v-model="dataForm.icon"
|
||||||
|
v-popover:iconListPopover
|
||||||
|
:readonly="true"
|
||||||
|
placeholder="菜单图标名称"
|
||||||
|
class="icon-list__input"
|
||||||
|
></el-input>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="2" class="icon-list__tips">
|
<el-col :span="2" class="icon-list__tips">
|
||||||
<el-tooltip placement="top" effect="light">
|
<el-tooltip placement="top" effect="light">
|
||||||
<div slot="content">全站推荐使用SVG Sprite, 详细请参考:<a href="//github.com/daxiongYang/renren-fast-vue/blob/master/src/icons/index.js" target="_blank">icons/index.js</a>描述</div>
|
<div slot="content">
|
||||||
|
全站推荐使用SVG Sprite, 详细请参考:
|
||||||
|
<a
|
||||||
|
href="//github.com/daxiongYang/renren-fast-vue/blob/master/src/icons/index.js"
|
||||||
|
target="_blank"
|
||||||
|
>icons/index.js</a>描述
|
||||||
|
</div>
|
||||||
<i class="el-icon-warning"></i>
|
<i class="el-icon-warning"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -86,6 +136,7 @@
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
visible: false,
|
visible: false,
|
||||||
|
visiblePopover: false,
|
||||||
dataForm: {
|
dataForm: {
|
||||||
id: 0,
|
id: 0,
|
||||||
type: 1,
|
type: 1,
|
||||||
@ -94,7 +145,6 @@
|
|||||||
parentId: 0,
|
parentId: 0,
|
||||||
parentName: '',
|
parentName: '',
|
||||||
url: '',
|
url: '',
|
||||||
perms: '',
|
|
||||||
orderNum: 0,
|
orderNum: 0,
|
||||||
icon: '',
|
icon: '',
|
||||||
iconList: []
|
iconList: []
|
||||||
@ -118,8 +168,8 @@
|
|||||||
methods: {
|
methods: {
|
||||||
init (id) {
|
init (id) {
|
||||||
this.handleGetSysMenuSelect()
|
this.handleGetSysMenuSelect()
|
||||||
if (id) {
|
|
||||||
this.dataForm.id = id || 0
|
this.dataForm.id = id || 0
|
||||||
|
if (id) {
|
||||||
this.apiType = '/update'
|
this.apiType = '/update'
|
||||||
this.handleEdit()
|
this.handleEdit()
|
||||||
} else { // 新增
|
} else { // 新增
|
||||||
@ -145,7 +195,6 @@
|
|||||||
this.dataForm.name = res.menu.name
|
this.dataForm.name = res.menu.name
|
||||||
this.dataForm.parentId = res.menu.parentId
|
this.dataForm.parentId = res.menu.parentId
|
||||||
this.dataForm.url = res.menu.url
|
this.dataForm.url = res.menu.url
|
||||||
this.dataForm.perms = res.menu.perms
|
|
||||||
this.dataForm.orderNum = res.menu.orderNum
|
this.dataForm.orderNum = res.menu.orderNum
|
||||||
this.dataForm.icon = res.menu.icon
|
this.dataForm.icon = res.menu.icon
|
||||||
this.menuListTreeSetCurrentNode()
|
this.menuListTreeSetCurrentNode()
|
||||||
@ -161,7 +210,6 @@
|
|||||||
'name': this.dataForm.name,
|
'name': this.dataForm.name,
|
||||||
'parentId': this.dataForm.parentId,
|
'parentId': this.dataForm.parentId,
|
||||||
'url': this.dataForm.url,
|
'url': this.dataForm.url,
|
||||||
'perms': this.dataForm.perms,
|
|
||||||
'orderNum': this.dataForm.orderNum,
|
'orderNum': this.dataForm.orderNum,
|
||||||
'icon': this.dataForm.icon
|
'icon': this.dataForm.icon
|
||||||
}
|
}
|
||||||
@ -187,6 +235,7 @@
|
|||||||
menuListTreeCurrentChangeHandle (data, node) {
|
menuListTreeCurrentChangeHandle (data, node) {
|
||||||
this.dataForm.parentId = data.menuId
|
this.dataForm.parentId = data.menuId
|
||||||
this.dataForm.parentName = data.name
|
this.dataForm.parentName = data.name
|
||||||
|
this.visiblePopover = false
|
||||||
},
|
},
|
||||||
// 菜单树设置当前选中节点
|
// 菜单树设置当前选中节点
|
||||||
menuListTreeSetCurrentNode () {
|
menuListTreeSetCurrentNode () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user