|
@@ -4,7 +4,8 @@
|
|
|
<el-col :span="4">
|
|
|
<el-button v-if="treeData.length === 0" type="primary" plain icon="el-icon-circle-plus-outline" size="mini"
|
|
|
@click="addDeviceDirectoryEvent">新增设备目录</el-button>
|
|
|
- <el-tree v-if="treeData.length !== 0" :data="treeData" :props="defaultProps" node-key="id"
|
|
|
+ <el-tree ref="directoryTree" :data="treeData" :props="defaultProps" node-key="id"
|
|
|
+ :current-node-key="currentNodeKey" :highlight-current="true"
|
|
|
default-expand-all @node-click="handleNodeClick" @node-contextmenu="handleRightClick">
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }">
|
|
|
<!-- <i class="el-icon-box" style="color: #DFBA49; margin-right: 5px;"></i>-->
|
|
@@ -134,6 +135,9 @@ export default {
|
|
|
created() {
|
|
|
this.getDeviceDirectoryTree()
|
|
|
},
|
|
|
+ mounted(){
|
|
|
+
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
//设备目录树参数
|
|
@@ -149,6 +153,7 @@ export default {
|
|
|
optionData: [],
|
|
|
node: null,
|
|
|
tree: null,
|
|
|
+ currentNodeKey:0,
|
|
|
//表格参数
|
|
|
isShowCheckbox: false,
|
|
|
isShowIndex: false,
|
|
@@ -308,12 +313,12 @@ export default {
|
|
|
searchEvent() {
|
|
|
this.queryParams.page = 1
|
|
|
this.queryParams.limit = 10
|
|
|
- this.getDeviceLedgerPage()
|
|
|
+ this.getDeviceLedgerPage();
|
|
|
},
|
|
|
/** 重置按钮操作 */
|
|
|
resetQuery(event) {
|
|
|
- this.$refs['queryForm'].resetFields();
|
|
|
- this.searchEvent();
|
|
|
+ this.$refs['queryForm'].resetFields();
|
|
|
+ this.searchEvent();
|
|
|
},
|
|
|
/** 点击除菜单以外其他区域,菜单隐藏 */
|
|
|
optionCardClose(event) {
|
|
@@ -377,6 +382,8 @@ export default {
|
|
|
this.treeData = res.data
|
|
|
if(this.treeData[0].children.length>0){
|
|
|
this.queryParams.directoryId = this.treeData[0].children[0].id;
|
|
|
+ this.currentNodeKey = this.treeData[0].children[0].id;
|
|
|
+ this.$refs.directoryTree.setCurrentKey(this.treeData[0].children[0].id);
|
|
|
this.getDeviceLedgerPage();
|
|
|
}
|
|
|
}
|
|
@@ -385,6 +392,7 @@ export default {
|
|
|
/** 处理节点点击 */
|
|
|
handleNodeClick(event, data, node) {
|
|
|
this.queryParams.directoryId = event.id
|
|
|
+ this.currentNodeKey = event.id
|
|
|
this.getDeviceLedgerPage()
|
|
|
},
|
|
|
/** 处理节点右键点击 */
|
|
@@ -425,6 +433,7 @@ export default {
|
|
|
}
|
|
|
this.tableTotal = res.data.count
|
|
|
this.tableData = res.data.deviceLedgerList
|
|
|
+ this.$refs['directoryTree'].setCurrentKey(this.currentNodeKey);
|
|
|
})
|
|
|
},
|
|
|
/** 新增设备台账事件 */
|