update - 能源表具看板改

yangwl
yinq 4 months ago
parent d6cdd95daf
commit db81ec5e4c

@ -1,7 +1,18 @@
<template> <template>
<div id="wrapbg" class="app-container" style="height: 100vh"> <div id="wrapbg" class="app-container" style="height: 100vh">
<div class="zoomButton">
缩放比例
<el-button size="small" type="primary" icon="el-icon-minus" @click="reduce"></el-button>
{{ zoom }}
<el-button size="small" type="primary" icon="el-icon-plus" @click="add"></el-button>
</div>
<div class="aa"> <div class="aa">
<Tree :data="treeData" :index="0" :vw="vw" @itemClick="itemClick"/> <div class="zoom" :style="`transform-origin: 0 0;transform: scale(${zoom})`">
<Tree :data="treeData" :index="0" :vw="vw" @itemClick="itemClick" :key="key" v-if="treeShow"/>
</div>
</div>
<div class="menu">
<el-tree :data="leftTreeData" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
</div> </div>
<div <div
@ -283,9 +294,17 @@ export default {
return { return {
vw: document.body.clientWidth / 100, vw: document.body.clientWidth / 100,
treeData: [], treeData: [],
leftTreeData:[],
equipment: {}, equipment: {},
ModelShow: false, ModelShow: false,
energyType: 2, energyType: 2,
zoom: 1,
key:1,
treeShow:true,
defaultProps: {
children: 'children',
label: 'name'
}
} }
}, },
mounted() { mounted() {
@ -322,6 +341,11 @@ export default {
} }
}) })
this.treeData = data this.treeData = data
this.leftTreeData = data
console.log(data)
this.key +=1
this.treeShow = false
this.treeShow = true
// console.log([data[0]]) // console.log([data[0]])
}) })
}, },
@ -336,10 +360,64 @@ export default {
beginCollectTime: nowDate + ' 00:00:00', beginCollectTime: nowDate + ' 00:00:00',
endCollectTime: nowDate + ' 23:59:59' endCollectTime: nowDate + ' 23:59:59'
}).then((response) => { }).then((response) => {
console.log(response)
this.equipment = response.data.result this.equipment = response.data.result
this.ModelShow = true this.ModelShow = true
}) })
},
reduce() {
if (this.zoom <= 0.1) {
return
}
if (this.zoom <= 1) {
this.zoom = Number((this.zoom - 0.1).toFixed(1))
} else if (this.zoom > 1) {
this.zoom = Number((this.zoom - 0.5).toFixed(1))
}
},
add() {
console.log(this.zoom)
if (this.zoom < 1) {
this.zoom = Number((this.zoom + 0.1).toFixed(1))
} else if (this.zoom >= 1) {
this.zoom = Number((this.zoom + 0.5).toFixed(1))
}
},
handleNodeClick(v){
const fun = (arr, data) => {
let resData = []
arr.forEach(v => {
if (v.pId === data.id) {
resData.push({
...v,
children: fun(arr, v)
})
}
})
return resData.length === 0 ? null : resData
}
request({
url: '/energy/report/board/fixtureStatus',
method: 'get',
params: {
energyType: 2,
objId:v.id
}
}).then(e => {
let data = []
e.data.result.forEach(v => {
if (v.pId === 0) {
let a = {
...v,
children: fun(e.data.result, v)
}
data.push(a)
}
})
this.treeData = data
this.key +=1
this.treeShow = false
this.treeShow = true
})
} }
} }
} }

Loading…
Cancel
Save