NEZ-2735 fix:project toop 部分有数据的节点不显示
This commit is contained in:
@@ -0,0 +1,70 @@
|
|||||||
|
export const Tools = [
|
||||||
|
{
|
||||||
|
group: 'General',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'rectangle',
|
||||||
|
icon: '\ue64d',
|
||||||
|
id: 'e64d',
|
||||||
|
nzClassName: 'nz-icon-rectangle',
|
||||||
|
unit: 'General'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rectangle',
|
||||||
|
icon: '\ue730;',
|
||||||
|
id: 'e730;',
|
||||||
|
nzClassName: 'nz-icon-rectangle1',
|
||||||
|
unit: 'General'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rectangle',
|
||||||
|
icon: '\ue731;',
|
||||||
|
id: '731',
|
||||||
|
nzClassName: 'nz-icon-EMAC1',
|
||||||
|
unit: 'General'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rectangle',
|
||||||
|
icon: '\ue67f;',
|
||||||
|
id: 'e67f',
|
||||||
|
nzClassName: 'nz-icon-module5',
|
||||||
|
unit: 'General'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rectangle',
|
||||||
|
icon: '\ue67e',
|
||||||
|
id: 'e67e',
|
||||||
|
nzClassName: 'nz-icon-module3',
|
||||||
|
unit: 'General'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rectangle',
|
||||||
|
icon: '\ue67d',
|
||||||
|
id: 'e67d',
|
||||||
|
nzClassName: 'nz-icon-module1',
|
||||||
|
unit: 'General'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rectangle',
|
||||||
|
icon: '\ue67c',
|
||||||
|
id: 'e67c',
|
||||||
|
nzClassName: 'nz-icon-module4',
|
||||||
|
unit: 'General'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rectangle',
|
||||||
|
icon: '\ue67b',
|
||||||
|
id: 'e67b',
|
||||||
|
nzClassName: 'nz-icon-module2',
|
||||||
|
unit: 'General'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rectangle',
|
||||||
|
icon: '\ue680',
|
||||||
|
id: 'e680',
|
||||||
|
nzClassName: 'nz-icon-module6',
|
||||||
|
unit: 'General'
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -1,21 +1,16 @@
|
|||||||
import { Meta2d, registerNode } from '@meta2d/core'
|
import { Meta2d, registerNode, s8 } from '@meta2d/core'
|
||||||
import { flowPens } from '@meta2d/flow-diagram'
|
import { flowPens } from '@meta2d/flow-diagram'
|
||||||
import { activityDiagram } from '@meta2d/activity-diagram'
|
import { activityDiagram } from '@meta2d/activity-diagram'
|
||||||
import { classPens } from '@meta2d/class-diagram'
|
import { classPens } from '@meta2d/class-diagram'
|
||||||
import { sequencePens, sequencePensbyCtx } from '@meta2d/sequence-diagram'
|
import { sequencePens, sequencePensbyCtx } from '@meta2d/sequence-diagram'
|
||||||
// import { chartsPens } from '@meta2d/le5le-charts'
|
// import { chartsPens } from '@meta2d/le5le-charts'
|
||||||
import {
|
import {
|
||||||
Tools,
|
disposeTopoOldData
|
||||||
canvasRegister,
|
|
||||||
imageTemp,
|
|
||||||
onChangeAnimate,
|
|
||||||
onChangeAnimateLine,
|
|
||||||
myCubec,
|
|
||||||
myCubeAnchors
|
|
||||||
} from '../../L5/services/canvas.js'
|
} from '../../L5/services/canvas.js'
|
||||||
import { getTopology, setTopology, dealImg, topologyImg } from '@/components/common/js/common'
|
import { getTopology, setTopology, dealImg, topologyImg } from '@/components/common/js/common'
|
||||||
import bus from '@/libs/bus'
|
import bus from '@/libs/bus'
|
||||||
import topoUtil from '@/components/common/project/meta2d/js/topoUtil'
|
import topoUtil from '@/components/common/project/meta2d/js/topoUtil'
|
||||||
|
import lineData from '@/components/common/project/meta2d/js/defaultPenLineData'
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@@ -153,9 +148,13 @@ export default {
|
|||||||
if (pen.data && pen.data.params) {
|
if (pen.data && pen.data.params) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (name) {
|
if (name && !pen.text) {
|
||||||
pen.text = name
|
pen.text = name
|
||||||
}
|
}
|
||||||
|
if (pen.data && pen.data.imageId) {
|
||||||
|
pen.imageId = pen.data.imageId
|
||||||
|
pen.image = `/monitor/project/topo/icon/${pen.data.imageId}/0`
|
||||||
|
}
|
||||||
pen.data = {
|
pen.data = {
|
||||||
params: { // 用于编辑时 重置为节点初始状态
|
params: { // 用于编辑时 重置为节点初始状态
|
||||||
background: pen.background || '#22222200',
|
background: pen.background || '#22222200',
|
||||||
@@ -187,6 +186,7 @@ export default {
|
|||||||
}
|
}
|
||||||
pen.nzName = name
|
pen.nzName = name
|
||||||
pen.moduleId = ''
|
pen.moduleId = ''
|
||||||
|
pen.iconFamily = 'nz-icon'
|
||||||
pen.disableInput = pen.disableInput || true
|
pen.disableInput = pen.disableInput || true
|
||||||
pen.background = pen.background || '#22222200'
|
pen.background = pen.background || '#22222200'
|
||||||
pen.textAlign = pen.textAlign || 'center'
|
pen.textAlign = pen.textAlign || 'center'
|
||||||
@@ -211,11 +211,42 @@ export default {
|
|||||||
pen.isNz = true
|
pen.isNz = true
|
||||||
pen.locked = pen.locked || 0
|
pen.locked = pen.locked || 0
|
||||||
pen.isBottom = false
|
pen.isBottom = false
|
||||||
|
if (pen.rect) {
|
||||||
|
pen.x = pen.rect.x
|
||||||
|
pen.y = pen.rect.y
|
||||||
|
pen.height = pen.rect.height
|
||||||
|
pen.width = pen.rect.width
|
||||||
|
delete pen.rect
|
||||||
|
delete pen.textRect
|
||||||
|
}
|
||||||
},
|
},
|
||||||
lineInit (pen, name) { // 初始化连线参数
|
lineInit (pen, name) { // 初始化连线参数
|
||||||
if (pen.data && pen.data.params) {
|
if (pen.data && pen.data.params) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (pen.from && pen.to) {
|
||||||
|
const width = pen.from.x - pen.to.x
|
||||||
|
const height = pen.from.y - pen.to.y
|
||||||
|
const from = pen.from
|
||||||
|
const to = pen.to
|
||||||
|
pen.lineName = pen.name
|
||||||
|
pen.name = 'line'
|
||||||
|
pen.borderType = 0
|
||||||
|
pen.anchors = lineData.anchors
|
||||||
|
const penId = pen.id
|
||||||
|
pen.anchors[0].connectTo = from.id
|
||||||
|
pen.anchors[1].connectTo = to.id
|
||||||
|
pen.anchors[0].anchorId = from.anchorIndex + ''
|
||||||
|
pen.anchors[1].anchorId = to.anchorIndex + ''
|
||||||
|
pen.anchors[0].id = s8()
|
||||||
|
pen.anchors[1].id = s8()
|
||||||
|
pen.anchors[0].penId = penId
|
||||||
|
pen.anchors[1].penId = penId
|
||||||
|
pen.x = width > 0 ? to.x : from.x
|
||||||
|
pen.y = height > 0 ? to.y : from.y
|
||||||
|
pen.width = Math.abs(to.x - from.x)
|
||||||
|
pen.height = Math.abs(to.y - from.y)
|
||||||
|
}
|
||||||
pen.data = {
|
pen.data = {
|
||||||
params: {
|
params: {
|
||||||
animateColor: pen.animateColor || '#FA901CFF',
|
animateColor: pen.animateColor || '#FA901CFF',
|
||||||
@@ -375,6 +406,12 @@ export default {
|
|||||||
const findPen = getTopology(this.meta2dId).getPenRect(pen)
|
const findPen = getTopology(this.meta2dId).getPenRect(pen)
|
||||||
obj[key] = findPen[key]
|
obj[key] = findPen[key]
|
||||||
}
|
}
|
||||||
|
if (key === 'image') {
|
||||||
|
obj.icon = ''
|
||||||
|
}
|
||||||
|
if (key === 'icon') {
|
||||||
|
obj.image = ''
|
||||||
|
}
|
||||||
getTopology(this.meta2dId).setValue(obj) // 更新pen
|
getTopology(this.meta2dId).setValue(obj) // 更新pen
|
||||||
if (key === 'lineAnimateType') {
|
if (key === 'lineAnimateType') {
|
||||||
if (!pen[key]) {
|
if (!pen[key]) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default {
|
|||||||
initEdit (id) {
|
initEdit (id) {
|
||||||
const endTime = new Date().getTime()
|
const endTime = new Date().getTime()
|
||||||
const startTime = endTime - 60 * this.params.timeType * 1000
|
const startTime = endTime - 60 * this.params.timeType * 1000
|
||||||
const elements = getTopology(id).data().elements
|
const elements = getTopology(id).data().elements || []
|
||||||
this.getQueryValues(elements, startTime, endTime)
|
this.getQueryValues(elements, startTime, endTime)
|
||||||
bus.$emit('changeSelectPens', [])
|
bus.$emit('changeSelectPens', [])
|
||||||
getTopology(id).inactive()
|
getTopology(id).inactive()
|
||||||
@@ -143,7 +143,7 @@ export default {
|
|||||||
if (!data.pens) {
|
if (!data.pens) {
|
||||||
data.pens = []
|
data.pens = []
|
||||||
}
|
}
|
||||||
data.pens.forEach(pen => {
|
data.pens.forEach((pen, index) => {
|
||||||
pen.isBottom = true
|
pen.isBottom = true
|
||||||
if (!pen.nzName) {
|
if (!pen.nzName) {
|
||||||
pen.nzName = ''
|
pen.nzName = ''
|
||||||
@@ -151,6 +151,16 @@ export default {
|
|||||||
if (!pen.moduleId) {
|
if (!pen.moduleId) {
|
||||||
pen.moduleId = ''
|
pen.moduleId = ''
|
||||||
}
|
}
|
||||||
|
if (pen.icon) {
|
||||||
|
pen.iconFamily = 'nz-icon'
|
||||||
|
}
|
||||||
|
if (!pen.nzName) {
|
||||||
|
if (!pen.type) {
|
||||||
|
this.nodeInit(pen, 'element-' + index)
|
||||||
|
} else {
|
||||||
|
this.lineInit(pen, 'element-' + index)
|
||||||
|
}
|
||||||
|
}
|
||||||
if (pen.isNz) {
|
if (pen.isNz) {
|
||||||
if (pen.data.legend && pen.data.enable.valueMapping) {
|
if (pen.data.legend && pen.data.enable.valueMapping) {
|
||||||
const findItem = queryValues.find(query => query.name === pen.data.legend && query.parent === pen.data.parent)
|
const findItem = queryValues.find(query => query.name === pen.data.legend && query.parent === pen.data.parent)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
@change="change('nzName')"></el-input>
|
@change="change('nzName')"></el-input>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row-item form-row-item-full">
|
<div class="form-row-item form-row-item-full" v-if="!pen.type">
|
||||||
<div class="form-row-key">
|
<div class="form-row-key">
|
||||||
{{$t('overall.module')}}
|
{{$t('overall.module')}}
|
||||||
</div>
|
</div>
|
||||||
@@ -296,7 +296,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-row-value">
|
<div class="form-row-value">
|
||||||
<!-- <el-input v-model="pen.image" size="small" @change="change('image')"/>-->
|
<!-- <el-input v-model="pen.image" size="small" @change="change('image')"/>-->
|
||||||
<meta2dSelectImage :selectImage="pen.image" :imgId="pen.imageId" @updateImage="updateImage"/>
|
<meta2dSelectImage :selectImage="pen.image" :imgId="pen.imageId" :icon="pen.icon" @updateImage="updateImage"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row-item">
|
<div class="form-row-item">
|
||||||
@@ -1219,11 +1219,20 @@ export default {
|
|||||||
this.pen.autoPlay = false
|
this.pen.autoPlay = false
|
||||||
}
|
}
|
||||||
this.$emit('change', key)
|
this.$emit('change', key)
|
||||||
|
this.$forceUpdate()
|
||||||
},
|
},
|
||||||
updateImage (image) {
|
updateImage (image) {
|
||||||
this.pen.image = image.image
|
|
||||||
this.pen.imageId = image.id
|
this.pen.imageId = image.id
|
||||||
this.change('image')
|
if (image.image) {
|
||||||
|
this.pen.image = image.image
|
||||||
|
this.pen.icon = ''
|
||||||
|
this.change('image')
|
||||||
|
}
|
||||||
|
if (image.icon) {
|
||||||
|
this.pen.icon = image.icon
|
||||||
|
this.pen.image = ''
|
||||||
|
this.change('icon')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
colorChange (val, key) {
|
colorChange (val, key) {
|
||||||
this.pen.data.params[key] = val
|
this.pen.data.params[key] = val
|
||||||
|
|||||||
@@ -23,20 +23,21 @@
|
|||||||
<div class="image-select-box" style="width: 650px;height:446px;margin-top: 10px" v-my-loading="imgageLoading">
|
<div class="image-select-box" style="width: 650px;height:446px;margin-top: 10px" v-my-loading="imgageLoading">
|
||||||
<el-card shadow="hover" style="height:446px;width:100%;overflow-y: auto"
|
<el-card shadow="hover" style="height:446px;width:100%;overflow-y: auto"
|
||||||
class="project-topology-add-node">
|
class="project-topology-add-node">
|
||||||
<div v-for="(item, index) in tools" :key="index" class="collapse-box">
|
<div v-for="(item, index) in tools" :key="index" class="collapse-box" v-if="item.group !== 'General' || showDefault">
|
||||||
<div :title="item.group" :name="item.group">
|
<div :title="item.group" :name="item.group">
|
||||||
<div class="nz-collapse-header" :class="item.show ? 'is-active' : ''" @click.stop="selectGroup(item)">
|
<div class="nz-collapse-header" :class="item.show ? 'is-active' : ''" @click.stop="selectGroup(item)">
|
||||||
<span class="nz-icon-caret-right-box">
|
<span class="nz-icon-caret-right-box">
|
||||||
<i class="nz-icon nz-icon-caret-right" :class="item.show ? 'rotate90': ''" />
|
<i class="nz-icon nz-icon-caret-right" :class="item.show ? 'rotate90': ''" />
|
||||||
</span>
|
</span>
|
||||||
<div class="text-ellipsis nz-collapse-header-content">{{item.group}}</div>
|
<div class="text-ellipsis nz-collapse-header-content">{{item.group}}</div>
|
||||||
<i class="nz-icon nz-icon-delete title-delete" @click.stop="tooltipDeleteTitle(item)" :title="$t('overall.delete')" />
|
<i class="nz-icon nz-icon-delete title-delete" v-if="item.group!== 'General'" @click.stop="tooltipDeleteTitle(item)" :title="$t('overall.delete')" />
|
||||||
<span class="title-all">{{item.children.length}}</span>
|
<span class="title-all">{{item.children.length}}</span>
|
||||||
</div>
|
</div>
|
||||||
<transition name="el-zoom-in-top">
|
<transition name="el-zoom-in-top">
|
||||||
<div v-show="item.show" class="nz-collapse-body">
|
<div v-show="item.show" class="nz-collapse-body">
|
||||||
<div v-for="(btn, i) in item.children" :key="'info2'+'-'+index+'-'+i" class="buttons image-box-item" :class="btn.id === selectImgId ? 'is-select':''">
|
<div v-for="(btn, i) in item.children" :key="'info2'+'-'+index+'-'+i" class="buttons image-box-item" :class="btn.id === selectImgId ? 'is-select':''">
|
||||||
<img :src="btn.image" v-if="btn.image" class="image-src" @click.stop="selectImageChange(btn)">
|
<img :src="btn.image" v-if="btn.image" class="image-src" @click.stop="selectImageChange(btn)">
|
||||||
|
<i v-if="btn.nzClassName" class="nz-icon image-src" :class="btn.nzClassName" style="font-size: 40px" @click.stop="selectImageChange(btn)"/>
|
||||||
<div class="img-text text-ellipsis" :title="btn.imageName">{{btn.imageName}}</div>
|
<div class="img-text text-ellipsis" :title="btn.imageName">{{btn.imageName}}</div>
|
||||||
<i v-if="item.group!=='General'" class="delIcon nz-icon nz-icon-delete" @click.stop="tooltipDelete(btn)"></i>
|
<i v-if="item.group!=='General'" class="delIcon nz-icon nz-icon-delete" @click.stop="tooltipDelete(btn)"></i>
|
||||||
</div>
|
</div>
|
||||||
@@ -134,15 +135,21 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { Tools } from '@/components/common/project/meta2d/js/defaultIcon'
|
||||||
export default {
|
export default {
|
||||||
name: 'meta2dSelectImage',
|
name: 'meta2dSelectImage',
|
||||||
props: {
|
props: {
|
||||||
selectImage: {},
|
selectImage: {},
|
||||||
imgId: {}
|
icon: {},
|
||||||
|
imgId: {},
|
||||||
|
showDefault: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
tools: [],
|
tools: [...Tools],
|
||||||
title: this.$t('overall.uploadCustomPicture'),
|
title: this.$t('overall.uploadCustomPicture'),
|
||||||
imgageLoading: false,
|
imgageLoading: false,
|
||||||
iconArray: [],
|
iconArray: [],
|
||||||
@@ -167,13 +174,21 @@ export default {
|
|||||||
mounted () {
|
mounted () {
|
||||||
this.baseUrl = localStorage.getItem('nz-baseURL')
|
this.baseUrl = localStorage.getItem('nz-baseURL')
|
||||||
this.token = localStorage.getItem('nz-token')
|
this.token = localStorage.getItem('nz-token')
|
||||||
|
if (this.icon) {
|
||||||
|
const iconId = this.icon.charCodeAt().toString(16)
|
||||||
|
const findItem = this.tools[0].children.find(item => item.id === iconId)
|
||||||
|
if (findItem) {
|
||||||
|
this.unit = findItem.unit
|
||||||
|
this.imageName = findItem.name
|
||||||
|
}
|
||||||
|
}
|
||||||
this.imageInit()
|
this.imageInit()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
imageInit () { // 加载所有图片
|
imageInit () { // 加载所有图片
|
||||||
this.$get('monitor/project/topo/icon').then(res => {
|
this.$get('monitor/project/topo/icon').then(res => {
|
||||||
this.imgageLoading = true
|
this.imgageLoading = true
|
||||||
this.tools = []
|
this.tools = [...Tools]
|
||||||
this.iconArray = [...res.data.list]
|
this.iconArray = [...res.data.list]
|
||||||
this.iconArray.forEach((item, index) => {
|
this.iconArray.forEach((item, index) => {
|
||||||
item.imageName = item.name
|
item.imageName = item.name
|
||||||
@@ -227,7 +242,7 @@ export default {
|
|||||||
})
|
})
|
||||||
if (findItem) {
|
if (findItem) {
|
||||||
findItem.show = true
|
findItem.show = true
|
||||||
findItem.children.forEach(item=>{
|
findItem.children.forEach(item => {
|
||||||
if (item.id === this.selectImgId) {
|
if (item.id === this.selectImgId) {
|
||||||
this.selectImg = item
|
this.selectImg = item
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ export default {
|
|||||||
lineData.anchors[0].id = s8()
|
lineData.anchors[0].id = s8()
|
||||||
lineData.anchors[1].id = s8()
|
lineData.anchors[1].id = s8()
|
||||||
lineData.anchors[0].penId = penId
|
lineData.anchors[0].penId = penId
|
||||||
lineData.anchors[1].penId = s8()
|
lineData.anchors[1].penId = penId
|
||||||
const pen = {
|
const pen = {
|
||||||
...lineData,
|
...lineData,
|
||||||
id: penId,
|
id: penId,
|
||||||
|
|||||||
Reference in New Issue
Block a user