Merge branch 'dev-3.3' of https://git.mesalab.cn/nezha/nezha-fronted into dev-3.3

This commit is contained in:
likexuan
2022-06-09 13:18:17 +08:00
10 changed files with 40 additions and 71 deletions

View File

@@ -95,6 +95,7 @@
width: 100%;
box-sizing: border-box;
overflow-y: auto;
overflow-x: hidden;
}
.list-item{
height: 64px;

View File

@@ -59,7 +59,7 @@
}
.search-item-value-box{
line-height: 47px;
height: 100%;
height: 13px;
width: calc(100% - 120px);
display: flex;
align-items: center;

View File

@@ -107,17 +107,17 @@
}
}
.panel-select-item:hover{
color: #FA901C;
color: $--color-primary;
background: $--background-color-base;
i{
color: #FA901C;
color: $--color-primary;
}
}
.panel-select-item.active{
color: #FA901C;
color: $--color-primary;
background: $--background-color-base;
i{
color: #FA901C;
color: $--color-primary;
}
}
}
@@ -161,4 +161,8 @@
color:#FF9219 !important;
cursor: pointer ;
}
.highlight-keyword{
color:$--color-primary;
background: none;
}
}

View File

@@ -327,7 +327,7 @@ import {
myCubec,
myCubeAnchors
} from '../project/L5/services/canvas.js'
import {getTopology, getTopologyImg, setTopology, setTopologyImg} from '../js/common'
import {getTopology, setTopology} from '../js/common'
import CanvasProps from '../project/L5/CanvasProps'
import topologyTopTool from '../project/L5/topologyTopTool'
import popDataMain from '../project/popData/Main'
@@ -1744,7 +1744,7 @@ export default {
res.data.list.forEach((item, index) => {
item.imageName = item.name
delete item.name
const nowImage = getTopologyImg(item.id) ? JSON.parse(getTopologyImg(item.id)) : ''
const nowImage = ''
if (nowImage && nowImage.data) {
promiseArr.push(nowImage)
} else {
@@ -1756,14 +1756,6 @@ export default {
this.iconArray = [...res.data.list]
this.iconArray.forEach((item, index) => {
item.image = res2[index].data
const nowImage = getTopologyImg(item.id) ? JSON.parse(getTopologyImg(item.id)) : ''
if (!nowImage || (nowImage && !nowImage.data)) {
setTopologyImg(item.id, JSON.stringify({
data: res2[index].data,
width: res2[index].width,
height: res2[index].height
}))
}
const group = this.tools.find(tool => tool.group === item.unit)
if (group) {
group.children.push({
@@ -1814,7 +1806,7 @@ export default {
}
imgidList.forEach((item, index) => {
if (item.data.imageId && imageAllId.data.list.find(image => item.data.imageId === image.id)) {
const nowImage = getTopologyImg(item.data.imageId) ? JSON.parse(getTopologyImg(item.data.imageId)) : ''
const nowImage = ''
if (nowImage && nowImage.data) {
promiseArr.push(nowImage)
} else {
@@ -1835,14 +1827,6 @@ export default {
this.iconArray.forEach((item, index) => {
if (item.id) {
item.image = res2[index].data
const nowImage = getTopologyImg(item.id) ? JSON.parse(getTopologyImg(item.id)) : ''
if (!nowImage || (nowImage && !nowImage.image)) {
setTopologyImg(item.id, JSON.stringify({
data: res2[index].data,
width: res2[index].width,
height: res2[index].height
}))
}
}
})
this.imgInit = true

View File

@@ -52,7 +52,7 @@
<div class="list-item-sub" v-if="item.sub">
{{ item.sub }}
</div>
<div class="is-jump" v-my-loading:circle3.scaleMin.icon="true">
<div class="is-jump" v-my-loading:circle3.scaleMin.icon="jumpLoading">
<i class="nz-icon nz-icon-huiche"></i>
</div>
</li>

View File

@@ -45,11 +45,11 @@ export function setTopology (key, value) {
// const topologyImgList = localStorage.getItem('nz-imgList') ? JSON.parse(localStorage.getItem('nz-imgList')) : {}
export function getTopologyImg (key) {
return localStorage.getItem('nz-topologyImg-' + key)
return false
}
export function setTopologyImg (key, img) {
localStorage.setItem('nz-topologyImg-' + key, img)
// localStorage.setItem('nz-topologyImg-' + key, img)
}
export function setHexagon (key, value) {

View File

@@ -8,8 +8,10 @@
<span>{{item.name}}</span>
</li>
</ul>
<div slot="default">
<slot name="tail"></slot>
<div class="dashboard-select-tail">
<span class="dashboard-select-add" v-has="'main_add'" :title='$t("dashboard.panel.createPanelTitleSec")' @click="toAdd">
<i class="nz-icon nz-icon-create-square"></i>&nbsp;&nbsp;{{$t('overall.addDashboard')}}
</span>
</div>
</div>
<div class="pop-item-wider">
@@ -28,11 +30,11 @@
check-on-click-node
check-strictly
default-expand-all
highlight-current
:highlight-current="true"
node-key="id"
ref="panelTree">
<div class="tree--node" slot-scope="{ node, data }">
<span :title="node.label + ' (' + data.chartNum +' charts' ">{{ node.label }}</span>
<HighlightText :queries="filterPanel" :highlightClass="'highlight-keyword'" style="vertical-align: middle" :title="node.label + ' (' + data.chartNum +' charts' ">{{node.label}}</HighlightText>
<el-row class="block-col-2" style="margin-left:10px;margin-right:8px">
<el-col>
<el-dropdown v-if="!panelLock" placement="bottom-end" trigger="click" style="margin-right:10px">
@@ -64,8 +66,12 @@
</template>
<script>
import bus from '@/libs/bus'
import HighlightText from 'vue-text-highlight'
export default {
name: 'selectDashboard',
components: {
HighlightText
},
props: {
placement: { type: String },
panelData: { type: Array },
@@ -123,6 +129,12 @@ export default {
this.userId = localStorage.getItem('nz-user-id')
},
methods: {
// 新增仪表盘
toAdd () {
this.$parent.toAdd()
this.esc()
},
// 左侧tab点击
tabChange (value) {
if (this.currentTab !== value) {
@@ -141,7 +153,7 @@ export default {
const flatArr = this.flatten(this.panelData)
this.treeData = flatArr.filter(item => item.createBy == this.userId)
} else if (type === 'browse') { // 最近浏览
const browseArr = JSON.parse(localStorage.getItem(`nz-${this.userId}-browse`) || '[]')
const browseArr = JSON.parse(localStorage.getItem(`nz-view-dashboard-${this.userId}`) || '[]')
const flatArr = this.flatten(this.panelData)
const tempArr = []
// 比对id获取最近浏览的数据
@@ -215,7 +227,7 @@ export default {
// 设置最近浏览的面板
setBrowse () {
// 获取最近浏览id数组
let browseArr = JSON.parse(localStorage.getItem(`nz-${this.userId}-browse`) || '[]')
let browseArr = JSON.parse(localStorage.getItem(`nz-view-dashboard-${this.userId}`) || '[]')
const flatArr = this.flatten(this.panelData)
// 若最近浏览的数据已被删除 则截取掉
for (let i = 0; i < browseArr.length; i++) {
@@ -236,7 +248,7 @@ export default {
browseArr.unshift({ id: this.panel.id })
// 如果数组长度大于10则截取
browseArr.splice(10)
localStorage.setItem(`nz-${this.userId}-browse`, JSON.stringify(browseArr))
localStorage.setItem(`nz-view-dashboard-${this.userId}`, JSON.stringify(browseArr))
},
// 新增收藏
addStarred: bus.debounceFn(function (data) {

View File

@@ -351,7 +351,7 @@ import {
myCubec,
myCubeAnchors
} from './L5/services/canvas.js'
import { getTopology, setTopology, getTopologyImg, setTopologyImg } from '../js/common'
import { getTopology, setTopology } from '../js/common'
import CanvasProps from './L5/CanvasProps'
import topologyTopTool from './L5//topologyTopTool'
import CanvasContextMenu from './L5/CanvasContextMenu'
@@ -1744,26 +1744,13 @@ export default {
res.data.list.forEach((item, index) => {
item.imageName = item.name
delete item.name
const nowImage = getTopologyImg(item.id) ? JSON.parse(getTopologyImg(item.id)) : ''
if (nowImage && nowImage.data) {
promiseArr.push(nowImage)
} else {
promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.id}/1`))
}
imgArr.push({ ...item })
})
Promise.all(promiseArr).then((res2, header) => {
this.iconArray = [...res.data.list]
this.iconArray.forEach((item, index) => {
item.image = res2[index].data
const nowImage = getTopologyImg(item.id) ? JSON.parse(getTopologyImg(item.id)) : ''
if (!nowImage || (nowImage && !nowImage.data)) {
setTopologyImg(item.id, JSON.stringify({
data: res2[index].data,
width: res2[index].width,
height: res2[index].height
}))
}
const group = this.tools.find(tool => tool.group === item.unit)
if (group) {
group.children.push({
@@ -1816,12 +1803,7 @@ export default {
}
imgidList.forEach((item, index) => {
if (item.data.imageId && imageAllId.data.list.find(image => item.data.imageId === image.id)) {
const nowImage = getTopologyImg(item.data.imageId) ? JSON.parse(getTopologyImg(item.data.imageId)) : ''
if (nowImage && nowImage.data) {
promiseArr.push(nowImage)
} else {
promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}/1`))
}
} else if (item.data.imageId) {
promiseArr.push(imgDefault)
} else {
@@ -1837,14 +1819,6 @@ export default {
this.iconArray.forEach((item, index) => {
if (item.id) {
item.image = res2[index].data
const nowImage = getTopologyImg(item.id) ? JSON.parse(getTopologyImg(item.id)) : ''
if (!nowImage || (nowImage && !nowImage.image)) {
setTopologyImg(item.id, JSON.stringify({
data: res2[index].data,
width: res2[index].width,
height: res2[index].height
}))
}
}
})
this.imgInit = true

View File

@@ -30,13 +30,6 @@
<i @click.stop="delStarred(showPanel)" v-if="showPanel.starred" class="nz-icon nz-icon-a-xingzhuang2"></i>
<i @click.stop="addStarred(showPanel)" v-else class="nz-icon nz-icon-xingzhuang"></i>
</template>
<template v-slot:tail>
<div class="dashboard-select-tail">
<span class="dashboard-select-add" v-has="'main_add'" :title='$t("dashboard.panel.createPanelTitleSec")' @click="toAdd">
<i class="nz-icon nz-icon-create-square"></i>&nbsp;&nbsp;{{$t('overall.addDashboard')}}
</span>
</div>
</template>
</select-dashboard>
</div>

View File

@@ -50,6 +50,7 @@ import chartList from '@/components/chart/chartList.vue'
import moment from 'moment-timezone'
import { loadI18n } from '@/components/common/i18n'
import i18nData from '@/entrance/exportHtml/i18nData'
const dataJson = window.dataJson || {}
export default {
name: 'Entrance',
@@ -67,7 +68,7 @@ export default {
this.$i18n.locale = this.dataJson.language
loadI18n(i18nData)
const localOffset = moment.tz.guess()// 默认 一分钟显示时区偏移的结果
localStorage.setItem('nz-sys-timezone', JSON.stringify(localOffset))
localStorage.setItem('nz-sys-timezone', localOffset)
},
mounted () {
},