diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml index 7aa5481..15ec32e 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml @@ -276,6 +276,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and hd.active_status = #{activeStatus} and hd.device_status = #{deviceStatus} and hd.tenant_id = #{tenantId} + and hd.releated_device_id = #{releatedDeviceId} and hd.online_status = #{onlineStatus} ${params.tenantDataScope} diff --git a/ruoyi-ui/src/views/business/device/index.vue b/ruoyi-ui/src/views/business/device/index.vue index 179f887..fb9ee22 100644 --- a/ruoyi-ui/src/views/business/device/index.vue +++ b/ruoyi-ui/src/views/business/device/index.vue @@ -1,245 +1,298 @@ @@ -458,6 +512,8 @@ import { import {getToken} from "@/utils/auth"; import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; +import toggleMenuLeftImg from '@/assets/images/togglemenu-left.png' +import toggleMenuRightImg from '@/assets/images/togglemenu-right.png' export default { components: {Treeselect}, @@ -489,6 +545,13 @@ export default { data() { return { + toggleMenuLeftImg: toggleMenuLeftImg, + toggleMenuRightImg: toggleMenuRightImg, + toggleLeftDisplay: true, + toggleRightDisplay: false, + // 网关设备名称 + gatewayDeviceName: undefined, + // 遮罩层 loading: true, // 选中数组 @@ -503,6 +566,8 @@ export default { total: 0, // 设备信息表格数据 deviceList: [], + // 网关设备信息表格数据 + gatewayDeviceList: [], //场景列表 scenes: [], //查询页面监控单元树 @@ -544,6 +609,10 @@ export default { // 是否显示弹出层 open: false, + defaultProps: { + children: "children", + label: "deviceName" + }, // 用户导入参数 upload: { @@ -653,8 +722,15 @@ export default { fileList: [], }; }, + watch: { + // 根据名称筛选部门树 + gatewayDeviceName(val) { + this.$refs.tree.filter(val); + } + }, created() { this.getList(); + this.getGatewayDeviceList(); getScenes().then(response => { this.scenes = response.data; }); @@ -690,6 +766,15 @@ export default { this.loading = false; }); }, + + getGatewayDeviceList() { + this.loading = true; + listDevice({"deviceType": 1}).then(response => { + this.gatewayDeviceList = response.rows; + this.loading = false; + }); + }, + // 取消按钮 cancel() { this.open = false; @@ -737,6 +822,8 @@ export default { /** 重置按钮操作 */ resetQuery() { this.resetForm("queryForm"); + this.queryParams.deviceType = null; + this.queryParams.releatedDeviceId = null; this.handleQuery(); }, // 多选框选中数据 @@ -1115,7 +1202,7 @@ export default { importTemplate() { this.$refs["uploadForm"].validate(valid => { if (valid) { - this.download('business/device/importTemplate', {"sceneId": this.upload.sceneId}, `device_template_`+this.upload.sceneName+`_${new Date().getTime()}.xlsx`) + this.download('business/device/importTemplate', {"sceneId": this.upload.sceneId}, `device_template_` + this.upload.sceneName + `_${new Date().getTime()}.xlsx`) } }); }, @@ -1138,9 +1225,40 @@ export default { this.$refs.upload.submit(); } }); + }, + + // 筛选节点 + filterNode(value, data) { + if (!value) return true; + return data.deviceName.indexOf(value) !== -1; + }, + // 节点单击事件 + handleNodeClick(data) { + this.queryParams.deviceType = this.DEVICE_TYPE_GATEWAY_SUB_EQUIPMENT; + this.queryParams.releatedDeviceId = data.deviceId; + this.handleQuery(); + }, + + toggleDeviceClick() { + if (this.toggleLeftDisplay) { + this.toggleRightDisplay = true; + this.toggleLeftDisplay = false; + } else if (this.toggleRightDisplay) { + this.toggleRightDisplay = false; + this.toggleLeftDisplay = true; + } } } }; - +