This commit is contained in:
shijingjing
2022-06-21 18:52:25 +08:00
parent 3ac9250f38
commit 0ac92994bc
2 changed files with 63 additions and 14 deletions

View File

@@ -22,7 +22,10 @@
prefix-icon="el-icon-search"
@clear="search.name = '', handleTreeFilter()" clearable/>
</div>
<div title>设备列表</div>
<div title>
<div>设备列表</div>
<el-button type="text" icon="iconfont iconResetting" plain="true" @click="updateDev" size="mini" :loading="btnLoading">
</el-button></div>
<div fill class="deviceList">
<el-tree ref="deviceTree" highlight-current :render-content="renderItem" :data="treeData" :props="propsConfig"
@node-click="handleNodeClick" @node-contextmenu="nodeContextmenu"
@@ -98,7 +101,8 @@ export default {
x: '',
y: '',
node: {}
}
},
btnLoading: false,
}
},
methods: {
@@ -110,8 +114,10 @@ export default {
this.isShowMenu = false
},
getDevices() {
this.ins.post("/app/appzyvideoequipment/tree", null, {
params: {size: 999}
this.instance.post(`/app/appzyvideoequipment/tree`, null, {
params: {
size: 999
}
}).then(res => {
if (res?.data) {
this.staData = res.data.count
@@ -122,6 +128,21 @@ export default {
})
},
updateDev() {
this.btnLoading = true
this.instance.post(`/app/appzyvideoequipment/sync`, null, {
timeout: 1000000
}).then(res => {
if (res.code == 0) {
this.$message.success('更新成功')
this.getDevices()
}
this.btnLoading = false
}).catch(() => {
this.btnLoading = false
})
},
handleTreeCommand(e, node) {
this.$emit('treeCommand', {
type: e,
@@ -154,14 +175,16 @@ export default {
handleTreeFilter() {
this.$refs.deviceTree?.filter(this.search.name)
},
onChange() {
this.$refs.deviceTree?.filter(this.search.name)
}
},
},
created() {
this.dict.load("deviceStatus")
this.getDevices()
this.$dict.load("deviceStatus").then(()=>{
this.getDevices()
})
},
mounted() {
@@ -247,6 +270,18 @@ export default {
background: #3E4A69;
padding: 0 16px;
line-height: 28px;
display: flex;
justify-content: space-between;
align-items: center;
::v-deep .el-button {
padding: 0 4px;
height: 28px;
background: #3E4A69;
}
::v-deep .el-button:hover {
border: none;
}
}
::v-deep.deviceList {