Archived
forked from admin/userbase
This commit is contained in:
@@ -33,14 +33,22 @@
|
|||||||
</FormItem>
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<Button @click="show = false">取消</Button>
|
<div class="push-setting-footer">
|
||||||
<Button type="primary" :loading="saving" @click="handleSave">保存</Button>
|
<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>
|
</template>
|
||||||
</Modal>
|
</Modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<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 { Message } from 'view-ui-plus';
|
||||||
import useCurrentInstance from '@/utils/hook/useCurrentInstance';
|
import useCurrentInstance from '@/utils/hook/useCurrentInstance';
|
||||||
|
|
||||||
@@ -59,8 +67,6 @@ const show = computed({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const interfaceOptions = [
|
const interfaceOptions = [
|
||||||
{ value: 'group/SyncGroup', label: '组全量同步' },
|
|
||||||
{ value: 'user/SyncUser', label: '用户全量同步' },
|
|
||||||
{ value: 'group/AddGroup', label: '添加组' },
|
{ value: 'group/AddGroup', label: '添加组' },
|
||||||
{ value: 'group/UpdateGroup', label: '更新组' },
|
{ value: 'group/UpdateGroup', label: '更新组' },
|
||||||
{ value: 'group/DeleteGroup', label: '删除组' },
|
{ value: 'group/DeleteGroup', label: '删除组' },
|
||||||
@@ -82,6 +88,8 @@ const roleOptions = [
|
|||||||
const schoolOptions = ref<{ value: number; label: string }[]>([]);
|
const schoolOptions = ref<{ value: number; label: string }[]>([]);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const saving = ref(false);
|
const saving = ref(false);
|
||||||
|
const syncingGroup = ref(false);
|
||||||
|
const syncingUser = ref(false);
|
||||||
|
|
||||||
const form = ref({
|
const form = ref({
|
||||||
pushEnabled: false,
|
pushEnabled: false,
|
||||||
@@ -187,6 +195,30 @@ function handleSave() {
|
|||||||
.catch((e: any) => Message.error(e?.message || '保存失败'))
|
.catch((e: any) => Message.error(e?.message || '保存失败'))
|
||||||
.finally(() => (saving.value = false));
|
.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>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -212,4 +244,20 @@ function handleSave() {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
color: #999;
|
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>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user