From ba698c38e83a669f17494720a9ff05765ba462c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=B7=E5=86=89=E5=86=89?= Date: Thu, 25 Sep 2025 19:23:33 +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=E3=80=81=E6=9C=8D=E5=8A=A1=E5=99=A8=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/disRevenue/resource.js | 57 ++++- src/router/index.js | 4 +- .../resource/monitorStategy/details.vue | 91 ++++--- .../resource/monitorStategy/index.vue | 39 ++- .../resource/monitorStategy/view.vue | 173 ++++++++++--- .../resource/monitorTemp/details.vue | 43 +++- .../disRevenue/resource/monitorTemp/view.vue | 2 +- .../resource/serverScript/dynamicForm.vue | 237 ++++++++++-------- .../resource/serverScript/serverScript.vue | 49 ++-- .../serverScript/serverScriptDetails.vue | 224 +++++++++-------- 10 files changed, 588 insertions(+), 331 deletions(-) diff --git a/src/api/disRevenue/resource.js b/src/api/disRevenue/resource.js index 25b9a34..71f4809 100644 --- a/src/api/disRevenue/resource.js +++ b/src/api/disRevenue/resource.js @@ -242,12 +242,11 @@ export function getMonitorPolicy(Id) { method: 'get' }) } -// 查询资源监控项 -export function getMonitorPolicyList(query) { +// 下发策略 +export function getMonitorPolicyList(Id) { return request({ - url: '/rocketmq/monitorPolicy/issuePolicy', - method: 'post', - data: query + url: '/rocketmq/monitorPolicy/issuePolicy?id=' + Id, + method: 'get' }) } @@ -289,3 +288,51 @@ export function getResMonitorGroup() { method: 'get' }) } +/** ----------------脚本服务器策略------------ */ +// 查询列表 +export function listPolicy(query) { + return request({ + url: '/rocketmq/policy/list', + method: 'post', + data: query + }) +} +// 查询详细 +export function getPolicy(Id) { + return request({ + url: '/rocketmq/policy/' + Id, + method: 'get' + }) +} +// 下发策略 +export function getPolicyList(Id) { + return request({ + url: '/rocketmq/policy/issueDeploymentPolicy?id=' + Id, + method: 'get' + }) +} + +// 新增 +export function addPolicy(data) { + return request({ + url: '/rocketmq/policy', + method: 'post', + data: data + }) +} + +// 修改 +export function updatePolicy(data) { + return request({ + url: '/rocketmq/policy', + method: 'put', + data: data + }) +} +// 删除 +export function delPolicy(Ids) { + return request({ + url: '/rocketmq/policy/' + Ids, + method: 'delete' + }) +} diff --git a/src/router/index.js b/src/router/index.js index 4d0c1c7..b1ddc4a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -351,7 +351,7 @@ export const dynamicRoutes = [ path: 'index/:id?', component: () => import('@/views/disRevenue/resource/monitorTemp/view'), name: 'monitorTempView', - meta: { title: '监控模版信息', activeMenu: '/disRevenue/resource/monitorTemp' } + meta: { title: '监控模版详情', activeMenu: '/disRevenue/resource/monitorTemp' } } ] }, @@ -380,7 +380,7 @@ export const dynamicRoutes = [ path: 'index/:id?', component: () => import('@/views/disRevenue/resource/monitorStategy/view'), name: 'monitorStategyView', - meta: { title: '监控模版信息', activeMenu: '/disRevenue/resource/monitorStategy' } + meta: { title: '资源监控策略详情', activeMenu: '/disRevenue/resource/monitorStategy' } } ] }, diff --git a/src/views/disRevenue/resource/monitorStategy/details.vue b/src/views/disRevenue/resource/monitorStategy/details.vue index 3972952..554ad7c 100644 --- a/src/views/disRevenue/resource/monitorStategy/details.vue +++ b/src/views/disRevenue/resource/monitorStategy/details.vue @@ -181,30 +181,20 @@ // 第二节点 1栏 option: [], linuxSystem: { - monitorItem: [{ - firstTitle: 'Linux系统', secondTitle: '监控项', title: 'CPU监控', modelName: 'cpu',time: '', - checkList: [] - },{ - firstTitle: 'Linux系统', secondTitle: '监控项', title: '其他监控', modelName: 'other', - checkList: [] - }], - autodiscoverItem: [{ - firstTitle: 'Linux系统', secondTitle: '自动发现项', title: '发现挂载文件系统', modelName: 'vfs', time: '', - checkList: [] - },{ - firstTitle: 'Linux系统', secondTitle: '自动发现项', title: '发现网络接口', modelName: 'net', time: '300', - checkList: [] - },{ - firstTitle: 'Linux系统', secondTitle: '自动发现项', title: '发现硬盘设备', modelName: 'disk', time: '', - checkList: [] - }, { - firstTitle: 'Linux系统', secondTitle: '自动发现项', title: '发现docker', modelName: 'docker', time: '', - checkList: [] - }], + monitorItem: [ + {firstTitle: 'Linux系统', secondTitle: '监控项', title: 'CPU监控', modelName: 'cpu',time: '', checkList: []}, + {firstTitle: 'Linux系统', secondTitle: '监控项', title: '其他监控', modelName: 'other', checkList: []} + ], + autodiscoverItem: [ + {firstTitle: 'Linux系统', secondTitle: '自动发现项', title: '发现挂载文件系统', modelName: 'vfs', time: '', checkList: []}, + {firstTitle: 'Linux系统', secondTitle: '自动发现项', title: '发现网络接口', modelName: 'net', time: '300', checkList: []}, + {firstTitle: 'Linux系统', secondTitle: '自动发现项', title: '发现硬盘设备', modelName: 'disk', time: '', checkList: []}, + {firstTitle: 'Linux系统', secondTitle: '自动发现项', title: '发现docker', modelName: 'docker', time: '', checkList: []} + ], }, // 第二节点 2栏 列显隐信息 monitorTable: { - nodeOne: [{firstTitle: '华为交换机', secondTitle: '监控项', modelName: 'other', checkList: []}], + nodeOne: [{firstTitle: '华为交换机', secondTitle: '监控项', modelName: 'switchOther', checkList: []}], nodeTow: [ {firstTitle: '华为交换机', secondTitle: '自动发现项', title: '网络端口发现', modelName: 'switchNet', time: '300', checkList: []}, {firstTitle: '华为交换机', secondTitle: '自动发现项',title: '光模块发现', modelName: 'switchModule', time: '', checkList: []}, @@ -264,13 +254,10 @@ getFormDataList(id) { this.tempContent = {}; getMonitorPolicy(id).then(val => { - console.log('val===',val); if (val && val.data) { - // this.activeTypeName = val.data.template.resourcyType; this.ruleFormData = val.data.policy; this.resourceType = val.data.resourceType; this.tempContent[val.data.resourceType] = val.data[val.data.resourceType]; - console.log('tempContent====',this.tempContent); } }).catch(() => { // this.$modal.msgError("操作失败") @@ -279,7 +266,6 @@ // 通过监控模版选项 查询监控策略展示项 fnGetMonitorTempList(id) { getMonitorTemp(id).then(res => { - console.log('res===',res); if (res && res.data) { if (this.resourceType === 'linux') { // cpu 详情 @@ -298,6 +284,7 @@ } }); this.linuxSystem.monitorItem[1].checkList = this.tempContent['linux'].other; + this.handleCheckedCitiesChange(null, this.linuxSystem.monitorItem[1]); } else { this.linuxSystem.monitorItem[1].checkList = res.data && res.data['linux'] && res.data['linux'].other || []; } @@ -350,12 +337,27 @@ } else { // one if (res.data && res.data['switch'] && res.data['switch'].switchOther && res.data['switch'].switchOther.length > 0) { - this.monitorTable.nodeOne[0].checkList = res.data && res.data['switch'] && res.data['switch'].switchOther; + if (this.tempContent['switch'] && this.tempContent['switch'].switchOther && this.tempContent['switch'].switchOther.length > 0) { + this.tempContent['switch'].switchOther.forEach(item => { + if (item && item.collectionCycle) { + item.time = item.collectionCycle.toString(); + } + }); + this.monitorTable.nodeOne[0].checkList = this.tempContent['switch'].switchOther; + this.handleCheckedCitiesChange(null, this.monitorTable.nodeOne[0]); + } else { + this.monitorTable.nodeOne[0].checkList = res.data && res.data['switch'] && res.data['switch'].switchOther || []; + } } let newArr = []; // tow-1 if (res.data && res.data['switch'] && res.data['switch'].switchNet && res.data['switch'].switchNet.length > 0) { this.monitorTable.nodeTow[0].checkList = res.data && res.data['switch'] && res.data['switch'].switchNet; + if (this.tempContent['switch'] && this.tempContent['switch'].switchNet && this.tempContent['switch'].switchNet.length > 0) { + if (this.tempContent['switch'].switchNet[0] && this.tempContent['switch'].switchNet[0].collectionCycle) { + this.monitorTable.nodeTow[0].time = this.tempContent['switch'].switchNet[0].collectionCycle.toString(); + } + } newArr.push(this.monitorTable.nodeTow[0]); if (this.monitorTable.nodeTow[0].time) { this.handleCheckedCitiesChange(this.monitorTable.nodeTow[0].time, this.monitorTable.nodeTow[0]); @@ -364,21 +366,45 @@ // tow-2 if (res.data && res.data['switch'] && res.data['switch'].switchModule && res.data['switch'].switchModule.length > 0) { this.monitorTable.nodeTow[1].checkList = res.data && res.data['switch'] && res.data['switch'].switchModule; + if (this.tempContent['switch'] && this.tempContent['switch'].switchModule && this.tempContent['switch'].switchModule.length > 0) { + if (this.tempContent['switch'].switchModule[0] && this.tempContent['switch'].switchModule[0].collectionCycle) { + this.monitorTable.nodeTow[1].time = this.tempContent['switch'].switchModule[0].collectionCycle.toString(); + this.handleCheckedCitiesChange(this.monitorTable.nodeTow[1].time, this.monitorTable.nodeTow[1]); + } + } newArr.push(this.monitorTable.nodeTow[1]); } // tow-3 if (res.data && res.data['switch'] && res.data['switch'].switchMpu && res.data['switch'].switchMpu.length > 0) { this.monitorTable.nodeTow[2].checkList = res.data && res.data['switch'] && res.data['switch'].switchMpu; + if (this.tempContent['switch'] && this.tempContent['switch'].switchMpu && this.tempContent['switch'].switchMpu.length > 0) { + if (this.tempContent['switch'].switchMpu[0] && this.tempContent['switch'].switchMpu[0].collectionCycle) { + this.monitorTable.nodeTow[2].time = this.tempContent['switch'].switchMpu[0].collectionCycle.toString(); + this.handleCheckedCitiesChange(this.monitorTable.nodeTow[2].time, this.monitorTable.nodeTow[2]); + } + } newArr.push(this.monitorTable.nodeTow[2]); } // tow-4 if (res.data && res.data['switch'] && res.data['switch'].switchPwr && res.data['switch'].switchPwr.length > 0) { this.monitorTable.nodeTow[3].checkList = res.data && res.data['switch'] && res.data['switch'].switchPwr; + if (this.tempContent['switch'] && this.tempContent['switch'].switchPwr && this.tempContent['switch'].switchPwr.length > 0) { + if (this.tempContent['switch'].switchPwr[0] && this.tempContent['switch'].switchPwr[0].collectionCycle) { + this.monitorTable.nodeTow[3].time = this.tempContent['switch'].switchPwr[0].collectionCycle.toString(); + this.handleCheckedCitiesChange(this.monitorTable.nodeTow[3].time, this.monitorTable.nodeTow[3]); + } + } newArr.push(this.monitorTable.nodeTow[3]); } // tow-5 - if (res.data && res.data['switch'] && res.data['switch'].switchNet && res.data['switch'].switchNet.length > 0) { + if (res.data && res.data['switch'] && res.data['switch'].switchFan && res.data['switch'].switchFan.length > 0) { this.monitorTable.nodeTow[4].checkList = res.data && res.data['switch'] && res.data['switch'].switchFan; + if (this.tempContent['switch'] && this.tempContent['switch'].switchFan && this.tempContent['switch'].switchFan.length > 0) { + if (this.tempContent['switch'].switchFan[0] && this.tempContent['switch'].switchFan[0].collectionCycle) { + this.monitorTable.nodeTow[4].time = this.tempContent['switch'].switchFan[0].collectionCycle.toString(); + this.handleCheckedCitiesChange(this.monitorTable.nodeTow[4].time, this.monitorTable.nodeTow[4]); + } + } newArr.push(this.monitorTable.nodeTow[4]); } this.monitorTable.nodeTow = newArr; @@ -387,7 +413,6 @@ }); }, async next(num) { - console.log('num==',num,'active====',this.active); if (num === '-1') { this.active--; } else { @@ -469,15 +494,14 @@ } } }); - console.log('params===',this.paramsList); this.synthesisList = Object.assign({}, this.checkAllParams); }, // 单个选择按钮 handleCheckedCitiesChange(changeVal,iteListAll) { - console.log('changeVal==',changeVal, 'iteListAll===',iteListAll, 'cvvvv===','time' in iteListAll); if ('time' in iteListAll) { if (changeVal) { - this.checkAllParams[iteListAll.modelName].time = iteListAll && iteListAll.time; + this.checkAllParams[iteListAll.modelName]['time'] = iteListAll && iteListAll.time; + this.checkAllParams[iteListAll.modelName].data = iteListAll['checkList']; } else { delete this.checkAllParams[iteListAll.modelName]; } @@ -487,9 +511,7 @@ }, // 提交 submit() { - console.log('ruleFormData==',this.ruleFormData); - console.log('synthesisList==',this.synthesisList); - let params = Object.assign({resourceType: this.resourceType}, {collectionAndIdList: this.paramsList}, this.ruleFormData); + let params = Object.assign(this.ruleFormData, {resourceType: this.resourceType}, {collectionAndIdList: this.paramsList}); let fnType = addMonitorPolicy; if (this.paramsData && this.paramsData.id) { fnType = updateMonitorPolicy; @@ -501,7 +523,6 @@ this.$modal.closeLoading(); }).catch(error => { this.$modal.closeLoading(); - this.$modal.msgError("操作失败") }); }, // 返回 diff --git a/src/views/disRevenue/resource/monitorStategy/index.vue b/src/views/disRevenue/resource/monitorStategy/index.vue index ee80246..1993755 100644 --- a/src/views/disRevenue/resource/monitorStategy/index.vue +++ b/src/views/disRevenue/resource/monitorStategy/index.vue @@ -2,10 +2,10 @@
- + @@ -18,7 +18,7 @@ placeholder="请选择策略状态" clearable> @@ -33,8 +33,8 @@ -