Trim third party sync settings

This commit is contained in:
2026-06-10 16:24:15 +08:00
parent 58f889b6c9
commit cd97031233
3 changed files with 35 additions and 181 deletions
-3
View File
@@ -37,9 +37,7 @@ const businessModules = import.meta.glob([
'./langs/zh-CN/application.json', './langs/zh-CN/application.json',
'./langs/zh-CN/chat.json', './langs/zh-CN/chat.json',
'./langs/zh-CN/dept.json', './langs/zh-CN/dept.json',
'./langs/zh-CN/dingtalk-sync.json',
'./langs/zh-CN/dict.json', './langs/zh-CN/dict.json',
'./langs/zh-CN/feishu-sync.json',
'./langs/zh-CN/file-manager.json', './langs/zh-CN/file-manager.json',
'./langs/zh-CN/loginLog.json', './langs/zh-CN/loginLog.json',
'./langs/zh-CN/menu.json', './langs/zh-CN/menu.json',
@@ -54,7 +52,6 @@ const businessModules = import.meta.glob([
'./langs/zh-CN/ui-config.json', './langs/zh-CN/ui-config.json',
'./langs/zh-CN/user-avatar.json', './langs/zh-CN/user-avatar.json',
'./langs/zh-CN/user.json', './langs/zh-CN/user.json',
'./langs/zh-CN/wecom-sync.json',
]); ]);
const baseLocalesMap = loadLocalesMapFromDir( const baseLocalesMap = loadLocalesMapFromDir(
@@ -3,7 +3,6 @@
"ssoConfig": "SSO配置", "ssoConfig": "SSO配置",
"notifyConfig": "通知配置", "notifyConfig": "通知配置",
"modelConfig": "模型配置", "modelConfig": "模型配置",
"syncConfig": "同步配置",
"save": "保存", "save": "保存",
"reset": "恢复默认", "reset": "恢复默认",
"resetConfirm": "确定要恢复该分组为默认配置吗?这将删除数据库中的自定义配置,恢复为环境变量的默认值。", "resetConfirm": "确定要恢复该分组为默认配置吗?这将删除数据库中的自定义配置,恢复为环境变量的默认值。",
@@ -29,10 +28,7 @@
"notify_feishu": "飞书通知", "notify_feishu": "飞书通知",
"notify_wecom": "企业微信通知", "notify_wecom": "企业微信通知",
"notify_sms": "短信通知", "notify_sms": "短信通知",
"notify_wechat_mp": "微信公众号", "notify_wechat_mp": "微信公众号"
"sync_dingtalk": "钉钉",
"sync_wecom": "企业微信",
"sync_feishu": "飞书"
}, },
"fields": { "fields": {
"client_id": "Client ID", "client_id": "Client ID",
@@ -8,9 +8,7 @@ import { Page } from '@vben/common-ui';
import { import {
BellRing, BellRing,
Bot, Bot,
CircleHelp,
IconifyIcon, IconifyIcon,
RefreshCw,
Shield, Shield,
} from '@vben/icons'; } from '@vben/icons';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
@@ -28,14 +26,10 @@ import {
getAllConfigsApi, getAllConfigsApi,
} from '#/api/core/system-config'; } from '#/api/core/system-config';
import { CardList } from '#/components/card-list'; import { CardList } from '#/components/card-list';
import { ZqDialog } from '#/components/zq-dialog';
import { ZqTabs } from '#/components/zq-tabs'; import { ZqTabs } from '#/components/zq-tabs';
import ConfigForm from './modules/config-form.vue'; import ConfigForm from './modules/config-form.vue';
import DingtalkSyncForm from './modules/dingtalk-sync-form.vue';
import ModelConfigForm from './modules/model-config-form.vue'; import ModelConfigForm from './modules/model-config-form.vue';
import FeishuSyncForm from './modules/feishu-sync-form.vue';
import WecomSyncForm from './modules/wecom-sync-form.vue';
defineOptions({ name: 'SystemConfigManager' }); defineOptions({ name: 'SystemConfigManager' });
@@ -44,7 +38,7 @@ interface ConfigMenuItem extends CardListItem {
name: string; name: string;
group: string; group: string;
icon: string; icon: string;
category: 'notify' | 'oauth' | 'sync'; category: 'notify' | 'oauth';
} }
const SSO_GROUPS = [ const SSO_GROUPS = [
@@ -68,12 +62,6 @@ const NOTIFY_GROUPS = [
'notify_wechat_mp', 'notify_wechat_mp',
]; ];
const SYNC_GROUPS = [
'sync_dingtalk',
'sync_wecom',
'sync_feishu',
];
const GROUP_ICONS: Record<string, string> = { const GROUP_ICONS: Record<string, string> = {
oauth_gitee: 'simple-icons:gitee', oauth_gitee: 'simple-icons:gitee',
oauth_github: 'simple-icons:github', oauth_github: 'simple-icons:github',
@@ -90,9 +78,6 @@ const GROUP_ICONS: Record<string, string> = {
notify_feishu: 'simple-icons:bytedance', notify_feishu: 'simple-icons:bytedance',
notify_wecom: 'simple-icons:wechat', notify_wecom: 'simple-icons:wechat',
notify_wechat_mp: 'simple-icons:wechat', notify_wechat_mp: 'simple-icons:wechat',
sync_dingtalk: 'ri:dingding-line',
sync_wecom: 'simple-icons:wechat',
sync_feishu: 'simple-icons:bytedance',
}; };
const activeTab = ref<string>('oauth'); const activeTab = ref<string>('oauth');
@@ -101,11 +86,6 @@ const selectedMenuId = ref<string>('oauth_gitee');
const loading = ref(false); const loading = ref(false);
const saving = ref(false); const saving = ref(false);
const configFormRef = ref<InstanceType<typeof ConfigForm>>(); const configFormRef = ref<InstanceType<typeof ConfigForm>>();
const syncFormRef = ref<InstanceType<typeof DingtalkSyncForm>>();
const wecomSyncFormRef = ref<InstanceType<typeof WecomSyncForm>>();
const feishuSyncFormRef = ref<InstanceType<typeof FeishuSyncForm>>();
const syncSaving = ref(false);
const showGuideDialog = ref(false);
const menuItems = computed<ConfigMenuItem[]>(() => { const menuItems = computed<ConfigMenuItem[]>(() => {
const items: ConfigMenuItem[] = []; const items: ConfigMenuItem[] = [];
@@ -130,16 +110,6 @@ const menuItems = computed<ConfigMenuItem[]>(() => {
}); });
} }
for (const group of SYNC_GROUPS) {
items.push({
id: group,
name: $t(`system-config.groups.${group}`),
group,
icon: GROUP_ICONS[group] || 'mdi:sync',
category: 'sync',
});
}
return items; return items;
}); });
@@ -157,7 +127,6 @@ const tabItems = computed<ZqTabItem[]>(() => [
{ key: 'oauth', label: $t('system-config.ssoConfig'), icon: Shield }, { key: 'oauth', label: $t('system-config.ssoConfig'), icon: Shield },
{ key: 'notify', label: $t('system-config.notifyConfig'), icon: BellRing }, { key: 'notify', label: $t('system-config.notifyConfig'), icon: BellRing },
{ key: 'model', label: $t('system-config.modelConfig'), icon: Bot }, { key: 'model', label: $t('system-config.modelConfig'), icon: Bot },
{ key: 'sync', label: $t('system-config.syncConfig'), icon: RefreshCw },
]); ]);
const cardListOptions: CardListOptions<ConfigMenuItem> = { const cardListOptions: CardListOptions<ConfigMenuItem> = {
@@ -219,21 +188,6 @@ function handleSaved() {
loadAllConfigs(); loadAllConfigs();
} }
async function handleSyncSave() {
syncSaving.value = true;
try {
if (selectedMenuId.value === 'sync_wecom') {
await wecomSyncFormRef.value?.save();
} else if (selectedMenuId.value === 'sync_feishu') {
await feishuSyncFormRef.value?.save();
} else {
await syncFormRef.value?.save();
}
} finally {
syncSaving.value = false;
}
}
onMounted(() => { onMounted(() => {
loadAllConfigs(); loadAllConfigs();
}); });
@@ -278,136 +232,43 @@ onMounted(() => {
<!-- 右侧内容 --> <!-- 右侧内容 -->
<div class="flex-1 overflow-hidden"> <div class="flex-1 overflow-hidden">
<!-- 同步配置 --> <!-- SSO/通知配置通用表单 -->
<template v-if="activeTab === 'sync'"> <ElCard
<ElCard shadow="never"
shadow="never" class="config-card flex h-full flex-col !border-none"
class="config-card flex h-full flex-col !border-none" >
> <template #header>
<template #header> <div class="card-header">
<div class="card-header"> <IconifyIcon
<IconifyIcon :icon="selectedItem?.icon || ''"
:icon="selectedItem?.icon || ''" class="mr-2 size-5 opacity-60"
class="mr-2 size-5 opacity-60" />
/> <span>{{ selectedItem?.name }}</span>
<span>{{ selectedItem?.name }}</span> <div class="ml-auto flex gap-2">
<div class="ml-auto flex items-center gap-2"> <ElButton @click="handleReset">
<CircleHelp {{ $t('system-config.reset') }}
class="size-5 cursor-pointer opacity-50 transition-opacity hover:opacity-100" </ElButton>
@click="showGuideDialog = true" <ElButton
/> type="primary"
<ElButton :loading="saving"
type="primary" @click="handleSave"
:loading="syncSaving"
@click="handleSyncSave"
>
{{ $t('system-config.save') }}
</ElButton>
</div>
</div>
</template>
<DingtalkSyncForm
v-if="selectedMenuId === 'sync_dingtalk'"
ref="syncFormRef"
/>
<WecomSyncForm
v-else-if="selectedMenuId === 'sync_wecom'"
ref="wecomSyncFormRef"
/>
<FeishuSyncForm
v-else-if="selectedMenuId === 'sync_feishu'"
ref="feishuSyncFormRef"
/>
</ElCard>
<!-- 配置步骤弹窗 -->
<ZqDialog
v-model="showGuideDialog"
:title="selectedMenuId === 'sync_wecom' ? $t('wecom-sync.guideTitle') : selectedMenuId === 'sync_feishu' ? $t('feishu-sync.guideTitle') : $t('dingtalk-sync.guideTitle')"
width="680px"
:show-footer="false"
max-height="70vh"
>
<div class="space-y-5 px-2 py-1">
<div
v-for="(step, idx) in (selectedMenuId === 'sync_wecom' ? 5 : selectedMenuId === 'sync_feishu' ? 5 : 6)"
:key="`${selectedMenuId}-${idx}`"
class="flex gap-3"
>
<div
class="flex size-7 flex-shrink-0 items-center justify-center rounded-full text-sm font-semibold text-white"
style="background-color: var(--el-color-primary)"
> >
{{ idx + 1 }} {{ $t('system-config.save') }}
</div> </ElButton>
<div class="flex-1">
<div
class="mb-1 text-sm font-semibold"
style="color: var(--el-text-color-primary)"
>
{{ selectedMenuId === 'sync_wecom'
? $t(`wecom-sync.guideStep${idx + 1}Title`)
: selectedMenuId === 'sync_feishu'
? $t(`feishu-sync.guideStep${idx + 1}Title`)
: $t(`dingtalk-sync.guideStep${idx + 1}Title`)
}}
</div>
<div
class="text-sm leading-relaxed"
style="color: var(--el-text-color-secondary)"
>
{{ selectedMenuId === 'sync_wecom'
? $t(`wecom-sync.guideStep${idx + 1}Desc`)
: selectedMenuId === 'sync_feishu'
? $t(`feishu-sync.guideStep${idx + 1}Desc`)
: $t(`dingtalk-sync.guideStep${idx + 1}Desc`)
}}
</div>
</div>
</div> </div>
</div> </div>
</ZqDialog> </template>
</template>
<!-- SSO/通知配置通用表单 --> <ElScrollbar class="flex-1">
<template v-else> <ConfigForm
<ElCard ref="configFormRef"
shadow="never" :group="selectedMenuId"
class="config-card flex h-full flex-col !border-none" :config-data="allConfigs[selectedMenuId] || {}"
> :loading="loading"
<template #header> @saved="handleSaved"
<div class="card-header"> />
<IconifyIcon </ElScrollbar>
:icon="selectedItem?.icon || ''" </ElCard>
class="mr-2 size-5 opacity-60"
/>
<span>{{ selectedItem?.name }}</span>
<div class="ml-auto flex gap-2">
<ElButton @click="handleReset">
{{ $t('system-config.reset') }}
</ElButton>
<ElButton
type="primary"
:loading="saving"
@click="handleSave"
>
{{ $t('system-config.save') }}
</ElButton>
</div>
</div>
</template>
<ElScrollbar class="flex-1">
<ConfigForm
ref="configFormRef"
:group="selectedMenuId"
:config-data="allConfigs[selectedMenuId] || {}"
:loading="loading"
@saved="handleSaved"
/>
</ElScrollbar>
</ElCard>
</template>
</div> </div>
</template> </template>