推送日志修改
This commit is contained in:
@@ -34,9 +34,9 @@
|
||||
</Form>
|
||||
<template #footer>
|
||||
<div class="push-setting-footer">
|
||||
<div class="footer-left">
|
||||
<Button type="primary" icon="ios-people" :loading="syncingGroup" @click="handleSyncGroup">组全量同步</Button>
|
||||
<Button type="primary" icon="ios-person" :loading="syncingUser" @click="handleSyncUser">用户全量同步</Button>
|
||||
<div v-if="form.pushEnabled" class="footer-left">
|
||||
<Button type="primary" :loading="syncingGroup" @click="handleSyncGroup">组全量同步</Button>
|
||||
<Button type="primary" :loading="syncingUser" @click="handleSyncUser">用户全量同步</Button>
|
||||
</div>
|
||||
<div class="footer-right">
|
||||
<Button type="primary" :loading="saving" @click="handleSave">保存</Button>
|
||||
@@ -51,6 +51,7 @@
|
||||
import { computed, ref, watch, type Ref } from 'vue';
|
||||
import { Message } from 'view-ui-plus';
|
||||
import useCurrentInstance from '@/utils/hook/useCurrentInstance';
|
||||
import MyConfirm from '@/components/MyConfirm';
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean;
|
||||
@@ -197,20 +198,31 @@ function handleSave() {
|
||||
}
|
||||
|
||||
function handleSyncGroup() {
|
||||
doSync('group/SyncGroup', syncingGroup, '组全量同步');
|
||||
triggerSync('group/SyncGroup', syncingGroup, '组全量同步');
|
||||
}
|
||||
|
||||
function handleSyncUser() {
|
||||
doSync('user/SyncUser', syncingUser, '用户全量同步');
|
||||
triggerSync('user/SyncUser', syncingUser, '用户全量同步');
|
||||
}
|
||||
|
||||
function doSync(interfacePath: string, loadingRef: Ref<boolean>, name: string) {
|
||||
async function triggerSync(interfacePath: string, loadingRef: Ref<boolean>, name: string) {
|
||||
await MyConfirm({
|
||||
msg: `确定对本应用执行「${name}」吗?`,
|
||||
info: '将向该订阅方投递一次全量数据,可在「推送日志」查看实际结果。',
|
||||
confirmText: '确定推送',
|
||||
async onOk() {
|
||||
await doSync(interfacePath, loadingRef, name);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function doSync(interfacePath: string, loadingRef: Ref<boolean>, name: string): Promise<void> {
|
||||
if (!props.appId) {
|
||||
Message.error('应用不存在');
|
||||
return;
|
||||
return Promise.resolve();
|
||||
}
|
||||
loadingRef.value = true;
|
||||
(Apis as any)
|
||||
return (Apis as any)
|
||||
.Push.test({
|
||||
data: { appId: props.appId, interfacePath, targetIds: null },
|
||||
cacheFor: null,
|
||||
|
||||
+15
-14
@@ -117,29 +117,31 @@ const tableHeight = ref($utils.useTableHeight({ isOperat: false, isPage: true, i
|
||||
|
||||
const columns = [
|
||||
{ type: 'index', title: '序号', width: 70, align: 'center' },
|
||||
{
|
||||
title: '日志时间',
|
||||
key: 'createdAt',
|
||||
width: 170,
|
||||
render: (h: any, { row }: any) =>
|
||||
h('span', row.createdAt ? Utils.dateFormat(row.createdAt, 'yyyy-MM-dd HH:mm:ss') : '-'),
|
||||
},
|
||||
{ title: '应用', key: 'appName', width: 160, ellipsis: true, tooltip: true },
|
||||
{
|
||||
title: '接口',
|
||||
key: 'interfaceLabel',
|
||||
minWidth: 180,
|
||||
width: 140,
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
render: (h: any, { row }: any) =>
|
||||
h('span', { attrs: { title: row.interfacePath } }, row.interfaceLabel || row.interfacePath || '-'),
|
||||
},
|
||||
{
|
||||
title: '调用结果',
|
||||
key: 'success',
|
||||
width: 90,
|
||||
width: 120,
|
||||
align: 'center',
|
||||
render: (h: any, { row }: any) =>
|
||||
h('span', { class: row.success === 1 ? 'text-success' : 'text-error' }, row.success === 1 ? '成功' : '失败'),
|
||||
},
|
||||
{
|
||||
title: '日志时间',
|
||||
key: 'createdAt',
|
||||
width: 170,
|
||||
render: (h: any, { row }: any) =>
|
||||
h('span', row.createdAt ? Utils.dateFormat(row.createdAt, 'yyyy-MM-dd HH:mm:ss') : '-'),
|
||||
},
|
||||
{
|
||||
title: '重试',
|
||||
key: 'attemptNo',
|
||||
@@ -157,16 +159,15 @@ const columns = [
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 130,
|
||||
align: 'center',
|
||||
fixed: 'right' as const,
|
||||
width: 150,
|
||||
align: 'left',
|
||||
render: (h: any, { row }: any) => {
|
||||
const actions = [
|
||||
h('a', { style: { color: '#577afb', marginRight: '12px' }, on: { click: () => openDetail(row) } }, '详情'),
|
||||
h('a', { style: { color: '#577afb', marginRight: '12px' }, onClick: () => openDetail(row) }, '详情'),
|
||||
];
|
||||
if (row.success !== 1) {
|
||||
actions.push(
|
||||
h('a', { style: { color: '#ed4014' }, on: { click: () => handleRetry(row) } }, '重试')
|
||||
h('a', { style: { color: '#ed4014' }, onClick: () => handleRetry(row) }, '重试')
|
||||
);
|
||||
}
|
||||
return h('span', actions);
|
||||
|
||||
Reference in New Issue
Block a user