fix:修改 全局搜索 loading 一直显示的问题 以及 图片 不缓存到localstorage
This commit is contained in:
@@ -327,7 +327,7 @@ import {
|
|||||||
myCubec,
|
myCubec,
|
||||||
myCubeAnchors
|
myCubeAnchors
|
||||||
} from '../project/L5/services/canvas.js'
|
} 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 CanvasProps from '../project/L5/CanvasProps'
|
||||||
import topologyTopTool from '../project/L5/topologyTopTool'
|
import topologyTopTool from '../project/L5/topologyTopTool'
|
||||||
import popDataMain from '../project/popData/Main'
|
import popDataMain from '../project/popData/Main'
|
||||||
@@ -1744,7 +1744,7 @@ export default {
|
|||||||
res.data.list.forEach((item, index) => {
|
res.data.list.forEach((item, index) => {
|
||||||
item.imageName = item.name
|
item.imageName = item.name
|
||||||
delete item.name
|
delete item.name
|
||||||
const nowImage = getTopologyImg(item.id) ? JSON.parse(getTopologyImg(item.id)) : ''
|
const nowImage = ''
|
||||||
if (nowImage && nowImage.data) {
|
if (nowImage && nowImage.data) {
|
||||||
promiseArr.push(nowImage)
|
promiseArr.push(nowImage)
|
||||||
} else {
|
} else {
|
||||||
@@ -1756,14 +1756,6 @@ export default {
|
|||||||
this.iconArray = [...res.data.list]
|
this.iconArray = [...res.data.list]
|
||||||
this.iconArray.forEach((item, index) => {
|
this.iconArray.forEach((item, index) => {
|
||||||
item.image = res2[index].data
|
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)
|
const group = this.tools.find(tool => tool.group === item.unit)
|
||||||
if (group) {
|
if (group) {
|
||||||
group.children.push({
|
group.children.push({
|
||||||
@@ -1814,7 +1806,7 @@ export default {
|
|||||||
}
|
}
|
||||||
imgidList.forEach((item, index) => {
|
imgidList.forEach((item, index) => {
|
||||||
if (item.data.imageId && imageAllId.data.list.find(image => item.data.imageId === image.id)) {
|
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) {
|
if (nowImage && nowImage.data) {
|
||||||
promiseArr.push(nowImage)
|
promiseArr.push(nowImage)
|
||||||
} else {
|
} else {
|
||||||
@@ -1835,14 +1827,6 @@ export default {
|
|||||||
this.iconArray.forEach((item, index) => {
|
this.iconArray.forEach((item, index) => {
|
||||||
if (item.id) {
|
if (item.id) {
|
||||||
item.image = res2[index].data
|
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
|
this.imgInit = true
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="global-search-bac" v-if="globalShow" @click.self="close">
|
<div class="global-search-bac" v-if="globalShow" @click.self="close">
|
||||||
<div class="global-search-box" :class="firstShow? '' : 'search-after'" @click.self="close">
|
<div class="global-search-box" :class="firstShow? '' : 'search-after'" @click.self="close">
|
||||||
<div class="global-search-input" :class="firstShow? '' : 'search-after'">
|
<div class="global-search-input" :class="firstShow? '' : 'search-after'">
|
||||||
<i class="nz-icon nz-icon-search" v-my-loading:circle3.scaleMin.icon="loading"></i>
|
<i class="nz-icon nz-icon-search" v-my-loading:circle3.scaleMin.icon="jumpLoading"></i>
|
||||||
<el-input v-model="searchStr" @input="searchAll" ref="searchStr" :placeholder="$t('globalSearch.placeholder')" @keydown.native="inputKeydown" clearable></el-input>
|
<el-input v-model="searchStr" @input="searchAll" ref="searchStr" :placeholder="$t('globalSearch.placeholder')" @keydown.native="inputKeydown" clearable></el-input>
|
||||||
<div @click="close" class="global-search-cancel">
|
<div @click="close" class="global-search-cancel">
|
||||||
{{$t('overall.cancel')}}
|
{{$t('overall.cancel')}}
|
||||||
|
|||||||
@@ -45,11 +45,11 @@ export function setTopology (key, value) {
|
|||||||
// const topologyImgList = localStorage.getItem('nz-imgList') ? JSON.parse(localStorage.getItem('nz-imgList')) : {}
|
// const topologyImgList = localStorage.getItem('nz-imgList') ? JSON.parse(localStorage.getItem('nz-imgList')) : {}
|
||||||
|
|
||||||
export function getTopologyImg (key) {
|
export function getTopologyImg (key) {
|
||||||
return localStorage.getItem('nz-topologyImg-' + key)
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setTopologyImg (key, img) {
|
export function setTopologyImg (key, img) {
|
||||||
localStorage.setItem('nz-topologyImg-' + key, img)
|
// localStorage.setItem('nz-topologyImg-' + key, img)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setHexagon (key, value) {
|
export function setHexagon (key, value) {
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ import {
|
|||||||
myCubec,
|
myCubec,
|
||||||
myCubeAnchors
|
myCubeAnchors
|
||||||
} from './L5/services/canvas.js'
|
} 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 CanvasProps from './L5/CanvasProps'
|
||||||
import topologyTopTool from './L5//topologyTopTool'
|
import topologyTopTool from './L5//topologyTopTool'
|
||||||
import CanvasContextMenu from './L5/CanvasContextMenu'
|
import CanvasContextMenu from './L5/CanvasContextMenu'
|
||||||
@@ -1744,26 +1744,13 @@ export default {
|
|||||||
res.data.list.forEach((item, index) => {
|
res.data.list.forEach((item, index) => {
|
||||||
item.imageName = item.name
|
item.imageName = item.name
|
||||||
delete 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`))
|
promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.id}/1`))
|
||||||
}
|
|
||||||
imgArr.push({ ...item })
|
imgArr.push({ ...item })
|
||||||
})
|
})
|
||||||
Promise.all(promiseArr).then((res2, header) => {
|
Promise.all(promiseArr).then((res2, header) => {
|
||||||
this.iconArray = [...res.data.list]
|
this.iconArray = [...res.data.list]
|
||||||
this.iconArray.forEach((item, index) => {
|
this.iconArray.forEach((item, index) => {
|
||||||
item.image = res2[index].data
|
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)
|
const group = this.tools.find(tool => tool.group === item.unit)
|
||||||
if (group) {
|
if (group) {
|
||||||
group.children.push({
|
group.children.push({
|
||||||
@@ -1816,12 +1803,7 @@ export default {
|
|||||||
}
|
}
|
||||||
imgidList.forEach((item, index) => {
|
imgidList.forEach((item, index) => {
|
||||||
if (item.data.imageId && imageAllId.data.list.find(image => item.data.imageId === image.id)) {
|
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`))
|
promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}/1`))
|
||||||
}
|
|
||||||
} else if (item.data.imageId) {
|
} else if (item.data.imageId) {
|
||||||
promiseArr.push(imgDefault)
|
promiseArr.push(imgDefault)
|
||||||
} else {
|
} else {
|
||||||
@@ -1837,14 +1819,6 @@ export default {
|
|||||||
this.iconArray.forEach((item, index) => {
|
this.iconArray.forEach((item, index) => {
|
||||||
if (item.id) {
|
if (item.id) {
|
||||||
item.image = res2[index].data
|
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
|
this.imgInit = true
|
||||||
|
|||||||
Reference in New Issue
Block a user