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

@@ -4,18 +4,15 @@
<ai-title slot="title" title="广播设备管理" isShowBottomBorder/> <ai-title slot="title" title="广播设备管理" isShowBottomBorder/>
<template #content> <template #content>
<ai-search-bar bottomBorder> <ai-search-bar bottomBorder>
<template slot="left">
<el-button type="primary" icon="iconfont iconResetting" @click="update" :loading="btnLoading">更新数据</el-button>
</template>
<template slot="right"> <template slot="right">
<el-input v-model="search.name" size="small" placeholder="设备名称/设备编号" clearable <el-input v-model="search.name" size="small" placeholder="设备名称/设备编号" clearable
v-throttle="() => {page.current = 1, getList()}" v-throttle="() => {page.current = 1, getList()}"
@clear=";(page.current = 1), (search.name = ''), getList()" suffix-icon="iconfont iconSearch"/> @clear=";(page.current = 1), (search.name = ''), getList()" suffix-icon="iconfont iconSearch"/>
</template> </template>
</ai-search-bar> </ai-search-bar>
<ai-search-bar class="ai-search-ba mar-t10">
<template slot="left">
<!-- <el-button icon="iconfont" type="primary" size="small">数据同步</el-button> -->
<!-- <el-button icon="iconfont iconDelete" size="small" @click="removeAll" :disabled="ids.length == 0">删除 </el-button> -->
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :col-configs="colConfigs" :total="total" ref="aitableex" <ai-table :tableData="tableData" :col-configs="colConfigs" :total="total" ref="aitableex"
:current.sync="page.current" :size.sync="page.size" @getList="getList" :current.sync="page.current" :size.sync="page.size" @getList="getList"
@selection-change="(v) => (ids = v.map((e) => e.id))"> @selection-change="(v) => (ids = v.map((e) => e.id))">
@@ -114,6 +111,7 @@ export default {
areaId: '', areaId: '',
bindVisible: false, bindVisible: false,
changeInfo: {}, changeInfo: {},
btnLoading: false,
locate: false locate: false
} }
}, },
@@ -198,6 +196,22 @@ export default {
}, },
}) })
}, },
update () {
this.btnLoading = true
this.instance.post(`/app/appdlbquipment/sync`, null, {
timeout: 1000000
}).then(res => {
if (res.code == 0) {
this.$message.success('更新成功')
this.getList()
}
this.btnLoading = false
}).catch(() => {
this.btnLoading = false
})
},
}, },
} }
</script> </script>

View File

@@ -22,7 +22,10 @@
prefix-icon="el-icon-search" prefix-icon="el-icon-search"
@clear="search.name = '', handleTreeFilter()" clearable/> @clear="search.name = '', handleTreeFilter()" clearable/>
</div> </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"> <div fill class="deviceList">
<el-tree ref="deviceTree" highlight-current :render-content="renderItem" :data="treeData" :props="propsConfig" <el-tree ref="deviceTree" highlight-current :render-content="renderItem" :data="treeData" :props="propsConfig"
@node-click="handleNodeClick" @node-contextmenu="nodeContextmenu" @node-click="handleNodeClick" @node-contextmenu="nodeContextmenu"
@@ -98,7 +101,8 @@ export default {
x: '', x: '',
y: '', y: '',
node: {} node: {}
} },
btnLoading: false,
} }
}, },
methods: { methods: {
@@ -110,8 +114,10 @@ export default {
this.isShowMenu = false this.isShowMenu = false
}, },
getDevices() { getDevices() {
this.ins.post("/app/appzyvideoequipment/tree", null, { this.instance.post(`/app/appzyvideoequipment/tree`, null, {
params: {size: 999} params: {
size: 999
}
}).then(res => { }).then(res => {
if (res?.data) { if (res?.data) {
this.staData = res.data.count 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) { handleTreeCommand(e, node) {
this.$emit('treeCommand', { this.$emit('treeCommand', {
type: e, type: e,
@@ -154,14 +175,16 @@ export default {
handleTreeFilter() { handleTreeFilter() {
this.$refs.deviceTree?.filter(this.search.name) this.$refs.deviceTree?.filter(this.search.name)
}, },
onChange() { onChange() {
this.$refs.deviceTree?.filter(this.search.name) this.$refs.deviceTree?.filter(this.search.name)
} },
}, },
created() { created() {
this.dict.load("deviceStatus") this.$dict.load("deviceStatus").then(()=>{
this.getDevices() this.getDevices()
})
}, },
mounted() { mounted() {
@@ -247,6 +270,18 @@ export default {
background: #3E4A69; background: #3E4A69;
padding: 0 16px; padding: 0 16px;
line-height: 28px; 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 { ::v-deep.deviceList {