From 9782011cd20f3342a248a3c5583f1d71a71fe86d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=B7=E5=86=89=E5=86=89?= Date: Wed, 24 Sep 2025 20:58:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=9B=91=E6=8E=A7=E7=AD=96?= =?UTF-8?q?=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/disRevenue/resource.js | 64 +++ src/components/table/index.vue | 71 +-- .../resource/monitorStategy/details.vue | 408 ++++++++++++------ .../resource/monitorStategy/index.vue | 46 +- .../resource/monitorStategy/view.vue | 64 ++- .../resource/monitorTemp/details.vue | 26 +- .../disRevenue/resource/monitorTemp/index.vue | 15 +- .../disRevenue/resource/monitorTemp/view.vue | 173 +++++++- 8 files changed, 619 insertions(+), 248 deletions(-) diff --git a/src/api/disRevenue/resource.js b/src/api/disRevenue/resource.js index 9c23216..25b9a34 100644 --- a/src/api/disRevenue/resource.js +++ b/src/api/disRevenue/resource.js @@ -225,3 +225,67 @@ export function delMonitorTemp(Ids) { method: 'delete' }) } + +/** ----------------资源监控策略------------ */ +// 查询列表 +export function listMonitorPolicy(query) { + return request({ + url: '/rocketmq/monitorPolicy/list', + method: 'post', + data: query + }) +} +// 查询详细 +export function getMonitorPolicy(Id) { + return request({ + url: '/rocketmq/monitorPolicy/' + Id, + method: 'get' + }) +} +// 查询资源监控项 +export function getMonitorPolicyList(query) { + return request({ + url: '/rocketmq/monitorPolicy/issuePolicy', + method: 'post', + data: query + }) +} + +// 新增 +export function addMonitorPolicy(data) { + return request({ + url: '/rocketmq/monitorPolicy', + method: 'post', + data: data + }) +} + +// 修改 +export function updateMonitorPolicy(data) { + return request({ + url: '/rocketmq/monitorPolicy', + method: 'put', + data: data + }) +} +// 删除 +export function delMonitorPolicy(Ids) { + return request({ + url: '/rocketmq/monitorPolicy/' + Ids, + method: 'delete' + }) +} +// 关联监控模板下拉接口 +export function getMonitorPolicyTemp() { + return request({ + url: '/rocketmq/template/getAllTemplate', + method: 'get' + }) +} +// 关联资源组下拉接口 +export function getResMonitorGroup() { + return request({ + url: '/system/resourceMonitor/resourceGroupList ', + method: 'get' + }) +} diff --git a/src/components/table/index.vue b/src/components/table/index.vue index 369c7c9..2465f40 100644 --- a/src/components/table/index.vue +++ b/src/components/table/index.vue @@ -10,7 +10,7 @@ - + @@ -113,8 +113,7 @@ ids: [], selectList: [], isProcessing: false, // 防止事件循环的标志位 - checkColumns: [], - typeParent: false + checkColumns: [] } }, // 监听showSearch的变化,并且把变化后的值传给父组件 @@ -160,8 +159,6 @@ /** 多选框选中数据 */ handleSelectionChange(selection) { - if (this.typeParent) return - console.log('selection=====',selection); if (this.config && this.config['tableKey']) { this.selectList = []; this.ids = []; @@ -192,13 +189,24 @@ this.isProcessing = false; }); this.selectList.forEach(val => { - this.$refs.selChangeList.toggleRowSelection(val,true); + this.$refs[`tableRef_${this.config.tableKey}`].toggleRowSelection(val,true); }); } else { this.selectList = selection; this.ids = selection.map(item => item.id); } }, + // 全选按钮操作 + handleSelectAll(tabAll){ + // 资源监控策略和资源监控模块使用 selectable: 控制列是否可选,值为false则不可选--this.config.selectable为判断 + if (this.config && this.config.tableKey && this.config.selectable === true) { + if (tabAll && tabAll.length > 0) { + this.defaultSelectRows([]); // 取消全选 + } else { + this.selectAllRows(); // 全选 + } + } + }, // 提供给父组件调用的方法:返回当前表格的选中数据 资源监控策略和资源监控模块使用 getSelectedData() { return { @@ -206,10 +214,9 @@ data: [...this.selectList] // 选中的数据 }; }, - // 提供给父组件调用的方法:全选所有行 + // 提供给父组件调用的方法:全选所有行 资源监控策略和资源监控模块使用 selectAllRows() { - this.typeParent = true; - const table = this.$refs[`tableRef_${this.config.tableKey}`]; + const table = this.config && this.config.tableKey ? this.$refs[`tableRef_${this.config.tableKey}`] : this.$refs.selChangeList; if (!table) return; // 清空现有选中状态 this.selectList = []; @@ -225,55 +232,13 @@ // } }); }, - // selectAllRows() { - // const table = this.$refs[`tableRef_${this.config.tableKey}`]; - // if (!table) return; - // - // // 1. 筛选出所有可选的行(根据selectable配置) - // const selectableRows = this.tableList.filter(row => { - // // 如果有自定义选中规则,使用规则判断 - // if (this.config?.selectable && typeof this.config.selectable === 'function') { - // return this.config.selectable(row); - // } - // // 默认全部可选 - // return true; - // }); - // - // // 2. 清空现有选中状态 - // table.clearSelection(); // 使用表格内置方法清空,保证状态同步 - // this.selectList = []; - // this.ids = []; - // - // // 3. 选中所有可选行 - // selectableRows.forEach(row => { - // table.toggleRowSelection(row, true); - // this.selectList.push(row); - // this.ids.push(row.id); - // }); - // - // // 4. 同步表格内部的全选状态(关键修复) - // this.$nextTick(() => { - // // 当所有可选行都被选中时,更新表格的全选状态 - // if (selectableRows.length > 0 && this.selectList.length === selectableRows.length) { - // // 获取表头的全选复选框DOM - // const headerCheckbox = table.$el.querySelector('.el-table__header-wrapper .el-checkbox__input'); - // if (headerCheckbox) { - // // 触发表格内部的状态更新(模拟用户点击全选框的行为) - // headerCheckbox.click(); - // // 强制更新表格视图 - // table.$forceUpdate(); - // } - // } - // }); - // }, // 提供给父组件调用的方法:默认选中值 defaultSelectRows(rows){ - this.typeParent = true; - const tableInstance = this.$refs[`tableRef_${this.config.tableKey}`]; + const tableInstance = this.config && this.config.tableKey ? this.$refs[`tableRef_${this.config.tableKey}`] : this.$refs.selChangeList; this.selectList = []; this.ids = []; if (tableInstance) { - if (rows) { + if (rows && rows.length > 0) { rows.forEach(row => { tableInstance.toggleRowSelection(row, true); this.selectList.push(row); diff --git a/src/views/disRevenue/resource/monitorStategy/details.vue b/src/views/disRevenue/resource/monitorStategy/details.vue index 73480e1..3972952 100644 --- a/src/views/disRevenue/resource/monitorStategy/details.vue +++ b/src/views/disRevenue/resource/monitorStategy/details.vue @@ -3,7 +3,7 @@
- + @@ -16,21 +16,21 @@
- + - + @@ -59,11 +59,11 @@ - +