MTRAgent管理、MTR探测策略
1、MTRAgent管理模块联调form表单、丢包趋势图表 2、MTR探测策略联调列表、表单等功能
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ VUE_APP_TITLE = SAAS综合管理平台
|
||||
# 开发环境配置
|
||||
ENV = 'development'
|
||||
|
||||
# 若依管理系统/开发环境
|
||||
# SAAS管理系统/开发环境
|
||||
VUE_APP_BASE_API = '/dev-api'
|
||||
|
||||
# 路由懒加载
|
||||
|
||||
+1
-1
@@ -4,5 +4,5 @@ VUE_APP_TITLE = SAAS综合管理平台
|
||||
# 生产环境配置
|
||||
ENV = 'production'
|
||||
|
||||
# 若依管理系统/生产环境
|
||||
# SAAS管理系统/生产环境
|
||||
VUE_APP_BASE_API = 'http://172.16.15.102:8080'
|
||||
|
||||
+2
-2
@@ -8,5 +8,5 @@ NODE_ENV = production
|
||||
# 测试环境配置
|
||||
ENV = 'staging'
|
||||
|
||||
# 若依管理系统/测试环境
|
||||
VUE_APP_BASE_API = '/stage-api'
|
||||
# SAAS管理系统/测试环境
|
||||
VUE_APP_BASE_API = 'http://172.16.15.51:8080'
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
## 开发
|
||||
|
||||
```bash
|
||||
# 克隆项目
|
||||
git clone https://gitee.com/y_project/RuoYi-Vue
|
||||
|
||||
# 进入项目目录
|
||||
cd ruoyi-ui
|
||||
|
||||
# 安装依赖
|
||||
npm install
|
||||
|
||||
# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
|
||||
npm install --registry=https://registry.npmmirror.com
|
||||
|
||||
# 启动服务
|
||||
npm run dev
|
||||
```
|
||||
|
||||
浏览器访问 http://localhost:80
|
||||
|
||||
## 发布
|
||||
|
||||
```bash
|
||||
# 构建测试环境
|
||||
npm run build:stage
|
||||
|
||||
# 构建生产环境
|
||||
npm run build:prod
|
||||
## 开发
|
||||
|
||||
```bash
|
||||
# 克隆项目
|
||||
git clone https://gitee.com/y_project/RuoYi-Vue
|
||||
|
||||
# 进入项目目录
|
||||
cd profitManage
|
||||
|
||||
# 安装依赖
|
||||
npm install
|
||||
|
||||
# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
|
||||
npm install --registry=https://registry.npmmirror.com
|
||||
|
||||
# 启动服务
|
||||
npm run dev
|
||||
```
|
||||
|
||||
浏览器访问 http://localhost:80
|
||||
|
||||
## 发布
|
||||
|
||||
```bash
|
||||
# 构建测试环境
|
||||
npm run build:stage
|
||||
|
||||
# 构建生产环境
|
||||
npm run build:prod
|
||||
```
|
||||
@@ -1125,3 +1125,66 @@ export function lossRateByMtr(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 根据mtrClientId获取所有clientId
|
||||
export function mtrCToClientIds(data) {
|
||||
return request({
|
||||
url: '/mtragent/mtrClientRegistration/getClientIdByMtrClientId',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 标识
|
||||
export function logicalNodeAll() {
|
||||
return request({
|
||||
url: '/mtragent/mtrClientRegistration/getAllLogicalNode',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
// 所有 mtrclientId
|
||||
export function allMtrClientIdData(data) {
|
||||
return request({
|
||||
url: '/mtragent/mtrClientRegistration/getAllMtrMsg',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
/** --------------MTR探测策略--------------- */
|
||||
// 查询列表
|
||||
export function listMtrPolicy(query) {
|
||||
return request({
|
||||
url: '/mtragent/mtrPolicyConfig/list',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
// 新增
|
||||
export function addMtrPolicy(data) {
|
||||
return request({
|
||||
url: '/mtragent/mtrPolicyConfig',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 修改
|
||||
export function updateMtrPolicy(data) {
|
||||
return request({
|
||||
url: '/mtragent/mtrPolicyConfig',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 查询详细
|
||||
export function getMtrPolicyt(Id) {
|
||||
return request({
|
||||
url: '/mtragent/mtrPolicyConfig/' + Id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
// 删除
|
||||
export function delMtrPolicy(Ids) {
|
||||
return request({
|
||||
url: '/mtragent/mtrPolicyConfig/' + Ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
v-else
|
||||
:key="config && config.key ? `${config && config.key}-${key}` : `${key}`"
|
||||
:prop="key"
|
||||
:class="formVal && formVal.labelWidthNull ? 'labelWidthNullSty' : ''"
|
||||
:required="formVal.required">
|
||||
<template #label>
|
||||
<span :title="formVal.label">{{formVal.label ? formVal.label + ':' : ''}}</span>
|
||||
@@ -432,5 +433,11 @@
|
||||
::v-deep .vue-treeselect__multi-value{
|
||||
line-height: 25px!important;
|
||||
}
|
||||
::v-deep .labelWidthNullSty .el-form-item__label {
|
||||
width: 0px!important;
|
||||
}
|
||||
::v-deep .labelWidthNullSty .el-form-item__content {
|
||||
margin-left: 0px!important;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -2,16 +2,9 @@
|
||||
<div class="app-container">
|
||||
<el-collapse v-model="activeShowList" @change="collapseChange">
|
||||
<template v-for="(val,key, index) of chartDataLit">
|
||||
<el-collapse-item :title="`【${val && val.title || ''}】${val && val.serverIp || ''}`" :name="val && val.title || ''">
|
||||
<el-collapse-item :title="`【${val && val.title || ''}】${val && val.jointName || ''}`" :name="val && val.title || ''">
|
||||
<div class="mt10 w100">
|
||||
<div class="w100 plr-20" style="font-size: 14px">
|
||||
<div v-for="(item,key,index) of val && val.formList || []" :key="`${key}-${index}`" class="w50 disInlineBlock p10">
|
||||
<!-- <span class="w50 disInlineBlock" style="color: #C0C4CC;">{{item}}</span><span class="w50">{{val && val.formModel[key] || '-'}}</span>-->
|
||||
<div class="disInlineBlock" style="width: 120px;color: #C0C4CC;">{{item}}</div>
|
||||
<div style="width: calc(100% - 120px);vertical-align: top;" class="disInlineBlock">{{val && val.formModel[key] || '-'}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-for="item of val && val.echartList || []" :key="`div-${val && val.title || ''}-${item && item.title || ''}-${index}`" class="w100 mt20 mb20" style="height: 200px;border-top: 1px solid #d8dce5">
|
||||
<div v-for="item of val && val.echartList || []" :key="`div-${val && val.title || ''}-${item && item.title || ''}-${index}`" class="w100" style="height: 200px;">
|
||||
<EchartsLine class="w100 h100" :key="`chart-${val && val.title || ''}-${item && item.title || ''}-${index}`" :lineData="item && item.dataVal || {}" :dateDataTrans="item && item.dateDataTrans || {}" :dateShowType="item && item.dateShowType || 'datetimerange'" :title="item && item.title || '图表数据'" :chartData="(valData, unit) => chartDataEvent(valData, item.fnEvent,val.title, unit)"></EchartsLine>
|
||||
</div>
|
||||
</div>
|
||||
@@ -22,24 +15,76 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {lossRateByMtr} from "@/api/disRevenue/resource"
|
||||
import {mtrCToClientIds, lossRateByMtr} from "@/api/disRevenue/resource"
|
||||
import EchartsLine from "@/components/echartsList/line.vue";
|
||||
export default {
|
||||
name: "lossRateChart",
|
||||
components: {EchartsLine},
|
||||
data() {
|
||||
return {
|
||||
activeShowList: [],
|
||||
chartDataLit: {},
|
||||
echartList: [{
|
||||
title: ' ',
|
||||
dateShowType: 'datetimerange',
|
||||
dateDataTrans: {transList: true},
|
||||
dataVal: {
|
||||
titleVal: {textAlign: 'left', left: '1%'},
|
||||
yAxisName: ' ',
|
||||
gridTop: '35%',
|
||||
legend: {},
|
||||
lineXData: ['2025-9-1', '2025-9-2', '2025-9-3', '2025-9-4', '2025-9-5', '2025-9-6', '2025-9-7'],
|
||||
dataList: [{
|
||||
name: '',
|
||||
data: [220, 182, 191, 234, 290, 330, 310]
|
||||
}]
|
||||
}
|
||||
}],
|
||||
paramsData: {},
|
||||
currTimeList: {},
|
||||
defaultTimes: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.paramsData = this.$route && this.$route.query;
|
||||
let startData = '';
|
||||
let endData = '';
|
||||
const year = new Date().getFullYear();
|
||||
const month = String(new Date().getMonth() + 1).padStart(2, '0'); // 0=1月,11=12月
|
||||
const day = String(new Date().getDate()).padStart(2, '0'); // 当前日(如8)
|
||||
const prevDay = String(new Date().getDate() - 1).padStart(2, '0');
|
||||
const hours = String(new Date().getHours()).padStart(2, '0') + ':';
|
||||
const minutes = String(new Date().getMinutes()).padStart(2, '0') + ':';
|
||||
const seconds = String(new Date().getSeconds()).padStart(2, '0');
|
||||
startData = `${year}-${month}-${prevDay}` + ' ' + hours + minutes + seconds;
|
||||
endData = `${year}-${month}-${day}` + ' ' + hours + minutes + seconds;
|
||||
this.currTimeList = {startTime: startData, endTime: endData};
|
||||
this.defaultTimes = [startData, endData];
|
||||
this.getLossRateChart();
|
||||
},
|
||||
methods: {
|
||||
getLossRateChart() {
|
||||
lossRateByMtr({mtrClientId: this.paramsData.mtrClientId}).then(res => {
|
||||
console.log('res===',res)
|
||||
this.activeShowList = [];
|
||||
mtrCToClientIds({mtrClientId: this.paramsData.mtrClientId}).then(res => {
|
||||
let dataList = {};
|
||||
res && res.data.forEach(item => {
|
||||
this.activeShowList.push(item.clientId);
|
||||
// let chartList = JSON.parse(JSON.stringify(this.echartList));
|
||||
// chartList[0].dateDataTrans['dateRange'] = this.defaultTimes;
|
||||
item['title'] = item.clientId;
|
||||
item['jointName'] = '丢包率';
|
||||
// item['echartList'] = chartList;
|
||||
dataList[item.clientId] = item;
|
||||
// this.getEchartList(dataList, item.clientId);
|
||||
});
|
||||
this.chartDataLit = dataList;
|
||||
});
|
||||
},
|
||||
getEchartList(content, key) {
|
||||
console.log('content===',content);
|
||||
console.log('key===',key);
|
||||
lossRateByMtr({}).then(res => {
|
||||
|
||||
});
|
||||
},
|
||||
collapseChange(val) {
|
||||
@@ -49,6 +94,10 @@
|
||||
// }
|
||||
},
|
||||
chartDataEvent(valData, funcName, tabName, unit) {
|
||||
// console.log('valData===',valData);
|
||||
// console.log('funcName===',funcName);
|
||||
// console.log('tabName===',tabName);
|
||||
// console.log('unit===',unit);
|
||||
// // 检查函数是否存在,避免报错
|
||||
// if (typeof this[funcName] === 'function') {
|
||||
// // 调用实际函数,并传递参数(如选中的值、当前项)
|
||||
@@ -62,5 +111,10 @@
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
::v-deep .el-collapse-item__header {
|
||||
background-color: #d4e3fc!important;
|
||||
/*color: #fff!important;*/
|
||||
padding-left: 20px;
|
||||
font-size: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -87,20 +87,21 @@
|
||||
<mtrAgentView :open="`type_${viewOpen}`" :dialogRowData="dialogRowData" @dialogResult="fnDialogResult"></mtrAgentView>
|
||||
</el-dialog>
|
||||
<!-- MTR探测策略 -->
|
||||
<el-dialog title="MTR探测策略" :visible.sync="mtrProbeOpen" width="800px" append-to-body style="padding-bottom: 20px;">
|
||||
<mtrAgentView :open="`type_${mtrProbeOpen}`" :dialogRowData="dialogRowData" @dialogResult="fnDialogResult"></mtrAgentView>
|
||||
<el-dialog title="MTR探测策略" :visible.sync="mtrProbeOpen" width="1000px" append-to-body style="padding-bottom: 20px;">
|
||||
<mtrProbeView :open="`type_${mtrProbeOpen}`" :dialogRowData="dialogRowData" @dialogResult="fnDialogResult"></mtrProbeView>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Register">
|
||||
import Form from '@/components/form/index.vue';
|
||||
import {listMtrAgent, getLogicalNode} from '@/api/disRevenue/resource';
|
||||
import {listMtrAgent, logicalNodeAll} from '@/api/disRevenue/resource';
|
||||
import TableList from '@/components/table/index.vue';
|
||||
import mtrAgentView from './mtrAgentView';
|
||||
import mtrProbeView from '../mtrProbe/mtrProbeView';
|
||||
export default {
|
||||
name: 'mtrAgent',
|
||||
components: {TableList,Form, mtrAgentView},
|
||||
components: {TableList,Form, mtrAgentView, mtrProbeView},
|
||||
dicts: ['rm_moreip_status', 'rm_register_status', 'rm_register_online_state', 'policy_method'],
|
||||
data() {
|
||||
return {
|
||||
@@ -168,11 +169,11 @@
|
||||
methods: {
|
||||
// 逻辑标识接口
|
||||
fnLogicalNode() {
|
||||
// getLogicalNode().then(val => {
|
||||
// this.logicalNodeList = val && val.map(item => {
|
||||
// return Object.assign({label: item.logicalNodeId, value: item.logicalNodeId});
|
||||
// });
|
||||
// });
|
||||
logicalNodeAll().then(val => {
|
||||
this.logicalNodeList = val && val.data.map(item => {
|
||||
return Object.assign({label: item.logicalNodeId, value: item.logicalNodeId});
|
||||
});
|
||||
});
|
||||
},
|
||||
// 处理子组件传递的新值
|
||||
handleValueChange(newValue) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<script setup name="Handle">
|
||||
import Form from '@/components/form/index.vue';
|
||||
import {addMtrAgent, getMtrAgent, getRegistList} from "@/api/disRevenue/resource"
|
||||
import {addMtrAgent, getMtrAgent, allMtrClientIdData} from "@/api/disRevenue/resource"
|
||||
export default {
|
||||
name: 'mtrAgent_view',
|
||||
components: {Form},
|
||||
@@ -122,11 +122,11 @@
|
||||
break;
|
||||
case 'clientAllId':
|
||||
this.$set(this.ruleForm, 'mtrClientIds', '');
|
||||
getRegistList({resourceType: 1}).then(res => {
|
||||
allMtrClientIdData({}).then(res => {
|
||||
let str = '';
|
||||
if (res && res.data) {
|
||||
res && res.data.map(item => {
|
||||
str+= item.clientId + '\n';
|
||||
str+= item.mtrClientId + '\n';
|
||||
});
|
||||
}
|
||||
this.$set(this.ruleForm, 'mtrClientIds', str);
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
<script setup name="Register">
|
||||
import Form from '@/components/form/index.vue';
|
||||
import {listMtrAgent} from '@/api/disRevenue/resource';
|
||||
import {listMtrPolicy, delMtrPolicy} from '@/api/disRevenue/resource';
|
||||
import TableList from '@/components/table/index.vue';
|
||||
export default {
|
||||
name: 'mtrProbe',
|
||||
@@ -64,12 +64,12 @@
|
||||
policyName: { label: `策略名称`, minWidth: '120', visible: true},
|
||||
priority: { label: `优先级`,minWidth: '150', visible: true },
|
||||
mtrClientId: { label: `MTRClientID`, minWidth: '320', visible: true},
|
||||
description:{ label: `服务器集合`,minWidth: '90', visible: true},
|
||||
heartbeatInterval: { label: `是否探测`, minWidth: '100', visible: true},
|
||||
heartbeatCount: { label: `开始时间`, minWidth: '80'},
|
||||
networkInfo: { label: `结束时间`, minWidth: '100'},
|
||||
scheduledUpdateTime: { label: `探测频率`,minWidth: '160'},
|
||||
filePath: { label: `探测目标IP集合`,minWidth: '200'},
|
||||
serverGroup:{ label: `服务器集合`,minWidth: '90', visible: true},
|
||||
probeFlag: { label: `是否探测`, minWidth: '100', visible: true},
|
||||
startTime: { label: `开始时间`, minWidth: '80'},
|
||||
endTime: { label: `结束时间`, minWidth: '100'},
|
||||
probeFrequency: { label: `探测频率`,minWidth: '160'},
|
||||
serveripGroup: { label: `探测目标IP集合`,minWidth: '200'},
|
||||
updateTime:{ label: `修改时间`,minWidth: '160'},
|
||||
createTime: { label: `创建时间`,minWidth: '160'},
|
||||
},
|
||||
@@ -115,7 +115,7 @@
|
||||
if (params && !params.queryName) {
|
||||
params.queryName = null;
|
||||
}
|
||||
listMtrAgent(this.addDateRange(params)).then(response => {
|
||||
listMtrPolicy(this.addDateRange(params)).then(response => {
|
||||
this.roleList = response.rows;
|
||||
this.queryParams.total = response.total;
|
||||
})
|
||||
@@ -184,7 +184,7 @@
|
||||
let content = '<p style="font-size: 1rem;font-weight: 600;">删除MTR探测策略</p>' +
|
||||
'<p style="height: 0px;margin-bottom: 50px;">删除后数据将不能恢复,请确认是否继续!!!</p>';
|
||||
this.$modal.confirm(content).then(function() {
|
||||
return delMonitorPolicy(rowData.id)
|
||||
return delMtrPolicy(rowData.id)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功")
|
||||
@@ -192,7 +192,7 @@
|
||||
break;
|
||||
case 'export':
|
||||
let paramsList = Object.assign({}, this.queryParams,rowData);
|
||||
this.download("mtragent/mtrClientRegistration/export", paramsList, `MTR探测策略_${new Date().getTime()}.xlsx`, null, 'json');
|
||||
this.download("mtragent/mtrPolicyConfig/export", paramsList, `MTR探测策略_${new Date().getTime()}.xlsx`, null, 'json');
|
||||
break;
|
||||
default:
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<script setup name="Handle">
|
||||
import Form from '@/components/form/index.vue';
|
||||
import {addMtrAgent, getMtrAgent, getRegistList} from "@/api/disRevenue/resource"
|
||||
import {addMtrPolicy, updateMtrPolicy, getMtrPolicyt} from "@/api/disRevenue/resource"
|
||||
export default {
|
||||
name: 'mtrProbe_view',
|
||||
components: {Form},
|
||||
@@ -27,6 +27,11 @@
|
||||
if (val === 'type_true') {
|
||||
this.paramsData = {};
|
||||
this.$set(this.ruleForm, 'mtrClientId', this.dialogRowData && this.dialogRowData.mtrClientId || '');
|
||||
this.$set(this.ruleForm, 'clientAllId', false);
|
||||
if (this.formList && this.formList.length > 0) {
|
||||
this.formList[0].controls.serveripGroup['hidden'] = true;
|
||||
this.formList[0].controls.clientAllId['label'] = '显示相关IP';
|
||||
}
|
||||
} else if (val === 'type_false') {
|
||||
// 清空form
|
||||
this.$refs['formRef'].$refs.ruleForm.resetFields();
|
||||
@@ -38,7 +43,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ruleForm: {snmpDetect: '1'},
|
||||
ruleForm: {probeFlag: '1'},
|
||||
formList: [],
|
||||
paramsData: {},
|
||||
config: {},
|
||||
@@ -51,6 +56,7 @@
|
||||
this.paramsData = {};
|
||||
if (this.dialogRowData && this.dialogRowData.mtrClientId) {
|
||||
this.$set(this.ruleForm, 'mtrClientId', this.dialogRowData && this.dialogRowData.mtrClientId || '');
|
||||
this.$set(this.ruleForm, 'clientAllId', false);
|
||||
}
|
||||
}
|
||||
if (this.paramsData && this.paramsData.id) {
|
||||
@@ -68,27 +74,23 @@
|
||||
methods: {
|
||||
// formList集合
|
||||
fnFormList() {
|
||||
let colSpan = 18;
|
||||
if (this.paramsData && this.paramsData.readonly) {
|
||||
colSpan = 12;
|
||||
}
|
||||
if (this.paramsData && this.paramsData.readonly) {
|
||||
this.formList = [{
|
||||
config: {title: ' ', colSpan: '', readonly: true},
|
||||
controls: {
|
||||
id: {label: 'ID',hidden: true},
|
||||
policyName: {label: '策略名称', span: colSpan, type: 'input', required: true},
|
||||
policyName: {label: '策略名称', span: 12, type: 'input', required: true},
|
||||
priority: {label: '优先级', span: 12, type: 'input'},
|
||||
mtrClientId: {label: 'MTRClientID', span: colSpan, type: 'select', options: []},
|
||||
snmpDetect: {label: '是否探测', span: colSpan, type: 'radio', eventName: 'change',required: true, options: this.dict.type.rm_register_snmp_detect},
|
||||
startTime: {label: '开始时间', span: colSpan, type: 'datetime', hidden: this.ruleForm && this.ruleForm.snmpDetect === '1' ? false: true},
|
||||
endTime: {label: '结束时间', span: colSpan, type: 'datetime', hidden: this.ruleForm && this.ruleForm.snmpDetect === '1' ? false: true},
|
||||
pl: {label: '探测频率', span: colSpan, type: 'select', options: [], hidden: this.ruleForm && this.ruleForm.snmpDetect === '1' ? false: true},
|
||||
updateTime: {label: '修改时间', span: colSpan, type: 'datetime'},
|
||||
createTime: {label: '创建时间', span: colSpan, type: 'datetime'},
|
||||
createBy: {label: '创建人', span: colSpan, type: 'datetime'},
|
||||
mtrClientIds: {label: '服务器集合', span: colSpan, type: 'textarea', rows:15, placeholder: '请粘贴/输入ClientID列表,如\nClientID1\nClientID2\n...', required: true},
|
||||
clientAllId: {label: '探测目标IP集合', span: colSpan, type: 'input'},
|
||||
mtrClientId: {label: 'MTRClientID', span: 12, type: 'select', options: []},
|
||||
probeFlag: {label: '是否探测', span: 12, type: 'radio', eventName: 'change',required: true, options: this.dict.type.rm_register_snmp_detect},
|
||||
startTime: {label: '开始时间', span: 12, type: 'datetime', hidden: this.ruleForm && this.ruleForm.probeFlag === '1' ? false: true},
|
||||
endTime: {label: '结束时间', span: 12, type: 'datetime', hidden: this.ruleForm && this.ruleForm.probeFlag === '1' ? false: true},
|
||||
probeFrequency: {label: '探测频率', span: 12, type: 'select', options: [], hidden: this.ruleForm && this.ruleForm.probeFlag === '1' ? false: true},
|
||||
updateTime: {label: '修改时间', span: 12, type: 'datetime'},
|
||||
createTime: {label: '创建时间', span: 12, type: 'datetime'},
|
||||
createBy: {label: '创建人', span: 12, type: 'datetime'},
|
||||
serverGroup: {label: '服务器集合', span: 12, type: 'textarea', rows:15, placeholder: '请粘贴/输入ClientID列表,如\nClientID1\nClientID2\n...', required: true},
|
||||
serveripGroup: {label: '探测目标IP集合', span: 12, type: 'input'},
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
@@ -96,24 +98,23 @@
|
||||
config: {title: ' ', colSpan: '', readonly: this.paramsData && this.paramsData.readonly},
|
||||
controls: {
|
||||
id: {label: 'ID',hidden: true},
|
||||
policyName: {label: '策略名称', span: colSpan, type: 'input', required: true},
|
||||
priority: {label: '优先级', span: 12, type: 'input', hidden: this.paramsData && this.paramsData.readonly ? false : true},
|
||||
mtrClientId: {label: 'MTRClientID', span: colSpan, type: 'select', required: true, options: []},
|
||||
mtrClientIds: {label: '服务器集合', span: colSpan, type: 'textarea', rows:15, placeholder: '请粘贴/输入ClientID列表,如\nClientID1\nClientID2\n...', required: true},
|
||||
policyName: {label: '策略名称', span: 18, type: 'input', required: true},
|
||||
mtrClientId: {label: 'MTRClientID', span: 18, type: 'select', required: true, options: []},
|
||||
serverGroup: {label: '服务器集合', span: 15, type: 'textarea', rows:15, placeholder: '请粘贴/输入ClientID列表,如\nClientID1\nClientID2\n...', required: true},
|
||||
clientAllId: {label: '显示相关IP', span: 3, type: 'button', style: 'vertical-align: top'},
|
||||
snmpDetect: {label: '是否探测', span: colSpan, type: 'radio', eventName: 'change',required: true, options: this.dict.type.rm_register_snmp_detect},
|
||||
startTime: {label: '开始时间', span: colSpan, type: 'datetime', eventName: 'change', hidden: this.ruleForm && this.ruleForm.snmpDetect === '1' ? false: true},
|
||||
endTime: {label: '结束时间', span: colSpan, type: 'datetime', eventName: 'change', pickerOptions: {}, hidden: this.ruleForm && this.ruleForm.snmpDetect === '1' ? false: true},
|
||||
probe: {label: '探测频率', span: colSpan, type: 'select', options: [], hidden: this.ruleForm && this.ruleForm.snmpDetect === '1' ? false: true},
|
||||
serveripGroup: {label: '', span: 5, labelWidthNull: true, type: 'textarea', rows:15, placeholder: 'IP1\nIP2\nIP3\n...', hidden: this.ruleForm && this.ruleForm.clientAllId ? false: true},
|
||||
probeFlag: {label: '是否探测', span: 18, type: 'radio', eventName: 'change',required: true, options: this.dict.type.rm_register_snmp_detect},
|
||||
startTime: {label: '开始时间', span: 18, type: 'datetime', eventName: 'change', pickerOptions: {}, hidden: this.ruleForm && this.ruleForm.probeFlag === '1' ? false: true},
|
||||
endTime: {label: '结束时间', span: 18, type: 'datetime', eventName: 'change', pickerOptions: {}, hidden: this.ruleForm && this.ruleForm.probeFlag === '1' ? false: true},
|
||||
probeFrequency: {label: '探测频率', span: 18, type: 'select', options: [], hidden: this.ruleForm && this.ruleForm.probeFlag === '1' ? false: true},
|
||||
}
|
||||
}];
|
||||
}
|
||||
},
|
||||
// 获取详情
|
||||
getFormDataList(id) {
|
||||
getMtrAgent(id).then(val => {
|
||||
getMtrPolicyt(id).then(val => {
|
||||
if (val && val.data) {
|
||||
val.data['method'] = val.data && val.data['method'] || val.data['method'] === 0 ? val.data['method'].toString() : val.data['method'];
|
||||
this.fnFormList(val.data);
|
||||
this.ruleForm = val.data;
|
||||
}
|
||||
@@ -125,7 +126,7 @@
|
||||
callback(result, dataVal, formVal) {
|
||||
if (result && result.fnCode) {
|
||||
switch (result.fnCode) {
|
||||
case 'snmpDetect':
|
||||
case 'probeFlag':
|
||||
if (dataVal === '1') {
|
||||
this.formList[0].controls.startTime['hidden'] = false;
|
||||
this.formList[0].controls.endTime['hidden'] = false;
|
||||
@@ -137,19 +138,34 @@
|
||||
}
|
||||
break;
|
||||
case 'startTime':
|
||||
// let formModel = this.$refs.formRef.$refs.ruleForm.model;
|
||||
// console.log('fff===',dataVal);
|
||||
// if (formModel && !formModel.endTime) {
|
||||
// this.formList[0].controls.endTime['pickerOptions'] = {
|
||||
// disabledDate: (time) => {
|
||||
// // 禁用开始时间之前的日期
|
||||
// return time.getTime() < dataVal.getTime();
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
this.formList[0].controls.endTime['pickerOptions'] = {
|
||||
disabledDate: (time) => {
|
||||
// 禁用开始时间之前的日期
|
||||
return time.getTime() < new Date(dataVal).getTime();
|
||||
}
|
||||
};
|
||||
break;
|
||||
case 'endTime':
|
||||
this.formList[0].controls.startTime['pickerOptions'] = {
|
||||
disabledDate: (time) => {
|
||||
// 禁用开始时间之前的日期
|
||||
return time.getTime() > new Date(dataVal).getTime();
|
||||
}
|
||||
};
|
||||
break;
|
||||
case 'clientAllId':
|
||||
this.$set(this.ruleForm, 'mtrClientIds', '');
|
||||
if (this.ruleForm && this.ruleForm.clientAllId) {
|
||||
this.formList[0].controls.serveripGroup['hidden'] = true;
|
||||
this.formList[0].controls.clientAllId['label'] = '显示相关IP';
|
||||
this.$set(this.ruleForm, 'clientAllId', false);
|
||||
this.$set(this.ruleForm, 'serveripGroup', '');
|
||||
} else {
|
||||
this.formList[0].controls.serveripGroup['hidden'] = false;
|
||||
this.formList[0].controls.clientAllId['label'] = '不显示相关IP';
|
||||
this.$set(this.ruleForm, 'clientAllId', true);
|
||||
this.$set(this.ruleForm, 'serveripGroup', '');
|
||||
}
|
||||
return;
|
||||
getRegistList({resourceType: 1}).then(res => {
|
||||
let str = '';
|
||||
if (res && res.data) {
|
||||
@@ -157,11 +173,15 @@
|
||||
str+= item.clientId + '\n';
|
||||
});
|
||||
}
|
||||
this.$set(this.ruleForm, 'mtrClientIds', str);
|
||||
this.$set(this.ruleForm, 'serveripGroup', str);
|
||||
});
|
||||
break;
|
||||
case 'submit':
|
||||
addMtrAgent(dataVal).then(response => {
|
||||
let fnType = addMtrPolicy;
|
||||
if (dataVal && dataVal.id) {
|
||||
fnType = updateMtrPolicy;
|
||||
}
|
||||
fnType(dataVal).then(response => {
|
||||
this.$modal.msgSuccess(response.msg);
|
||||
if (this.open) {
|
||||
this.$emit("dialogResult", {open: true});
|
||||
|
||||
Reference in New Issue
Block a user