|
@@ -74,7 +74,7 @@
|
|
|
<el-checkbox label="connected" size="small">并网</el-checkbox>
|
|
|
<el-checkbox label="correct" size="small">合理值</el-checkbox>
|
|
|
<el-checkbox label="connected10" size="small"
|
|
|
- >并网十分钟</el-checkbox
|
|
|
+ >并网后十分钟</el-checkbox
|
|
|
>
|
|
|
<el-checkbox label="prestop10" size="small"
|
|
|
>停机前十分钟</el-checkbox
|
|
@@ -118,13 +118,19 @@
|
|
|
<div class="dataBox">
|
|
|
<div class="l">
|
|
|
<el-tree
|
|
|
+ v-if="currentNodeKey"
|
|
|
accordion
|
|
|
+ highlight-current
|
|
|
+ node-key="id"
|
|
|
:data="treeData"
|
|
|
:props="{
|
|
|
children: 'children',
|
|
|
- label: 'windturbineid',
|
|
|
+ label: 'label',
|
|
|
}"
|
|
|
@node-click="nodeClick"
|
|
|
+ :default-expanded-keys="defaultTreeData"
|
|
|
+ :default-checked-keys="defaultTreeData"
|
|
|
+ :current-node-key="currentNodeKey"
|
|
|
/>
|
|
|
</div>
|
|
|
<div class="r">
|
|
@@ -213,6 +219,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
treeData: [],
|
|
|
+ defaultTreeData: [], //默认选中数据
|
|
|
changzhan: "",
|
|
|
changzhanArray: [],
|
|
|
fengji: [],
|
|
@@ -257,14 +264,15 @@ export default {
|
|
|
label: "5分钟",
|
|
|
},
|
|
|
{
|
|
|
- id: "900",
|
|
|
- label: "15分钟",
|
|
|
+ id: "600",
|
|
|
+ label: "10分钟",
|
|
|
},
|
|
|
],
|
|
|
tableData: [],
|
|
|
currentPage: 1,
|
|
|
pageSize: 500,
|
|
|
tableTotal: 0,
|
|
|
+ currentNodeKey: "",
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -277,7 +285,6 @@ export default {
|
|
|
let stationen = this.changzhan;
|
|
|
let windturbineid = this.fengji;
|
|
|
let time = this.date;
|
|
|
-
|
|
|
let connected = false;
|
|
|
let correct = false;
|
|
|
let connected10 = false;
|
|
@@ -350,7 +357,21 @@ export default {
|
|
|
baseURL: "http://192.168.1.18:9002/",
|
|
|
subUrl: "powercurve/tree",
|
|
|
success(res) {
|
|
|
- that.treeData = res.data;
|
|
|
+ that.treeData = that.addLabelToTreeData(res.data);
|
|
|
+ // 初始化第一条
|
|
|
+ that.defaultTreeData.push(res.data[0].id);
|
|
|
+ that.defaultTreeData.push(res.data[0].children[0].id);
|
|
|
+ that.defaultTreeData.push(res.data[0].children[0].children[0].id);
|
|
|
+ that.defaultTreeData.push(
|
|
|
+ res.data[0].children[0].children[0].children[0].id
|
|
|
+ );
|
|
|
+ let data = that.getFirstTreeData(res.data[0]);
|
|
|
+ that.currentNodeKey = data.id;
|
|
|
+ that.changzhan = data.stationen;
|
|
|
+ that.fengji = data.windturbineid;
|
|
|
+ that.date = data.time;
|
|
|
+ that.getTableData();
|
|
|
+ that.nodeClick(data);
|
|
|
},
|
|
|
});
|
|
|
},
|
|
@@ -443,6 +464,30 @@ export default {
|
|
|
this.getTableData();
|
|
|
},
|
|
|
|
|
|
+ // 获取树状结构内第一个节点内的第一条数据
|
|
|
+ getFirstTreeData(treeData) {
|
|
|
+ if (treeData?.children) {
|
|
|
+ return this.getFirstTreeData(treeData.children[0]);
|
|
|
+ } else {
|
|
|
+ return treeData;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 给树状结构最后一层添加label字段
|
|
|
+ addLabelToTreeData(treeData) {
|
|
|
+ for (let i = 0; i < treeData.length; i++) {
|
|
|
+ const item = treeData[i];
|
|
|
+ if (Array.isArray(item?.children)) {
|
|
|
+ this.addLabelToTreeData(item.children);
|
|
|
+ } else {
|
|
|
+ treeData.forEach((ele) => {
|
|
|
+ ele.label = ele.windturbineid;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return treeData;
|
|
|
+ },
|
|
|
+
|
|
|
// 树形结构点击处理
|
|
|
nodeClick(res) {
|
|
|
if (!res.children) {
|
|
@@ -478,14 +523,14 @@ export default {
|
|
|
height: 100%;
|
|
|
|
|
|
.l {
|
|
|
- width: 20%;
|
|
|
+ width: 15%;
|
|
|
height: 100%;
|
|
|
.el-tree {
|
|
|
height: 100%;
|
|
|
}
|
|
|
}
|
|
|
.r {
|
|
|
- width: 80%;
|
|
|
+ width: 85%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
}
|