@ -132,6 +132,25 @@
background
layout = "total, sizes, prev, pager, next, jumper"
/ >
<!-- 采集周期详情弹窗 -- >
< el -dialog v -model = " cycleDetailVisible " title = "采集周期详情" width = "640px" destroy -on -close >
< el -descriptions :column ="2" border v-if ="cycleDetailRow" >
< el -descriptions -item label = "周期时间" > { { cycleDetailRow . cycleTime } } < / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "采集地址" > { { cycleDetailRow . addressName || cycleDetailRow . collectAddressId } } < / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "总机床数" > { { cycleDetailRow . totalMachines } } < / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "成功数" > { { cycleDetailRow . successCount } } < / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "失败数" > { { cycleDetailRow . failCount } } < / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "是否异常" >
< el -tag : type = "cycleDetailRow.hasAnomaly ? 'danger' : 'success'" size = "small" > { { cycleDetailRow . hasAnomaly ? '有异常' : '无异常' } } < / e l - t a g >
< / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "变更分布" :span ="2" > { { cycleDetailRow . changeDistribution || '无' } } < / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "摘要" :span ="2" > { { cycleDetailRow . cycleSummary || '无' } } < / e l - d e s c r i p t i o n s - i t e m >
< / e l - d e s c r i p t i o n s >
< template # footer >
< el -button @ click = "cycleDetailVisible = false" > 关闭 < / e l - b u t t o n >
< / template >
< / e l - d i a l o g >
< / e l - t a b - p a n e >
<!-- 3 ) Raw -- >
@ -153,9 +172,20 @@
< el -table :data ="rawList" border stripe v-loading ="rawLoading" style="width: 100%" >
< el -table -column prop = "id" label = "ID" width = "80" / >
< el -table -column prop = "logTime" label = "时间" width = "170" / >
< el -table -column prop = "sourceAddress" label = "地址" / >
< el -table -column prop = "contentPreview" label = "内容摘要" show -overflow -tooltip / >
< el -table -column prop = "requestTime" label = "请求时间" width = "170" / >
< el -table -column prop = "responseDuration" label = "耗时(ms)" width = "100" / >
< el -table -column label = "成功" width = "80" align = "center" >
< template # default = "{ row }" >
< el -tag : type = "row.isSuccess ? 'success' : 'danger'" size = "small" > { { row . isSuccess ? '成功' : '失败' } } < / e l - t a g >
< / template >
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "statusCode" label = "状态码" width = "90" / >
< el -table -column prop = "errorMessage" label = "错误信息" show -overflow -tooltip / >
< el -table -column label = "操作" width = "120" fixed = "right" align = "center" >
< template # default = "{ row }" >
< el -button type = "text" @click ="viewRawDetail(row)" > 查 看 详 情 < / el -button >
< / template >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e >
< el -pagination
@ -166,6 +196,30 @@
background
layout = "total, sizes, prev, pager, next, jumper"
/ >
<!-- 原始数据详情弹窗 -- >
< el -dialog v -model = " rawDetailVisible " title = "原始采集数据详情" width = "860px" destroy -on -close >
< el -descriptions :column ="2" border v-if ="rawDetail" >
< el -descriptions -item label = "ID" > { { rawDetail . id } } < / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "采集地址ID" > { { rawDetail . collectAddressId } } < / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "请求时间" > { { rawDetail . requestTime } } < / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "响应时间" > { { rawDetail . responseTime } } < / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "响应耗时" > { { rawDetail . responseDuration } } ms < / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "状态码" > { { rawDetail . statusCode } } < / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "是否成功" >
< el -tag : type = "rawDetail.isSuccess ? 'success' : 'danger'" size = "small" > { { rawDetail . isSuccess ? '成功' : '失败' } } < / e l - t a g >
< / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "创建时间" > { { rawDetail . createdAt } } < / e l - d e s c r i p t i o n s - i t e m >
< el -descriptions -item label = "错误信息" :span ="2" > { { rawDetail . errorMessage || '无' } } < / e l - d e s c r i p t i o n s - i t e m >
< / e l - d e s c r i p t i o n s >
< div style = "margin-top: 16px" >
< div style = "font-weight: bold; margin-bottom: 8px" > 原始JSON : < / div >
< el -input type = "textarea" :rows ="16" readonly :model-value ="formatJson(rawDetail?.rawJson)" style = "font-family: monospace" / >
< / div >
< template # footer >
< el -button @ click = "rawDetailVisible = false" > 关闭 < / e l - b u t t o n >
< / template >
< / e l - d i a l o g >
< / e l - t a b - p a n e >
< / e l - t a b s >
< / div >
@ -301,10 +355,13 @@ function resetCycle() {
}
function viewCycle ( row : CollectCycle ) {
/ / 仅 演 示 用 : 打 开 一 个 简 单 的 提 示 信 息
ElMessage. info ( ` 周期 ${ row . cycleTime } 区间分析完成,共 ${ row . totalMachines } 台机床 ` )
cycleDetailRow . value = row
cycleDetailVisible. value = true
}
const cycleDetailRow = ref < CollectCycle | null > ( null )
const cycleDetailVisible = ref ( false )
watch ( ( ) => cyclePage . page + cyclePage . pageSize , loadCycles )
/ / 初 始 加 载 周 期 数 据
onMounted ( ( ) => {
@ -320,7 +377,28 @@ const rawList = ref<CollectRaw[]>([])
const rawLoading = ref ( false )
const rawPage = reactive ( { page : 1 , pageSize : 20 , total : 0 } )
const rawQuery = reactive ( { dateRange : null as string [ ] | null , addressId : undefined as number | undefined } )
const rawURLList = ref < string [ ] > ( [ ] )
const rawDetailVisible = ref ( false )
const rawDetail = ref < CollectRaw | null > ( null )
async function viewRawDetail ( row : CollectRaw ) {
rawDetailVisible . value = true
rawDetail . value = null
try {
const res = await request . get < CollectRaw > ( ` /admin/collect-log/raw/ ${ row . id } ` )
rawDetail . value = res . data as CollectRaw
} catch {
rawDetail . value = row
}
}
function formatJson ( json : string | undefined | null ) : string {
if ( ! json ) return ''
try {
return JSON . stringify ( JSON . parse ( json ) , null , 2 )
} catch {
return json
}
}
async function loadRaw ( ) {
rawLoading . value = true
@ -345,6 +423,8 @@ function resetRaw() {
loadRaw ( )
}
watch ( ( ) => [ rawPage . page , rawPage . pageSize ] , ( ) => loadRaw ( ) )
onMounted ( ( ) => {
loadRaw ( )
} )
@ -376,8 +456,6 @@ async function loadMachines() {
}
/ / - - - - - - - - - - - - - - H e l p e r s - - - - - - - - - - - - - -
/ / 为 模 板 暴 露 t a g / l a b e l 映 射
< / script >
< style scoped lang = "scss" >