Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev
Conflicts: ruoyi-admin/src/main/resources/application-prod.yml ruoyi-generator/src/main/resources/vm/java/controller.java.vm ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm ruoyi-ui/src/assets/styles/ruoyi.scss ruoyi-ui/src/assets/styles/sidebar.scss ruoyi-ui/src/layout/components/Navbar.vue ruoyi-ui/src/layout/components/Settings/index.vue ruoyi-ui/src/layout/components/TagsView/index.vue ruoyi-ui/src/settings.js ruoyi-ui/src/store/getters.js ruoyi-ui/src/store/modules/permission.js ruoyi-ui/src/store/modules/settings.js ruoyi-ui/src/store/modules/tagsView.js ruoyi-ui/src/views/monitor/druid/index.vue
This commit is contained in:
commit
f093da99ec
|
@ -43,7 +43,7 @@ spring:
|
||||||
allow:
|
allow:
|
||||||
url-pattern: /druid/*
|
url-pattern: /druid/*
|
||||||
# 控制台管理用户名和密码
|
# 控制台管理用户名和密码
|
||||||
login-username: admin
|
login-username: ruoyi
|
||||||
login-password: 123456
|
login-password: 123456
|
||||||
filter:
|
filter:
|
||||||
stat:
|
stat:
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class ${ClassName}Controller extends BaseController {
|
||||||
public AjaxResult<${ClassName}Vo> export(${ClassName}QueryBo bo) {
|
public AjaxResult<${ClassName}Vo> export(${ClassName}QueryBo bo) {
|
||||||
List<${ClassName}Vo> list = i${ClassName}Service.queryList(bo);
|
List<${ClassName}Vo> list = i${ClassName}Service.queryList(bo);
|
||||||
ExcelUtil<${ClassName}Vo> util = new ExcelUtil<${ClassName}Vo>(${ClassName}Vo.class);
|
ExcelUtil<${ClassName}Vo> util = new ExcelUtil<${ClassName}Vo>(${ClassName}Vo.class);
|
||||||
return util.exportExcel(list, "${businessName}" );
|
return util.exportExcel(list, "${businessName}数据" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -176,6 +176,12 @@
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* submenu item */
|
||||||
|
.el-menu--horizontal > .el-submenu .el-submenu__title {
|
||||||
|
height: 50px !important;
|
||||||
|
line-height: 50px !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* text color */
|
/* text color */
|
||||||
.text-navy {
|
.text-navy {
|
||||||
color: #1ab394;
|
color: #1ab394;
|
||||||
|
|
|
@ -135,9 +135,6 @@
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-submenu__icon-arrow {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-upload
|
||||||
|
:action="uploadUrl"
|
||||||
|
:on-success="handleUploadSuccess"
|
||||||
|
:on-error="handleUploadError"
|
||||||
|
name="file"
|
||||||
|
:show-file-list="false"
|
||||||
|
:headers="headers"
|
||||||
|
style="display: none"
|
||||||
|
ref="upload"
|
||||||
|
v-if="this.uploadUrl"
|
||||||
|
>
|
||||||
|
</el-upload>
|
||||||
<div class="editor" ref="editor" :style="styles"></div>
|
<div class="editor" ref="editor" :style="styles"></div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -7,6 +21,7 @@ import Quill from "quill";
|
||||||
import "quill/dist/quill.core.css";
|
import "quill/dist/quill.core.css";
|
||||||
import "quill/dist/quill.snow.css";
|
import "quill/dist/quill.snow.css";
|
||||||
import "quill/dist/quill.bubble.css";
|
import "quill/dist/quill.bubble.css";
|
||||||
|
import { getToken } from "@/utils/auth";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Editor",
|
name: "Editor",
|
||||||
|
@ -30,10 +45,18 @@ export default {
|
||||||
readOnly: {
|
readOnly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
|
},
|
||||||
|
/* 上传地址 */
|
||||||
|
uploadUrl: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
headers: {
|
||||||
|
Authorization: "Bearer " + getToken()
|
||||||
|
},
|
||||||
Quill: null,
|
Quill: null,
|
||||||
currentValue: "",
|
currentValue: "",
|
||||||
options: {
|
options: {
|
||||||
|
@ -52,7 +75,7 @@ export default {
|
||||||
[{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色
|
[{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色
|
||||||
[{ align: [] }], // 对齐方式
|
[{ align: [] }], // 对齐方式
|
||||||
["clean"], // 清除文本格式
|
["clean"], // 清除文本格式
|
||||||
["link", "image", "video"] // 链接、图片、视频
|
["link", "image"] // 链接、图片
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
placeholder: "请输入内容",
|
placeholder: "请输入内容",
|
||||||
|
@ -95,6 +118,26 @@ export default {
|
||||||
init() {
|
init() {
|
||||||
const editor = this.$refs.editor;
|
const editor = this.$refs.editor;
|
||||||
this.Quill = new Quill(editor, this.options);
|
this.Quill = new Quill(editor, this.options);
|
||||||
|
// 如果设置了上传地址则自定义图片上传事件
|
||||||
|
if (this.uploadUrl) {
|
||||||
|
let toolbar = this.Quill.getModule("toolbar");
|
||||||
|
toolbar.addHandler("image", (value) => {
|
||||||
|
this.uploadType = "image";
|
||||||
|
if (value) {
|
||||||
|
this.$refs.upload.$children[0].$refs.input.click();
|
||||||
|
} else {
|
||||||
|
this.quill.format("image", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toolbar.addHandler("video", (value) => {
|
||||||
|
this.uploadType = "video";
|
||||||
|
if (value) {
|
||||||
|
this.$refs.upload.$children[0].$refs.input.click();
|
||||||
|
} else {
|
||||||
|
this.quill.format("video", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
this.Quill.pasteHTML(this.currentValue);
|
this.Quill.pasteHTML(this.currentValue);
|
||||||
this.Quill.on("text-change", (delta, oldDelta, source) => {
|
this.Quill.on("text-change", (delta, oldDelta, source) => {
|
||||||
const html = this.$refs.editor.children[0].innerHTML;
|
const html = this.$refs.editor.children[0].innerHTML;
|
||||||
|
@ -114,13 +157,31 @@ export default {
|
||||||
this.$emit("on-editor-change", eventName, ...args);
|
this.$emit("on-editor-change", eventName, ...args);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleUploadSuccess(res, file) {
|
||||||
|
// 获取富文本组件实例
|
||||||
|
let quill = this.Quill;
|
||||||
|
// 如果上传成功
|
||||||
|
if (res.code == 200) {
|
||||||
|
// 获取光标所在位置
|
||||||
|
let length = quill.getSelection().index;
|
||||||
|
// 插入图片 res.url为服务器返回的图片地址
|
||||||
|
quill.insertEmbed(length, "image", res.url);
|
||||||
|
// 调整光标到最后
|
||||||
|
quill.setSelection(length + 1);
|
||||||
|
} else {
|
||||||
|
this.$message.error("图片插入失败");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleUploadError() {
|
||||||
|
this.$message.error("图片插入失败");
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.editor, .ql-toolbar {
|
.editor, .ql-toolbar {
|
||||||
white-space: pre-wrap!important;
|
white-space: pre-wrap !important;
|
||||||
line-height: normal !important;
|
line-height: normal !important;
|
||||||
}
|
}
|
||||||
.quill-img {
|
.quill-img {
|
||||||
|
|
|
@ -0,0 +1,154 @@
|
||||||
|
<template>
|
||||||
|
<el-menu
|
||||||
|
:default-active="activeMenu"
|
||||||
|
mode="horizontal"
|
||||||
|
@select="handleSelect"
|
||||||
|
>
|
||||||
|
<template v-for="(item, index) in topMenus">
|
||||||
|
<el-menu-item :index="item.path" :key="index" v-if="index < visibleNumber"
|
||||||
|
><svg-icon :icon-class="item.meta.icon" />
|
||||||
|
{{ item.meta.title }}</el-menu-item
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 顶部菜单超出数量折叠 -->
|
||||||
|
<el-submenu index="more" v-if="topMenus.length > visibleNumber">
|
||||||
|
<template slot="title">更多菜单</template>
|
||||||
|
<template v-for="(item, index) in topMenus">
|
||||||
|
<el-menu-item
|
||||||
|
:index="item.path"
|
||||||
|
:key="index"
|
||||||
|
v-if="index >= visibleNumber"
|
||||||
|
><svg-icon :icon-class="item.meta.icon" />
|
||||||
|
{{ item.meta.title }}</el-menu-item
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-submenu>
|
||||||
|
</el-menu>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { constantRoutes } from "@/router";
|
||||||
|
|
||||||
|
// 不需要激活的路由
|
||||||
|
const noactiveList = ["/user/profile", "/dict/type", "/gen/edit", "/job/log"];
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 顶部栏初始数
|
||||||
|
visibleNumber: 5,
|
||||||
|
// 是否为首次加载
|
||||||
|
isFrist: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 顶部显示菜单
|
||||||
|
topMenus() {
|
||||||
|
let topMenus = [];
|
||||||
|
this.routers.map((menu) => {
|
||||||
|
if (menu.hidden !== true) {
|
||||||
|
topMenus.push(menu);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return topMenus;
|
||||||
|
},
|
||||||
|
// 所有的路由信息
|
||||||
|
routers() {
|
||||||
|
return this.$store.state.permission.topbarRouters;
|
||||||
|
},
|
||||||
|
// 设置子路由
|
||||||
|
childrenMenus() {
|
||||||
|
var childrenMenus = [];
|
||||||
|
this.routers.map((router) => {
|
||||||
|
for (var item in router.children) {
|
||||||
|
if (router.children[item].parentPath === undefined) {
|
||||||
|
router.children[item].path = router.path + "/" + router.children[item].path;
|
||||||
|
router.children[item].parentPath = router.path;
|
||||||
|
}
|
||||||
|
childrenMenus.push(router.children[item]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return constantRoutes.concat(childrenMenus);
|
||||||
|
},
|
||||||
|
// 默认激活的菜单
|
||||||
|
activeMenu() {
|
||||||
|
const path = this.$route.path;
|
||||||
|
let activePath = this.routers[0].path;
|
||||||
|
var noactive = noactiveList.some(function (item) {
|
||||||
|
return path.indexOf(item) !== -1;
|
||||||
|
});
|
||||||
|
if (noactive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (path.lastIndexOf("/") > 0) {
|
||||||
|
const tmpPath = path.substring(1, path.length);
|
||||||
|
activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"));
|
||||||
|
} else if ("/index" == path || "" == path) {
|
||||||
|
if (!this.isFrist) {
|
||||||
|
this.isFrist = true;
|
||||||
|
} else {
|
||||||
|
activePath = "index";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.activeRoutes(activePath);
|
||||||
|
return activePath;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
beforeMount() {
|
||||||
|
window.addEventListener('resize', this.setVisibleNumber)
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
window.removeEventListener('resize', this.setVisibleNumber)
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.setVisibleNumber();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 根据宽度计算设置显示栏数
|
||||||
|
setVisibleNumber() {
|
||||||
|
const width = document.body.getBoundingClientRect().width / 3;
|
||||||
|
this.visibleNumber = parseInt(width / 85);
|
||||||
|
},
|
||||||
|
// 菜单选择事件
|
||||||
|
handleSelect(key, keyPath) {
|
||||||
|
if (key.indexOf("http://") !== -1 || key.indexOf("https://") !== -1) {
|
||||||
|
// http(s):// 路径新窗口打开
|
||||||
|
window.open(key, "_blank");
|
||||||
|
} else {
|
||||||
|
this.activeRoutes(key);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 当前激活的路由
|
||||||
|
activeRoutes(key) {
|
||||||
|
var routes = [];
|
||||||
|
if (this.childrenMenus && this.childrenMenus.length > 0) {
|
||||||
|
this.childrenMenus.map((item) => {
|
||||||
|
if (key == item.parentPath || (key == "index" && "" == item.path)) {
|
||||||
|
routes.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.$store.commit("SET_SIDEBAR_ROUTERS", routes);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.el-menu--horizontal > .el-menu-item {
|
||||||
|
float: left;
|
||||||
|
height: 50px;
|
||||||
|
line-height: 50px;
|
||||||
|
margin: 0;
|
||||||
|
border-bottom: 3px solid transparent;
|
||||||
|
color: #999093;
|
||||||
|
padding: 0 5px;
|
||||||
|
margin: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-menu--horizontal > .el-menu-item.is-active {
|
||||||
|
border-bottom: 3px solid #409eff;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -2,7 +2,8 @@
|
||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
||||||
|
|
||||||
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
|
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/>
|
||||||
|
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/>
|
||||||
|
|
||||||
<div class="right-menu">
|
<div class="right-menu">
|
||||||
<template v-if="device!=='mobile'">
|
<template v-if="device!=='mobile'">
|
||||||
|
@ -48,6 +49,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import Breadcrumb from '@/components/Breadcrumb'
|
import Breadcrumb from '@/components/Breadcrumb'
|
||||||
|
import TopNav from '@/components/TopNav'
|
||||||
import Hamburger from '@/components/Hamburger'
|
import Hamburger from '@/components/Hamburger'
|
||||||
import Screenfull from '@/components/Screenfull'
|
import Screenfull from '@/components/Screenfull'
|
||||||
import SizeSelect from '@/components/SizeSelect'
|
import SizeSelect from '@/components/SizeSelect'
|
||||||
|
@ -58,6 +60,7 @@ import RuoYiDoc from '@/components/RuoYi/Doc'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Breadcrumb,
|
Breadcrumb,
|
||||||
|
TopNav,
|
||||||
Hamburger,
|
Hamburger,
|
||||||
Screenfull,
|
Screenfull,
|
||||||
SizeSelect,
|
SizeSelect,
|
||||||
|
@ -81,6 +84,11 @@ export default {
|
||||||
value: val
|
value: val
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
topNav: {
|
||||||
|
get() {
|
||||||
|
return this.$store.state.settings.topNav
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -127,6 +135,11 @@ export default {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.topmenu-container {
|
||||||
|
position: absolute;
|
||||||
|
left: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
.errLog-container {
|
.errLog-container {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
|
|
|
@ -41,6 +41,11 @@
|
||||||
<el-divider/>
|
<el-divider/>
|
||||||
|
|
||||||
<h3 class="drawer-title">系统布局配置</h3>
|
<h3 class="drawer-title">系统布局配置</h3>
|
||||||
|
|
||||||
|
<div class="drawer-item">
|
||||||
|
<span>开启 TopNav</span>
|
||||||
|
<el-switch v-model="topNav" class="drawer-switch" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="drawer-item">
|
<div class="drawer-item">
|
||||||
<span>开启 Tags-Views</span>
|
<span>开启 Tags-Views</span>
|
||||||
|
@ -57,6 +62,10 @@
|
||||||
<el-switch v-model="sidebarLogo" class="drawer-switch" />
|
<el-switch v-model="sidebarLogo" class="drawer-switch" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<el-divider/>
|
||||||
|
|
||||||
|
<el-button size="small" type="primary" plain icon="el-icon-document-add" @click="saveSetting">保存配置</el-button>
|
||||||
|
<el-button size="small" plain icon="el-icon-refresh" @click="resetSetting">重置配置</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -67,15 +76,14 @@ import ThemePicker from '@/components/ThemePicker'
|
||||||
export default {
|
export default {
|
||||||
components: { ThemePicker },
|
components: { ThemePicker },
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {
|
||||||
|
sideTheme: this.$store.state.settings.sideTheme
|
||||||
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
theme() {
|
theme() {
|
||||||
return this.$store.state.settings.theme
|
return this.$store.state.settings.theme
|
||||||
},
|
},
|
||||||
sideTheme() {
|
|
||||||
return this.$store.state.settings.sideTheme
|
|
||||||
},
|
|
||||||
fixedHeader: {
|
fixedHeader: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.state.settings.fixedHeader
|
return this.$store.state.settings.fixedHeader
|
||||||
|
@ -87,6 +95,20 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
topNav: {
|
||||||
|
get() {
|
||||||
|
return this.$store.state.settings.topNav
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.$store.dispatch('settings/changeSetting', {
|
||||||
|
key: 'topNav',
|
||||||
|
value: val
|
||||||
|
})
|
||||||
|
if (!val) {
|
||||||
|
this.$store.commit("SET_SIDEBAR_ROUTERS", this.$store.state.permission.defaultRoutes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
tagsView: {
|
tagsView: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.state.settings.tagsView
|
return this.$store.state.settings.tagsView
|
||||||
|
@ -122,6 +144,38 @@ export default {
|
||||||
key: 'sideTheme',
|
key: 'sideTheme',
|
||||||
value: val
|
value: val
|
||||||
})
|
})
|
||||||
|
this.sideTheme = val;
|
||||||
|
},
|
||||||
|
saveSetting() {
|
||||||
|
const loading = this.$loading({
|
||||||
|
lock: true,
|
||||||
|
fullscreen: false,
|
||||||
|
text: "正在保存到本地,请稍后...",
|
||||||
|
spinner: "el-icon-loading",
|
||||||
|
background: "rgba(0, 0, 0, 0.7)"
|
||||||
|
});
|
||||||
|
localStorage.setItem(
|
||||||
|
"layout-setting",
|
||||||
|
`{
|
||||||
|
"topNav":${this.topNav},
|
||||||
|
"tagsView":${this.tagsView},
|
||||||
|
"fixedHeader":${this.fixedHeader},
|
||||||
|
"sidebarLogo":${this.sidebarLogo},
|
||||||
|
"sideTheme":"${this.sideTheme}"
|
||||||
|
}`
|
||||||
|
);
|
||||||
|
setTimeout(loading.close(), 1000)
|
||||||
|
},
|
||||||
|
resetSetting() {
|
||||||
|
this.$loading({
|
||||||
|
lock: true,
|
||||||
|
fullscreen: false,
|
||||||
|
text: "正在清除设置缓存并刷新,请稍后...",
|
||||||
|
spinner: "el-icon-loading",
|
||||||
|
background: "rgba(0, 0, 0, 0.7)"
|
||||||
|
});
|
||||||
|
localStorage.removeItem("layout-setting")
|
||||||
|
setTimeout("window.location.reload()", 1000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
<li @click="refreshSelectedTag(selectedTag)">刷新页面</li>
|
<li @click="refreshSelectedTag(selectedTag)">刷新页面</li>
|
||||||
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">关闭当前</li>
|
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">关闭当前</li>
|
||||||
<li @click="closeOthersTags">关闭其他</li>
|
<li @click="closeOthersTags">关闭其他</li>
|
||||||
|
<li v-if="!isLastView()" @click="closeRightTags">关闭右侧</li>
|
||||||
<li @click="closeAllTags(selectedTag)">关闭所有</li>
|
<li @click="closeAllTags(selectedTag)">关闭所有</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -83,6 +84,13 @@ export default {
|
||||||
isAffix(tag) {
|
isAffix(tag) {
|
||||||
return tag.meta && tag.meta.affix
|
return tag.meta && tag.meta.affix
|
||||||
},
|
},
|
||||||
|
isLastView() {
|
||||||
|
try {
|
||||||
|
return this.selectedTag.fullPath === this.visitedViews[this.visitedViews.length - 1].fullPath
|
||||||
|
} catch (err) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
filterAffixTags(routes, basePath = '/') {
|
filterAffixTags(routes, basePath = '/') {
|
||||||
let tags = []
|
let tags = []
|
||||||
routes.forEach(route => {
|
routes.forEach(route => {
|
||||||
|
@ -152,6 +160,13 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
closeRightTags() {
|
||||||
|
this.$store.dispatch('tagsView/delRightTags', this.selectedTag).then(visitedViews => {
|
||||||
|
if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
|
||||||
|
this.toLastView(visitedViews)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
closeOthersTags() {
|
closeOthersTags() {
|
||||||
this.$router.push(this.selectedTag).catch(()=>{});
|
this.$router.push(this.selectedTag).catch(()=>{});
|
||||||
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
|
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
|
||||||
|
|
|
@ -11,6 +11,11 @@ module.exports = {
|
||||||
*/
|
*/
|
||||||
showSettings: false,
|
showSettings: false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否显示顶部导航
|
||||||
|
*/
|
||||||
|
topNav: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否显示 tagsView
|
* 是否显示 tagsView
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,6 +11,8 @@ const getters = {
|
||||||
roles: state => state.user.roles,
|
roles: state => state.user.roles,
|
||||||
permissions: state => state.user.permissions,
|
permissions: state => state.user.permissions,
|
||||||
permission_routes: state => state.permission.routes,
|
permission_routes: state => state.permission.routes,
|
||||||
|
topbarRouters:state => state.permission.topbarRouters,
|
||||||
|
defaultRoutes:state => state.permission.defaultRoutes,
|
||||||
sidebarRouters:state => state.permission.sidebarRouters,
|
sidebarRouters:state => state.permission.sidebarRouters,
|
||||||
}
|
}
|
||||||
export default getters
|
export default getters
|
||||||
|
|
|
@ -7,6 +7,8 @@ const permission = {
|
||||||
state: {
|
state: {
|
||||||
routes: [],
|
routes: [],
|
||||||
addRoutes: [],
|
addRoutes: [],
|
||||||
|
defaultRoutes: [],
|
||||||
|
topbarRouters: [],
|
||||||
sidebarRouters: []
|
sidebarRouters: []
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
@ -14,8 +16,19 @@ const permission = {
|
||||||
state.addRoutes = routes
|
state.addRoutes = routes
|
||||||
state.routes = constantRoutes.concat(routes)
|
state.routes = constantRoutes.concat(routes)
|
||||||
},
|
},
|
||||||
SET_SIDEBAR_ROUTERS: (state, routers) => {
|
SET_DEFAULT_ROUTES: (state, routes) => {
|
||||||
state.sidebarRouters = constantRoutes.concat(routers)
|
state.defaultRoutes = constantRoutes.concat(routes)
|
||||||
|
},
|
||||||
|
SET_TOPBAR_ROUTES: (state, routes) => {
|
||||||
|
// 顶部导航菜单默认添加统计报表栏指向首页
|
||||||
|
const index = [{
|
||||||
|
path: 'index',
|
||||||
|
meta: { title: '统计报表', icon: 'dashboard'}
|
||||||
|
}]
|
||||||
|
state.topbarRouters = routes.concat(index);
|
||||||
|
},
|
||||||
|
SET_SIDEBAR_ROUTERS: (state, routes) => {
|
||||||
|
state.sidebarRouters = routes
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -30,7 +43,9 @@ const permission = {
|
||||||
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
|
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
|
||||||
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
|
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
|
||||||
commit('SET_ROUTES', rewriteRoutes)
|
commit('SET_ROUTES', rewriteRoutes)
|
||||||
commit('SET_SIDEBAR_ROUTERS', sidebarRoutes)
|
commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes))
|
||||||
|
commit('SET_DEFAULT_ROUTES', sidebarRoutes)
|
||||||
|
commit('SET_TOPBAR_ROUTES', sidebarRoutes)
|
||||||
resolve(rewriteRoutes)
|
resolve(rewriteRoutes)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
import variables from '@/assets/styles/element-variables.scss'
|
import variables from '@/assets/styles/element-variables.scss'
|
||||||
import defaultSettings from '@/settings'
|
import defaultSettings from '@/settings'
|
||||||
|
|
||||||
const { sideTheme, showSettings, tagsView, fixedHeader, sidebarLogo } = defaultSettings
|
const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo } = defaultSettings
|
||||||
|
|
||||||
|
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
|
||||||
const state = {
|
const state = {
|
||||||
theme: variables.theme,
|
theme: variables.theme,
|
||||||
sideTheme: sideTheme,
|
sideTheme: storageSetting.sideTheme || sideTheme,
|
||||||
showSettings: showSettings,
|
showSettings: showSettings,
|
||||||
tagsView: tagsView,
|
topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav,
|
||||||
fixedHeader: fixedHeader,
|
tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView,
|
||||||
sidebarLogo: sidebarLogo
|
fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
|
||||||
|
sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo
|
||||||
}
|
}
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
CHANGE_SETTING: (state, { key, value }) => {
|
CHANGE_SETTING: (state, { key, value }) => {
|
||||||
if (state.hasOwnProperty(key)) {
|
if (state.hasOwnProperty(key)) {
|
||||||
|
|
|
@ -62,6 +62,23 @@ const mutations = {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
DEL_RIGHT_VIEWS: (state, view) => {
|
||||||
|
const index = state.visitedViews.findIndex(v => v.path === view.path)
|
||||||
|
if (index === -1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
state.visitedViews = state.visitedViews.filter((item, idx) => {
|
||||||
|
if (idx <= index || (item.meta && item.meta.affix)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
const i = state.cachedViews.indexOf(item.name)
|
||||||
|
if (i > -1) {
|
||||||
|
state.cachedViews.splice(i, 1)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,6 +165,13 @@ const actions = {
|
||||||
|
|
||||||
updateVisitedView({ commit }, view) {
|
updateVisitedView({ commit }, view) {
|
||||||
commit('UPDATE_VISITED_VIEW', view)
|
commit('UPDATE_VISITED_VIEW', view)
|
||||||
|
},
|
||||||
|
|
||||||
|
delRightTags({ commit }, view) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
commit('DEL_RIGHT_VIEWS', view)
|
||||||
|
resolve([...state.visitedViews])
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ export function addDateRange(params, dateRange, propName) {
|
||||||
var search = params;
|
var search = params;
|
||||||
search.params = {};
|
search.params = {};
|
||||||
if (null != dateRange && '' != dateRange) {
|
if (null != dateRange && '' != dateRange) {
|
||||||
if (typeof(propName) === "undefined") {
|
if (typeof (propName) === "undefined") {
|
||||||
search.params["beginTime"] = dateRange[0];
|
search.params["beginTime"] = dateRange[0];
|
||||||
search.params["endTime"] = dateRange[1];
|
search.params["endTime"] = dateRange[1];
|
||||||
} else {
|
} else {
|
||||||
|
@ -129,24 +129,47 @@ export function praseStrEmpty(str) {
|
||||||
* @param {*} id id字段 默认 'id'
|
* @param {*} id id字段 默认 'id'
|
||||||
* @param {*} parentId 父节点字段 默认 'parentId'
|
* @param {*} parentId 父节点字段 默认 'parentId'
|
||||||
* @param {*} children 孩子节点字段 默认 'children'
|
* @param {*} children 孩子节点字段 默认 'children'
|
||||||
* @param {*} rootId 根Id 默认 0
|
|
||||||
*/
|
*/
|
||||||
export function handleTree(data, id, parentId, children, rootId) {
|
export function handleTree(data, id, parentId, children) {
|
||||||
id = id || 'id'
|
let config = {
|
||||||
parentId = parentId || 'parentId'
|
id: id || 'id',
|
||||||
children = children || 'children'
|
parentId: parentId || 'parentId',
|
||||||
rootId = rootId || Math.min.apply(Math, data.map(item => { return item[parentId] })) || 0
|
childrenList: children || 'children'
|
||||||
//对源数据深度克隆
|
};
|
||||||
const cloneData = JSON.parse(JSON.stringify(data))
|
|
||||||
//循环所有项
|
var childrenListMap = {};
|
||||||
const treeData = cloneData.filter(father => {
|
var nodeIds = {};
|
||||||
let branchArr = cloneData.filter(child => {
|
var tree = [];
|
||||||
//返回每一项的子级数组
|
|
||||||
return father[id] === child[parentId]
|
for (let d of data) {
|
||||||
});
|
let parentId = d[config.parentId];
|
||||||
branchArr.length > 0 ? father.children = branchArr : '';
|
if (childrenListMap[parentId] == null) {
|
||||||
//返回第一层
|
childrenListMap[parentId] = [];
|
||||||
return father[parentId] === rootId;
|
}
|
||||||
});
|
nodeIds[d[config.id]] = d;
|
||||||
return treeData != '' ? treeData : data;
|
childrenListMap[parentId].push(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let d of data) {
|
||||||
|
let parentId = d[config.parentId];
|
||||||
|
if (nodeIds[parentId] == null) {
|
||||||
|
tree.push(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let t of tree) {
|
||||||
|
adaptToChildrenList(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
function adaptToChildrenList(o) {
|
||||||
|
if (childrenListMap[o[config.id]] !== null) {
|
||||||
|
o[config.childrenList] = childrenListMap[o[config.id]];
|
||||||
|
}
|
||||||
|
if (o[config.childrenList]) {
|
||||||
|
for (let c of o[config.childrenList]) {
|
||||||
|
adaptToChildrenList(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ export default {
|
||||||
name: "Druid",
|
name: "Druid",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
src: process.env.VUE_APP_BASE_API + "/druid/index.html",
|
src: process.env.VUE_APP_BASE_API + "/druid/login.html",
|
||||||
height: document.documentElement.clientHeight - 94.5 + "px;",
|
height: document.documentElement.clientHeight - 94.5 + "px;",
|
||||||
loading: true
|
loading: true
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue