|
|
|
@ -26,8 +26,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
<template v-if="/^\/system+/.test($route.path)">
|
|
|
|
<template v-if="/^\/system+/.test($route.path)">
|
|
|
|
<vxe-modal
|
|
|
|
<vxe-modal
|
|
|
|
transfer
|
|
|
|
|
|
|
|
v-model="isShow"
|
|
|
|
v-model="isShow"
|
|
|
|
|
|
|
|
transfer
|
|
|
|
show-footer
|
|
|
|
show-footer
|
|
|
|
title="快捷菜单"
|
|
|
|
title="快捷菜单"
|
|
|
|
show-confirm-button
|
|
|
|
show-confirm-button
|
|
|
|
@ -55,6 +55,23 @@
|
|
|
|
children: node.children,
|
|
|
|
children: node.children,
|
|
|
|
isDefaultExpanded: true
|
|
|
|
isDefaultExpanded: true
|
|
|
|
})"
|
|
|
|
})"
|
|
|
|
|
|
|
|
@select="treeSelected"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item v-if="moduleMenus.length > 0" label="模块菜单" prop="url">
|
|
|
|
|
|
|
|
<Treeselect
|
|
|
|
|
|
|
|
v-model="form.module_url"
|
|
|
|
|
|
|
|
:disable-branch-nodes="true"
|
|
|
|
|
|
|
|
:options="moduleMenus"
|
|
|
|
|
|
|
|
:multiple="false"
|
|
|
|
|
|
|
|
no-children-text="无子菜单"
|
|
|
|
|
|
|
|
:normalizer="node => ({
|
|
|
|
|
|
|
|
id: /^#+/g.test(node.path) ? node.id : node.path,
|
|
|
|
|
|
|
|
key: node.id,
|
|
|
|
|
|
|
|
label: node.name,
|
|
|
|
|
|
|
|
children: node.children,
|
|
|
|
|
|
|
|
isDefaultExpanded: true
|
|
|
|
|
|
|
|
})"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="排序" prop="sort">
|
|
|
|
<el-form-item label="排序" prop="sort">
|
|
|
|
@ -82,12 +99,13 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import { index as moduleIndex } from '@/api/module'
|
|
|
|
import { index, save, destroy } from '@/api/diyMenu'
|
|
|
|
import { index, save, destroy } from '@/api/diyMenu'
|
|
|
|
import { deepCopy } from '@/utils'
|
|
|
|
import { deepCopy } from '@/utils'
|
|
|
|
import { permissions } from '@/api/me'
|
|
|
|
import { permissions } from '@/api/me'
|
|
|
|
import SvgIcon from '@/components/SvgIcon/index.vue'
|
|
|
|
import SvgIcon from '@/components/SvgIcon/index.vue'
|
|
|
|
import { defaultModalSize } from '@/settings'
|
|
|
|
import { defaultModalSize } from '@/settings'
|
|
|
|
|
|
|
|
import { menu } from '@/api/module'
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: 'QuickMenu',
|
|
|
|
name: 'QuickMenu',
|
|
|
|
components: {
|
|
|
|
components: {
|
|
|
|
@ -110,8 +128,11 @@ export default {
|
|
|
|
myMenus: [],
|
|
|
|
myMenus: [],
|
|
|
|
isShow: false,
|
|
|
|
isShow: false,
|
|
|
|
menus: [],
|
|
|
|
menus: [],
|
|
|
|
|
|
|
|
modules: [],
|
|
|
|
|
|
|
|
moduleMenus: [],
|
|
|
|
form: {
|
|
|
|
form: {
|
|
|
|
url: '',
|
|
|
|
url: '',
|
|
|
|
|
|
|
|
module_url: '',
|
|
|
|
name: '',
|
|
|
|
name: '',
|
|
|
|
sort: '',
|
|
|
|
sort: '',
|
|
|
|
status: '',
|
|
|
|
status: '',
|
|
|
|
@ -132,10 +153,51 @@ export default {
|
|
|
|
computed: {
|
|
|
|
computed: {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
created() {
|
|
|
|
|
|
|
|
this.getModule()
|
|
|
|
this.getMenu()
|
|
|
|
this.getMenu()
|
|
|
|
this.getDiymenu()
|
|
|
|
this.getDiymenu()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
async getModule() {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
const res = await moduleIndex()
|
|
|
|
|
|
|
|
this.modules = res.rows
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
console.error(err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
treeSelected(node) {
|
|
|
|
|
|
|
|
if (!/\//.test(node.path)) {
|
|
|
|
|
|
|
|
const module = this.modules.find(i => i.name === node.path)
|
|
|
|
|
|
|
|
if (module) {
|
|
|
|
|
|
|
|
this.getModuleMenu(module.id)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async getModuleMenu(module_id) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
const res = await menu({
|
|
|
|
|
|
|
|
with_root: 1,
|
|
|
|
|
|
|
|
data_only: 1,
|
|
|
|
|
|
|
|
module_id
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
|
|
const formatMenu = (arr) => {
|
|
|
|
|
|
|
|
arr.forEach(item => {
|
|
|
|
|
|
|
|
if (item.children) {
|
|
|
|
|
|
|
|
item.children.length === 0 ? delete item.children : formatMenu(item.children)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
formatMenu(res)
|
|
|
|
|
|
|
|
this.moduleMenus = res
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
console.error(err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
linkTo(item) {
|
|
|
|
linkTo(item) {
|
|
|
|
if (item.method === 'self') {
|
|
|
|
if (item.method === 'self') {
|
|
|
|
this.$router.push(item.url)
|
|
|
|
this.$router.push(item.url)
|
|
|
|
@ -207,6 +269,9 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
async submit() {
|
|
|
|
async submit() {
|
|
|
|
this.form.image_id = this.fileList[0]?.response?.id
|
|
|
|
this.form.image_id = this.fileList[0]?.response?.id
|
|
|
|
|
|
|
|
if (!/\//.test(this.form.url) && this.form.url && this.form.module_url) {
|
|
|
|
|
|
|
|
this.form.url = `/${this.form.url}?to=${this.form.module_url}`
|
|
|
|
|
|
|
|
}
|
|
|
|
await save(this.form)
|
|
|
|
await save(this.form)
|
|
|
|
this.$message({
|
|
|
|
this.$message({
|
|
|
|
type: 'success',
|
|
|
|
type: 'success',
|
|
|
|
|