Commit df51dbaf by zhengjie

2.0 抢先版,主要更新了#10

parent a5c9f588
import request from '@/utils/request'
export function getErrDetail(id) {
return request({
url: 'api/logs/error/' + id,
method: 'get'
})
}
<template>
<div :class="{'show':show}" class="header-search">
<svg-icon class-name="search-icon" icon-class="search" @click.stop="click" />
<el-select
ref="headerSearchSelect"
v-model="search"
:remote-method="querySearch"
filterable
default-first-option
remote
placeholder="Search"
class="header-search-select"
@change="change"
>
<el-option v-for="item in options" :key="item.path" :value="item" :label="item.title.join(' > ')" />
</el-select>
</div>
</template>
<script>
// fuse is a lightweight fuzzy-search module
// make search results more in line with expectations
import Fuse from 'fuse.js'
import path from 'path'
export default {
name: 'HeaderSearch',
data() {
return {
search: '',
options: [],
searchPool: [],
show: false,
fuse: undefined
}
},
computed: {
routes() {
return this.$store.getters.permission_routes
}
},
watch: {
routes() {
this.searchPool = this.generateRoutes(this.routes)
},
searchPool(list) {
this.initFuse(list)
},
show(value) {
if (value) {
document.body.addEventListener('click', this.close)
} else {
document.body.removeEventListener('click', this.close)
}
}
},
mounted() {
this.searchPool = this.generateRoutes(this.routes)
},
methods: {
click() {
this.show = !this.show
if (this.show) {
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus()
}
},
close() {
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.blur()
this.options = []
this.show = false
},
change(val) {
this.$router.push(val.path)
this.search = ''
this.options = []
this.$nextTick(() => {
this.show = false
})
},
initFuse(list) {
this.fuse = new Fuse(list, {
shouldSort: true,
threshold: 0.4,
location: 0,
distance: 100,
maxPatternLength: 32,
minMatchCharLength: 1,
keys: [{
name: 'title',
weight: 0.7
}, {
name: 'path',
weight: 0.3
}]
})
},
// Filter out the routes that can be displayed in the sidebar
// And generate the internationalized title
generateRoutes(routes, basePath = '/', prefixTitle = []) {
let res = []
for (const router of routes) {
// skip hidden router
if (router.hidden) { continue }
const data = {
path: path.resolve(basePath, router.path),
title: [...prefixTitle]
}
if (router.meta && router.meta.title) {
// generate internationalized title
data.title = [...data.title, router.meta.title]
if (router.redirect !== 'noRedirect') {
// only push the routes with title
// special case: need to exclude parent router without redirect
res.push(data)
}
}
// recursive child routes
if (router.children) {
const tempRoutes = this.generateRoutes(router.children, data.path, data.title)
if (tempRoutes.length >= 1) {
res = [...res, ...tempRoutes]
}
}
}
return res
},
querySearch(query) {
if (query !== '') {
this.options = this.fuse.search(query)
} else {
this.options = []
}
}
}
}
</script>
<style lang="scss" scoped>
.header-search {
font-size: 0 !important;
.search-icon {
cursor: pointer;
font-size: 18px;
}
.header-search-select {
font-size: 18px;
transition: width 0.2s;
width: 0;
overflow: hidden;
background: transparent;
border-radius: 0;
display: inline-block;
vertical-align: middle;
/deep/ .el-input__inner {
border-radius: 0;
border: 0;
padding-left: 0;
padding-right: 0;
box-shadow: none !important;
border-bottom: 1px solid #d9d9d9;
vertical-align: middle;
}
}
&.show {
.header-search-select {
width: 210px;
margin-left: 10px;
}
}
}
</style>
...@@ -4,12 +4,15 @@ ...@@ -4,12 +4,15 @@
<el-form-item label="作者名称" prop="author"> <el-form-item label="作者名称" prop="author">
<el-input v-model="form.author" style="width: 420px;"/> <el-input v-model="form.author" style="width: 420px;"/>
</el-form-item> </el-form-item>
<el-form-item label="至于包下" prop="pack"> <el-form-item label="去表前缀" prop="prefix">
<el-input v-model="form.pack" style="width: 420px;"/> <el-input v-model="form.prefix" placeholder="默认不去除表前缀" style="width: 420px;"/>
</el-form-item> </el-form-item>
<el-form-item label="模块名称" prop="moduleName"> <el-form-item label="模块名称" prop="moduleName">
<el-input v-model="form.moduleName" style="width: 420px;"/> <el-input v-model="form.moduleName" style="width: 420px;"/>
</el-form-item> </el-form-item>
<el-form-item label="至于包下" prop="pack">
<el-input v-model="form.pack" style="width: 420px;"/>
</el-form-item>
<el-form-item label="前端路径" prop="path"> <el-form-item label="前端路径" prop="path">
<el-input v-model="form.path" style="width: 420px;"/> <el-input v-model="form.path" style="width: 420px;"/>
</el-form-item> </el-form-item>
...@@ -34,7 +37,7 @@ export default { ...@@ -34,7 +37,7 @@ export default {
data() { data() {
return { return {
loading: false, dialog: false, loading: false, dialog: false,
form: { author: '', pack: '', path: '', moduleName: '', cover: 'false', apiPath: '' }, form: { author: '', pack: '', path: '', moduleName: '', cover: 'false', apiPath: '', prefix: '' },
rules: { rules: {
author: [ author: [
{ required: true, message: '作者不能为空', trigger: 'blur' } { required: true, message: '作者不能为空', trigger: 'blur' }
...@@ -88,7 +91,7 @@ export default { ...@@ -88,7 +91,7 @@ export default {
resetForm() { resetForm() {
this.dialog = false this.dialog = false
this.$refs['form'].resetFields() this.$refs['form'].resetFields()
this.form = { author: '', pack: '', path: '', moduleName: '', cover: 'false', apiPath: '' } this.form = { author: '', pack: '', path: '', moduleName: '', cover: 'false', apiPath: '', prefix: '' }
} }
} }
} }
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<div class="drawer-container"> <div class="drawer-container">
<div> <div>
<h3 class="drawer-title">系统布局配置</h3> <h3 class="drawer-title">系统布局配置</h3>
<div class="drawer-item"> <div class="drawer-item">
<span>显示 Logo</span> <span>显示 Logo</span>
<el-switch v-model="sidebarLogo" class="drawer-switch" /> <el-switch v-model="sidebarLogo" class="drawer-switch" />
...@@ -16,14 +15,13 @@ ...@@ -16,14 +15,13 @@
<el-switch v-model="tagsView" class="drawer-switch" /> <el-switch v-model="tagsView" class="drawer-switch" />
</div> </div>
<div class="drawer-item"> <div class="drawer-item">
<span>显示 SettingBtn</span> <span>显示 SettingButton</span>
<el-switch v-model="settingBtn" class="drawer-switch" /> <el-switch v-model="settingBtn" class="drawer-switch" />
</div> </div>
<div class="drawer-item"> <div class="drawer-item">
<span>菜单 uniqueOpened</span> <span>菜单 UniqueOpened</span>
<el-switch v-model="uniqueOpened" class="drawer-switch" /> <el-switch v-model="uniqueOpened" class="drawer-switch" />
</div> </div>
</div> </div>
</div> </div>
</template> </template>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="createTime" label="异常详情" width="100px"> <el-table-column prop="createTime" label="异常详情" width="100px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" @click="info(scope.row.exceptionDetail)">查看详情</el-button> <el-button size="mini" type="text" @click="info(scope.row.id)">查看详情</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
<script> <script>
import initData from '@/mixins/initData' import initData from '@/mixins/initData'
import { parseTime } from '@/utils/index' import { parseTime } from '@/utils/index'
import { getErrDetail } from '@/api/log'
import eHeader from './module/header' import eHeader from './module/header'
export default { export default {
components: { eHeader }, components: { eHeader },
...@@ -64,9 +65,11 @@ export default { ...@@ -64,9 +65,11 @@ export default {
if (logType !== '' && logType !== null) { this.params['logType'] = logType } if (logType !== '' && logType !== null) { this.params['logType'] = logType }
return true return true
}, },
info(errorInfo) { info(id) {
this.errorInfo = errorInfo
this.dialog = true this.dialog = true
getErrDetail(id).then(res => {
this.errorInfo = res.exception
})
} }
} }
} }
......
...@@ -28,8 +28,8 @@ export default { ...@@ -28,8 +28,8 @@ export default {
data() { data() {
return { return {
ico: 'unlock', unlock: true, content: '锁定滚动条', ico: 'unlock', unlock: true, content: '锁定滚动条',
height: document.documentElement.clientHeight - 94.5 + 'px;', height: document.documentElement.clientHeight - 140 + 'px;',
width: document.documentElement.clientWidth - 185 + 'px;', width: document.documentElement.clientWidth - 210 + 'px;',
data: [{ name: 'elAdmin-', timestamp: new Date(), threadName: 'system-prompt-message', level: 'INFO', className: 'me.zhengjie.AppRun' + ' :', body: 'Welcome, no log output' }], data: [{ name: 'elAdmin-', timestamp: new Date(), threadName: 'system-prompt-message', level: 'INFO', className: 'me.zhengjie.AppRun' + ' :', body: 'Welcome, no log output' }],
// level // level
INFO: '#0000ff', WARN: '#FFFF00', ERROR: '#FF0000', DEBUG: '#DEA000' INFO: '#0000ff', WARN: '#FFFF00', ERROR: '#FF0000', DEBUG: '#DEA000'
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
import checkPermission from '@/utils/permission' // 权限判断函数 import checkPermission from '@/utils/permission' // 权限判断函数
import initData from '@/mixins/initData' import initData from '@/mixins/initData'
import { del } from '@/api/redis' import { del } from '@/api/redis'
import { getPermissionTree } from '@/api/permission'
import eHeader from './module/header' import eHeader from './module/header'
import edit from './module/edit' import edit from './module/edit'
export default { export default {
...@@ -60,7 +59,6 @@ export default { ...@@ -60,7 +59,6 @@ export default {
} }
}, },
created() { created() {
this.getPermissions()
this.$nextTick(() => { this.$nextTick(() => {
this.init() this.init()
}) })
...@@ -95,11 +93,6 @@ export default { ...@@ -95,11 +93,6 @@ export default {
this.$refs[index].doClose() this.$refs[index].doClose()
console.log(err.response.data.message) console.log(err.response.data.message)
}) })
},
getPermissions() {
getPermissionTree().then(res => {
this.permissions = res
})
} }
} }
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<el-table-column prop="name" label="名称"/> <el-table-column prop="name" label="名称"/>
<el-table-column label="所属部门"> <el-table-column label="所属部门">
<template slot-scope="scope"> <template slot-scope="scope">
<div>{{ scope.row.dept.name }}</div> <div>{{ scope.row.deptSuperiorName ? scope.row.deptSuperiorName + ' / ' : '' }}{{ scope.row.dept.name }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="sort" label="排序"> <el-table-column prop="sort" label="排序">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment