Archived
forked from admin/userbase
This commit is contained in:
@@ -33,14 +33,22 @@
|
||||
</FormItem>
|
||||
</Form>
|
||||
<template #footer>
|
||||
<Button @click="show = false">取消</Button>
|
||||
<Button type="primary" :loading="saving" @click="handleSave">保存</Button>
|
||||
<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>
|
||||
<div class="footer-right">
|
||||
<Button type="primary" :loading="saving" @click="handleSave">保存</Button>
|
||||
<Button @click="show = false">取消</Button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { computed, ref, watch, type Ref } from 'vue';
|
||||
import { Message } from 'view-ui-plus';
|
||||
import useCurrentInstance from '@/utils/hook/useCurrentInstance';
|
||||
|
||||
@@ -59,8 +67,6 @@ const show = computed({
|
||||
});
|
||||
|
||||
const interfaceOptions = [
|
||||
{ value: 'group/SyncGroup', label: '组全量同步' },
|
||||
{ value: 'user/SyncUser', label: '用户全量同步' },
|
||||
{ value: 'group/AddGroup', label: '添加组' },
|
||||
{ value: 'group/UpdateGroup', label: '更新组' },
|
||||
{ value: 'group/DeleteGroup', label: '删除组' },
|
||||
@@ -82,6 +88,8 @@ const roleOptions = [
|
||||
const schoolOptions = ref<{ value: number; label: string }[]>([]);
|
||||
const loading = ref(false);
|
||||
const saving = ref(false);
|
||||
const syncingGroup = ref(false);
|
||||
const syncingUser = ref(false);
|
||||
|
||||
const form = ref({
|
||||
pushEnabled: false,
|
||||
@@ -187,6 +195,30 @@ function handleSave() {
|
||||
.catch((e: any) => Message.error(e?.message || '保存失败'))
|
||||
.finally(() => (saving.value = false));
|
||||
}
|
||||
|
||||
function handleSyncGroup() {
|
||||
doSync('group/SyncGroup', syncingGroup, '组全量同步');
|
||||
}
|
||||
|
||||
function handleSyncUser() {
|
||||
doSync('user/SyncUser', syncingUser, '用户全量同步');
|
||||
}
|
||||
|
||||
function doSync(interfacePath: string, loadingRef: Ref<boolean>, name: string) {
|
||||
if (!props.appId) {
|
||||
Message.error('应用不存在');
|
||||
return;
|
||||
}
|
||||
loadingRef.value = true;
|
||||
(Apis as any)
|
||||
.Push.test({
|
||||
data: { appId: props.appId, interfacePath, targetIds: null },
|
||||
cacheFor: null,
|
||||
})
|
||||
.then((res: any) => Message.success(res?.message || `${name}已触发`))
|
||||
.catch((e: any) => Message.error(e?.message || `${name}失败`))
|
||||
.finally(() => (loadingRef.value = false));
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -212,4 +244,20 @@ function handleSave() {
|
||||
text-align: center;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.push-setting-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.footer-left {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.footer-right {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user