diff --git a/nezha-fronted/src/components/common/ChartDiagram/diagram.vue b/nezha-fronted/src/components/common/ChartDiagram/diagram.vue index 3e5897293..a4467f629 100644 --- a/nezha-fronted/src/components/common/ChartDiagram/diagram.vue +++ b/nezha-fronted/src/components/common/ChartDiagram/diagram.vue @@ -361,7 +361,33 @@ export default { imgInit: false, // 判断图片是否加载完成 toolGroup: '基本形状', 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: {}, topologyLoading: false, contextmenu: { @@ -833,7 +859,12 @@ export default { const selLevel = pen.data.valueMapping.find(item => item.level === maxLevel) if (selLevel) { 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.bkType = 0 } @@ -1063,6 +1094,7 @@ export default { error: false, animatePlay: false, fillStyle: data.fillStyle, + iconColor: data.fillStyle, strokeStyle: data.strokeStyle, gradientColor: '#bae7ff', gradientType: 0, @@ -1557,7 +1589,30 @@ export default { if (!this.fromOverView) { this.$get('monitor/project/topo/icon').then(res => { 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 promiseArr = [] res.data.list.forEach((item, index) => { @@ -1685,6 +1740,7 @@ export default { item.animateType = item.data.animateType if (item.type === 0) { item.fillStyle = item.data.fillStyle + item.iconColor = item.data.fillStyle item.strokeStyle = item.data.strokeStyle item.animatePlay = false item.fontColor = '#000000' diff --git a/nezha-fronted/src/components/common/project/L5/services/canvas.js b/nezha-fronted/src/components/common/project/L5/services/canvas.js index 3f81eaec5..03addf18b 100644 --- a/nezha-fronted/src/components/common/project/L5/services/canvas.js +++ b/nezha-fronted/src/components/common/project/L5/services/canvas.js @@ -18,25 +18,6 @@ export const Tools = [ { group: 'General', 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', icon: 'icon-cube', @@ -295,7 +276,7 @@ export function myTextRect (node) { node.fullTextRect = node.rect } 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 } export function myTextRect2 (node) {