MTRAgent管理的新建MTR探测策略改为页面,并且提交添加错误提示弹窗、优化并修改bug

This commit is contained in:
康冉冉
2025-12-09 18:44:28 +08:00
parent 2dced36534
commit 0204f2152c
10 changed files with 81 additions and 31 deletions
+6 -4
View File
@@ -1208,19 +1208,21 @@ export function listMtrPolicy(query) {
})
}
// 新增
export function addMtrPolicy(data) {
export function addMtrPolicy(data, config) {
return request({
url: '/mtragent/mtrPolicyConfig',
method: 'post',
data: data
data: data,
...config
})
}
// 修改
export function updateMtrPolicy(data) {
export function updateMtrPolicy(data, config) {
return request({
url: '/mtragent/mtrPolicyConfig',
method: 'put',
data: data
data: data,
...config
})
}
// 查询详细
+1 -1
View File
@@ -399,7 +399,7 @@
}
},
// 提供给父组件调用的方法:默认选中值 otherRow:新的回显方式,防止破坏原来rows判断的逻辑与回显
defaultSelectRows(rows,otherRow){
defaultSelectRowsAll(rows,otherRow){
const tableInstance = this.config && this.config.tableKey ? this.$refs[`tableRef_${this.config.tableKey}`] : this.$refs.selChangeList;
this.selectList = [];
this.ids = [];
+14
View File
@@ -784,6 +784,20 @@ export const dynamicRoutes = [
}
]
},
{
path: '/resource/mtrAgent/addMtrProbe',
component: Layout,
hidden: true,
permissions: ['resource:mtrAgent:addMtrProbe'],
children: [
{
path: ':id?',
component: () => import('@/views/resource/mtrProbe/mtrProbeView'),
name: 'mtrAgentLossRateProbe',
meta: { title: '新建MTR探测策略', activeMenu: '/resource/mtrAgent' }
}
]
},
// mtr探测策略
{
path: '/resource/mtrProbe/view',
+5 -2
View File
@@ -95,8 +95,11 @@ service.interceptors.response.use(res => {
}
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
} else if (code === 500) {
Message({ message: msg, type: 'error' })
return Promise.reject(new Error(msg))
if (!(res.config && res.config.skipErrorHandling)) {
Message({ message: msg, type: 'error' })
return Promise.reject(new Error(msg))
}
return Promise.reject(msg)
} else if (code === 601) {
Message({ message: msg, type: 'warning' })
return Promise.reject('error')
@@ -173,7 +173,7 @@
this.tableList = val && val.data || [];
if (this.tableColChange[changeVal] && this.tableColChange[changeVal].length > 0) {
setTimeout(() => {
this.$refs.tabRef.defaultSelectRows(null, this.tableColChange[changeVal]);
this.$refs.tabRef.defaultSelectRowsAll(null, this.tableColChange[changeVal]);
},500);
}
this.$modal.closeLoading();
@@ -171,7 +171,7 @@
// });
// this.download("/system/Business/export", {properties: dataList,}, `业务管理_${new Date().getTime()}.xlsx`);
let paramsList = Object.assign({}, this.queryParams,rowData);
this.download("system/Business/export", paramsList, `业务管理_${new Date().getTime()}.xlsx`, null, 'json');
this.download("system/business/export", paramsList, `业务管理_${new Date().getTime()}.xlsx`, null, 'json');
break;
default:
@@ -155,7 +155,7 @@
// });
// this.download("/system/alarmManage/export", {properties: dataList,}, `拓扑管理_${new Date().getTime()}.xlsx`);
let paramsList = Object.assign({}, this.queryParams,rowData);
this.download("system/alarmManage/export", paramsList, `消息推送_${new Date().getTime()}.xlsx`, null, 'json');
this.download("rocketmq/alarmPushConfig/export", paramsList, `消息推送_${new Date().getTime()}.xlsx`, null, 'json');
break;
default:
}
+12 -5
View File
@@ -87,9 +87,9 @@
<mtrAgentView :open="`type_${viewOpen}`" :dialogRowData="dialogRowData" @dialogResult="fnDialogResult"></mtrAgentView>
</el-dialog>
<!-- MTR探测策略 -->
<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>
<!-- <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>
@@ -238,8 +238,15 @@
});
break;
case 'addMtrProbe':
this.mtrProbeOpen = true;
this.dialogRowData = rowData || {};
// this.mtrProbeOpen = true;
// this.dialogRowData = rowData || {};
this.$router.push({
path:'/resource/mtrAgent/addMtrProbe',
query: {
routeType: 'mtrAgent',
mtrClientId: rowData.mtrClientId
}
});
break;
case 'echartView':
this.$router.push({
+29 -5
View File
@@ -1,6 +1,12 @@
<template>
<div :class="open && open.length > 0 ? '' : 'app-container'">
<Form ref="formRef" :formList="formList" :ruleFormData="ruleForm" :config="config" @fnClick="callback"></Form>
<el-dialog title="并发限制警告" :visible.sync="errorMsgOpen" width="550px" append-to-body style="padding-bottom: 20px;">
<div style="line-height: 22px;color: #444;height: calc(100vh - 190px);overflow: auto;" v-html="errorMsg"></div>
<div style="text-align: right;margin-right: 20px;margin-top: 10px;">
<el-button type="primary" @click="errorMsgOpen = false">去修改</el-button>
</div>
</el-dialog>
</div>
</template>
@@ -50,7 +56,10 @@
formList: [],
paramsData: {},
config: {},
includeList: {}
includeList: {},
errorMsgOpen: false,
errorMsg: '',
routeType: '',
}
},
created() {
@@ -62,6 +71,13 @@
this.$set(this.ruleForm, 'clientAllId', false);
}
}
// mtrAgent页面跳转过来的值
if (this.paramsData && this.paramsData.routeType) {
this.routeType = this.paramsData.routeType;
this.$set(this.ruleForm, 'mtrClientId', this.paramsData && this.paramsData.mtrClientId || '');
this.$set(this.ruleForm, 'clientAllId', false);
}
if (this.paramsData && this.paramsData.id) {
this.getFormDataList(this.paramsData.id);
} else {
@@ -210,22 +226,27 @@
if (dataVal && dataVal.id) {
fnType = updateMtrPolicy;
}
fnType(dataVal).then(response => {
fnType(dataVal, {skipErrorHandling: true}).then(response => {
this.$modal.msgSuccess(response.msg);
this.loading = false;
if (this.open) {
this.$emit("dialogResult", {open: true});
} else if (this.routeType === 'mtrAgent') {
this.$router.push("/resource/mtrAgent")
} else {
this.$router.push("/resource/mtrProbe")
}
}).catch(() => {
}).catch((error) => {
this.errorMsgOpen = true;
this.errorMsg = error.replace(':',':<br>').replace(/,/g, '<br>');
this.loading = false;
this.$modal.msgError("操作失败")
});
break;
case 'cancel':
if (this.open) {
this.$emit("dialogResult", {open: false});
} else if (this.routeType === 'mtrAgent') {
this.$router.push("/resource/mtrAgent")
} else {
this.$router.push("/resource/mtrProbe")
}
@@ -237,5 +258,8 @@
}
}
</script>
<style>
<style scoped>
::v-deep .el-dialog__body{
padding: 0px 20px 20px!important;
}
</style>
+11 -11
View File
@@ -89,7 +89,7 @@
</el-form>
<!-- 表格数据 -->
<TableList :columns="columns" :config="config" :modelIdent="this.$options.name" :queryParams="queryParams" :tableList="roleList" @fnClick="callback" @fnRenderList="getList" @value-change="handleValueChange">
<TableList ref="tabRef" :columns="columns" :config="config" :modelIdent="this.$options.name" :queryParams="queryParams" :tableList="roleList" @fnClick="callback" @fnRenderList="getList" @value-change="handleValueChange">
<template #tempCopy="{ row, column}">
{{row.clientId}}<el-link :underline="false" icon="el-icon-document-copy" title="复制" v-clipboard:copy="row.clientId" v-clipboard:success="clipboardSuccess" style="margin-left: 10px;color: #409EFF;"></el-link>
</template>
@@ -512,8 +512,8 @@
this.dialogRowData = rowData;
break;
case 'tagRemark':
this.tagRuleForm = {};
this.tagOpen = true;
this.tagRuleForm = {remark: null, deployDevice: ''};
this.$nextTick(() => {
// 5. 最后执行重置
if (this.$refs['tagFormRef']?.$refs.ruleForm) {
@@ -522,11 +522,10 @@
this.tagFormList[0].controls.deployDevice['disabled'] = false;
if (rowData && rowData.id) {
this.tagTitle = '修改标签';
this.tagRuleForm = {
id: rowData.id,
deployDevice: rowData.clientId,
remark: rowData && rowData.remark ? rowData.remark.split(',') : null
};
this.$set(this.tagRuleForm, 'id', rowData.id);
this.$set(this.tagRuleForm, 'deployDevice', rowData.clientId);
this.$set(this.tagRuleForm, 'remark', rowData && rowData.remark ? rowData.remark.split(',') : null);
// this.tagRuleForm = this.deepCopy(modelVal);
this.tagFormList[0].controls.deployDevice['disabled'] = true;
} else {
this.tagTitle = '批量增加标签';
@@ -539,10 +538,9 @@
params+= item.clientId + '\n'
}
});
this.tagRuleForm = {
deployDevice: params,
remark: null
};
this.$set(this.tagRuleForm, 'deployDevice', params);
this.$set(this.tagRuleForm, 'remark', null);
this.$set(this.tagRuleForm, 'id', null);
}
}
});
@@ -718,6 +716,8 @@
fnType(params).then(res => {
this.$modal.msgSuccess(res.msg);
this.tagOpen = false;
this.tagRuleForm = {};
this.$refs.tabRef.defaultSelectRows([]);
this.getList();
});
},