diff --git a/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailRelationTopo/index.vue b/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailRelationTopo/index.vue index 51d7bb2..679d79a 100644 --- a/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailRelationTopo/index.vue +++ b/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailRelationTopo/index.vue @@ -1,163 +1,168 @@ - - - - - + + + + + diff --git a/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailRelationTopo/node.js b/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailRelationTopo/node.js index b2b4143..af8cd49 100644 --- a/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailRelationTopo/node.js +++ b/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailRelationTopo/node.js @@ -1,56 +1,56 @@ -/* eslint-disable no-useless-constructor */ -import { TreeNode } from 'butterfly-dag' - -import $ from 'jquery' - -class BaseNode extends TreeNode { - constructor(opts) { - super(opts) - } - - draw = (opts) => { - const container = $(`
`) - .css('top', opts.top) - .css('left', opts.left) - .attr('id', opts.id) - let icon - if (opts.options.icon) { - if (opts.options.icon.split('$$')[2]) { - icon = $(``) - } else { - icon = $(``) - } - } else { - icon = $(`${opts.options.name[0].toUpperCase()}`) - } - - const titleContent = $(`
${opts.options.title}
`) - const uniqueDom = $(`
${opts.options.unique_alias || opts.options.unique_name}:${opts.options.unique_value}
`) - container.append(icon) - container.append(titleContent) - container.append(uniqueDom) - - if (opts.options.side && !opts.options.children.length) { - const addIcon = $(``) - container.append(addIcon) - addIcon.on('click', () => { - if (opts.options.side === 'left') { - this.emit('events', { - type: 'custom:clickLeft', - data: { ...this } - }) - } - if (opts.options.side === 'right') { - this.emit('events', { - type: 'custom:clickRight', - data: { ...this } - }) - } - }) - } - - return container[0] - } -} - -export default BaseNode +/* eslint-disable no-useless-constructor */ +import { TreeNode } from 'butterfly-dag' + +import $ from 'jquery' + +class BaseNode extends TreeNode { + constructor(opts) { + super(opts) + } + + draw = (opts) => { + const container = $(`
`) + .css('top', opts.top) + .css('left', opts.left) + .attr('id', opts.id) + let icon + if (opts.options.icon) { + if (opts.options.icon.split('$$')[2]) { + icon = $(``) + } else { + icon = $(``) + } + } else { + icon = $(`${opts.options.name[0].toUpperCase()}`) + } + + const titleContent = $(`
${opts.options.title}
`) + const uniqueDom = $(`
${opts.options.unique_alias || opts.options.unique_name}:${opts.options.unique_value}
`) + container.append(icon) + container.append(titleContent) + container.append(uniqueDom) + + if (opts.options.side && (!opts.options.children.length && !(opts.options.edges && opts.options.edges.length && opts.options.edges.find(e => e.source === opts.options.side && e.sourceNode === opts.options.id)))) { + const addIcon = $(``) + container.append(addIcon) + addIcon.on('click', () => { + if (opts.options.side === 'left') { + this.emit('events', { + type: 'custom:clickLeft', + data: { ...this } + }) + } + if (opts.options.side === 'right') { + this.emit('events', { + type: 'custom:clickRight', + data: { ...this } + }) + } + }) + } + + return container[0] + } +} + +export default BaseNode