NZ-584 feat: overview调整

This commit is contained in:
chenjinsong
2021-04-28 17:48:50 +08:00
parent 6ba59a4e86
commit f91133cbb6
10 changed files with 1318 additions and 377 deletions

View File

@@ -43,7 +43,11 @@ $--warning-color: var(--theme-color); //全局警告橙色
$--suspended-color: #9e9c98; //全局停用色灰色
:export {
themeColor: $--theme-color
themeColor: $--theme-color;
dangerColor: $--danger-color;
successColor: $--success-color;
warningColor: var(--theme-color);
suspendedColor: $--suspended-color;
}
/* element-ui变量覆盖 */
/*$--color-primary: red; // 覆盖element-ui的主题色

View File

@@ -3,125 +3,117 @@
<div class="alert-label-info" v-if="type==='asset'" v-loading="loading">
<div class="alert-label-box">
<div class="alert-label-title">ID</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.id:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.id ? alertLabelData.id : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">SN</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.sn:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.sn ? alertLabelData.sn:'--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Host</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.host:'--'}}</div>
<div class="alert-label-title">IP</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.manageIp ? alertLabelData.manageIp : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">State</div>
<div class="alert-label-value">{{alertLabelData?(alertStateStr(alertLabelData.state)):'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.state && alertLabelData.state.name ? alertLabelData.state.name : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Ping</div>
<div class="alert-label-value">
<div v-if="alertLabelData" :class="{'active-icon green':alertLabelData.pingStatus == 1,'active-icon red':alertLabelData.pingStatus == 0}"></div>
<span v-if="alertLabelData">{{alertLabelData.pingRtt?alertLabelData.pingRtt+'ms':'--'}}</span>
<div v-if="alertLabelData" :class="{'green-bg': alertLabelData && alertLabelData.pingInfo && alertLabelData.pingInfo.status === 1,'red-bg': alertLabelData && alertLabelData.pingInfo && alertLabelData.pingInfo.status === 0}" class="active-icon"></div>
<span v-if="alertLabelData">{{alertLabelData && alertLabelData.pingInfo && alertLabelData.pingInfo.rtt ? alertLabelData.pingInfo.rtt + 'ms':'--'}}</span>
</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Asset Type</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.assetType:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.type && alertLabelData.type.name ? alertLabelData.type.name:'--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Vendor</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.vendor:'--'}}</div>
<div class="alert-label-title">Brand</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.brand && alertLabelData.brand.name ? alertLabelData.brand.name : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Model</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.model:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.model && alertLabelData.model.name ? alertLabelData.model.name : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">PingLastReply</div>
<div class="alert-label-value">{{(alertLabelData&&alertLabelData.pingLastReply)?alertLabelData.pingLastReply:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.pingInfo && alertLabelData.pingInfo.lastUpdate ? alertLabelData.pingInfo.lastUpdate : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Alert</div>
<div class="alert-label-value">
<span v-if="alertLabelData" :class="{danger:alertLabelData.alert>0,success:alertLabelData.alert<=0}">{{alertLabelData.alert + alertActiveStr()}}</span>
<span v-if="alertLabelData" :class="alertLabelData && alertLabelData.alertNum > 0 ? 'danger' : 'success'">{{alertLabelData && alertLabelData.alertNum ? alertLabelData.alertNum : 0 + ' ' + alertActiveStr()}}</span>
</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">DC</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.dataCenter:'--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Endpoint</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.endpoint:'--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Administrator</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.principal:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.dc && alertLabelData.dc.name ? alertLabelData.dc.name : '--'}}</div>
</div>
</div>
<div class="alert-label-info" v-if="type==='module'" v-loading="loading">
<div class="alert-label-box">
<div class="alert-label-title">ID</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.id:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.id ? alertLabelData.id : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Name</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.name:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.name ? alertLabelData.name : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Project</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.project.name:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.project && alertLabelData.project.name ?alertLabelData.project.name : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Description</div>
<div class="alert-label-value">{{alertLabelData?(alertLabelData.remark?alertLabelData.remark:'-'):'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.remark ? alertLabelData.remark : '-'}}</div>
</div>
</div>
<div class="alert-label-info" v-if="type==='project'" v-loading="loading">
<div class="alert-label-box">
<div class="alert-label-title">ID</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.id:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData ? alertLabelData.id : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Name</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.name:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData ? alertLabelData.name : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Description</div>
<div class="alert-label-value">{{alertLabelData?(alertLabelData.remark?alertLabelData.remark:'-'):'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.remark ? alertLabelData.remark : '--'}}</div>
</div>
</div>
<div class="alert-label-info" v-if="type==='endpoint'" v-loading="loading">
<div class="alert-label-box">
<div class="alert-label-title">ID</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.id:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.id ? alertLabelData.id : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Project</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.project.name:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.project && alertLabelData.project.name ? alertLabelData.project.name : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Module</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.module.name:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.module && alertLabelData.module.name ? alertLabelData.module.name : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Labels</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.labels:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.labels ? alertLabelData.labels : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Host</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.host:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.host ? alertLabelData.host : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Port</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.port:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.port ? alertLabelData.port : '--'}}</div>
</div>
<div class="alert-label-box">
<div class="alert-label-title">Path</div>
<div class="alert-label-value">{{alertLabelData?alertLabelData.path:'--'}}</div>
<div class="alert-label-value">{{alertLabelData && alertLabelData.path ? alertLabelData.path : '--'}}</div>
</div>
</div>
</div>
@@ -240,40 +232,40 @@ export default {
init () {
this.loading = true
if (this.type === 'asset') {
this.$get('/asset/info?id=' + this.id).then((res) => {
this.$get('asset/asset/' + this.id).then((res) => {
if (res.msg === 'success') {
this.loading = false
this.alertLabelData = res.data.Basic
this.alertLabelData = res.data
} else {
this.$message.error(res.msg)
}
})
}
if (this.type === 'project') {
this.$get('/project?id=' + this.id).then((res) => {
this.$get('monitor/project/' + this.id).then((res) => {
if (res.msg === 'success') {
this.loading = false
this.alertLabelData = res.data.list[0]
this.alertLabelData = res.data
} else {
this.$message.error(res.msg)
}
})
}
if (this.type === 'module') {
this.$get('/module?id=' + this.id).then((res) => {
this.$get('monitor/module/' + this.id).then((res) => {
if (res.msg === 'success') {
this.loading = false
this.alertLabelData = res.data.list[0]
this.alertLabelData = res.data
} else {
this.$message.error(res.msg)
}
})
}
if (this.type === 'endpoint') {
this.$get('/endpoint?id=' + this.id).then((res) => {
this.$get('monitor/endpoint/' + this.id).then((res) => {
if (res.msg === 'success') {
this.loading = false
this.alertLabelData = res.data.list[0]
this.alertLabelData = res.data
} else {
this.$message.error(res.msg)
}
@@ -392,13 +384,13 @@ export default {
word-break: break-all;
}
.danger{
background-color: #d64f40;
background-color: $--danger-color;
color: white;
padding: 2px 5px;
border-radius: 4px;
}
.success{
background-color: #50d050;
background-color: $--success-color;
color: white;
padding: 2px 5px;
border-radius: 4px;

View File

@@ -54,13 +54,6 @@ export default {
created () {
const localStorageTitle = JSON.parse(localStorage.getItem('nz-tableTitle-' + localStorage.getItem('nz-username') + '-' + this.tableId))
if (localStorageTitle) {
for (const title of this.originalTableTitle) {
for (const lsTitle of localStorageTitle) {
if (lsTitle.prop === title.prop) {
lsTitle.label = title.label
}
}
}
localStorage.setItem('nz-tableTitle-' + localStorage.getItem('nz-username') + '-' + this.tableId, JSON.stringify(localStorageTitle))
}
},

View File

@@ -252,7 +252,7 @@ export default {
clearTimeout(this.timer)
}
this.assetData.id = data
const boxWidth = document.getElementsByClassName('content-right')[0].offsetWidth
const boxWidth = document.getElementsByClassName('list-page')[0].offsetWidth
this.boxWidth = boxWidth
// this.assetData.rate=window.screen.height/1297;
this.$nextTick(() => {

View File

@@ -36,7 +36,7 @@
<transition name="el-zoom-in-top">
<element-set
v-if="tools.showCustomTableTitle"
:tableId="tableId"
:tableId="$parent.tableId"
ref="customTableTitle"
:custom-table-title="customTableTitle"
:original-table-title="tableTitle"
@@ -88,10 +88,6 @@ export default {
searchMsg: {
type: Object
},
tableId: {
type: String,
default: ''
},
hasSearch: {
type: Boolean,
default: false

View File

@@ -5,25 +5,21 @@
</el-breadcrumb>
<div class="header-menu">
<el-dropdown>
<div class="header-menu&#45;&#45;item"><i class="nz-icon nz-icon-more-app"></i></div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="(item, index) in linkData" :key="index" :index="'0-' + index">
<span class="link-title"><a :href='item.url' :title="item.name" rel="noopener norefferrer" target="_blank">{{item.name}}</a></span>
</el-dropdown-item>
</el-dropdown-menu>
<div class="header-menu__item"><i class="nz-icon nz-icon-more-app"></i></div>
<el-dropdown-menu></el-dropdown-menu>
</el-dropdown>
<el-dropdown>
<el-dropdown-menu slot="dropdown"></el-dropdown-menu>
<el-dropdown-menu></el-dropdown-menu>
<div id="header-open-cli" @click="cli">
<div class="header-menu&#45;&#45;item"><i class="nz-icon nz-icon-terminal"></i></div>
<div class="header-menu__item"><i class="nz-icon nz-icon-terminal"></i></div>
<span v-show="$store.state.consoleCount>0" class="right-tip">{{$store.state.consoleCount<=10?$store.state.consoleCount:'10+'}}</span>
</div>
</el-dropdown>
<el-dropdown>
<div class="header-menu&#45;&#45;item"><i class="nz-icon nz-icon-create-square"></i></div>
<div class="header-menu__item"><i class="nz-icon nz-icon-create-square"></i></div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="(item, createIndex) in createMenu" :key="createIndex" v-has="item.permission" :index="`${createIndex}`">
<div :id="'create-box-'+createIndex" @click="createBox(item)">
<div :id="'create-box-'+createIndex">
<span>{{item.label}}</span>
</div>
</el-dropdown-item>
@@ -38,10 +34,10 @@
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item>
<div id="header-to-english" :style="language=='en'?'color:#f90':''" @click="changeLocal('en')"><i class="nz-icon nz-icon-lang-en"></i>English</div>
<div id="header-to-english" :style="language === 'en'?'color:#f90':''" @click="changeLocal('en')"><i class="nz-icon nz-icon-lang-en"></i>English</div>
</el-dropdown-item>
<el-dropdown-item>
<div id="header-to-chinese" :style="language=='cn'?'color:#f90':''" @click="changeLocal('cn')"><i class="nz-icon nz-icon-lang-zh"></i>中文</div>
<div id="header-to-chinese" :style="language === 'cn'?'color:#f90':''" @click="changeLocal('cn')"><i class="nz-icon nz-icon-lang-zh"></i>中文</div>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
@@ -57,38 +53,18 @@
</el-dropdown-menu>
</el-dropdown>
</div>
<transition name="right-box">
<project-box v-if="rightBox.project.show" ref="projectBox" :project="editProject" @close="closeProjectRightBox"></project-box>
</transition>
<transition name="right-box">
<module-box v-if="rightBox.module.show" ref="moduleBox" :currentProject="currentProject" :module="editModule" @close="closeModuleRightBox"></module-box>
</transition>
<transition name="right-box">
<add-endpoint-box v-if="rightBox.endpoint.show" ref="addEndpointBox" :currentModule="currentModule" :currentProject="currentProject" @close="closeEndpointRightBox"></add-endpoint-box>
</transition>
<transition name="right-box">
<asset-box v-if="rightBox.asset.show" ref="assetAddUnit" :asset="editAsset" @close="closeAssetRightBox"></asset-box>
</transition>
<transition name="right-box">
<alert-config-box v-if="rightBox.alertRule.show" ref="alertConfigBox" :alert-rule="editAlertRule" @close="closeAlertRuleRightBox"></alert-config-box>
</transition>
<transition name="right-box">
<dc-box v-if="rightBox.dc.show" :dc="dc" :user-data="userData" @close="closeDcBox" @reload="getAssetData"></dc-box>
</transition>
<change-password :cur-user="username" :show-dialog="showChangePin" @click="showPinDialog" @dialogClosed="dialogClosed"></change-password>
</div>
</template>
<script>
import bus from '../../libs/bus'
import dcBox from '../common/rightBox/dcBox' // dc弹框
import { mapActions } from 'vuex'
import changePin from '../page/config/changePin'
export default {
name: 'Header',
components: {
'change-password': changePin,
'dc-box': dcBox
},
data () {
return {
@@ -96,81 +72,6 @@ export default {
language: localStorage.getItem('nz-language') ? localStorage.getItem('nz-language') : 'en',
// 顶部菜单相关
/* activeIndex: '', */
activeItemIndex: '',
activeItemIndexes: [],
hoverItemIndex: '',
dc: {
id: '',
name: '',
location: '',
tel: '',
principal: '',
area: {
id: 0,
name: ''
}
},
userData: [],
assetData: [], // 顶部菜单asset的下拉内容
// add侧滑相关
rightBox: {
project: { show: false },
module: { show: false },
endpoint: { show: false },
asset: { show: false },
alertRule: { show: false },
dc: { show: false }
},
projectData: [], // 顶部菜单project列表中的数据
editProject: { id: '', name: '', remark: '' }, // 新增/编辑的project
currentProject: { id: '', name: '', remark: '' }, // module/endpoint弹框用来回显project
editModule: { type: 'http', name: '', project: {}, port: 9100, path: '', param: '', paramObj: [], labelModule: [], labels: '' }, // 新增/编辑的module
currentModule: { id: '', name: '', project: {}, port: '', path: '', param: '', paramObj: [], labels: '', labelModule: [] }, // endpoint弹框用来回显module此处固定为空对象
editEndpoint: { // 新增/编辑的endpoint
id: '',
host: '',
port: '',
param: '',
path: '',
asset: { id: '', name: '', host: '' },
project: { id: '', name: '' },
module: { id: '', name: '', param: '', paramObj: {}, projectId: '', labelModule: [], labels: '' },
moduleId: '',
assetId: '',
labelModule: []
},
editAsset: {
id: '',
sn: '',
host: '',
state: 1,
purchaseDate: '',
idcId: '',
cabinetId: '',
modelId: '',
model: { type: { code: '' } },
assetType: '',
impi: {
host: '',
port: ''
},
tags: [],
accounts: []
},
editAlertRule: {
id: '',
alertName: '',
linkObject: { id: '', name: '' },
expr: '',
unit: 2,
operator: '>',
last: 60,
severity: 'P2',
summary: '',
description: ''
},
createMenu: [ // 新增按钮内容
{
label: this.$t('project.project.project'),
@@ -217,9 +118,6 @@ export default {
* @param parentMenu 菜单大类
* */
jumpTo (route) {
if (route != 'asset') {
this.activeItemIndexes = []
}
this.$router.push({
path: route,
query: {
@@ -227,88 +125,6 @@ export default {
}
})
},
getLinkData () {
/* this.$get('link').then(response => {
this.$store.commit('setLinkData', response.data)
}) */
},
createBox (item) {
if (item.type == 1) {
this.rightBox.project.show = true
this.editProject = { id: '', name: '', remark: '' }
} else if (item.type == 2) {
this.rightBox.module.show = true
this.editModule = {
name: '',
project: {},
port: 9100,
path: '',
param: '',
labels: '',
type: 'http',
paramObj: [],
snmpParam: '',
labelModule: [],
// snmp setting 下划线命名是因为业务需求
walk: [],
version: 2, // 2/3
max_repetitions: 25,
retries: 3,
timeout: 10, // s
community: 'public',
username: '',
security_level: 'noAuthNoPriv', // noAuthNoPriv/authNoPriv/authPriv
pin: '',
auth_protocol: 'MD5', // MD5/SHA
priv_protocol: 'DES', // DES/AES
priv_pin: '',
context_name: ''
}
} else if (item.type == 3) {
this.rightBox.endpoint.show = true
} else if (item.type == 4) {
this.rightBox.asset.show = true
} else if (item.type == 5) {
this.rightBox.alertRule.show = true
} else if (item.type == 6) {
this.rightBox.dc.show = true
}
},
jumpToAsset (dc) {
if (dc) {
this.activeItemIndex = dc.id
this.$store.commit('setCurrentDc', dc.id)
bus.$emit('header-dc-change', dc.id) // 发送给leftMenu顶部dc条件改变了
} else {
this.activeItemIndex = ''
this.$store.commit('setCurrentDc', '')
bus.$emit('clear-asset-filter') // 清除leftMenu左侧菜单过滤条件
}
this.jumpTo('/asset')
},
jumpToProject (p) {
if (!this.hasButton('project_view')) {
return
}
this.currentProject = p
if (p.id !== this.$store.state.currentProject.id) {
bus.$emit('project-page-type', 'project')
}
this.$store.commit('currentProjectChange', p)
this.activeItemIndex = p.id
this.jumpTo('/project')
},
getAssetData () {
this.$get('idc', { pageSize: -1 }).then(response => {
if (response.code == 200) {
this.assetData = response.data.list
this.assetData.forEach(item => {
this.$set(item, item.name, false)
})
this.$store.commit('setIdcArr', this.assetData)
}
})
},
changeLocal (lang) {
if (lang != localStorage.getItem('nz-language')) {
localStorage.setItem('nz-language', lang)
@@ -316,85 +132,11 @@ export default {
window.location.reload()
}
},
getProjectList () {
this.$get('monitor/project', { pageSize: -1 }).then(response => {
if (response.code == 200) {
this.projectData = response.data.list
let flag = false
// 如果currentProject不在新取到的数据里说明它被删了
for (let i = 0; i < this.projectData.length; i++) {
if (this.projectData[i].id == this.currentProject.id) {
flag = true
break
}
}
if (!flag && this.projectData.length > 0) {
this.currentProject = this.projectData[0]
this.activeItemIndex = this.currentProject.id
this.$store.commit('currentProjectChange', this.currentProject)
}
}
})
},
getUserData () {
return new Promise(resolve => {
this.$get('sys/user', { pageSize: -1, pageNo: 1 }).then(response => {
if (response.code === 200) {
this.userData = response.data.list
}
resolve()
})
})
},
closeProjectRightBox (refresh) {
this.rightBox.project.show = false
if (refresh) {
this.getProjectList()
bus.$emit('project-list-change')
}
},
closeModuleRightBox (refresh) {
this.rightBox.module.show = false
if (refresh) {
bus.$emit('module-list-change')
}
},
closeEndpointRightBox (refresh) {
this.rightBox.endpoint.show = false
if (refresh) {
bus.$emit('endpoint-list-change')
}
},
closeAssetRightBox (refresh) {
this.rightBox.asset.show = false
if (refresh) {
bus.$emit('asset-list-change')
}
},
closeAlertRuleRightBox (refresh) {
this.rightBox.alertRule.show = false
if (refresh) {
bus.$emit('alert-rule-list-change')
}
},
closeDcBox (refresh) {
this.rightBox.dc.show = false
if (refresh) {
this.getAssetData()
bus.$emit('dc-list-change')
}
},
toEditProject (p) {
this.editProject = Object.assign({}, p)
this.rightBox.project.show = true
},
logout () {
this.$get('logout').then(() => {
this.logoutSuccess()
document.location.href = '/'
})
// this.jumpTo('/login');
},
refreshLang () {
this.language = localStorage.getItem('nz-language')
@@ -418,13 +160,6 @@ export default {
this.username = sessionStorage.getItem('nz-username')
this.refreshLang()
})
bus.$on('dc-list-change', () => { // dc.vue增删改dc时刷新顶部菜单dc列表
this.getAssetData()
})
bus.$on('current-project-change', project => {
this.currentProject = project
this.activeItemIndex = project.id
})
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL)
window.addEventListener('popstate', this.cancel, false)
@@ -435,45 +170,12 @@ export default {
this.$i18n.locale = this.language
if (sessionStorage.getItem('nz-token')) {
this.initEvent()
this.getAssetData()
this.getUserData()
this.getProjectList()
this.getLinkData()
}
// 刷新后有高亮
/* let activePath = this.$route.path.slice(1);
this.activeIndex = activePath; */
},
computed: {
linkData () {
return this.$store.getters.getLinkData
},
route () {
return this.$route.path
},
overViewProject () {
return this.$store.getters.getOverViewProject
},
menuIsActive () {
return function (menu, isParent) {
if (isParent) {
const isCurrent = menu.children.some(sub => {
return sub.route == this.route
})
if (isCurrent) {
return 'menu-active'
} else {
return ''
}
} else {
if (menu.route == this.route) {
return 'menu-item-active'
} else {
return ''
}
}
}
},
breadcrumb () {
const vm = this
const menuList = this.$store.getters.menuList
@@ -495,17 +197,8 @@ export default {
return breadcrumb
}
},
watch: {
overViewProject (n) {
if (n) {
this.jumpToProject(n)
}
}
},
beforeDestroy () {
bus.$off('login')
bus.$off('dc-list-change')
bus.$off('current-project-change')
},
destroyed () {
window.removeEventListener('popstate', this.cancel, false)

View File

@@ -4,7 +4,6 @@
ref="dataList"
:api="url"
:custom-table-title.sync="tools.customTableTitle"
:from="fromRoute.asset"
:has-search="true"
:layout="['searchInput', 'elementSet', 'clickSearch']"
:search-msg="searchMsg">

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
.overview {
height: 100%;
padding: 0 10px;
background-color: #f6f6f6;
}
.overview-content-header{

View File

@@ -31,7 +31,7 @@ export default new Router({
},
{
path: 'overview',
component: resolve => require(['../components/page/dashboard/overview/overview2.vue'], resolve)
component: resolve => require(['../components/page/dashboard/overview/overview.vue'], resolve)
},
{
path: '/monitor/project',