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