diff --git a/src/views/base/deviceLedger/index.vue b/src/views/base/deviceLedger/index.vue index 73328bf..df2e42d 100644 --- a/src/views/base/deviceLedger/index.vue +++ b/src/views/base/deviceLedger/index.vue @@ -184,6 +184,13 @@ v-hasPermi="['base:deviceLedger:remove']" >删除 + 参数 + @@ -202,13 +209,13 @@ - + --> - + { this.deviceLedgerList = response.data }) + // 从路由参数获取设备编号 + const deviceCode = this.$route.query.deviceCode; + if (deviceCode) { + this.queryParams.deviceCode = deviceCode; + } this.getList(); }, + watch: { + // 监听路由变化,重新获取参数并查询 + '$route.query.deviceCode': { + handler(newVal, oldVal) { + // 只在值真正变化且新值存在时才查询(避免重置时重复查询) + if (newVal && newVal !== this.queryParams.deviceCode) { + this.queryParams.deviceCode = newVal; + this.queryParams.pageNum = 1; + this.getList(); + } + } + } + }, methods: { /** 查询设备参数列表 */ getList() { @@ -324,6 +342,11 @@ export default { /** 重置按钮操作 */ resetQuery() { this.resetForm("queryForm"); + this.queryParams.deviceCode = null; + // 清除路由中的 deviceCode 参数 + if (this.$route.query.deviceCode) { + this.$router.replace({ path: this.$route.path }); + } this.handleQuery(); }, // 多选框选中数据