feat: 添加topology固定的 图标为小模块

This commit is contained in:
zhangyu
2021-07-07 11:21:18 +08:00
parent 2b89e99f08
commit 87268e43ff
2 changed files with 60 additions and 23 deletions

View File

@@ -361,7 +361,33 @@ export default {
imgInit: false, // 判断图片是否加载完成 imgInit: false, // 判断图片是否加载完成
toolGroup: '基本形状', toolGroup: '基本形状',
editFlag: true, editFlag: true,
tools: [...Tools], tools: [
...Tools,
{
group: '123',
children: [
{
name: 'rectangle2',
icon: 'icon-rect',
data: {
text: 'rect',
rect: {
width: 100,
height: 100
},
paddingLeft: 10,
paddingRight: 10,
paddingTop: 10,
paddingBottom: 10,
name: 'rectangleImg2',
icon: '\ue6cf',
iconFamily: 'nz-icon',
iconColor: ''
}
}
]
}
],
props: {}, props: {},
topologyLoading: false, topologyLoading: false,
contextmenu: { contextmenu: {
@@ -833,7 +859,12 @@ export default {
const selLevel = pen.data.valueMapping.find(item => item.level === maxLevel) const selLevel = pen.data.valueMapping.find(item => item.level === maxLevel)
if (selLevel) { if (selLevel) {
pen.fontColor = selLevel.color.text pen.fontColor = selLevel.color.text
pen.fillStyle = selLevel.color.fill console.log(pen.iconFamily)
if (pen.iconFamily) {
pen.fillStyle = 'transparent'
pen.iconColor = selLevel.color.fill
}
pen.strokeStyle = selLevel.color.line pen.strokeStyle = selLevel.color.line
pen.bkType = 0 pen.bkType = 0
} }
@@ -1063,6 +1094,7 @@ export default {
error: false, error: false,
animatePlay: false, animatePlay: false,
fillStyle: data.fillStyle, fillStyle: data.fillStyle,
iconColor: data.fillStyle,
strokeStyle: data.strokeStyle, strokeStyle: data.strokeStyle,
gradientColor: '#bae7ff', gradientColor: '#bae7ff',
gradientType: 0, gradientType: 0,
@@ -1557,7 +1589,30 @@ export default {
if (!this.fromOverView) { if (!this.fromOverView) {
this.$get('monitor/project/topo/icon').then(res => { this.$get('monitor/project/topo/icon').then(res => {
this.imgageLoading = true this.imgageLoading = true
this.tools = [...Tools] this.tools = [...Tools, {
group: '123',
children: [
{
name: 'rectangle2',
icon: 'icon-rect',
data: {
text: 'rect',
rect: {
width: 100,
height: 100
},
paddingLeft: 10,
paddingRight: 10,
paddingTop: 10,
paddingBottom: 10,
name: 'rectangleImg2',
icon: '\ue6cf',
iconFamily: 'nz-icon',
iconColor: '#000'
}
}
]
}]
const imgArr = [] const imgArr = []
const promiseArr = [] const promiseArr = []
res.data.list.forEach((item, index) => { res.data.list.forEach((item, index) => {
@@ -1685,6 +1740,7 @@ export default {
item.animateType = item.data.animateType item.animateType = item.data.animateType
if (item.type === 0) { if (item.type === 0) {
item.fillStyle = item.data.fillStyle item.fillStyle = item.data.fillStyle
item.iconColor = item.data.fillStyle
item.strokeStyle = item.data.strokeStyle item.strokeStyle = item.data.strokeStyle
item.animatePlay = false item.animatePlay = false
item.fontColor = '#000000' item.fontColor = '#000000'

View File

@@ -18,25 +18,6 @@ export const Tools = [
{ {
group: 'General', group: 'General',
children: [ children: [
// {
// name: 'rectangle',
// icon: 'icon-rect',
// data: {
// text: 'rect',
// rect: {
// width: 100,
// height: 100
// },
// paddingLeft: 10,
// paddingRight: 10,
// paddingTop: 10,
// paddingBottom: 10,
// name: 'rectangleImg',
// icon: '\ue680',
// iconFamily: 'nz-icon',
// iconColor: ''
// }
// },
{ {
name: 'rectangle', name: 'rectangle',
icon: 'icon-cube', icon: 'icon-cube',
@@ -295,7 +276,7 @@ export function myTextRect (node) {
node.fullTextRect = node.rect node.fullTextRect = node.rect
} }
export function myIconRect2 (node) { export function myIconRect2 (node) {
node.iconRect = new Rect(node.rect.x + node.paddingLeft, node.rect.y + node.paddingTop, node.rect.width - (node.paddingLeft + node.paddingRight), node.rect.height - (node.paddingTop + node.paddingBottom)) node.iconRect = node.rect
node.fullIconRect = node.rect node.fullIconRect = node.rect
} }
export function myTextRect2 (node) { export function myTextRect2 (node) {