|
@@ -15,7 +15,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { message } from 'ant-design-vue'
|
|
|
-import { getFloorTreeStation, getFloorNodeStation } from '@/api/model'
|
|
|
+import { getFloorTreeStation, getFloorNodeStation, getDeviceInfo } from '@/api/model'
|
|
|
export default {
|
|
|
name: 'FloorTree',
|
|
|
components: {},
|
|
@@ -34,90 +34,50 @@ export default {
|
|
|
labelList: [
|
|
|
{
|
|
|
ID: 1,
|
|
|
- Name: 'Normal',
|
|
|
- Value: '10kW',
|
|
|
- Temp: 1,
|
|
|
modelId: '5540248693744400250^2577715',
|
|
|
- Position: [1.9924240818584793, 0.38897212905269996, -17.251471757125557],
|
|
|
},
|
|
|
{
|
|
|
ID: 2,
|
|
|
- Name: ' Normal',
|
|
|
- Value: '10kW',
|
|
|
- Temp: 1,
|
|
|
modelId: '5540248693744400250^2577745',
|
|
|
- Position: [1.9924248966597007, 0.38897179064630044, -17.18284616400028],
|
|
|
},
|
|
|
{
|
|
|
ID: 3,
|
|
|
- Name: ' Normal',
|
|
|
- Value: '10kW',
|
|
|
- Temp: 1,
|
|
|
modelId: '5540248693744400250^2577775',
|
|
|
- Position: [1.992426164640796, 0.38897136295565365, -17.248733138065056],
|
|
|
},
|
|
|
{
|
|
|
ID: 4,
|
|
|
- Name: ' Normal',
|
|
|
- Value: '10kW',
|
|
|
- Temp: 1,
|
|
|
modelId: '5540248693744400250^2577805',
|
|
|
- Position: [1.992426760938923, 0.38897107739037484, -17.260878756384397],
|
|
|
},
|
|
|
{
|
|
|
ID: 5,
|
|
|
- Name: ' Normal',
|
|
|
- Value: '10kW',
|
|
|
- Temp: 1,
|
|
|
modelId: '5540248693744400250^2577835',
|
|
|
- Position: [1.9924273453884698, 0.3889708037135168, -17.262281843417373],
|
|
|
},
|
|
|
{
|
|
|
ID: 6,
|
|
|
- Name: ' Normal',
|
|
|
- Value: '10kW',
|
|
|
- Temp: 1,
|
|
|
modelId: '5540248693744400250^2577865',
|
|
|
- Position: [1.9924279688364297, 0.38897050402513367, -17.27748002657744],
|
|
|
},
|
|
|
{
|
|
|
ID: 7,
|
|
|
- Name: ' Normal',
|
|
|
- Value: '10kW',
|
|
|
- Temp: 1,
|
|
|
modelId: '5540248693744400250^2577893',
|
|
|
- Position: [1.9924285690675736, 0.3889702158086993, -17.29481886208023],
|
|
|
},
|
|
|
{
|
|
|
ID: 8,
|
|
|
- Name: ' Normal',
|
|
|
- Value: '10kW',
|
|
|
- Temp: 1,
|
|
|
modelId: '5540248693744400250^2577921',
|
|
|
- Position: [1.9924291665061238, 0.38896994212876546, -17.28233886751317],
|
|
|
},
|
|
|
{
|
|
|
ID: 9,
|
|
|
- Name: ' Normal',
|
|
|
- Value: '10kW',
|
|
|
- Temp: 1,
|
|
|
modelId: '5540248693744400250^2577951',
|
|
|
- Position: [1.992431608826218, 0.38896877854518686, -17.318993014525223],
|
|
|
},
|
|
|
{
|
|
|
ID: 10,
|
|
|
- Name: ' Normal',
|
|
|
- Value: '10kW',
|
|
|
- Temp: 1,
|
|
|
modelId: '5540248693744400250^2577981',
|
|
|
- Position: [1.9924322104802943, 0.38896849706568337, -17.32055258651264],
|
|
|
},
|
|
|
], //标签列表
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
checkedKeys(val) {
|
|
|
- if (val[0] === '9b7933bf-97ef-43e8-aa25-12621fd0eb65' && val.length === 1) {
|
|
|
+ if (val[0] === '09a98e75-1e88-4f3b-99bd-5de84cbec2c2' && val.length === 1) {
|
|
|
this.allowAddLabel = true
|
|
|
} else {
|
|
|
window.api.Label.removeAllCustomHtml()
|
|
@@ -270,44 +230,73 @@ export default {
|
|
|
})
|
|
|
return items
|
|
|
},
|
|
|
- handleLeftClick(){
|
|
|
+ handleLeftClick() {
|
|
|
let that = this
|
|
|
window.api.Public.event('RIGHT_CLICK', function (click) {
|
|
|
window.api.Feature.getByEvent(click.position, function (json) {
|
|
|
if (json) {
|
|
|
window.api.Label.removeAllCustomHtml()
|
|
|
- that.AddLabel(json.id,click.position)
|
|
|
+ that.AddLabel(json.id)
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- AddLabel(id,position) {
|
|
|
+ async AddLabel(id) {
|
|
|
+ let that = this
|
|
|
+
|
|
|
let item = this.labelList.filter((item) => {
|
|
|
- return item.modelId === id
|
|
|
+ return item.modelId === id
|
|
|
})
|
|
|
- if(!this.allowAddLabel || item.length === 0){
|
|
|
+ if (!this.allowAddLabel || item.length === 0) {
|
|
|
return
|
|
|
}
|
|
|
- let htmlstr =
|
|
|
- '<div class="LabelTemplate' +
|
|
|
- item[0].Temp +
|
|
|
- ' " style="width:200px"><div class="topview"></div><div class="content name" style="display: flex; justify-content: space-between;width:200px"><div>Status:</div><div style="color:#1AC9FF">' +
|
|
|
- item[0].Name +
|
|
|
- '</div></div><div class="content name" style="display: flex;justify-content: space-between;width:200px"><div>Pow Consmp:</div><div style="color:#1AC9FF">' +
|
|
|
- item[0].Value +
|
|
|
- '</div></div><div class="Icon"></div></div>'
|
|
|
+ const { data } = await getDeviceInfo(`CH${item[0].ID}`)
|
|
|
+ let htmlstr = '<div class="LabelTemplate1" style="width: 300px;height: 230px;"><div class="topview"></div>'
|
|
|
+ data.forEach((item) => {
|
|
|
+ htmlstr +=
|
|
|
+ '<div class="content name" style="display: flex; justify-content: space-between;width:300px"><div>' +
|
|
|
+ item.displayName +
|
|
|
+ ':</div><div style="color:#1AC9FF">' +
|
|
|
+ item['present-value'] +
|
|
|
+ item.units +
|
|
|
+ '</div></div>'
|
|
|
+ })
|
|
|
+ htmlstr +=
|
|
|
+ '<div class="content name" style="display: flex; justify-content: space-between;width:300px"><div>Link to document:</div><div style="color:#1AC9FF"><span class="icon iconfont icon-lianjie"></span></div></div>'
|
|
|
+ htmlstr += '<div class="Icon" style="margin-top:0px;"></div></div>'
|
|
|
+
|
|
|
let option = {
|
|
|
id: item[0].ID,
|
|
|
axisType: 1,
|
|
|
- // position: item[0].Position,
|
|
|
- position: position,
|
|
|
+ position: window.api.Feature.getCenterById(id, id.split('^')[0]),
|
|
|
attachmentPoint: 7,
|
|
|
html: htmlstr,
|
|
|
- offset: { x: 20, y: -250 },
|
|
|
+ offset: { x: 70, y: -380 },
|
|
|
maxDistance: 1000,
|
|
|
displayRange: [0, 1000],
|
|
|
}
|
|
|
window.api.Lable.AddCustomLabel(option)
|
|
|
+ document.getElementsByClassName('icon-lianjie')[0].addEventListener(
|
|
|
+ 'click',
|
|
|
+ function () {
|
|
|
+ that.goToDocument()
|
|
|
+ },
|
|
|
+ false
|
|
|
+ )
|
|
|
+ },
|
|
|
+ goToDocument() {
|
|
|
+ this.$router.push({
|
|
|
+ name: 'DocumentDashboard',
|
|
|
+ params: {
|
|
|
+ tab: '2',
|
|
|
+ project: {
|
|
|
+ id: 69,
|
|
|
+ name: 'Two International Finance Centre',
|
|
|
+ type: 'project',
|
|
|
+ uniId: 'project_69',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ })
|
|
|
},
|
|
|
},
|
|
|
}
|