图形监控修复点击两次才打开折叠面板的问题、提交表单验证存在未知clientId的提示

1、图形监控修复点击两次才打开折叠面板的问题
2、所有与填写ClientID相关的表单都添加存在未知ClientID的提示以拦截提交
3、MTRAgent管理的配置更新策略的表单提交时添加存在未知mtrClientID的拦截提示
4、优化并修改bug
This commit is contained in:
康冉冉
2025-12-11 18:34:12 +08:00
parent 0b66502f4d
commit 7cd33caaf6
8 changed files with 143 additions and 24 deletions
@@ -7,6 +7,7 @@
<script setup>
import Form from '@/components/form/index.vue';
import {addBusDeploy, getBusDeploy, updateBusDeploy, listAllBusinessList, getAllBusScriptName, reviewBusiness} from "@/api/disRevenue/earnManage"
import {getRegistList} from "@/api/disRevenue/resource"
export default {
name: 'BusinessIssuedDetails',
components: {Form},
@@ -45,6 +46,7 @@
paramsData: {},
config: {},
busNameList: {},
clientIdList: {},
}
},
created() {
@@ -72,6 +74,7 @@
this.getBusinessNames();
this.getBusScriptNames();
this.fnFormList();
this.getClientIDList();
},
methods: {
// formList集合
@@ -126,13 +129,24 @@
getFormDataList(id) {
getBusDeploy(id).then(val => {
if (val && val.data) {
val.data['scriptName'] = Number(val.data['scriptName']);
val.data['scriptName'] = !isNaN(val.data['scriptName']) ? Number(val.data['scriptName']) : val.data['scriptName'];
this.ruleForm = val.data;
}
}).catch(() => {
// this.$modal.msgError("操作失败")
});
},
// 所有ClientID
getClientIDList() {
this.clientIdList = {};
getRegistList({resourceType: 1}).then(res => {
if (res && res.data) {
res && res.data.map(item => {
this.clientIdList[item.clientId] = item.clientId;
});
}
});
},
// 业务名称
getBusinessNames() {
listAllBusinessList().then(val => {
@@ -163,6 +177,19 @@
}
break;
case 'submit':
let unknownData = [];
if (dataVal && dataVal.deployDevice) {
let deployList = JSON.parse(JSON.stringify(dataVal.deployDevice.trim())).split('\n');
deployList.forEach(item => {
if (!this.clientIdList[item]) {
unknownData.push(item);
}
});
}
if (unknownData && unknownData.length > 0) {
this.$modal.msgWarning(`存在未知的ClientID: ${unknownData.join('; ')}`);
return;
}
this.loading = true;
dataVal['businessCode'] = this.busNameList[dataVal.businessName].id;
let fnType = addBusDeploy;
+25 -1
View File
@@ -42,7 +42,8 @@
formList: [],
paramsData: {},
config: {},
includeList: {}
includeList: {},
clientIdList: {},
}
},
created() {
@@ -59,6 +60,7 @@
this.fnFormList();
// this.getResNameList();
}
this.getMtrClientList();
if (this.paramsData && this.paramsData.readonly) {
this.config = {
buttonGroup: [{title: '返回', fnCode: 'goBack'}]
@@ -110,6 +112,15 @@
// this.$modal.msgError("操作失败")
});
},
getMtrClientList() {
allMtrClientIdData({}).then(res => {
if (res && res.data) {
res && res.data.map(item => {
this.clientIdList[item.mtrClientId] = item.mtrClientId;
});
}
});
},
// 监听事件
callback(result, dataVal, formVal) {
if (result && result.fnCode) {
@@ -134,6 +145,19 @@
});
break;
case 'submit':
let unknownData = [];
if (dataVal && dataVal.mtrClientIds) {
let deployList = JSON.parse(JSON.stringify(dataVal.mtrClientIds.trim())).split('\n');
deployList.forEach(item => {
if (!this.clientIdList[item]) {
unknownData.push(item);
}
});
}
if (unknownData && unknownData.length > 0) {
this.$modal.msgWarning(`存在未知的MTRClientID: ${unknownData.join('; ')}`);
return;
}
addMtrAgent(dataVal).then(response => {
this.$modal.msgSuccess(response.msg);
if (this.open) {
@@ -136,7 +136,7 @@
<script>
import Form from '@/components/form/index.vue';
import {addResourcePolicy, updateResourcePolicy,getMonitorTempList, getMonitorPolicy, listAllSwitchName, getResMonitorGroup} from "@/api/disRevenue/resource"
import {addResourcePolicy, updateResourcePolicy,getMonitorTempList, getMonitorPolicy, getRegistList} from "@/api/disRevenue/resource"
export default {
name: "LinuxMonitorStratEdit",
components: {Form},
@@ -178,6 +178,7 @@
policyName: Date.now(),
},
formList: [],
clientIdList: {},
firstData: {
cpu: {title: 'CPU监控', time: '',
checkList: []
@@ -217,6 +218,7 @@
this.getDataList();
}
this.fnFormList();
this.getClientIDList();
},
methods: {
// formList集合
@@ -267,6 +269,17 @@
// this.$modal.msgError("操作失败")
});
},
// 所有ClientID
getClientIDList() {
this.clientIdList = {};
getRegistList({resourceType: 1}).then(res => {
if (res && res.data) {
res && res.data.map(item => {
this.clientIdList[item.clientId] = item.clientId;
});
}
});
},
getDataList() {
let itemTypeList = ['monitorItem', 'autodiscoverItem'];
itemTypeList.forEach(item => {
@@ -368,6 +381,19 @@
},
async submit() {
if (!await this.fnFormValid()) return;
let unknownData = [];
if (this.ruleFormData && this.ruleFormData.deployDevice) {
let deployList = JSON.parse(JSON.stringify(this.ruleFormData.deployDevice.trim())).split('\n');
deployList.forEach(item => {
if (!this.clientIdList[item]) {
unknownData.push(item);
}
});
}
if (unknownData && unknownData.length > 0) {
this.$modal.msgWarning(`存在未知的ClientID: ${unknownData.join('; ')}`);
return;
}
// 监控项
let idsList = [];
Object.keys(this.firstData).forEach(key => {
+16 -2
View File
@@ -33,9 +33,8 @@
}
if (this.paramsData && this.paramsData.type && this.paramsData.type === 'edit') {
this.fnBusNameList();
} else {
this.registList();
}
this.registList();
this.fnFormList();
},
methods: {
@@ -127,8 +126,10 @@
},
// clientId
registList() {
this.clientIdList = {};
getRegistList({resourceType: 1}).then(res => {
this.formList[0].controls.clientId['options'] = res && res.data.map(item => {
this.clientIdList[item.clientId] = item.clientId;
return Object.assign({label: item.clientId, value: item.clientId});
});
});
@@ -165,6 +166,19 @@
switch (result.fnCode) {
case 'submit':
if (this.paramsData && this.paramsData.type && this.paramsData.type === 'edit') {
let unknownData = [];
if (dataVal && dataVal.deployDevice) {
let deployList = JSON.parse(JSON.stringify(dataVal.deployDevice.trim())).split('\n');
deployList.forEach(item => {
if (!this.clientIdList[item]) {
unknownData.push(item);
}
});
}
if (unknownData && unknownData.length > 0) {
this.$modal.msgWarning(`存在未知的ClientID: ${unknownData.join('; ')}`);
return;
}
dataVal['businessCode'] = this.busNameList[dataVal.businessName].id;
bindBusByClient(dataVal).then(res => {
this.$modal.msgSuccess(res.msg);
@@ -75,7 +75,8 @@
return newObj;
},
collapseChange(val) {
this.activeShowList = val;
let collAll = val.concat(this.activeShowList);
this.activeShowList = Array.from(new Set(collAll));
if (val && val.length > 0) {
this.$emit("collapseChangeData", val);
}
@@ -7,7 +7,7 @@
<script setup>
import Form from '@/components/form/index.vue';
import {getPolicy, addPolicy, updatePolicy} from "@/api/disRevenue/resource"
import {getPolicy, addPolicy, updatePolicy, getRegistList} from "@/api/disRevenue/resource"
import {getAllBusScriptName} from "@/api/disRevenue/earnManage"
export default {
name: 'severScriptStratDetails',
@@ -48,6 +48,7 @@
formList: [],
paramsData: {},
scriptList: {},
clientIdList: {},
}
},
created() {
@@ -61,6 +62,7 @@
}
this.fnFormList();
this.getBusScriptNames();
this.getClientIDList();
},
methods: {
// formList集合
@@ -78,7 +80,7 @@
defaultParams: {label: '脚本参数', span: 18, type: 'input'},
executionMethod: {label: '执行方式', span: 18, type: 'select', eventName:'change', options: this.dict.type.policy_method, required: true},
scheduledTime: {label: '定时时间', span: 18, type: 'datetime', required: true, hidden: this.ruleForm.executionMethod == '1' ? false : true},
policyStatus: {label: '策略状态', span: 18, type: 'select', options: this.dict.type.policy_statufas, hidden: !(this.paramsData && this.paramsData.readonly)},
policyStatus: {label: '策略状态', span: 18, type: 'select', options: this.dict.type.policy_status, hidden: !(this.paramsData && this.paramsData.readonly)},
deployTime: {label: '下发策略时间', span: 18, type: 'datetime', hidden: !(this.paramsData && this.paramsData.readonly)},
createBy: {label: '创建人', span: 18, type: 'input', hidden: !(this.paramsData && this.paramsData.readonly)},
createTime: {label: '创建时间', span: 18, type: 'datetime', hidden: !(this.paramsData && this.paramsData.readonly)},
@@ -112,6 +114,17 @@
}).catch(() => {
});
},
// 所有ClientID
getClientIDList() {
this.clientIdList = {};
getRegistList({resourceType: 1}).then(res => {
if (res && res.data) {
res && res.data.map(item => {
this.clientIdList[item.clientId] = item.clientId;
});
}
});
},
// 监听事件
callback(result, dataVal, formVal) {
if (result && result.fnCode) {
@@ -133,6 +146,19 @@
}
break;
case 'submit':
let unknownData = [];
if (dataVal && dataVal.deployDevice) {
let deployList = JSON.parse(JSON.stringify(dataVal.deployDevice.trim())).split('\n');
deployList.forEach(item => {
if (!this.clientIdList[item]) {
unknownData.push(item);
}
});
}
if (unknownData && unknownData.length > 0) {
this.$modal.msgWarning(`存在未知的ClientID: ${unknownData.join('; ')}`);
return;
}
let fnType = addPolicy;
if (dataVal && dataVal.id) {
fnType = updatePolicy;
@@ -380,8 +380,8 @@
}
mountCollect['echartList'][0] = netEcharts;
this.$set(this.secondChartList, keyName, mountCollect);
return true;
}
return true;
}).catch(() => {
return true;
});
@@ -410,8 +410,8 @@
};
mountCollect['echartList'][1] = netEcharts;
this.$set(this.secondChartList, keyName, mountCollect);
return true;
}
return true;
}).catch(() => {
return true;
});
@@ -440,8 +440,8 @@
};
mountCollect['echartList'][1] = netEcharts;
this.$set(this.secondChartList, keyName, mountCollect);
return true;
}
return true;
}).catch(() => {
return true;
});
@@ -468,9 +468,9 @@
};
mountCollect['echartList'][2] = netEcharts;
this.$set(this.secondChartList, keyName, mountCollect);
// return true;
this.$modal.closeLoading();
}
// return true;
this.$modal.closeLoading();
}).catch(() => {
// return true;
this.$modal.closeLoading();
@@ -534,8 +534,8 @@
};
mountCollect['echartList'][0] = netEcharts;
this.$set(this.secondChartList, keyName, mountCollect);
return true;
}
return true;
}).catch(() => {
return true;
});
@@ -564,9 +564,9 @@
};
mountCollect['echartList'][1] = netEcharts;
this.$set(this.secondChartList, keyName, mountCollect);
this.$modal.closeLoading();
return true;
}
this.$modal.closeLoading();
return true;
}).catch(() => {
this.$modal.closeLoading();
return true;
@@ -629,8 +629,8 @@
};
mountCollect['echartList'][0] = netEcharts;
this.$set(this.secondChartList, keyName, mountCollect);
return true;
}
return true;
}).catch(() => {
return true;
});
@@ -654,8 +654,8 @@
};
mountCollect['echartList'][1] = netEcharts;
this.$set(this.secondChartList, keyName, mountCollect);
return true;
}
return true;
}).catch(() => {
return true;
});
@@ -679,9 +679,9 @@
};
mountCollect['echartList'][2] = netEcharts;
this.$set(this.secondChartList, keyName, mountCollect);
this.$modal.closeLoading();
return true;
}
this.$modal.closeLoading();
return true;
}).catch(() => {
this.$modal.closeLoading();
return true;
@@ -740,8 +740,8 @@
};
mountCollect['echartList'][0] = netEcharts;
this.$set(this.secondChartList, keyName, mountCollect);
return true;
}
return true;
}).catch(() => {
return true;
});
@@ -765,9 +765,9 @@
};
mountCollect['echartList'][1] = netEcharts;
this.$set(this.secondChartList, keyName, mountCollect);
this.$modal.closeLoading();
return true;
}
this.$modal.closeLoading();
return true;
}).catch(() => {
this.$modal.closeLoading();
return true;
@@ -74,7 +74,8 @@
return newObj;
},
collapseChange(val) {
this.activeShowList = val;
let collAll = val.concat(this.activeShowList);
this.activeShowList = Array.from(new Set(collAll));
if (val && val.length > 0) {
this.$emit("collapseChangeData", val);
}