Archived
forked from admin/userbase
This commit is contained in:
@@ -34,9 +34,9 @@
|
|||||||
</Form>
|
</Form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="push-setting-footer">
|
<div class="push-setting-footer">
|
||||||
<div class="footer-left">
|
<div v-if="form.pushEnabled" class="footer-left">
|
||||||
<Button type="primary" icon="ios-people" :loading="syncingGroup" @click="handleSyncGroup">组全量同步</Button>
|
<Button type="primary" :loading="syncingGroup" @click="handleSyncGroup">组全量同步</Button>
|
||||||
<Button type="primary" icon="ios-person" :loading="syncingUser" @click="handleSyncUser">用户全量同步</Button>
|
<Button type="primary" :loading="syncingUser" @click="handleSyncUser">用户全量同步</Button>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer-right">
|
<div class="footer-right">
|
||||||
<Button type="primary" :loading="saving" @click="handleSave">保存</Button>
|
<Button type="primary" :loading="saving" @click="handleSave">保存</Button>
|
||||||
@@ -51,6 +51,7 @@
|
|||||||
import { computed, ref, watch, type Ref } from 'vue';
|
import { computed, ref, watch, type Ref } from 'vue';
|
||||||
import { Message } from 'view-ui-plus';
|
import { Message } from 'view-ui-plus';
|
||||||
import useCurrentInstance from '@/utils/hook/useCurrentInstance';
|
import useCurrentInstance from '@/utils/hook/useCurrentInstance';
|
||||||
|
import MyConfirm from '@/components/MyConfirm';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelValue: boolean;
|
modelValue: boolean;
|
||||||
@@ -197,20 +198,31 @@ function handleSave() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleSyncGroup() {
|
function handleSyncGroup() {
|
||||||
doSync('group/SyncGroup', syncingGroup, '组全量同步');
|
triggerSync('group/SyncGroup', syncingGroup, '组全量同步');
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSyncUser() {
|
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) {
|
if (!props.appId) {
|
||||||
Message.error('应用不存在');
|
Message.error('应用不存在');
|
||||||
return;
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
loadingRef.value = true;
|
loadingRef.value = true;
|
||||||
(Apis as any)
|
return (Apis as any)
|
||||||
.Push.test({
|
.Push.test({
|
||||||
data: { appId: props.appId, interfacePath, targetIds: null },
|
data: { appId: props.appId, interfacePath, targetIds: null },
|
||||||
cacheFor: null,
|
cacheFor: null,
|
||||||
|
|||||||
+15
-14
@@ -117,29 +117,31 @@ const tableHeight = ref($utils.useTableHeight({ isOperat: false, isPage: true, i
|
|||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{ type: 'index', title: '序号', width: 70, align: 'center' },
|
{ 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: 'appName', width: 160, ellipsis: true, tooltip: true },
|
||||||
{
|
{
|
||||||
title: '接口',
|
title: '接口',
|
||||||
key: 'interfaceLabel',
|
key: 'interfaceLabel',
|
||||||
minWidth: 180,
|
width: 140,
|
||||||
|
ellipsis: true,
|
||||||
|
tooltip: true,
|
||||||
render: (h: any, { row }: any) =>
|
render: (h: any, { row }: any) =>
|
||||||
h('span', { attrs: { title: row.interfacePath } }, row.interfaceLabel || row.interfacePath || '-'),
|
h('span', { attrs: { title: row.interfacePath } }, row.interfaceLabel || row.interfacePath || '-'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '调用结果',
|
title: '调用结果',
|
||||||
key: 'success',
|
key: 'success',
|
||||||
width: 90,
|
width: 120,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
render: (h: any, { row }: any) =>
|
render: (h: any, { row }: any) =>
|
||||||
h('span', { class: row.success === 1 ? 'text-success' : 'text-error' }, row.success === 1 ? '成功' : '失败'),
|
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: '重试',
|
title: '重试',
|
||||||
key: 'attemptNo',
|
key: 'attemptNo',
|
||||||
@@ -157,16 +159,15 @@ const columns = [
|
|||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
width: 130,
|
width: 150,
|
||||||
align: 'center',
|
align: 'left',
|
||||||
fixed: 'right' as const,
|
|
||||||
render: (h: any, { row }: any) => {
|
render: (h: any, { row }: any) => {
|
||||||
const actions = [
|
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) {
|
if (row.success !== 1) {
|
||||||
actions.push(
|
actions.push(
|
||||||
h('a', { style: { color: '#ed4014' }, on: { click: () => handleRetry(row) } }, '重试')
|
h('a', { style: { color: '#ed4014' }, onClick: () => handleRetry(row) }, '重试')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return h('span', actions);
|
return h('span', actions);
|
||||||
|
|||||||
Reference in New Issue
Block a user