CN-906 fix: 面包屑功能调整(部分)
This commit is contained in:
@@ -208,6 +208,7 @@ import {
|
|||||||
handleSpecialValue
|
handleSpecialValue
|
||||||
} from '@/utils/tools'
|
} from '@/utils/tools'
|
||||||
import { getNowTime, getSecond } from '@/utils/date-util'
|
import { getNowTime, getSecond } from '@/utils/date-util'
|
||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Header',
|
name: 'Header',
|
||||||
@@ -301,41 +302,17 @@ export default {
|
|||||||
} */
|
} */
|
||||||
},
|
},
|
||||||
breadcrumb () {
|
breadcrumb () {
|
||||||
const breadcrumbMap = []
|
const breadcrumb = []
|
||||||
this.curTabProp = this.$route.query.dimensionType ? this.$route.query.dimensionType : null
|
this.generateBreadcrumb(breadcrumb, this.$store.getters.menuList)
|
||||||
this.$store.getters.menuList.forEach(menu => {
|
|
||||||
if (this.$_.isEmpty(menu.children) && menu.route) {
|
|
||||||
breadcrumbMap.push({
|
|
||||||
name: this.$t(menu.i18n),
|
|
||||||
path: menu.route,
|
|
||||||
columnName: menu.columnName,
|
|
||||||
columnValue: menu.columnValue
|
|
||||||
})
|
|
||||||
} else if (!this.$_.isEmpty(menu.children)) {
|
|
||||||
menu.children.forEach(child => {
|
|
||||||
breadcrumbMap.push({
|
|
||||||
name: child.i18n ? this.$t(child.i18n) : child.name,
|
|
||||||
parentName: menu.i18n ? this.$t(menu.i18n) : menu.name,
|
|
||||||
path: child.route,
|
|
||||||
columnName: child.columnName,
|
|
||||||
columnValue: child.columnValue
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
const breadcrumb = breadcrumbMap.find(b => this.route === b.path)
|
|
||||||
const thirdMenu = this.getUrlParam(this.curTabState.thirdMenu, '')
|
const thirdMenu = this.getUrlParam(this.curTabState.thirdMenu, '')
|
||||||
const fourthMenu = this.getUrlParam(this.curTabState.fourthMenu, '')
|
const fourthMenu = this.getUrlParam(this.curTabState.fourthMenu, '')
|
||||||
let result = []
|
|
||||||
|
let result = [...breadcrumb]
|
||||||
if (fourthMenu) {
|
if (fourthMenu) {
|
||||||
result = breadcrumb ? [breadcrumb.parentName, breadcrumb.name, thirdMenu, fourthMenu] : []
|
result = [...result, thirdMenu, fourthMenu]
|
||||||
} else if (thirdMenu) {
|
} else if (thirdMenu) {
|
||||||
result = breadcrumb ? [breadcrumb.parentName, breadcrumb.name, thirdMenu] : []
|
result = [...result, thirdMenu]
|
||||||
} else {
|
|
||||||
result = breadcrumb ? [breadcrumb.parentName, breadcrumb.name] : []
|
|
||||||
}
|
|
||||||
if (!breadcrumb.parentName) {
|
|
||||||
result = result.filter((r, i) => i > 0)
|
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
},
|
},
|
||||||
@@ -359,6 +336,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async breadcrumb (n) {
|
async breadcrumb (n) {
|
||||||
|
this.curTabProp = this.$route.query.dimensionType ? this.$route.query.dimensionType : null
|
||||||
if (this.$route.params.typeName === fromRoute.dnsServiceInsights) {
|
if (this.$route.params.typeName === fromRoute.dnsServiceInsights) {
|
||||||
if (this.dnsQtypeMapData.size === 0) {
|
if (this.dnsQtypeMapData.size === 0) {
|
||||||
this.dnsQtypeMapData = await getDnsMapData('dnsQtype')
|
this.dnsQtypeMapData = await getDnsMapData('dnsQtype')
|
||||||
@@ -399,6 +377,22 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
generateBreadcrumb (breadcrumb, menus) {
|
||||||
|
const menu = menus.find(m => m.route === this.route)
|
||||||
|
if (menu) {
|
||||||
|
breadcrumb.unshift(menu.i18n ? this.$t(menu.i18n) : menu.name)
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < menus.length; i++) {
|
||||||
|
if (!_.isEmpty(menus[i].children)) {
|
||||||
|
if (this.generateBreadcrumb(breadcrumb, menus[i].children)) {
|
||||||
|
breadcrumb.unshift(menus[i].i18n ? this.$t(menus[i].i18n) : menus[i].name)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
handleClose () {
|
handleClose () {
|
||||||
this.showChangePin = false
|
this.showChangePin = false
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -36,11 +36,12 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
store.commit('setRoleList', roleList)
|
store.commit('setRoleList', roleList)
|
||||||
}
|
}
|
||||||
if (to.path) {
|
if (to.path) {
|
||||||
if (hasMenu(store.getters.menuList, to.path)) {
|
next()
|
||||||
|
/* if (hasMenu(store.getters.menuList, to.path)) {
|
||||||
next()
|
next()
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error('No access') // TODO 国际化
|
ElMessage.error('No access') // TODO 国际化
|
||||||
}
|
} */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ const routes = [
|
|||||||
path: '/knowledgeBase',
|
path: '/knowledgeBase',
|
||||||
component: () => import('@/views/setting/KnowledgeBase')
|
component: () => import('@/views/setting/KnowledgeBase')
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/knowledgeBase/form',
|
||||||
|
component: () => import('@/views/setting/KnowledgeBaseForm')
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Administration',
|
name: 'Administration',
|
||||||
path: '/administration',
|
path: '/administration',
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
@search="search"
|
@search="search"
|
||||||
>
|
>
|
||||||
<template v-slot:top-tool-right>
|
<template v-slot:top-tool-right>
|
||||||
<button id="roles-add" :title="$t('overall.createRole')" class="top-tool-btn margin-r-10"
|
<button id="knowledge-base-add" :title="$t('knowledgeBase.createKnowledgeBase')" class="top-tool-btn margin-r-10"
|
||||||
type="button" @click="add">
|
type="button" @click="jumpToCreatePage">
|
||||||
<i class="cn-icon-add cn-icon"></i>
|
<i class="cn-icon-add cn-icon"></i>
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
@@ -54,15 +54,8 @@ export default {
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
url: api.knowledgeBase,
|
url: api.knowledgeBase,
|
||||||
tableId: 'knowledgeBaseTable', // 需要分页的table的id,用于记录每页数量
|
tableId: 'knowledgeBaseTable' // 需要分页的table的id,用于记录每页数量
|
||||||
blankObject: { // 空白对象
|
|
||||||
tagName: '',
|
|
||||||
buildIn: '',
|
|
||||||
id: '',
|
|
||||||
tagType: '',
|
|
||||||
remark: '',
|
|
||||||
updateTime: ''
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -74,6 +67,14 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
jumpToCreatePage () {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/knowledgeBase/form',
|
||||||
|
query: {
|
||||||
|
t: +new Date()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
getTableData () {
|
getTableData () {
|
||||||
this.tools.loading = false
|
this.tools.loading = false
|
||||||
this.tableData = [
|
this.tableData = [
|
||||||
|
|||||||
51
src/views/setting/KnowledgeBaseForm.vue
Normal file
51
src/views/setting/KnowledgeBaseForm.vue
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<template>
|
||||||
|
<el-form :model="editObject" label-position="left" label-width="120px" ref="form">
|
||||||
|
<!--name-->
|
||||||
|
<el-form-item :label="$t('config.roles.name')" prop="name">
|
||||||
|
<el-input maxlength="64" placeholder="" id="role-box-input-name"
|
||||||
|
show-word-limit size="small" type="text" v-model="editObject.tagName"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('config.roles.name')" prop="name">
|
||||||
|
<el-input maxlength="64" placeholder="" id="role-box-input-name"
|
||||||
|
show-word-limit size="small" type="text" v-model="editObject.tagName"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('overall.remark')">
|
||||||
|
<el-input maxlength="256" show-word-limit :rows="2" size='mini' type="textarea" v-model="editObject.remark" id="role-box-input-remark"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import _ from 'lodash'
|
||||||
|
export default {
|
||||||
|
name: 'CreateKnowledgeBase',
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
},
|
||||||
|
setup () {
|
||||||
|
const { query } = useRoute()
|
||||||
|
const knowledgeBaseId = ref(query.id || '')
|
||||||
|
// 空白对象
|
||||||
|
const blankObject = {
|
||||||
|
tagName: '',
|
||||||
|
buildIn: '',
|
||||||
|
id: '',
|
||||||
|
tagType: '',
|
||||||
|
remark: '',
|
||||||
|
updateTime: ''
|
||||||
|
}
|
||||||
|
const editObject = ref(_.cloneDeep(blankObject))
|
||||||
|
return {
|
||||||
|
knowledgeBaseId,
|
||||||
|
editObject,
|
||||||
|
blankObject
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user