fix: 网元切换时命令操作信息过滤
This commit is contained in:
@@ -80,6 +80,14 @@ async function fnIPerf() {
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 网元切换时重置
|
||||
if (neType !== state.params.neType || neId !== state.params.neId) {
|
||||
state.initialized = false;
|
||||
state.params.neType = neType;
|
||||
state.params.neId = neId;
|
||||
}
|
||||
|
||||
// 软件版本检查
|
||||
state.params.neType = neType;
|
||||
state.params.neId = neId;
|
||||
@@ -88,7 +96,6 @@ async function fnIPerf() {
|
||||
neId,
|
||||
version: state.data.version,
|
||||
});
|
||||
|
||||
if (resVersion.code !== RESULT_CODE_SUCCESS) {
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
@@ -99,6 +106,7 @@ async function fnIPerf() {
|
||||
} else {
|
||||
state.versionInfo = resVersion.data;
|
||||
}
|
||||
|
||||
// 初始化的直接重发
|
||||
if (state.initialized) {
|
||||
fnResend();
|
||||
@@ -145,8 +153,8 @@ function fnResend() {
|
||||
if (!toolTerminal.value) return;
|
||||
state.running = true;
|
||||
toolTerminal.value.ctrlC();
|
||||
toolTerminal.value.clear();
|
||||
setTimeout(() => {
|
||||
toolTerminal.value.clear();
|
||||
const data = JSON.parse(JSON.stringify(state.data));
|
||||
if (state.dataType === 'options') data.command = '';
|
||||
toolTerminal.value.send('iperf', data);
|
||||
@@ -180,9 +188,12 @@ function fnProcessMessage(data: string): string {
|
||||
if (lestIndex !== -1) {
|
||||
text = text.substring(0, lestIndex);
|
||||
}
|
||||
if (text.endsWith('# ')) {
|
||||
text = text.substring(0, text.lastIndexOf('\r\n') + 2);
|
||||
}
|
||||
|
||||
// console.log({ parts, text });
|
||||
if (parts[0].startsWith('iperf')) {
|
||||
if (parts.length > 1 && parts[0].startsWith('iperf')) {
|
||||
return parts[0] + '\r\n' + text;
|
||||
}
|
||||
return text;
|
||||
|
||||
@@ -72,13 +72,15 @@ async function fnPing() {
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (state.initialized) {
|
||||
fnResend();
|
||||
return;
|
||||
|
||||
// 网元切换时重置
|
||||
if (neType !== state.params.neType || neId !== state.params.neId) {
|
||||
state.initialized = false;
|
||||
state.params.neType = neType;
|
||||
state.params.neId = neId;
|
||||
}
|
||||
|
||||
state.params.neType = neType;
|
||||
state.params.neId = neId;
|
||||
// 软件版本检查
|
||||
const resVersion = await pingV({ neType, neId });
|
||||
if (resVersion.code !== RESULT_CODE_SUCCESS) {
|
||||
message.warning({
|
||||
@@ -89,6 +91,12 @@ async function fnPing() {
|
||||
} else {
|
||||
state.versionInfo = resVersion.data;
|
||||
}
|
||||
|
||||
// 初始化的直接重发
|
||||
if (state.initialized) {
|
||||
fnResend();
|
||||
return;
|
||||
}
|
||||
state.initialized = true;
|
||||
}
|
||||
|
||||
@@ -108,8 +116,8 @@ function fnResend() {
|
||||
if (!toolTerminal.value) return;
|
||||
state.running = true;
|
||||
toolTerminal.value.ctrlC();
|
||||
toolTerminal.value.clear();
|
||||
setTimeout(() => {
|
||||
toolTerminal.value.clear();
|
||||
const data = JSON.parse(JSON.stringify(state.data));
|
||||
if (state.dataType === 'options') data.command = '';
|
||||
toolTerminal.value.send('ping', data);
|
||||
@@ -143,9 +151,12 @@ function fnProcessMessage(data: string): string {
|
||||
if (lestIndex !== -1) {
|
||||
text = text.substring(0, lestIndex);
|
||||
}
|
||||
if (text.endsWith('# ')) {
|
||||
text = text.substring(0, text.lastIndexOf('\r\n') + 2);
|
||||
}
|
||||
|
||||
// console.log({ parts, text });
|
||||
if (parts[0].startsWith('ping')) {
|
||||
if (parts.length > 1 && parts[0].startsWith('ping')) {
|
||||
return parts[0] + '\r\n' + text;
|
||||
}
|
||||
return text;
|
||||
@@ -377,10 +388,7 @@ onBeforeUnmount(() => {});
|
||||
<a-auto-complete
|
||||
v-model:value="state.data.command"
|
||||
:disabled="state.running"
|
||||
:options="[
|
||||
{ value: '-help' },
|
||||
{ value: '-i 1 -c 4 8.8.8.8' },
|
||||
]"
|
||||
:options="[{ value: '-help' }, { value: '-i 1 -c 4 8.8.8.8' }]"
|
||||
:dropdown-match-select-width="500"
|
||||
style="width: 100%"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user