温度管理:默认展开左侧树选中第一个节点
This commit is contained in:
parent
d9f890baf7
commit
986dbf1897
@ -10,6 +10,7 @@
|
||||
:props="defaultProps"
|
||||
node-key="id"
|
||||
@node-click="handleNodeClick"
|
||||
:default-expanded-keys="defaultExpandedKeys"
|
||||
/>
|
||||
</el-main>
|
||||
</el-aside>
|
||||
@ -33,11 +34,14 @@ const defaultProps = {
|
||||
const devicelistData = reactive({
|
||||
objectType: 10002,
|
||||
})
|
||||
const deviceData = ref([{
|
||||
const deviceData = ref(
|
||||
[{
|
||||
id: 0,
|
||||
name: "风机列表",
|
||||
children: []
|
||||
}])
|
||||
}]
|
||||
)
|
||||
const defaultExpandedKeys = ref([0]);
|
||||
const deviceId=ref()
|
||||
const equipTreeRef = ref()
|
||||
const deviceQuery = (data: any) => {
|
||||
@ -45,7 +49,7 @@ const deviceQuery = (data: any) => {
|
||||
deviceData.value[0].children = res.data
|
||||
nextTick(() => {
|
||||
deviceId.value=res.data[0]?.id
|
||||
equipTreeRef.value?.setCurrentKey(deviceData.value[0].id!, false)
|
||||
equipTreeRef.value?.setCurrentKey(deviceData.value[0].children[0].id!, true)
|
||||
getChartData({id:deviceId.value})
|
||||
})
|
||||
})
|
||||
@ -227,6 +231,7 @@ const attributesCode:any[]=[]
|
||||
const getChartData = (data: any) => {
|
||||
console.log(JSON.stringify(data))
|
||||
getTemperatureLimitByDeviceId(data).then((res) => {
|
||||
debugger
|
||||
if (res.code=='200') {
|
||||
temperatureData.name=[]
|
||||
temperatureData.values=[]
|
||||
@ -255,6 +260,7 @@ const getTemperaData = (data:any) => {
|
||||
if (res.code == 200) {
|
||||
const data = res.data[deviceId.value]
|
||||
const rangeKeys = Object.keys(data)
|
||||
temperatureData.values=[]
|
||||
attributesCode.forEach((attribute, index) => {
|
||||
if (attribute) {
|
||||
const attributeLower = attribute.toLowerCase();
|
||||
@ -290,6 +296,7 @@ const seriesStyle= (values, limit1High, limit1Low, limit2High, limit2Low) =>{
|
||||
series.data[index].itemStyle = { color: 'red' };
|
||||
} else {
|
||||
item.itemStyle.color= '#0064AA'
|
||||
series.data[index].itemStyle = { color: '#0064AA' };
|
||||
}
|
||||
})
|
||||
state.charts.temperatureChart.setOption(option);
|
||||
|
Loading…
Reference in New Issue
Block a user