推送功能添加

This commit is contained in:
chenxing
2026-08-14 09:08:01 +08:00
parent 4077ef64d8
commit 85619785f6
92 changed files with 862 additions and 15442 deletions
+144
View File
@@ -0,0 +1,144 @@
<template>
<Modal v-model="show" :mask-closable="false" width="720" title="推送日志详情" @on-visible-change="onVisibleChange">
<Form :label-width="110" class="push-log-detail-form">
<FormItem label="日志ID:">
<span>{{ row?.id ?? '-' }}</span>
</FormItem>
<FormItem label="应用:">
<span>{{ row?.appName ?? '-' }}</span>
<span class="sub-text">(appKey {{ row?.subscriberAppKey ?? '-' }})</span>
</FormItem>
<FormItem label="接口:">
<span>{{ row?.interfaceLabel ?? '-' }}</span>
<span class="sub-text">{{ row?.interfacePath ?? '' }}</span>
</FormItem>
<FormItem label="请求地址:">
<span class="break-all">{{ row?.requestUrl || '-' }}</span>
</FormItem>
<FormItem label="调用结果:">
<span :class="resultClass">{{ resultText }}</span>
</FormItem>
<FormItem label="触发类型:">
<span>{{ triggerText }}</span>
</FormItem>
<FormItem label="HTTP状态:">
<span :class="row?.httpStatus === 200 ? 'text-success' : 'text-error'">{{ row?.httpStatus ?? '-' }}</span>
</FormItem>
<FormItem label="业务码:">
<span>{{ row?.respCode ?? '-' }}</span>
</FormItem>
<FormItem label="业务消息:">
<span class="break-all">{{ row?.respMsg || '-' }}</span>
</FormItem>
<FormItem label="重试次数:">
<span>第 {{ row?.attemptNo ?? 1 }} 次</span>
</FormItem>
<FormItem label="耗时:">
<span>{{ row?.costMs != null ? row.costMs + ' ms' : '-' }}</span>
</FormItem>
<FormItem label="签名时间 t:">
<span>{{ row?.signT || '-' }}</span>
</FormItem>
<FormItem label="创建时间:">
<span>{{ formatTime(row?.createdAt) }}</span>
</FormItem>
<FormItem label="请求体:">
<pre class="json-pre">{{ formatJson(row?.payload) }}</pre>
</FormItem>
</Form>
<template #footer>
<Button type="primary" @click="show = false">确定</Button>
</template>
</Modal>
</template>
<script lang="ts" setup>
import { computed } from 'vue';
import Utils from '@/utils';
interface Props {
modelValue: boolean;
row?: Record<string, any> | null;
}
const props = withDefaults(defineProps<Props>(), { row: null });
const emit = defineEmits(['update:modelValue']);
const show = computed({
get: () => props.modelValue,
set: val => emit('update:modelValue', val),
});
const resultText = computed(() => (props.row?.success === 1 ? '成功' : '失败'));
const resultClass = computed(() => (props.row?.success === 1 ? 'text-success' : 'text-error'));
const triggerMap: Record<string, string> = {
manual: '手动测试',
auto: '自动触发',
retry: '失败重试',
};
const triggerText = computed(() => (props.row?.triggerType ? (triggerMap[props.row.triggerType] || props.row.triggerType) : '-'));
function onVisibleChange(val: boolean) {
if (!val) emit('update:modelValue', false);
}
function formatJson(val: any): string {
if (!val) return '-';
try {
return JSON.stringify(JSON.parse(val), null, 2);
} catch {
return String(val);
}
}
function formatTime(val: any): string {
if (!val) return '-';
return Utils.dateFormat(val, 'yyyy-MM-dd HH:mm:ss');
}
</script>
<style lang="scss" scoped>
.push-log-detail-form {
:deep(.ivu-form-item) {
margin-bottom: 14px;
}
:deep(.ivu-form-item-label) {
color: #515a6e;
font-weight: 500;
}
.text-success {
color: #19be6b;
}
.text-error {
color: #ed4014;
}
.sub-text {
margin-left: 8px;
color: #999;
font-size: 12px;
}
.break-all {
word-break: break-all;
}
.json-pre {
margin: 0;
padding: 10px 12px;
background: #f7f8fa;
border: 1px solid #e8eaec;
border-radius: 4px;
max-height: 240px;
overflow: auto;
white-space: pre-wrap;
word-break: break-all;
font-size: 13px;
line-height: 1.6;
}
}
</style>