fix: 处理 进入编辑页面 无法立即编辑的问题

This commit is contained in:
zhangyu
2021-07-08 14:35:37 +08:00
parent b831ddf354
commit 54f6745d32

View File

@@ -659,9 +659,16 @@ export default {
axiosArr.push({ item, arr }) axiosArr.push({ item, arr })
promiseArr.push(pensPromise(item, arr, index)) promiseArr.push(pensPromise(item, arr, index))
}) })
if (this.fromTopologyDialog && !this.isPreview) {
setTimeout(() => {
getTopology(this.topologyIndex).open(data)
getTopology(this.topologyIndex).centerView()
getTopology(this.topologyIndex).resize()
this.editTopology()
}, 100)
} else {
Promise.all(promiseArr).then((res) => { Promise.all(promiseArr).then((res) => {
getTopology(this.topologyIndex).open(data) getTopology(this.topologyIndex).open(data)
getTopology(this.topologyIndex).lock(1)
this.objChange = false this.objChange = false
let flag = false let flag = false
const position = { const position = {
@@ -706,6 +713,7 @@ export default {
this.oldTopologyData = JSON.stringify(getTopology(this.topologyIndex).data) this.oldTopologyData = JSON.stringify(getTopology(this.topologyIndex).data)
this.getNodesArr() this.getNodesArr()
}) })
}
}) })
}) })
}, },
@@ -754,11 +762,6 @@ export default {
getTopology(this.topologyIndex).data.name = '' getTopology(this.topologyIndex).data.name = ''
} }
getTopology(this.topologyIndex).lock(1) getTopology(this.topologyIndex).lock(1)
if (this.fromTopologyDialog && !this.isPreview) {
setTimeout(() => {
this.editTopology()
}, 100)
}
resolve() resolve()
}) })
}, },
@@ -878,7 +881,6 @@ 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
console.log(pen.iconFamily)
if (pen.iconFamily) { if (pen.iconFamily) {
pen.fillStyle = 'transparent' pen.fillStyle = 'transparent'
pen.iconColor = selLevel.color.fill pen.iconColor = selLevel.color.fill
@@ -1543,9 +1545,13 @@ export default {
data: { data: {
...imageTemp2.data, ...imageTemp2.data,
text: res.data.imageName, text: res.data.imageName,
image: data, image: data.data,
imageId: res.data.id, imageId: res.data.id,
unit: this.uploadPic.unit unit: this.uploadPic.unit,
rect: {
width: data.width,
height: data.height
}
} }
}) })
} else { } else {
@@ -1556,9 +1562,13 @@ export default {
data: { data: {
...imageTemp2.data, ...imageTemp2.data,
text: res.data.imageName, text: res.data.imageName,
image: data, image: data.data,
imageId: res.data.id, imageId: res.data.id,
unit: this.uploadPic.unit unit: this.uploadPic.unit,
rect: {
width: data.width,
height: data.height
}
} }
}] }]
}) })
@@ -1664,9 +1674,10 @@ export default {
imgArr.push({ ...item }) imgArr.push({ ...item })
}) })
Promise.all(promiseArr).then((res2, header) => { Promise.all(promiseArr).then((res2, header) => {
console.log(res2)
this.iconArray = [...res.data.list] this.iconArray = [...res.data.list]
this.iconArray.forEach((item, index) => { this.iconArray.forEach((item, index) => {
item.image = res2[index] item.image = res2[index].data
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({
@@ -1674,9 +1685,13 @@ export default {
data: { data: {
...imageTemp2.data, ...imageTemp2.data,
text: item.imageName, text: item.imageName,
image: res2[index], image: res2[index].data,
imageId: item.id, imageId: item.id,
unit: item.unit unit: item.unit,
rect: {
width: res2[index].width,
height: res2[index].height
}
} }
}) })
} else { } else {
@@ -1687,9 +1702,13 @@ export default {
data: { data: {
...imageTemp2.data, ...imageTemp2.data,
text: item.imageName, text: item.imageName,
image: res2[index], image: res2[index].data,
imageId: item.id, imageId: item.id,
unit: item.unit unit: item.unit,
rect: {
width: res2[index].width,
height: res2[index].height
}
} }
}] }]
}) })
@@ -1721,7 +1740,7 @@ export default {
}) })
this.iconArray.forEach((item, index) => { this.iconArray.forEach((item, index) => {
if (item.id) { if (item.id) {
item.image = res2[index] item.image = res2[index].data
} }
}) })
this.imgInit = true this.imgInit = true
@@ -1739,11 +1758,13 @@ export default {
.get(url) .get(url)
.then((res) => { .then((res) => {
return { return {
data: ('data:image/jpeg;base64,' + res.data) data: ('data:image/jpeg;base64,' + res.data),
width: res.headers.width === -1 ? 100 : (res.headers.width > 900 ? 900 : res.headers.width),
height: res.headers.height === -1 ? 100 : (res.headers.height > 900 ? 900 : res.headers.height)
} }
}) })
.then(data => { .then(data => {
resolve(data.data, data.header) resolve(data)
// changeImage(data,(img)=>{ // changeImage(data,(img)=>{
// resolve(img) // resolve(img)
// }) // })
@@ -1779,6 +1800,10 @@ export default {
item.data.expressArr = [''] item.data.expressArr = ['']
item.data.legends = [''] item.data.legends = ['']
} }
if (!item.data.expressAllArr.length) {
item.data.expressArr = ['']
item.data.legends = ['']
}
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