This commit is contained in:
qingjiao 2026-04-30 10:56:26 +08:00
parent 5627b466bf
commit 0acbe3b9d1
6 changed files with 131 additions and 2 deletions

View File

@ -188,3 +188,36 @@ export function getNetLang(query) {
params: query
})
}
// 获取网络抓包信息
export function getPacketCaptureInfo(data) {
return request({
url: '/pcap/status',
method: 'get',
data
})
}
// 开始抓包
export function startPacketCapture(data) {
return request({
url: '/pcap/start',
method: 'post',
data
})
}
// 停止抓包
export function stopPacketCapture(data) {
return request({
url: '/pcap/stop',
method: 'post',
data
})
}
// 删除抓包文件
export function deletePacketCapture(data) {
return request({
url: '/pcap/delete',
method: 'post',
data
})
}

View File

@ -74,6 +74,13 @@ export default {
update: 'Update',
choose: 'Choice',
tips: 'Tips',
NetworkPacketCapture: 'Network packet capture',
CapturingPacket: 'Capturing packets (Max 10 MB)......',
PacketCaptureHasBeenStopped: 'Packet capture is stopped and saved as tcpdump.pcap.',
StartPacketCapture: 'Start',
StopPacketCapture: 'Stop',
Download: 'Download',
Delete: 'Delete',
factorySettings: 'Restore Factory Settings',
routerRestart: 'Reboot The Device',
SIPserver: 'SIP Server IP',

View File

@ -73,6 +73,13 @@ export default {
update: 'Atualizar',
choose: 'Escolher',
tips: 'Dica',
NetworkPacketCapture: 'Captura de pacotes de rede',
CapturingPacket: 'Captura de pacotes em andamento (máximo de 10 MB)...',
PacketCaptureHasBeenStopped: 'A captura de pacotes foi interrompida.',
StartPacketCapture: 'Começar',
StopPacketCapture: 'Parar',
Download: 'Download',
Delete: 'Excluir',
factorySettings: 'Restaurar Configurações de Fábrica',
routerRestart: 'Reiniciar Dispositivo',
SIPserver: 'IP do Servidor SIP',

View File

@ -70,6 +70,13 @@ export default {
refresh: '自动刷新',
choose: '选择',
tips: '提示',
NetworkPacketCapture: '网络抓包',
CapturingPacket: '正在抓包(最大10兆)......',
PacketCaptureHasBeenStopped: '抓包已停止保存为tcpdump.pcap。',
StartPacketCapture: '开始',
StopPacketCapture: '停止',
Download: '下载',
Delete: '删除',
factorySettings: '恢复出厂设置',
routerRestart: '重启设备',
SIPserver: 'SIP服务器',

View File

@ -23,16 +23,48 @@
<!-- <el-button type="primary" style="margin-top: 48px;" @click="factorySetting">
{{ $t('table.factorySettings') }}
</el-button> -->
<div class="formbox">
<div class="formbox-l">{{ $t('table.NetworkPacketCapture') }}</div>
<el-button type="primary" v-if="DataDB.status === 0 || DataDB.status === 2" @click.stop="StartPacketCapture(1)">
{{ $t('table.StartPacketCapture') }}
</el-button>
<el-button type="danger" v-else @click.stop="StartPacketCapture(0)">
{{ $t('table.StopPacketCapture') }}
</el-button>
<el-button type="primary" @click.stop="DownloadFile" :disabled="DataDB.status !== 2">
{{ $t('table.Download') }}
</el-button>
<el-button type="primary" @click.stop="DeletePacketCaptureRecords" :disabled="DataDB.status !== 2">
{{ $t('table.Delete') }}
</el-button>
<span v-if="DataDB.status === 1" class="SpanBox1">
{{ $t('table.CapturingPacket') }}
</span>
<span v-else-if="DataDB.status === 2" class="SpanBox1">
{{ $t('table.PacketCaptureHasBeenStopped') }}
</span>
</div>
</div>
</div>
</template>
<script>
import { deviceReset, deviceReboot } from '@/api/index.js'
import {
deviceReset,
deviceReboot,
getPacketCaptureInfo,
deletePacketCapture,
startPacketCapture,
stopPacketCapture
} from '@/api/index.js'
export default {
name: 'FactorySetting',
data() {
return {
DataDB: {
status: 0,
file: ''
}
}
},
mounted() {},
@ -103,6 +135,49 @@ export default {
}).catch(() => {
})
},
getPacketInfo() {
getPacketCaptureInfo({}).then(res => {
const data = res.data
this.DataDB.status = data.status
this.DataDB.file = data.file
}).catch(() => {
})
},
StartPacketCapture(Flag) {
if (Flag === 1) {
startPacketCapture({}).then(res => {
setTimeout(() => {
this.getPacketInfo()
}, 300)
})
} else if (Flag === 0) {
stopPacketCapture({}).then(res => {
setTimeout(() => {
this.getPacketInfo()
}, 300)
})
}
},
DeletePacketCaptureRecords() {
const data = {
name: this.DataDB.file
}
// console.log(data);
deletePacketCapture(data).then(res => {
this.DataDB.status = 0
this.$message.success(this.$i18n.t('table.Delete') + this.$i18n.t('table.success'))
}).catch(() => {
})
},
DownloadFile() {
if (this.DataDB.file === '') {
return
}
const URL = '/prod-api/pcap/' + this.DataDB.file
window.open(URL)
}
}
}

View File

@ -87,7 +87,7 @@ module.exports = {
// before: require('./mock/mock-server.js'),
proxy: {
'/dev-api': {
target: 'http://127.0.0.1:8080', // http://127.0.0.1:8080
target: 'http://192.168.1.190:8080', // http://127.0.0.1:8080
secure: true, // 如果是https接口需要配置这个参数
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
pathRewrite: { '^/dev-api': '' }