fix(conflicts): 管理控制台界面替换为element plus

This commit is contained in:
sophie committed 2026-10-27 15:10:28 +08:00
commit 70c7f03a5a
21 files changed
+4600 -2947

No files matched your search

@@ -1,27 +1,32 @@
/**
* features/admin/modules/approvals/ApprovalsPage.vue
* 用户注册审批独立页面。路由:/admin/approvals
* 用途:用户注册审批列表。一张卡片里放标题和待审表格。
* 依赖:AdminListPage、useApprovalsAdmin、useElementProvider、element-plus、roleLabel。
* 逻辑:路由未挂进当前菜单。通过和拒绝由 composable 弹出 Element 确认框后调接口。
*/
<script setup lang="ts">
import { onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { ShieldCheck, Trash2 } from 'lucide-vue-next';
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
import { CircleCheck, Delete } from '@element-plus/icons-vue';
import { ElButton, ElConfigProvider, ElTable, ElTableColumn, ElTag } from 'element-plus';
import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import { adminRoleLabel } from '@/features/admin/utils/roleLabel';
import type { AdminUserRow } from '@/features/admin/types/admin.types';
import { useApprovalsAdmin } from './composables/useApprovalsAdmin';
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const {
pendingUsers,
isLoading,
showConfirmDialog,
confirmMessage,
loadAll,
approveUser,
rejectUser,
closeConfirm,
confirmActionHandler,
} = useApprovalsAdmin();
onMounted(() => {
@@ -30,80 +35,60 @@ onMounted(() => {
</script>
<template>
<section class="admin-table-section">
<div v-if="isLoading" class="flex items-center justify-center py-20">
<div class="animate-spin rounded-full h-10 w-10 border-b-2 border-brand-600" />
</div>
<ElConfigProvider :locale="elementLocale">
<AdminListPage :loading="isLoading">
<template #title>
<h2 class="section-title">{{ t('admin.approval.title') }}</h2>
<p class="section-desc">{{ t('admin.approval.subtitle') }}</p>
</template>
<template v-else>
<div class="admin-table-header">
<div>
<h2 class="section-title">{{ t('admin.approval.title') }}</h2>
<p class="section-desc mt-1">{{ t('admin.approval.subtitle') }}</p>
</div>
</div>
<div class="admin-table-wrap">
<table class="admin-table">
<thead>
<tr>
<th class="px-8 py-4 text-left text-xs">{{ t('admin.approval.headers.username') }}</th>
<th class="px-8 py-4 text-left text-xs">{{ t('admin.approval.headers.nameId') }}</th>
<th class="px-8 py-4 text-left text-xs">{{ t('admin.approval.headers.contact') }}</th>
<th class="px-8 py-4 text-left text-xs">{{ t('admin.approval.headers.role') }}</th>
<th class="px-8 py-4 text-right text-xs">{{ t('admin.approval.headers.actions') }}</th>
</tr>
</thead>
<tbody>
<tr v-if="pendingUsers.length === 0">
<td colspan="5" class="px-8 admin-table-empty">{{ t('admin.approval.noPending') }}</td>
</tr>
<tr v-for="user in pendingUsers" :key="user.id">
<td class="px-8 py-5 text-sm font-medium text-primary">
<div>{{ user.username }}</div>
<div class="text-xs text-muted font-normal">{{ user.email }}</div>
</td>
<td class="px-8 py-5 text-sm text-muted">
<div>{{ user.real_name || '-' }}</div>
<div class="text-xs text-muted font-mono">{{ user.employee_id || '-' }}</div>
</td>
<td class="px-8 py-5 text-sm text-muted">{{ user.phone_number || '-' }}</td>
<td class="px-8 py-5">
<span
class="px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800 border border-yellow-200"
>
{{ adminRoleLabel(t, user.role, user.role_name) }}
</span>
</td>
<td class="px-8 py-5 text-right flex items-center justify-end gap-2">
<button
type="button"
class="p-2 text-green-600 bg-green-50 rounded-lg hover:bg-green-100 transition-colors"
:title="t('admin.approval.confirmApprove')"
@click="approveUser(user.id)"
>
<ShieldCheck class="w-4 h-4" />
</button>
<button
type="button"
class="p-2 text-red-600 bg-red-50 rounded-lg hover:bg-red-100 transition-colors"
:title="t('admin.approval.confirmReject')"
@click="rejectUser(user.id)"
>
<Trash2 class="w-4 h-4" />
</button>
</td>
</tr>
</tbody>
</table>
</div>
</template>
<DeleteConfirmDialog
v-model="showConfirmDialog"
:message="confirmMessage"
@cancel="closeConfirm"
@confirm="confirmActionHandler"
/>
</section>
<ElTable
class="hx-admin-table"
:data="pendingUsers"
row-key="id"
:empty-text="t('admin.approval.noPending')"
>
<ElTableColumn :label="t('admin.approval.headers.username')" min-width="200">
<template #default="{ row }">
<div>{{ (row as AdminUserRow).username }}</div>
<p class="hx-element-hint">{{ (row as AdminUserRow).email }}</p>
</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.approval.headers.nameId')" min-width="160">
<template #default="{ row }">
<div>{{ (row as AdminUserRow).real_name || '-' }}</div>
<p class="hx-element-hint">{{ (row as AdminUserRow).employee_id || '-' }}</p>
</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.approval.headers.contact')" min-width="140">
<template #default="{ row }">{{ (row as AdminUserRow).phone_number || '-' }}</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.approval.headers.role')" min-width="120">
<template #default="{ row }">
<ElTag effect="light" type="warning">
{{ adminRoleLabel(t, (row as AdminUserRow).role, (row as AdminUserRow).role_name) }}
</ElTag>
</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.approval.headers.actions')" width="120" align="right">
<template #default="{ row }">
<ElButton
link
type="primary"
:icon="CircleCheck"
:title="t('admin.approval.confirmApprove')"
@click="approveUser((row as AdminUserRow).id)"
/>
<ElButton
link
type="danger"
:icon="Delete"
:title="t('admin.approval.confirmReject')"
@click="rejectUser((row as AdminUserRow).id)"
/>
</template>
</ElTableColumn>
</ElTable>
</AdminListPage>
</ElConfigProvider>
</template>
@@ -1,9 +1,12 @@
/**
* features/admin/modules/approvals/composables/useApprovalsAdmin.ts
* 用户注册审批:待审列表、通过、拒绝。
* 用途:用户注册审批的待审列表、通过和拒绝。
* 依赖:admin.api、useMessage、useAdminNavBadges、element-plus 的确认框。
* 逻辑:ApprovalsPage 调用本模块;通过和拒绝都先弹出 Element 确认框,成功后刷新列表和导航角标。
*/
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { ElMessageBox } from 'element-plus';
import { approveAdminUser, listAdminUsers, rejectAdminUser } from '@/features/admin/api/admin.api';
import { useMessage } from '@/shared/composables/useMessage';
import { useAdminNavBadges } from '@/features/admin/composables/useAdminNavBadges';
@@ -17,10 +20,6 @@ export function useApprovalsAdmin() {
const users = ref<AdminUserRow[]>([]);
const isLoading = ref(true);
const showConfirmDialog = ref(false);
const confirmMessage = ref('');
let confirmAction: (() => Promise<void> | void) | null = null;
const pendingUsers = computed(() => users.value.filter((u) => u.status === 'pending'));
const loadUsers = async (): Promise<void> => {
@@ -38,61 +37,61 @@ export function useApprovalsAdmin() {
isLoading.value = false;
};
const openConfirm = (message: string, action: () => Promise<void> | void): void => {
confirmMessage.value = message;
confirmAction = action;
showConfirmDialog.value = true;
};
const closeConfirm = (): void => {
showConfirmDialog.value = false;
confirmAction = null;
};
const confirmActionHandler = async (): Promise<void> => {
if (!confirmAction) return;
/**
* 弹出确认框。点取消时 Element 会拒绝 Promise,这里吞掉,不当成失败。
* @param message - 确认正文
* @returns 用户是否点了确定
*/
async function confirmAction(message: string): Promise<boolean> {
try {
await confirmAction();
} finally {
closeConfirm();
await ElMessageBox.confirm(message, t('common.deleteDialog.defaultTitle'), {
confirmButtonText: t('common.deleteDialog.confirm'),
cancelButtonText: t('common.deleteDialog.cancel'),
type: 'warning',
});
return true;
} catch {
return false;
}
};
}
const approveUser = (userId: number): void => {
openConfirm(t('admin.approval.confirmApprove'), async () => {
try {
await approveAdminUser(userId);
await loadUsers();
await refreshBadges();
} catch (e) {
console.error(e);
msg.error((e as Error).message || t('admin.msg.failed'));
}
});
};
/**
* 通过一条待审注册。先确认,再调审批接口并刷新角标。
* @param userId - 待审用户主键
*/
async function approveUser(userId: number): Promise<void> {
if (!(await confirmAction(t('admin.approval.confirmApprove')))) return;
try {
await approveAdminUser(userId);
await loadUsers();
await refreshBadges();
} catch (e) {
console.error(e);
msg.error((e as Error).message || t('admin.msg.failed'));
}
}
const rejectUser = (userId: number): void => {
openConfirm(t('admin.approval.confirmReject'), async () => {
try {
await rejectAdminUser(userId);
await loadUsers();
await refreshBadges();
} catch (e) {
console.error(e);
msg.error((e as Error).message || t('admin.msg.requestFailed'));
}
});
};
/**
* 拒绝一条待审注册。先确认,再调拒绝接口并刷新角标。
* @param userId - 待审用户主键
*/
async function rejectUser(userId: number): Promise<void> {
if (!(await confirmAction(t('admin.approval.confirmReject')))) return;
try {
await rejectAdminUser(userId);
await loadUsers();
await refreshBadges();
} catch (e) {
console.error(e);
msg.error((e as Error).message || t('admin.msg.requestFailed'));
}
}
return {
pendingUsers,
isLoading,
showConfirmDialog,
confirmMessage,
loadAll,
approveUser,
rejectUser,
closeConfirm,
confirmActionHandler,
};
}
@@ -1,16 +1,15 @@
/**
* features/admin/modules/departments/DepartmentsPage.vue
* 用途:部门管理列表。一张卡片里放标题、添加按钮、搜索、表格。
* 依赖:AdminListPage、useDepartmentsAdmin、useElementProvider、element-plus、lucide-vue-next、部门表单和员工名单弹窗。
* 依赖:AdminListPage、useDepartmentsAdmin、useElementProvider、element-plus、部门表单和员工名单弹窗。
* 逻辑:路由 /admin/departments。骨架用 AdminListPage。筛选、列和两个弹窗留在本页。
* 名称、编码、公司用表头排序,排的是当前过滤结果。删除用 Element 确认框。
* 表格用 Element stripe 斑马纹。员工、编辑、删除保持图标按钮,悬停文案走 i18n title。
* 表格用 Element stripe 斑马纹。员工数、编辑、删除用 Element 链接按钮,悬停文案走 i18n title。
*/
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { Plus } from '@element-plus/icons-vue';
import { Edit, Trash2, Users } from 'lucide-vue-next';
import { Delete, Edit, Plus, User } from '@element-plus/icons-vue';
import {
ElButton,
ElConfigProvider,
@@ -157,36 +156,34 @@ onMounted(() => {
</ElTableColumn>
<ElTableColumn :label="t('admin.dept.headers.members')" width="120" align="center">
<template #default="{ row }">
<button
type="button"
class="dept-member-btn"
<ElButton
link
type="primary"
:icon="User"
:title="t('admin.dept.actions.viewMembers')"
@click="openDepartmentMembers((row as AdminDepartmentRow).id)"
>
<Users class="dept-member-icon" />
<span>{{ row.member_count || 0 }}</span>
</button>
{{ row.member_count || 0 }}
</ElButton>
</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.dept.headers.actions')" width="120" align="right">
<template #default="{ row }">
<div class="dept-row-actions">
<button
type="button"
class="dept-icon-btn dept-icon-btn--edit"
<ElButton
link
type="primary"
:icon="Edit"
:title="t('admin.dept.actions.edit')"
@click="editDepartment(row as AdminDepartmentRow)"
>
<Edit class="dept-action-icon" />
</button>
<button
type="button"
class="dept-icon-btn dept-icon-btn--delete"
/>
<ElButton
link
type="danger"
:icon="Delete"
:title="t('admin.dept.actions.delete')"
@click="deleteDepartment((row as AdminDepartmentRow).id)"
>
<Trash2 class="dept-action-icon" />
</button>
/>
</div>
</template>
</ElTableColumn>
@@ -219,69 +216,9 @@ onMounted(() => {
white-space: nowrap;
}
.dept-member-btn,
.dept-icon-btn {
border: 0;
cursor: pointer;
line-height: 0;
}
.dept-member-btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 8px;
border-radius: 8px;
background: #eff6ff;
color: #2563eb;
}
.dept-member-btn:hover {
background: #dbeafe;
}
.dept-member-icon {
width: 20px;
height: 20px;
}
.dept-member-btn span {
margin-left: 4px;
font-size: 12px;
line-height: 1;
}
.dept-row-actions {
display: inline-flex;
justify-content: flex-end;
gap: 4px;
}
.dept-icon-btn {
padding: 6px;
border-radius: 8px;
background: transparent;
transition: background-color 0.15s ease;
}
.dept-action-icon {
width: 16px;
height: 16px;
}
.dept-icon-btn--edit {
color: #4f46e5;
}
.dept-icon-btn--edit:hover {
background: #eef2ff;
}
.dept-icon-btn--delete {
color: #dc2626;
}
.dept-icon-btn--delete:hover {
background: #fef2f2;
}
</style>
File diff suppressed because it is too large. Load diff
@@ -1,8 +1,8 @@
/**
* features/admin/modules/reports/composables/useReportsAdmin.ts
* 用途:管理后台报表(多表浏览、筛选、排序、chat_logs 批量删除、使用分析与应用运营看板)。
* 依赖:admin.api、useReportLayoutStorage、useOffsetPagination、useMessage、dateTime、vue-router。
* 逻辑:ReportsPage 调用本 composable;使用分析按用户服务端分页、按应用前端分页,均复用 PaginationBar;
* 依赖:admin.api、useReportLayoutStorage、useOffsetPagination、useMessage、dateTime、vue-router、element-plus(ElMessageBox)。
* 逻辑:ReportsPage 调用本 composable;使用分析按用户服务端分页、按应用前端分页,页码状态交给页面的 ElPagination;
* 低使用应用优先消费后端 low_agents(含零使用启用应用),与应用运营口径对齐;
* 统计范围统一为开始/结束日期(默认近 30 天),经 start_date/end_date 传给后端,聊天日志走 created_from/created_to;
* 趋势 by_day 前端按日期升序兜底;问题分析优先问题表前端分页;非表页切换时清空通用表状态防幽灵分页。
@@ -10,6 +10,7 @@
import { computed, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { ElMessageBox } from 'element-plus';
import * as XLSX from 'xlsx';
import {
batchDeleteAdminChatLogs,
@@ -655,30 +656,6 @@ export function useReportsAdmin() {
};
const isLoading = ref(true);
const showDeleteConfirmDialog = ref(false);
const deleteConfirmMessage = ref('');
let deleteConfirmAction: (() => Promise<void> | void) | null = null;
const openDeleteConfirm = (message: string, action: () => Promise<void> | void): void => {
deleteConfirmMessage.value = message;
deleteConfirmAction = action;
showDeleteConfirmDialog.value = true;
};
const closeDeleteConfirm = (): void => {
showDeleteConfirmDialog.value = false;
deleteConfirmAction = null;
};
const confirmDelete = async (): Promise<void> => {
if (!deleteConfirmAction) return;
try {
await deleteConfirmAction();
} finally {
closeDeleteConfirm();
}
};
const resolveTableFromRoute = (): AdminReportTableId => {
const table = route.params.table;
if (typeof table === 'string' && (ADMIN_REPORT_TABLES as readonly string[]).includes(table)) {
@@ -1575,25 +1552,41 @@ const toggleAllReportRows = () => {
selectedReportRowIds.value = Array.from(merged);
};
const batchDeleteChatLogs = async () => {
/**
* 批量删除已勾选的聊天日志。
* 核心逻辑:先弹出 Element 确认框;取消则直接返回。确认后按当前选中 id 调用原批量删除接口并刷新列表与总数。
* @returns 无。取消确认时不请求接口。
*/
const batchDeleteChatLogs = async (): Promise<void> => {
if (!isChatLogsTable.value) return;
if (selectedReportRowIds.value.length === 0) return;
const targetRowIds = [...selectedReportRowIds.value];
openDeleteConfirm(`Delete ${targetRowIds.length} selected chat logs?`, async () => {
isDeletingChatLogs.value = true;
try {
const data = await batchDeleteAdminChatLogs(targetRowIds);
msg.success(`Deleted ${data.deleted_count ?? 0} chat logs.`);
selectedReportRowIds.value = [];
await loadTableData();
chatLogsTotal.value = await loadTableCount('chat_logs');
} catch (e) {
console.error(e);
msg.error((e as Error).message || t('admin.msg.failed'));
} finally {
isDeletingChatLogs.value = false;
}
});
try {
await ElMessageBox.confirm(
t('admin.report.deleteSelected', { count: targetRowIds.length }),
t('common.deleteDialog.defaultTitle'),
{
type: 'warning',
confirmButtonText: t('common.deleteDialog.confirm'),
cancelButtonText: t('common.deleteDialog.cancel'),
},
);
} catch {
return;
}
isDeletingChatLogs.value = true;
try {
const data = await batchDeleteAdminChatLogs(targetRowIds);
msg.success(`Deleted ${data.deleted_count ?? 0} chat logs.`);
selectedReportRowIds.value = [];
await loadTableData();
chatLogsTotal.value = await loadTableCount('chat_logs');
} catch (e) {
console.error(e);
msg.error((e as Error).message || t('admin.msg.failed'));
} finally {
isDeletingChatLogs.value = false;
}
};
watch(currentTable, async () => {
@@ -1913,8 +1906,6 @@ watch([reportPageSize, issueQuestionTotal], () => {
reportRangeStart,
reportRangeEnd,
reportPageButtons,
showDeleteConfirmDialog,
deleteConfirmMessage,
loadAll,
handleFilterChange,
resetChatLogsColumns,
@@ -1941,6 +1932,5 @@ watch([reportPageSize, issueQuestionTotal], () => {
goToReportPage,
prevReportPage,
nextReportPage,
confirmDelete,
};
}
File diff suppressed because it is too large. Load diff
@@ -1,14 +1,13 @@
<script setup lang="ts">
/**
* features/admin/modules/training-config/components/LeanTargetModal.vue
* 用途:精益周任务"受训对象"选择弹窗,支持按角色、按员工两个维度多选(两个范围取并集生效)。
* 依赖:vue-i18n、lucide 图标与父级培训配置页面传入的目标状态(角色/用户 ID/用户列表)。
* 逻辑:弹窗打开时从 props 快照到本地草稿(取消不污染外部状态);员工支持关键字搜索;
* 确认后 emit save({ roles, userIds }),由父级写回表单并随"保存任务"统一落库。
* 用途:精益周任务受训对象选择对话框,按角色和员工两个维度多选。
* 依赖:element-plus 对话框、复选框和搜索框、vue-i18n、父级传入的用户列表。
* 逻辑:打开时把父级选择快照到本地草稿,取消不回写。确认后 emit save,由父级随保存任务提交。
*/
import { computed, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { Search } from 'lucide-vue-next';
import { ElButton, ElCheckbox, ElDialog, ElForm, ElFormItem, ElInput, ElText } from 'element-plus';
import type { AdminUserRow } from '../../../types/admin.types';
const props = defineProps<{
@@ -48,91 +47,144 @@ const summaryLabel = computed(() => t('admin.trainingConfig.lean.targetSelectedC
users: draftUserIds.value.length,
}));
/**
* 切换一个角色是否进入本次草稿。
* @param role - 角色名
*/
const toggleRole = (role: string) => {
draftRoles.value = draftRoles.value.includes(role)
? draftRoles.value.filter((item) => item !== role)
: [...draftRoles.value, role];
};
/**
* 切换一名员工是否进入本次草稿。
* @param userId - 用户主键
*/
const toggleUser = (userId: number) => {
draftUserIds.value = draftUserIds.value.includes(userId)
? draftUserIds.value.filter((item) => item !== userId)
: [...draftUserIds.value, userId];
};
/**
* 把草稿交回父级。落库仍等父级保存周任务。
*/
const handleSave = () => {
emit('save', { roles: [...draftRoles.value], userIds: [...draftUserIds.value] });
};
/**
* 对话框关闭时通知页面收起。
* @param open - Element 对话框的打开状态
*/
function onVisibleChange(open: boolean): void {
if (!open) emit('close');
}
</script>
<template>
<div v-if="props.visible" class="admin-modal-overlay animate-fade-in items-center" @click.self="emit('close')">
<div class="admin-modal-panel max-w-2xl max-h-[92vh] scale-100">
<div class="px-5 sm:px-8 pt-5 sm:pt-7 pb-4 border-b border-subtle">
<h3 class="section-title">{{ t('admin.trainingConfig.lean.targetModalTitle') }}</h3>
<p class="mt-1 text-xs text-muted">{{ t('admin.trainingConfig.lean.targetsHint') }}</p>
<ElDialog
:model-value="props.visible"
:title="t('admin.trainingConfig.lean.targetModalTitle')"
width="680px"
align-center
append-to-body
:close-on-click-modal="false"
@update:model-value="onVisibleChange"
>
<ElText type="info">{{ t('admin.trainingConfig.lean.targetsHint') }}</ElText>
<ElForm label-position="top" class="lean-target-form">
<div class="lean-target-grid">
<ElFormItem :label="t('admin.trainingConfig.lean.targetRoles')">
<div class="lean-target-list">
<ElCheckbox
v-for="role in props.roleOptions"
:key="role"
:model-value="draftRoles.includes(role)"
@change="toggleRole(role)"
>
{{ role }}
</ElCheckbox>
<ElText v-if="!props.roleOptions.length" type="info">{{ t('admin.trainingConfig.lean.targetRolesEmpty') }}</ElText>
</div>
</ElFormItem>
<ElFormItem :label="t('admin.trainingConfig.lean.targetUsers')">
<ElInput
v-model="keyword"
class="lean-target-search"
clearable
:placeholder="t('admin.trainingConfig.lean.targetSearchPlaceholder')"
/>
<div class="lean-target-list lean-target-list--scroll">
<ElCheckbox
v-for="user in filteredUsers"
:key="user.id"
:model-value="draftUserIds.includes(user.id)"
@change="toggleUser(user.id)"
>
{{ user.real_name || user.username }}
<ElText type="info">{{ user.username }}</ElText>
</ElCheckbox>
<ElText v-if="!filteredUsers.length" type="info">{{ t('admin.trainingConfig.lean.targetUsersEmpty') }}</ElText>
</div>
</ElFormItem>
</div>
<div class="px-5 sm:px-8 py-5 overflow-y-auto">
<div class="grid gap-5 md:grid-cols-2">
<!-- 按角色选择 -->
<div class="space-y-2">
<label class="label-field">{{ t('admin.trainingConfig.lean.targetRoles') }}</label>
<div class="space-y-2 rounded-xl border border-default bg-surface p-3">
<label
v-for="role in props.roleOptions"
:key="role"
class="flex cursor-pointer items-center gap-3 rounded-lg px-2 py-2 text-sm transition hover:bg-surface-soft"
>
<input
type="checkbox"
class="h-4 w-4 rounded border-default text-emerald-600 focus:ring-emerald-500"
:checked="draftRoles.includes(role)"
@change="toggleRole(role)"
/>
<span class="text-primary">{{ role }}</span>
</label>
<p v-if="!props.roleOptions.length" class="px-2 py-3 text-xs text-muted">{{ t('admin.trainingConfig.lean.targetRolesEmpty') }}</p>
</div>
</div>
<!-- 按员工选择 -->
<div class="space-y-2">
<label class="label-field">{{ t('admin.trainingConfig.lean.targetUsers') }}</label>
<div class="relative">
<Search class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted" />
<input
v-model="keyword"
type="text"
class="input-field pl-9 text-sm"
:placeholder="t('admin.trainingConfig.lean.targetSearchPlaceholder')"
/>
</div>
<div class="max-h-64 space-y-1 overflow-y-auto rounded-xl border border-default bg-surface p-2">
<label
v-for="user in filteredUsers"
:key="user.id"
class="flex cursor-pointer items-center gap-3 rounded-lg px-2 py-2 text-sm transition hover:bg-surface-soft"
>
<input
type="checkbox"
class="h-4 w-4 rounded border-default text-emerald-600 focus:ring-emerald-500"
:checked="draftUserIds.includes(user.id)"
@change="toggleUser(user.id)"
/>
<span class="min-w-0 flex-1 truncate text-primary">{{ user.real_name || user.username }}</span>
<span class="shrink-0 text-xs text-muted">{{ user.username }}</span>
</label>
<p v-if="!filteredUsers.length" class="px-2 py-3 text-xs text-muted">{{ t('admin.trainingConfig.lean.targetUsersEmpty') }}</p>
</div>
</div>
</ElForm>
<template #footer>
<div class="lean-target-footer">
<ElText type="info">{{ summaryLabel }}</ElText>
<div>
<ElButton @click="emit('close')">{{ t('admin.cancel') }}</ElButton>
<ElButton type="primary" @click="handleSave">{{ t('admin.trainingConfig.lean.targetConfirm') }}</ElButton>
</div>
</div>
<div class="admin-modal-footer">
<p class="mr-auto text-xs text-muted">{{ summaryLabel }}</p>
<button type="button" class="btn-ghost" @click="emit('close')">{{ t('admin.cancel') }}</button>
<button type="button" class="btn-primary" @click="handleSave">
{{ t('admin.trainingConfig.lean.targetConfirm') }}
</button>
</div>
</div>
</div>
</template>
</ElDialog>
</template>
<style scoped>
.lean-target-form {
margin-top: 12px;
}
.lean-target-grid {
display: grid;
grid-template-columns: 1fr;
gap: 16px;
}
.lean-target-list {
display: flex;
width: 100%;
flex-direction: column;
gap: 8px;
padding: 8px;
border: 1px solid var(--el-border-color);
border-radius: var(--el-border-radius-base);
}
.lean-target-list--scroll {
max-height: 16rem;
overflow: auto;
}
:deep(.lean-target-search) {
width: 16rem;
margin-bottom: 8px;
}
.lean-target-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
width: 100%;
}
@media (min-width: 768px) {
.lean-target-grid {
grid-template-columns: 1fr 1fr;
}
}
</style>
@@ -1,11 +1,12 @@
<script setup lang="ts">
/**
* features/admin/modules/training-config/components/TrainingTypeFormModal.vue
* 用途:提供培训类型 code 与名称的新增、编辑弹窗。
* 依赖:vue-i18n 与父级培训配置页面的表单状态。
* 逻辑:允许管理员输入符合编码规范的自定义类型 code,并将保存动作交由父级处理。
* 用途:培训类型编码和名称的新增、编辑对话框。
* 依赖:element-plus 对话框和表单、vue-i18n、父级传入的类型表单。
* 逻辑:TrainingConfigPage 打开本组件。字段仍写回父级 form 对象,保存由父级校验并调接口。样式跟页面已引入的 Element 皮肤走。
*/
import { useI18n } from 'vue-i18n';
import { ElButton, ElDialog, ElForm, ElFormItem, ElInput } from 'element-plus';
const props = defineProps<{
visible: boolean;
@@ -16,37 +17,45 @@ const props = defineProps<{
const emit = defineEmits<{ close: []; save: [] }>();
const { t } = useI18n();
/**
* 对话框关闭时通知页面收起。提交中不响应关闭。
* @param open - Element 对话框的打开状态
*/
function onVisibleChange(open: boolean): void {
if (!open && !props.isSaving) emit('close');
}
</script>
<template>
<div v-if="props.visible" class="admin-modal-overlay animate-fade-in items-center" @click.self="emit('close')">
<div class="admin-modal-panel max-w-lg max-h-[92vh] scale-100">
<div class="px-5 sm:px-8 pt-5 sm:pt-7 pb-4 border-b border-subtle">
<h3 class="section-title">{{ props.editing ? t('admin.trainingConfig.editType') : t('admin.trainingConfig.addType') }}</h3>
</div>
<div class="px-5 sm:px-8 py-5 space-y-4 overflow-y-auto">
<div class="space-y-1.5">
<label class="label-field">{{ t('admin.trainingConfig.fields.type') }}</label>
<input
v-model="props.form.training_type"
type="text"
class="input-field text-sm"
maxlength="50"
pattern="[a-z][a-z0-9_-]*"
:placeholder="t('admin.trainingConfig.placeholders.typeCode')"
/>
</div>
<div class="space-y-1.5">
<label class="label-field">{{ t('admin.trainingConfig.fields.name') }}</label>
<input v-model="props.form.name" type="text" class="input-field text-sm" :placeholder="t('admin.trainingConfig.fields.name')" />
</div>
</div>
<div class="admin-modal-footer">
<button type="button" class="btn-ghost" @click="emit('close')">{{ t('admin.cancel') }}</button>
<button type="button" class="btn-primary disabled:opacity-70" :disabled="props.isSaving" @click="emit('save')">
{{ props.isSaving ? `${t('admin.save')}...` : props.editing ? t('admin.update') : t('admin.add') }}
</button>
</div>
</div>
</div>
<ElDialog
:model-value="visible"
:title="editing ? t('admin.trainingConfig.editType') : t('admin.trainingConfig.addType')"
width="480px"
align-center
append-to-body
:close-on-click-modal="false"
:close-on-press-escape="!isSaving"
:show-close="!isSaving"
@update:model-value="onVisibleChange"
>
<ElForm label-position="top" :model="form" @submit.prevent="emit('save')">
<ElFormItem :label="t('admin.trainingConfig.fields.type')">
<ElInput
v-model="form.training_type"
maxlength="50"
:placeholder="t('admin.trainingConfig.placeholders.typeCode')"
/>
</ElFormItem>
<ElFormItem :label="t('admin.trainingConfig.fields.name')">
<ElInput v-model="form.name" :placeholder="t('admin.trainingConfig.fields.name')" />
</ElFormItem>
</ElForm>
<template #footer>
<ElButton :disabled="isSaving" @click="emit('close')">{{ t('admin.cancel') }}</ElButton>
<ElButton type="primary" :loading="isSaving" @click="emit('save')">
{{ editing ? t('admin.update') : t('admin.add') }}
</ElButton>
</template>
</ElDialog>
</template>
@@ -1,26 +1,24 @@
<script setup lang="ts">
/**
* features/admin/modules/wecom/WecomLayout.vue
* 企微管理壳层:二级 Tab、共享 composable、子路由出口。
* 用途:企微管理壳层。注入共享数据,并提供 Element 语言与样式。
* 依赖:useWecomAdmin、useElementProvider、element-plus、WECOM_ADMIN_KEY。
* 逻辑:路由 /admin/wecom 的父级。首屏等 loadAll 结束后再渲染子页。子页自己放页签和列表,解绑确认在 composable 里完成。
*/
import { onMounted, provide } from 'vue';
import { useI18n } from 'vue-i18n';
import { RefreshCw } from 'lucide-vue-next';
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
import WecomSubNav from './components/WecomSubNav.vue';
import { ElConfigProvider, ElLoading } from 'element-plus';
import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import { useWecomAdmin } from './composables/useWecomAdmin';
import { WECOM_ADMIN_KEY } from './wecom.context';
const { t } = useI18n();
const vLoading = ElLoading.directive;
const { elementLocale } = useElementProvider();
const wecomAdmin = useWecomAdmin();
const { isLoading } = wecomAdmin;
provide(WECOM_ADMIN_KEY, wecomAdmin);
const {
isLoading,
showDeleteConfirmDialog,
deleteConfirmMessage,
confirmDelete,
refreshWecomData,
} = wecomAdmin;
onMounted(() => {
void wecomAdmin.loadAll();
@@ -28,33 +26,15 @@ onMounted(() => {
</script>
<template>
<div v-if="isLoading" class="flex items-center justify-center py-20">
<div class="animate-spin rounded-full h-10 w-10 border-b-2 border-brand-600" />
</div>
<section v-else class="section-gap animate-fade-in-up space-y-6">
<div class="flex flex-col md:flex-row items-start md:items-center justify-between gap-4">
<div>
<h2 class="section-title">{{ t('admin.wecom.title') }}</h2>
<p class="section-desc mt-1">{{ t('admin.wecom.subtitle') }}</p>
</div>
<button
type="button"
class="btn-secondary inline-flex items-center gap-2 px-4 py-2 text-secondary rounded-xl hover-surface-soft transition-all shadow-sm"
@click="refreshWecomData()"
>
<RefreshCw class="w-4 h-4" />
{{ t('admin.wecom.refresh') }}
</button>
<ElConfigProvider :locale="elementLocale">
<div v-loading="isLoading" class="wecom-layout">
<router-view v-if="!isLoading" />
</div>
<WecomSubNav />
<router-view />
<DeleteConfirmDialog
v-model="showDeleteConfirmDialog"
:message="deleteConfirmMessage"
@confirm="confirmDelete"
/>
</section>
</ElConfigProvider>
</template>
<style scoped>
.wecom-layout {
min-height: 16rem;
}
</style>
@@ -1,10 +1,13 @@
<script setup lang="ts">
/**
* features/admin/modules/wecom/components/WecomOverviewCards.vue
* 企微 userid 绑定概览统计卡片。
* 用途:企微 userid 绑定概览。四张统计卡,不是列表。
* 依赖:getAdminWecomBindingStats、element-plus 的卡片和统计。
* 逻辑:绑定管理页放在列表卡片正文里。数字用 ElStatistic;说明句用文字块。refreshKey 变化时重拉。
*/
import { onMounted, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { ElCard, ElStatistic, ElText } from 'element-plus';
import { getAdminWecomBindingStats } from '@/features/admin/api/admin.api';
import type { WecomBindingStats } from '@/features/admin/types/wecom.types';
@@ -16,7 +19,8 @@ const { t } = useI18n();
const stats = ref<WecomBindingStats | null>(null);
/**
* 拉取绑定统计,供设置页概览卡片展示。
* 拉取绑定统计,供概览卡片展示。
* 核心逻辑:请求失败时清空卡片,避免留下过期数字。
*/
const loadStats = async (): Promise<void> => {
try {
@@ -42,22 +46,43 @@ defineExpose({ reload: loadStats });
</script>
<template>
<div v-if="stats" class="grid grid-cols-2 xl:grid-cols-4 gap-3">
<div class="rounded-xl bg-surface-soft px-4 py-3">
<div class="text-xs text-muted">{{ t('admin.wecom.overview.bound') }}</div>
<div class="mt-1 text-xl font-semibold text-primary">{{ stats.bound }} / {{ stats.total_active }}</div>
</div>
<div class="rounded-xl bg-surface-soft px-4 py-3">
<div class="text-xs text-muted">{{ t('admin.wecom.overview.unbound') }}</div>
<div class="mt-1 text-xl font-semibold text-amber-700">{{ stats.unbound }}</div>
</div>
<div class="rounded-xl bg-surface-soft px-4 py-3">
<div class="text-xs text-muted">{{ t('admin.wecom.overview.boundRate') }}</div>
<div class="mt-1 text-xl font-semibold text-emerald-700">{{ stats.bound_rate }}%</div>
</div>
<div class="rounded-xl bg-surface-soft px-4 py-3">
<div class="text-xs text-muted">{{ t('admin.wecom.overview.hint') }}</div>
<div class="mt-1 text-sm text-secondary leading-5">{{ t('admin.wecom.overview.hintDesc') }}</div>
</div>
<div v-if="stats" class="wecom-overview">
<ElCard shadow="never">
<ElStatistic
:title="t('admin.wecom.overview.bound')"
:value="stats.bound"
:suffix="` / ${stats.total_active}`"
/>
</ElCard>
<ElCard shadow="never">
<ElStatistic :title="t('admin.wecom.overview.unbound')" :value="stats.unbound" />
</ElCard>
<ElCard shadow="never">
<ElStatistic :title="t('admin.wecom.overview.boundRate')" :value="stats.bound_rate" suffix="%" />
</ElCard>
<ElCard shadow="never">
<div class="wecom-overview__hint-title">{{ t('admin.wecom.overview.hint') }}</div>
<ElText type="info">{{ t('admin.wecom.overview.hintDesc') }}</ElText>
</ElCard>
</div>
</template>
<style scoped>
.wecom-overview {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
}
.wecom-overview__hint-title {
margin-bottom: 8px;
color: var(--el-text-color-secondary);
font-size: var(--el-font-size-small);
}
@media (min-width: 1280px) {
.wecom-overview {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
}
</style>
@@ -1,33 +1,43 @@
<script setup lang="ts">
/**
* features/admin/modules/wecom/components/WecomSubNav.vue
* 企微管理二级 Tab 导航。
* 用途:企微管理的设置、绑定、审计页签。
* 依赖:AdminListTabs、vue-router、vue-i18n。
* 逻辑:放进各子页 AdminListPage 的 tabs 插槽。页签名就是现有路由名,点击只做 router.push。
*/
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useRoute, useRouter } from 'vue-router';
import AdminListTabs from '@/features/admin/components/AdminListTabs.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const tabs = [
{ name: 'AdminWecomSettings', labelKey: 'admin.wecom.nav.settings' },
{ name: 'AdminWecomBindings', labelKey: 'admin.wecom.nav.bindings' },
{ name: 'AdminWecomAudits', labelKey: 'admin.wecom.nav.audits' },
] as const;
const tabItems = computed(() => tabs.map((tab) => ({
name: tab.name,
label: t(tab.labelKey),
})));
const activeTab = computed(() => String(route.name || 'AdminWecomSettings'));
/**
* 切换企微子页。
* 核心逻辑:页签名与路由名相同,只跳转,不改路由表。
* @param name - AdminListTabs 当前 name
*/
function onTabChange(name: string): void {
if (name === activeTab.value) return;
void router.push({ name });
}
</script>
<template>
<div class="flex flex-wrap gap-2 border-b border-subtle pb-3">
<router-link
v-for="tab in tabs"
:key="tab.name"
:to="{ name: tab.name }"
class="rounded-xl px-4 py-2 text-sm font-medium transition-colors"
:class="route.name === tab.name
? 'bg-brand-50 text-brand-700 ring-1 ring-brand-200'
: 'text-secondary hover:bg-surface-soft hover:text-primary'"
>
{{ t(tab.labelKey) }}
</router-link>
</div>
<AdminListTabs :model-value="activeTab" :items="tabItems" @update:model-value="onTabChange" />
</template>
@@ -1,14 +1,23 @@
<script setup lang="ts">
/**
* features/admin/modules/wecom/components/WecomSyncPanel.vue
* OA userInfo_view 工号→wecom_userid 同步面板(预览 + 确认写入)。
* 依赖:useWecomSync、WECOM_ADMIN_KEY.refreshWecomData。
* 逻辑:绑定管理页调用;先扫本地工号,再按 IN 查 OA userInfo_view 匹配写入。
* 用途:OA userInfo_view 工号到 wecom_userid 的预览和确认写入面板。
* 依赖:useWecomSync、WECOM_ADMIN_KEY.refreshWecomData、element-plus。
* 逻辑:绑定管理页调用。先扫本地工号,再按 IN 查 OA 匹配。确认写入在 composable 里弹 Element 确认框。
*/
import { inject } from 'vue';
import { useI18n } from 'vue-i18n';
import { RefreshCw } from 'lucide-vue-next';
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
import { Refresh } from '@element-plus/icons-vue';
import {
ElAlert,
ElButton,
ElLoading,
ElStatistic,
ElTable,
ElTableColumn,
ElText,
} from 'element-plus';
import type { WecomSyncPendingUpdate } from '@/features/admin/types/wecom.types';
import { WECOM_ADMIN_KEY } from '../wecom.context';
import { useWecomSync } from '../composables/useWecomSync';
@@ -16,146 +25,190 @@ const emit = defineEmits<{
applied: [];
}>();
const vLoading = ElLoading.directive;
const { t } = useI18n();
const { refreshWecomData } = inject(WECOM_ADMIN_KEY)!;
const {
isSyncing,
previewSummary,
showApplyConfirm,
canApplySync,
applyBlockHint,
previewSync,
requestApplySync,
confirmApplySync,
} = useWecomSync({
onApplied: async () => {
await refreshWecomData();
emit('applied');
},
});
/**
* 预览表的行键。同一工号待写入的 userid 唯一。
* @param row - 待更新行
* @returns 工号与 userid 拼成的键
*/
function pendingRowKey(row: WecomSyncPendingUpdate): string {
return `${row.employee_id}-${row.wecom_userid}`;
}
</script>
<template>
<div class="card shadow-sm p-5 space-y-4">
<div>
<h3 class="font-semibold text-primary">{{ t('admin.wecom.sync.title') }}</h3>
<p class="mt-1 text-sm text-muted">{{ t('admin.wecom.sync.desc') }}</p>
<p class="mt-2 text-xs text-sky-900 bg-sky-50 border border-sky-100 rounded-lg px-3 py-2">
{{ t('admin.wecom.sync.oaSourceNote') }}
</p>
</div>
<div class="wecom-sync">
<h3 class="wecom-sync__title">{{ t('admin.wecom.sync.title') }}</h3>
<ElText type="info">{{ t('admin.wecom.sync.desc') }}</ElText>
<ElAlert
class="wecom-sync__note"
type="info"
:closable="false"
:title="t('admin.wecom.sync.oaSourceNote')"
/>
<div class="grid grid-cols-1 md:grid-cols-2 gap-3 text-sm">
<div class="wecom-sync__fields">
<div>
<div class="text-xs text-muted">{{ t('admin.wecom.sync.oaWorkcodeField') }}</div>
<div class="mt-1 font-mono text-primary">userInfo_view.workcode</div>
<div class="wecom-sync__label">{{ t('admin.wecom.sync.oaWorkcodeField') }}</div>
<div class="wecom-sync__mono">userInfo_view.workcode</div>
</div>
<div>
<div class="text-xs text-muted">{{ t('admin.wecom.sync.oaWecomIdField') }}</div>
<div class="mt-1 font-mono text-primary">userInfo_view.id</div>
<div class="wecom-sync__label">{{ t('admin.wecom.sync.oaWecomIdField') }}</div>
<div class="wecom-sync__mono">userInfo_view.id</div>
</div>
</div>
<div class="space-y-2">
<div class="flex flex-wrap gap-2">
<button
type="button"
class="inline-flex items-center gap-2"
:class="isSyncing ? 'btn-secondary opacity-60' : 'btn-primary'"
:disabled="isSyncing"
@click="previewSync"
>
<RefreshCw class="w-4 h-4" :class="{ 'animate-spin': isSyncing }" />
{{ t('admin.wecom.sync.preview') }}
</button>
<button
type="button"
:class="canApplySync && !isSyncing ? 'btn-primary' : 'btn-secondary opacity-60'"
:disabled="isSyncing"
:title="applyBlockHint || undefined"
@click="requestApplySync"
>
{{ t('admin.wecom.sync.apply') }}
</button>
</div>
<p v-if="applyBlockHint && !isSyncing" class="text-xs text-muted">
{{ applyBlockHint }}
</p>
<div class="wecom-sync__actions">
<ElButton type="primary" :icon="Refresh" :loading="isSyncing" @click="previewSync">
{{ t('admin.wecom.sync.preview') }}
</ElButton>
<ElButton
:type="canApplySync ? 'primary' : 'default'"
:disabled="isSyncing"
:title="applyBlockHint || undefined"
@click="requestApplySync"
>
{{ t('admin.wecom.sync.apply') }}
</ElButton>
</div>
<ElText v-if="applyBlockHint && !isSyncing" type="info">{{ applyBlockHint }}</ElText>
<div v-if="previewSummary" class="rounded-xl border border-subtle bg-surface-soft p-4 space-y-3 text-sm">
<div class="grid grid-cols-2 md:grid-cols-4 gap-3">
<div>
<div class="text-xs text-muted">{{ t('admin.wecom.sync.stats.localCandidates') }}</div>
<div class="font-semibold text-primary">{{ previewSummary.local_candidates }}</div>
</div>
<div>
<div class="text-xs text-muted">{{ t('admin.wecom.sync.stats.oaMatched') }}</div>
<div class="font-semibold text-primary">{{ previewSummary.local_matched }}</div>
</div>
<div>
<div class="text-xs text-muted">{{ t('admin.wecom.sync.stats.wouldUpdate') }}</div>
<div class="font-semibold text-brand-700">{{ previewSummary.would_update }}</div>
</div>
<div>
<div class="text-xs text-muted">{{ t('admin.wecom.sync.stats.conflicts') }}</div>
<div class="font-semibold" :class="previewSummary.conflicts?.length ? 'text-red-600' : 'text-emerald-700'">
{{ previewSummary.conflicts?.length || 0 }}
</div>
</div>
<div v-if="previewSummary" v-loading="isSyncing" class="wecom-sync__result">
<div class="wecom-sync__stats">
<ElStatistic :title="t('admin.wecom.sync.stats.localCandidates')" :value="previewSummary.local_candidates" />
<ElStatistic :title="t('admin.wecom.sync.stats.oaMatched')" :value="previewSummary.local_matched" />
<ElStatistic :title="t('admin.wecom.sync.stats.wouldUpdate')" :value="previewSummary.would_update" />
<ElStatistic :title="t('admin.wecom.sync.stats.conflicts')" :value="previewSummary.conflicts?.length || 0" />
</div>
<div v-if="previewSummary.local_missing > 0" class="text-xs text-muted">
<ElText v-if="previewSummary.local_missing > 0" type="info">
{{ t('admin.wecom.sync.localMissingHint', { count: previewSummary.local_missing }) }}
</div>
</ElText>
<div v-if="previewSummary.pending_updates?.length" class="overflow-x-auto">
<table class="admin-table min-w-full">
<thead>
<tr>
<th class="px-3 py-2 text-xs">{{ t('admin.wecom.headers.employeeId') }}</th>
<th class="px-3 py-2 text-xs">{{ t('admin.wecom.headers.user') }}</th>
<th class="px-3 py-2 text-xs">{{ t('admin.wecom.headers.wecomUserId') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="row in previewSummary.pending_updates" :key="`${row.employee_id}-${row.wecom_userid}`">
<td class="px-3 py-2 text-xs">{{ row.employee_id }}</td>
<td class="px-3 py-2 text-xs">
{{ row.username }}
<span v-if="row.name" class="text-muted"> · {{ row.name }}</span>
</td>
<td class="px-3 py-2 text-xs font-mono">{{ row.wecom_userid }}</td>
</tr>
</tbody>
</table>
<p v-if="previewSummary.would_update > previewSummary.pending_updates.length" class="mt-2 text-xs text-muted">
{{ t('admin.wecom.sync.previewTruncated', { total: previewSummary.would_update }) }}
</p>
</div>
<ElTable
v-if="previewSummary.pending_updates?.length"
class="hx-admin-table"
:data="previewSummary.pending_updates"
:row-key="pendingRowKey"
:empty-text="t('admin.wecom.noData')"
>
<ElTableColumn :label="t('admin.wecom.headers.employeeId')" min-width="140">
<template #default="{ row }">{{ (row as WecomSyncPendingUpdate).employee_id }}</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.wecom.headers.user')" min-width="180">
<template #default="{ row }">
{{ (row as WecomSyncPendingUpdate).username }}
<ElText v-if="(row as WecomSyncPendingUpdate).name" type="info">
· {{ (row as WecomSyncPendingUpdate).name }}
</ElText>
</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.wecom.headers.wecomUserId')" min-width="180">
<template #default="{ row }">
<span class="wecom-sync__mono">{{ (row as WecomSyncPendingUpdate).wecom_userid }}</span>
</template>
</ElTableColumn>
</ElTable>
<ElText
v-if="previewSummary.pending_updates?.length && previewSummary.would_update > previewSummary.pending_updates.length"
type="info"
>
{{ t('admin.wecom.sync.previewTruncated', { total: previewSummary.would_update }) }}
</ElText>
<div v-if="previewSummary.conflicts?.length" class="space-y-2">
<div class="text-xs font-medium text-red-700">{{ t('admin.wecom.sync.conflictsTitle') }}</div>
<div
<div v-if="previewSummary.conflicts?.length" class="wecom-sync__conflicts">
<ElText type="danger">{{ t('admin.wecom.sync.conflictsTitle') }}</ElText>
<ElAlert
v-for="(conflict, idx) in previewSummary.conflicts"
:key="idx"
class="rounded-lg border border-red-100 bg-red-50 px-3 py-2 text-xs text-red-800"
type="error"
:closable="false"
:title="conflict.employee_id + ' / ' + conflict.username"
>
{{ conflict.employee_id }} / {{ conflict.username }}
<span v-if="conflict.old_wecom_userid"> · {{ conflict.old_wecom_userid }} → {{ conflict.new_wecom_userid }}</span>
<span v-else-if="conflict.occupied_by_username"> · {{ t('admin.wecom.sync.occupiedBy', { user: conflict.occupied_by_username }) }}</span>
</div>
<span v-if="conflict.old_wecom_userid">{{ conflict.old_wecom_userid }} → {{ conflict.new_wecom_userid }}</span>
<span v-else-if="conflict.occupied_by_username">
{{ t('admin.wecom.sync.occupiedBy', { user: conflict.occupied_by_username }) }}
</span>
</ElAlert>
</div>
</div>
<DeleteConfirmDialog
v-model="showApplyConfirm"
:title="t('admin.wecom.sync.applyConfirmTitle')"
:message="t('admin.wecom.sync.applyConfirm', { count: previewSummary?.would_update || 0 })"
:confirm-text="t('admin.wecom.sync.applyConfirmButton')"
confirm-tone="primary"
@confirm="confirmApplySync"
/>
</div>
</template>
<style scoped>
.wecom-sync {
display: flex;
flex-direction: column;
gap: 12px;
padding: 16px 32px 24px;
border-top: 1px solid var(--el-border-color-lighter);
}
.wecom-sync__title {
margin: 0;
color: var(--el-text-color-primary);
font-size: var(--el-font-size-large);
font-weight: 600;
}
.wecom-sync__note {
margin-top: 4px;
}
.wecom-sync__fields,
.wecom-sync__stats {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
}
.wecom-sync__label {
color: var(--el-text-color-secondary);
font-size: var(--el-font-size-small);
}
.wecom-sync__mono {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.wecom-sync__actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.wecom-sync__result {
display: flex;
flex-direction: column;
gap: 12px;
}
.wecom-sync__conflicts {
display: flex;
flex-direction: column;
gap: 8px;
}
@media (min-width: 768px) {
.wecom-sync__stats {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
}
</style>
@@ -1,11 +1,12 @@
/**
* features/admin/modules/wecom/composables/useWecomAdmin.ts
* 企业微信:绑定、系统配置、通知、登录审计。
* 依赖:admin.api、useMessage、wecom 展示工具、PaginationBar 所需的审计分页状态。
* 逻辑:绑定走服务端分页;登录审计仍一次拉取最近 200 条,由前端切片分页。
* 依赖:admin.api、useMessage、wecom 展示工具、element-plus 确认框。
* 逻辑:绑定走服务端分页;登录审计仍一次拉取最近 200 条,由前端切片分页。解绑用 ElMessageBox。
*/
import { computed, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { ElMessageBox } from 'element-plus';
import * as XLSX from 'xlsx';
import {
bindAdminWecomUser,
@@ -90,10 +91,6 @@ export function useWecomAdmin() {
const wecomSystemSettings = ref<WecomSystemSettings>(createDefaultWecomSystemSettings());
const wecomIntegrationManifest = ref<WecomIntegrationManifest | null>(null);
const showDeleteConfirmDialog = ref(false);
const deleteConfirmMessage = ref('');
let deleteConfirmAction: (() => Promise<void> | void) | null = null;
const wecomBindUserOptions = computed(() => {
const keyword = wecomBindUserQuery.value.trim().toLowerCase();
return users.value
@@ -110,26 +107,6 @@ export function useWecomAdmin() {
}));
});
const openDeleteConfirm = (message: string, action: () => Promise<void> | void): void => {
deleteConfirmMessage.value = message;
deleteConfirmAction = action;
showDeleteConfirmDialog.value = true;
};
const closeDeleteConfirm = (): void => {
showDeleteConfirmDialog.value = false;
deleteConfirmAction = null;
};
const confirmDelete = async (): Promise<void> => {
if (!deleteConfirmAction) return;
try {
await deleteConfirmAction();
} finally {
closeDeleteConfirm();
}
};
const loadUsers = async (): Promise<void> => {
try {
users.value = await listAdminUsers();
@@ -428,19 +405,31 @@ export function useWecomAdmin() {
}
};
/**
* 管理员解绑企微 userid。取消确认则不请求。
* 核心逻辑:Element 确认框使用通用删除标题和按钮;确定后仍调用既有解绑接口并刷新列表。
* @param userId - 本地用户主键
*/
const unbindWecomUserByAdmin = async (userId: number): Promise<void> => {
openDeleteConfirm(t('admin.wecom.confirmUnbind'), async () => {
isSaving.value = true;
try {
await unbindAdminWecomUser(userId);
await refreshWecomData();
} catch (e) {
console.error(e);
msg.error((e as Error).message || t('admin.wecom.msg.unbindFailed'));
} finally {
isSaving.value = false;
}
});
try {
await ElMessageBox.confirm(t('admin.wecom.confirmUnbind'), t('common.deleteDialog.defaultTitle'), {
type: 'warning',
confirmButtonText: t('common.deleteDialog.confirm'),
cancelButtonText: t('common.deleteDialog.cancel'),
});
} catch {
return;
}
isSaving.value = true;
try {
await unbindAdminWecomUser(userId);
await refreshWecomData();
} catch (e) {
console.error(e);
msg.error((e as Error).message || t('admin.wecom.msg.unbindFailed'));
} finally {
isSaving.value = false;
}
};
const exportWecomAudits = (): void => {
@@ -522,8 +511,6 @@ export function useWecomAdmin() {
wecomNotifyMetrics,
wecomSystemSettings,
wecomIntegrationManifest,
showDeleteConfirmDialog,
deleteConfirmMessage,
loadAll,
refreshWecomData,
selectWecomBindUser,
@@ -539,6 +526,5 @@ export function useWecomAdmin() {
bindWecomUser,
unbindWecomUserByAdmin,
exportWecomAudits,
confirmDelete,
};
}
@@ -1,9 +1,12 @@
/**
* features/admin/modules/wecom/composables/useWecomSync.ts
* OA userInfo_view → 本地 wecom_userid 同步:预览 dry-run 与确认写入。
* 用途:OA userInfo_view 工号到本地 wecom_userid 的预览与确认写入。
* 依赖:admin.api 的 syncAdminWecomUserids、useMessage、element-plus 确认框。
* 逻辑:WecomSyncPanel 调用。先 dry-run,确认后再 apply。确认框取消则不写库。
*/
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { ElMessageBox } from 'element-plus';
import { syncAdminWecomUserids } from '@/features/admin/api/admin.api';
import { useMessage } from '@/shared/composables/useMessage';
import type { WecomSyncSummary } from '@/features/admin/types/wecom.types';
@@ -17,7 +20,6 @@ export function useWecomSync(options?: { onApplied?: () => void | Promise<void>
const isSyncing = ref(false);
const previewSummary = ref<WecomSyncSummary | null>(null);
const showApplyConfirm = ref(false);
const previewAttempted = ref(false);
const previewFailed = ref(false);
@@ -79,9 +81,29 @@ export function useWecomSync(options?: { onApplied?: () => void | Promise<void>
};
/**
* 打开确认写入对话框;不可写入时弹出对应提示。
* 确认后把预览结果写入数据库。
* 核心逻辑:调用 syncAdminWecomUserids({ apply: true }),成功后刷新预览摘要并通知页面。
*/
const requestApplySync = (): void => {
const confirmApplySync = async (): Promise<void> => {
isSyncing.value = true;
try {
const summary = await syncAdminWecomUserids({ apply: true });
previewSummary.value = summary;
msg.success(t('admin.wecom.sync.applyDone', { count: summary.updated || 0 }));
await options?.onApplied?.();
} catch (e) {
console.error(e);
msg.error((e as Error).message || t('admin.wecom.sync.applyFailed'));
} finally {
isSyncing.value = false;
}
};
/**
* 请求确认写入。不可写入时只提示原因;可以写入时先弹确认框,取消则不写库。
* 核心逻辑:拦截条件与原来一致。确认文案仍用同步模块自己的标题和按钮,取消按钮用通用文案。
*/
const requestApplySync = async (): Promise<void> => {
if (isSyncing.value) return;
if (previewFailed.value || (previewAttempted.value && !previewSummary.value)) {
msg.warning(t('admin.wecom.sync.previewFirstAfterFail'));
@@ -99,36 +121,28 @@ export function useWecomSync(options?: { onApplied?: () => void | Promise<void>
msg.info(t('admin.wecom.sync.nothingToUpdate'));
return;
}
showApplyConfirm.value = true;
};
/**
* 确认后将预览结果写入数据库。
*/
const confirmApplySync = async (): Promise<void> => {
isSyncing.value = true;
try {
const summary = await syncAdminWecomUserids({ apply: true });
previewSummary.value = summary;
showApplyConfirm.value = false;
msg.success(t('admin.wecom.sync.applyDone', { count: summary.updated || 0 }));
await options?.onApplied?.();
} catch (e) {
console.error(e);
msg.error((e as Error).message || t('admin.wecom.sync.applyFailed'));
} finally {
isSyncing.value = false;
await ElMessageBox.confirm(
t('admin.wecom.sync.applyConfirm', { count: previewSummary.value.would_update || 0 }),
t('admin.wecom.sync.applyConfirmTitle'),
{
type: 'warning',
confirmButtonText: t('admin.wecom.sync.applyConfirmButton'),
cancelButtonText: t('common.deleteDialog.cancel'),
},
);
} catch {
return;
}
await confirmApplySync();
};
return {
isSyncing,
previewSummary,
showApplyConfirm,
canApplySync,
applyBlockHint,
previewSync,
requestApplySync,
confirmApplySync,
};
}
@@ -1,18 +1,37 @@
<script setup lang="ts">
/**
* features/admin/modules/wecom/pages/WecomAuditsPage.vue
* 企微与密码登录审计列表。
* 依赖:WECOM_ADMIN_KEY、PaginationBar、formatLocalDateTime。
* 逻辑:表格渲染当前页切片;分页条对已拉取的最近 200 条做前端翻页。
* 用途:企微与密码登录审计列表。
* 依赖:AdminListPage、AdminListTabs、WECOM_ADMIN_KEY、element-plus、formatLocalDateTime。
* 逻辑:路由 AdminWecomAudits。页签仍跳原来的三个子路由。表格渲染当前页切片;分页对已拉取的最近 200 条做前端翻页。
*/
import { inject } from 'vue';
import { useI18n } from 'vue-i18n';
import { Download } from 'lucide-vue-next';
import PaginationBar from '@/shared/components/PaginationBar.vue';
import { Download, Refresh } from '@element-plus/icons-vue';
import {
ElButton,
ElConfigProvider,
ElOption,
ElPagination,
ElSelect,
ElSpace,
ElTable,
ElTableColumn,
ElTag,
ElText,
} from 'element-plus';
import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import { formatLocalDateTime } from '@/shared/utils/dateTime';
import type { WecomLoginAuditRow } from '@/features/admin/types/wecom.types';
import WecomSubNav from '../components/WecomSubNav.vue';
import { WECOM_ADMIN_KEY } from '../wecom.context';
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const {
wecomAuditSourceFilter,
wecomAuditStatusFilter,
@@ -20,83 +39,134 @@ const {
wecomAuditsPageSize,
wecomAuditsPageSizeOptions,
wecomAuditsTotal,
filteredWecomLoginAudits,
pagedWecomLoginAudits,
exportWecomAudits,
refreshWecomData,
getWecomAuditReasonText,
getWecomAuditMetaText,
} = inject(WECOM_ADMIN_KEY)!;
/**
* 登录来源筛选。空值表示全部,写回 composable 的 all。
* 核心逻辑:ElSelect 不用空字符串当选项值,业务判断仍看 all。
* @param value - 选中的来源;清空为 undefined 或空串
*/
function onAuditSourceChange(value: 'wecom' | 'password' | '' | undefined): void {
wecomAuditSourceFilter.value = value ? value : 'all';
}
/**
* 登录结果筛选。空值表示全部,写回 composable 的 all。
* @param value - 选中的状态;清空为 undefined 或空串
*/
function onAuditStatusChange(value: 'success' | 'failed' | '' | undefined): void {
wecomAuditStatusFilter.value = value ? value : 'all';
}
</script>
<template>
<div class="admin-table-section">
<div class="admin-table-header admin-table-header--stacked px-5 py-4">
<h3 class="font-semibold text-primary">{{ t('admin.wecom.auditTitle') }}</h3>
<div class="flex w-full md:w-auto flex-wrap md:flex-nowrap items-center justify-start md:justify-end gap-2">
<select v-model="wecomAuditSourceFilter" class="admin-table-filter-input h-11 min-w-[112px] shrink-0">
<option value="all">{{ t('admin.wecom.filters.allSources') }}</option>
<option value="wecom">{{ t('admin.wecom.sources.wecom') }}</option>
<option value="password">{{ t('admin.wecom.sources.password') }}</option>
</select>
<select v-model="wecomAuditStatusFilter" class="admin-table-filter-input h-11 min-w-[112px] shrink-0">
<option value="all">{{ t('admin.wecom.filters.allStatus') }}</option>
<option value="success">{{ t('admin.wecom.auditStatus.success') }}</option>
<option value="failed">{{ t('admin.wecom.auditStatus.failed') }}</option>
</select>
<button type="button" class="btn-secondary h-11 shrink-0 text-sm" @click="exportWecomAudits()">
<Download class="w-4 h-4" />
{{ t('admin.wecom.exportAudit') }}
</button>
</div>
</div>
<div class="admin-table-wrap">
<table class="admin-table">
<thead>
<tr>
<th class="px-4 py-3 text-xs">{{ t('admin.wecom.auditHeaders.time') }}</th>
<th class="px-4 py-3 text-xs">{{ t('admin.wecom.auditHeaders.source') }}</th>
<th class="px-4 py-3 text-xs">{{ t('admin.wecom.auditHeaders.user') }}</th>
<th class="px-4 py-3 text-xs">{{ t('admin.wecom.auditHeaders.status') }}</th>
<th class="px-4 py-3 text-xs">{{ t('admin.wecom.auditHeaders.reason') }}</th>
<th class="px-4 py-3 text-xs">{{ t('admin.wecom.auditHeaders.ip') }}</th>
</tr>
</thead>
<tbody>
<tr v-if="filteredWecomLoginAudits.length === 0">
<td colspan="6" class="px-4 admin-table-empty">{{ t('admin.wecom.noAuditData') }}</td>
</tr>
<tr v-for="row in pagedWecomLoginAudits" :key="row.id">
<td class="px-4 py-3 text-xs text-muted whitespace-nowrap" :title="row.created_at || '-'">{{ formatLocalDateTime(row.created_at) }}</td>
<td class="px-4 py-3 text-xs text-secondary">{{ t('admin.wecom.sources.' + row.source) }}</td>
<td class="px-4 py-3 text-xs text-secondary">{{ row.username || '-' }}</td>
<td class="px-4 py-3">
<span
class="inline-flex px-2 py-0.5 rounded-full text-[11px] font-medium"
:class="row.status === 'success' ? 'bg-green-50 text-green-700' : 'bg-red-50 text-red-700'"
>
{{ t('admin.wecom.auditStatus.' + row.status) }}
</span>
</td>
<td class="px-4 py-3 text-xs text-muted max-w-[360px] align-top">
<div class="max-w-[360px] whitespace-normal break-words">
<div class="text-xs text-secondary leading-5">{{ getWecomAuditReasonText(row) }}</div>
<div v-if="getWecomAuditMetaText(row)" class="mt-1 text-[11px] text-muted leading-5" :title="getWecomAuditMetaText(row)">
{{ getWecomAuditMetaText(row) }}
</div>
</div>
</td>
<td class="px-4 py-3 text-xs text-muted font-mono">{{ row.ip || '-' }}</td>
</tr>
</tbody>
</table>
</div>
<div class="px-4 pb-4 pt-2">
<PaginationBar
v-model:page="wecomAuditsPage"
v-model:page-size="wecomAuditsPageSize"
:total="wecomAuditsTotal"
:page-size-options="[...wecomAuditsPageSizeOptions]"
/>
</div>
</div>
<ElConfigProvider :locale="elementLocale">
<AdminListPage>
<template #title>
<h2 class="section-title">{{ t('admin.wecom.title') }}</h2>
<p class="section-desc mt-1">{{ t('admin.wecom.subtitle') }}</p>
</template>
<template #actions>
<ElSpace>
<ElButton :icon="Refresh" @click="refreshWecomData()">{{ t('admin.wecom.refresh') }}</ElButton>
<ElButton :icon="Download" @click="exportWecomAudits()">{{ t('admin.wecom.exportAudit') }}</ElButton>
</ElSpace>
</template>
<template #tabs>
<WecomSubNav />
</template>
<template #filters>
<ElSelect
class="wecom-filter-select"
:model-value="wecomAuditSourceFilter === 'all' ? undefined : wecomAuditSourceFilter"
clearable
:placeholder="t('admin.wecom.filters.allSources')"
@update:model-value="onAuditSourceChange"
>
<ElOption :label="t('admin.wecom.sources.wecom')" value="wecom" />
<ElOption :label="t('admin.wecom.sources.password')" value="password" />
</ElSelect>
<ElSelect
class="wecom-filter-select"
:model-value="wecomAuditStatusFilter === 'all' ? undefined : wecomAuditStatusFilter"
clearable
:placeholder="t('admin.wecom.filters.allStatus')"
@update:model-value="onAuditStatusChange"
>
<ElOption :label="t('admin.wecom.auditStatus.success')" value="success" />
<ElOption :label="t('admin.wecom.auditStatus.failed')" value="failed" />
</ElSelect>
</template>
<ElTable
class="hx-admin-table"
:data="pagedWecomLoginAudits"
row-key="id"
:empty-text="t('admin.wecom.noAuditData')"
>
<ElTableColumn :label="t('admin.wecom.auditHeaders.time')" min-width="180">
<template #default="{ row }">
{{ formatLocalDateTime((row as WecomLoginAuditRow).created_at) }}
</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.wecom.auditHeaders.source')" min-width="120">
<template #default="{ row }">
{{ t('admin.wecom.sources.' + (row as WecomLoginAuditRow).source) }}
</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.wecom.auditHeaders.user')" min-width="140">
<template #default="{ row }">{{ (row as WecomLoginAuditRow).username || '-' }}</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.wecom.auditHeaders.status')" min-width="110">
<template #default="{ row }">
<ElTag
effect="light"
:type="(row as WecomLoginAuditRow).status === 'success' ? 'success' : 'danger'"
>
{{ t('admin.wecom.auditStatus.' + (row as WecomLoginAuditRow).status) }}
</ElTag>
</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.wecom.auditHeaders.reason')" min-width="240">
<template #default="{ row }">
<div>{{ getWecomAuditReasonText(row as WecomLoginAuditRow) }}</div>
<ElText v-if="getWecomAuditMetaText(row as WecomLoginAuditRow)" type="info">
{{ getWecomAuditMetaText(row as WecomLoginAuditRow) }}
</ElText>
</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.wecom.auditHeaders.ip')" min-width="140">
<template #default="{ row }">
<span class="wecom-audit-mono">{{ (row as WecomLoginAuditRow).ip || '-' }}</span>
</template>
</ElTableColumn>
</ElTable>
<template #pagination>
<ElPagination
v-model:current-page="wecomAuditsPage"
v-model:page-size="wecomAuditsPageSize"
:total="wecomAuditsTotal"
:page-sizes="[...wecomAuditsPageSizeOptions]"
layout="total, sizes, prev, pager, next"
background
/>
</template>
</AdminListPage>
</ElConfigProvider>
</template>
<style scoped>
:deep(.wecom-filter-select) {
width: 11rem;
}
.wecom-audit-mono {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
</style>
@@ -1,291 +1,273 @@
<script setup lang="ts">
/**
* features/admin/modules/wecom/pages/WecomBindingsPage.vue
* 企微 OA 同步、快速绑定与绑定列表(搜索 + 服务端分页)。
* 依赖:WECOM_ADMIN_KEY、WecomSyncPanel、PaginationBar。
* 用途:企微绑定概览、OA 同步、快速绑定和绑定列表。
* 依赖:AdminListPage、AdminListTabs、WecomOverviewCards、WecomSyncPanel、WECOM_ADMIN_KEY、element-plus。
* 逻辑:路由 AdminWecomBindings。概览和同步在页签卡片里;绑定列表单独一张 AdminListPage,搜索和分页只服务这张表。
*/
import { inject } from 'vue';
import { useI18n } from 'vue-i18n';
import { Link2, Search, Unlink2 } from 'lucide-vue-next';
import PaginationBar from '@/shared/components/PaginationBar.vue';
import { Link, Refresh } from '@element-plus/icons-vue';
import {
ElButton,
ElCheckbox,
ElConfigProvider,
ElForm,
ElFormItem,
ElInput,
ElOption,
ElPagination,
ElSelect,
ElTable,
ElTableColumn,
ElTag,
ElText,
} from 'element-plus';
import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import type { WecomBindingRow } from '@/features/admin/types/wecom.types';
import WecomOverviewCards from '../components/WecomOverviewCards.vue';
import WecomSyncPanel from '../components/WecomSyncPanel.vue';
import WecomSubNav from '../components/WecomSubNav.vue';
import { WECOM_ADMIN_KEY } from '../wecom.context';
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const {
wecomBindUserQuery,
wecomBindUserDropdownOpen,
wecomBindUserOptions,
wecomBindUserQuery,
wecomBindForm,
isSaving,
wecomBoundOnly,
wecomBindings,
wecomBindingsKeyword,
wecomBindingsPage,
wecomBindingsPageSize,
wecomBindingsTotal,
wecomBindingsPages,
wecomBindingsPageSizeOptions,
selectWecomBindUser,
scheduleCloseWecomBindUserDropdown,
bindWecomUser,
unbindWecomUserByAdmin,
refreshWecomData,
} = inject(WECOM_ADMIN_KEY)!;
/**
* 同步写入成功后刷新绑定列表和配置。
* 核心逻辑:面板内部已经刷新过一次,这里再拉一次,保持原来的 applied 回调。
*/
const onSyncApplied = async (): Promise<void> => {
await refreshWecomData();
};
/**
* 选择要绑定的本地用户。清空时把 user_id 写回空串。
* 核心逻辑:下拉自己按姓名过滤,不再占用原来的搜索词,避免选项被收成一条。
* @param value - 用户 id;清空为 undefined 或空串
*/
function onBindUserChange(value: number | string | undefined): void {
if (value == null || value === '') {
wecomBindForm.value.user_id = '';
wecomBindUserQuery.value = '';
return;
}
wecomBindForm.value.user_id = Number(value);
wecomBindUserQuery.value = '';
}
</script>
<template>
<div class="space-y-6">
<WecomOverviewCards />
<WecomSyncPanel @applied="onSyncApplied" />
<p class="text-sm text-muted">{{ t('admin.wecom.bindingsHint') }}</p>
<div class="card shadow-sm p-5 space-y-4">
<h3 class="font-semibold text-primary">{{ t('admin.wecom.quickBind') }}</h3>
<div class="grid grid-cols-1 md:grid-cols-4 gap-3">
<div class="relative md:col-span-1">
<input
v-model="wecomBindUserQuery"
type="text"
class="input-field"
:placeholder="t('admin.wecom.fields.userSelect')"
@focus="wecomBindUserDropdownOpen = true"
@input="wecomBindUserDropdownOpen = true"
@blur="scheduleCloseWecomBindUserDropdown()"
/>
<div v-if="wecomBindUserDropdownOpen" class="admin-dropdown w-72">
<button
v-for="u in wecomBindUserOptions"
:key="u.id"
type="button"
class="flex w-full items-center justify-between gap-3 px-3 py-2 text-left hover:bg-blue-50"
@mousedown.prevent="selectWecomBindUser(u.id, u.label)"
>
<span class="text-sm text-primary">{{ u.label }}</span>
<span class="text-xs text-muted">{{ u.employeeId || '' }}</span>
</button>
<div v-if="wecomBindUserOptions.length === 0" class="px-3 py-2 text-sm text-muted">
{{ t('admin.wecom.noData') }}
</div>
</div>
<ElConfigProvider :locale="elementLocale">
<div class="wecom-bindings">
<AdminListPage>
<template #title>
<h2 class="section-title">{{ t('admin.wecom.title') }}</h2>
<p class="section-desc mt-1">{{ t('admin.wecom.subtitle') }}</p>
</template>
<template #actions>
<ElButton :icon="Refresh" @click="refreshWecomData()">{{ t('admin.wecom.refresh') }}</ElButton>
</template>
<template #tabs>
<WecomSubNav />
</template>
<div class="wecom-bindings__block">
<WecomOverviewCards />
</div>
<input v-model="wecomBindForm.wecom_userid" :placeholder="t('admin.wecom.fields.wecomUserId')" class="input-field md:col-span-2" />
<input v-model="wecomBindForm.wecom_unionid" :placeholder="t('admin.wecom.fields.wecomUnionId')" class="input-field" />
</div>
<div class="flex justify-end">
<button type="button" :disabled="isSaving" class="btn-primary px-5 py-2 disabled:opacity-60" @click="bindWecomUser()">
<Link2 class="w-4 h-4" /> {{ t('admin.wecom.bind') }}
</button>
</div>
</div>
<div class="admin-table-section space-y-0">
<div class="admin-table-header px-5 py-4 flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between">
<h3 class="font-semibold text-primary">{{ t('admin.wecom.bindingList') }}</h3>
<div class="flex flex-col gap-3 sm:flex-row sm:items-center">
<div class="relative min-w-[240px]">
<Search class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted" />
<input
v-model="wecomBindingsKeyword"
type="search"
class="input-field pl-9"
:placeholder="t('admin.wecom.searchBindings')"
/>
</div>
<label class="inline-flex items-center gap-2 text-sm text-secondary whitespace-nowrap">
<input v-model="wecomBoundOnly" type="checkbox" class="w-4 h-4 rounded text-brand-600 border-default" />
{{ t('admin.wecom.boundOnly') }}
</label>
</div>
</div>
<div class="admin-table-wrap">
<table class="admin-table">
<thead>
<tr>
<th class="px-4 py-3 text-xs">{{ t('admin.wecom.headers.user') }}</th>
<th class="px-4 py-3 text-xs">{{ t('admin.wecom.headers.employeeId') }}</th>
<th class="px-4 py-3 text-xs">{{ t('admin.wecom.headers.roleStatus') }}</th>
<th class="px-4 py-3 text-xs">{{ t('admin.wecom.headers.wecomUserId') }}</th>
<th class="px-4 py-3 text-xs">{{ t('admin.wecom.headers.unionId') }}</th>
<th class="px-4 py-3 text-xs text-right">{{ t('admin.wecom.headers.actions') }}</th>
</tr>
</thead>
<tbody>
<tr v-if="wecomBindings.length === 0">
<td colspan="6" class="px-4 admin-table-empty">{{ t('admin.wecom.noData') }}</td>
</tr>
<tr v-for="u in wecomBindings" :key="u.id">
<td class="px-4 py-3">
<div class="text-sm font-medium text-primary">{{ u.username }} <span class="text-muted">(#{{ u.id }})</span></div>
<div class="text-xs text-muted">{{ u.real_name || '-' }} · {{ u.email }}</div>
</td>
<td class="px-4 py-3 text-sm text-secondary font-mono">{{ u.employee_id || '-' }}</td>
<td class="px-4 py-3 text-sm text-secondary">{{ t('admin.role.' + u.role) }} / {{ t('admin.status.' + u.status) }}</td>
<td class="px-4 py-3 text-sm text-secondary font-mono">{{ u.wecom_userid || '-' }}</td>
<td class="px-4 py-3 text-sm text-secondary font-mono">{{ u.wecom_unionid || '-' }}</td>
<td class="px-4 py-3 text-right">
<button
v-if="u.wecom_userid"
type="button"
class="inline-flex items-center gap-1 px-3 py-1.5 text-xs text-red-600 bg-red-50 rounded-lg hover:bg-red-100"
@click="unbindWecomUserByAdmin(u.id)"
<WecomSyncPanel @applied="onSyncApplied" />
<div class="wecom-bindings__block">
<ElText type="info">{{ t('admin.wecom.bindingsHint') }}</ElText>
<h3 class="wecom-bindings__heading">{{ t('admin.wecom.quickBind') }}</h3>
<ElForm label-position="top" :model="wecomBindForm" @submit.prevent="bindWecomUser()">
<div class="wecom-bindings__form">
<ElFormItem :label="t('admin.wecom.fields.userSelect')">
<ElSelect
:model-value="wecomBindForm.user_id === '' ? undefined : wecomBindForm.user_id"
filterable
clearable
:placeholder="t('admin.wecom.fields.userSelect')"
@update:model-value="onBindUserChange"
>
<ElOption
v-for="user in wecomBindUserOptions"
:key="user.id"
:label="user.label"
:value="user.id"
/>
</ElSelect>
</ElFormItem>
<ElFormItem class="wecom-bindings__wide" :label="t('admin.wecom.fields.wecomUserId')">
<ElInput v-model="wecomBindForm.wecom_userid" :placeholder="t('admin.wecom.fields.wecomUserId')" />
</ElFormItem>
<ElFormItem :label="t('admin.wecom.fields.wecomUnionId')">
<ElInput v-model="wecomBindForm.wecom_unionid" :placeholder="t('admin.wecom.fields.wecomUnionId')" />
</ElFormItem>
</div>
<div class="wecom-bindings__submit">
<ElButton type="primary" :icon="Link" :loading="isSaving" @click="bindWecomUser()">
{{ t('admin.wecom.bind') }}
</ElButton>
</div>
</ElForm>
</div>
</AdminListPage>
<Unlink2 class="w-3.5 h-3.5" />
<AdminListPage>
<template #title>
<h2 class="section-title">{{ t('admin.wecom.bindingList') }}</h2>
</template>
<template #filters>
<ElInput
v-model="wecomBindingsKeyword"
class="wecom-filter-search"
clearable
:placeholder="t('admin.wecom.searchBindings')"
/>
<ElCheckbox v-model="wecomBoundOnly">{{ t('admin.wecom.boundOnly') }}</ElCheckbox>
</template>
{{ t('admin.wecom.unbind') }}
</button>
</td>
</tr>
</tbody>
</table>
</div>
<div class="px-4 pb-4 pt-2">
<PaginationBar
v-model:page="wecomBindingsPage"
v-model:page-size="wecomBindingsPageSize"
:total="wecomBindingsTotal"
:pages="wecomBindingsPages"
:page-size-options="[...wecomBindingsPageSizeOptions]"
:visible="wecomBindingsTotal > 0 || !!wecomBindingsKeyword.trim()"
/>
</div>
<ElTable
class="hx-admin-table"
:data="wecomBindings"
row-key="id"
:empty-text="t('admin.wecom.noData')"
>
<ElTableColumn :label="t('admin.wecom.headers.user')" min-width="220">
<template #default="{ row }">
<div>
{{ (row as WecomBindingRow).username }}
<ElText type="info">(#{{ (row as WecomBindingRow).id }})</ElText>
</div>
<ElText type="info">
{{ (row as WecomBindingRow).real_name || '-' }} · {{ (row as WecomBindingRow).email }}
</ElText>
</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.wecom.headers.employeeId')" min-width="140">
<template #default="{ row }">
<span class="wecom-bindings__mono">{{ (row as WecomBindingRow).employee_id || '-' }}</span>
</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.wecom.headers.roleStatus')" min-width="180">
<template #default="{ row }">
<span>{{ t('admin.role.' + (row as WecomBindingRow).role) }}</span>
<ElTag
class="wecom-bindings__status"
effect="light"
:type="(row as WecomBindingRow).status === 'active' ? 'success' : 'info'"
>
{{ t('admin.status.' + (row as WecomBindingRow).status) }}
</ElTag>
</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.wecom.headers.wecomUserId')" min-width="160">
<template #default="{ row }">
<span class="wecom-bindings__mono">{{ (row as WecomBindingRow).wecom_userid || '-' }}</span>
</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.wecom.headers.unionId')" min-width="160">
<template #default="{ row }">
<span class="wecom-bindings__mono">{{ (row as WecomBindingRow).wecom_unionid || '-' }}</span>
</template>
</ElTableColumn>
<ElTableColumn :label="t('admin.wecom.headers.actions')" width="120" align="right">
<template #default="{ row }">
<ElButton
v-if="(row as WecomBindingRow).wecom_userid"
link
type="danger"
@click="unbindWecomUserByAdmin((row as WecomBindingRow).id)"
>
{{ t('admin.wecom.unbind') }}
</ElButton>
</template>
</ElTableColumn>
</ElTable>
<template #pagination v-if="wecomBindingsTotal > 0 || !!wecomBindingsKeyword.trim()">
<ElPagination
v-model:current-page="wecomBindingsPage"
v-model:page-size="wecomBindingsPageSize"
:total="wecomBindingsTotal"
:page-sizes="[...wecomBindingsPageSizeOptions]"
layout="total, sizes, prev, pager, next"
background
/>
</template>
</AdminListPage>
</div>
</div>
</ElConfigProvider>
</template>
<style scoped>
.wecom-bindings {
display: flex;
flex-direction: column;
gap: 16px;
}
.wecom-bindings__block {
display: flex;
flex-direction: column;
gap: 12px;
padding: 16px 32px 24px;
border-top: 1px solid var(--el-border-color-lighter);
}
.wecom-bindings__heading {
margin: 0;
color: var(--el-text-color-primary);
font-size: var(--el-font-size-large);
font-weight: 600;
}
.wecom-bindings__form {
display: grid;
grid-template-columns: 1fr;
column-gap: 16px;
}
.wecom-bindings__submit {
display: flex;
justify-content: flex-end;
}
.wecom-bindings__mono {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.wecom-bindings__status {
margin-left: 8px;
}
:deep(.wecom-filter-search) {
width: 16rem;
}
@media (min-width: 768px) {
.wecom-bindings__form {
grid-template-columns: 1fr 2fr 1fr;
}
}
</style>
@@ -1,16 +1,42 @@
<script setup lang="ts">
/**
* features/admin/modules/wecom/pages/WecomSettingsPage.vue
* 企微系统配置、通知与集成复制。
* 依赖:WECOM_ADMIN_KEY、lucide CircleHelp。
* 逻辑:绑定概览卡片只在绑定管理页展示,本页仅编辑系统/通知配置。
* 用途:企微系统配置、通知指标和集成复制。
* 依赖:AdminListPage、AdminListTabs、WECOM_ADMIN_KEY、element-plus。
* 逻辑:路由 AdminWecomSettings。绑定概览不在本页。表单仍写回同一个 settings 对象,保存函数不变。
*/
import { inject } from 'vue';
import { computed, inject } from 'vue';
import { useI18n } from 'vue-i18n';
import { CircleHelp } from 'lucide-vue-next';
import { QuestionFilled, Refresh } from '@element-plus/icons-vue';
import {
ElAlert,
ElButton,
ElCard,
ElCollapse,
ElCollapseItem,
ElConfigProvider,
ElForm,
ElFormItem,
ElIcon,
ElInput,
ElOption,
ElSelect,
ElStatistic,
ElSwitch,
ElText,
ElTooltip,
} from 'element-plus';
import 'element-plus/dist/index.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/features/admin/styles/element-trial.css';
import AdminListPage from '@/features/admin/components/AdminListPage.vue';
import { useElementProvider } from '@/features/admin/composables/useElementProvider';
import type { WecomIntegrationManifest } from '@/features/admin/types/wecom.types';
import WecomSubNav from '../components/WecomSubNav.vue';
import { WECOM_ADMIN_KEY } from '../wecom.context';
const { t } = useI18n();
const { elementLocale } = useElementProvider();
const {
wecomSystemSettings,
isSaving,
@@ -23,238 +49,426 @@ const {
generateWecomEncodingAesKey,
saveWecomSystemSettings,
saveWecomNotifySettings,
refreshWecomData,
copyText,
} = inject(WECOM_ADMIN_KEY)!;
const copyFieldDefs: Array<{ key: keyof WecomIntegrationManifest; labelKey: string }> = [
{ key: 'public_base_url', labelKey: 'admin.wecom.copyFields.publicBaseUrl' },
{ key: 'callback_url', labelKey: 'admin.wecom.copyFields.callbackUrl' },
{ key: 'callback_token', labelKey: 'admin.wecom.copyFields.callbackToken' },
{ key: 'encoding_aes_key', labelKey: 'admin.wecom.copyFields.encodingAesKey' },
{ key: 'oauth_redirect_uri', labelKey: 'admin.wecom.copyFields.oauthRedirectUri' },
{ key: 'homepage_url', labelKey: 'admin.wecom.copyFields.homepageUrl' },
{ key: 'trusted_domain', labelKey: 'admin.wecom.copyFields.trustedDomain' },
{ key: 'authorize_api', labelKey: 'admin.wecom.copyFields.authorizeApi' },
{ key: 'login_api', labelKey: 'admin.wecom.copyFields.loginApi' },
];
const copyItems = computed(() => {
const manifest = wecomIntegrationManifest.value;
if (!manifest) return [];
return copyFieldDefs.map((item) => ({
key: item.key,
label: t(item.labelKey),
value: manifest[item.key] || '',
}));
});
</script>
<template>
<div class="space-y-6">
<div class="card shadow-sm p-5 space-y-4">
<h3 class="font-semibold text-primary">{{ t('admin.wecom.systemSettings') }}</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
<label class="inline-flex items-center gap-2 text-sm text-secondary">
<input v-model="wecomSystemSettings.enabled" type="checkbox" class="admin-checkbox" />
{{ t('admin.wecom.fields.enabled') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.enabled')" />
</label>
<label class="inline-flex items-center gap-2 text-sm text-secondary">
<input v-model="wecomSystemSettings.auto_create_user" type="checkbox" class="admin-checkbox" />
{{ t('admin.wecom.fields.autoCreateUser') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.autoCreateUser')" />
</label>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
<div>
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.corpId') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.corpId')" />
</label>
<input v-model="wecomSystemSettings.corp_id" class="input-field" />
</div>
<div>
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.agentId') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.agentId')" />
</label>
<input v-model="wecomSystemSettings.agent_id" class="input-field" />
</div>
<div class="md:col-span-2">
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.secret') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.secret')" />
</label>
<input v-model="wecomSystemSettings.secret" type="password" class="input-field" />
</div>
<div class="md:col-span-2">
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.redirectUri') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.redirectUri')" />
</label>
<input v-model="wecomSystemSettings.redirect_uri" class="input-field" />
</div>
<div class="md:col-span-2">
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.publicBaseUrl') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.publicBaseUrl')" />
</label>
<div class="flex flex-wrap gap-2">
<input
v-model="wecomSystemSettings.public_base_url"
:placeholder="t('admin.wecom.publicBasePlaceholder')"
class="input-field flex-1 min-w-[200px]"
/>
<button type="button" class="btn-secondary px-4 shrink-0" @click="generateWecomAddressesFromPublicBase()">
{{ t('admin.wecom.generateAddresses') }}
</button>
</div>
</div>
<div>
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.callbackToken') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.callbackToken')" />
</label>
<div class="flex gap-2">
<input v-model="wecomSystemSettings.callback_token" class="input-field flex-1 min-w-0" />
<button type="button" class="btn-secondary px-3 shrink-0 text-xs" @click="generateWecomCallbackToken()">
{{ t('admin.wecom.generateToken') }}
</button>
</div>
</div>
<div>
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.encodingAesKey') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.encodingAesKey')" />
</label>
<div class="flex gap-2">
<input v-model="wecomSystemSettings.encoding_aes_key" class="input-field flex-1 min-w-0 font-mono text-xs" />
<button type="button" class="btn-secondary px-3 shrink-0 text-xs" @click="generateWecomEncodingAesKey()">
{{ t('admin.wecom.generateEncodingKey') }}
</button>
</div>
</div>
<div>
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.callbackUrl') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.callbackUrl')" />
</label>
<input v-model="wecomSystemSettings.callback_url" class="input-field" />
</div>
<div>
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.homepageUrl') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.homepageUrl')" />
</label>
<input v-model="wecomSystemSettings.homepage_url" class="input-field" />
</div>
<div class="md:col-span-2">
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.trustedDomain') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.trustedDomain')" />
</label>
<input v-model="wecomSystemSettings.trusted_domain" class="input-field" />
</div>
<div>
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.matchRules') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.matchRules')" />
</label>
<input v-model="wecomSystemSettings.match_rules" class="input-field" />
</div>
<div>
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.matchOperator') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.matchOperator')" />
</label>
<select v-model="wecomSystemSettings.match_operator" class="input-field">
<option value="AND">AND</option>
<option value="OR">OR</option>
</select>
</div>
<div>
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.firstLoginBindMode') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.firstLoginBindMode')" />
</label>
<select v-model="wecomSystemSettings.first_login_bind_mode" class="input-field">
<option value="match_rules">{{ t('admin.wecom.bindModes.match_rules') }}</option>
<option value="input_verify">{{ t('admin.wecom.bindModes.input_verify') }}</option>
</select>
</div>
<div>
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.firstLoginInputFields') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.firstLoginInputFields')" />
</label>
<input v-model="wecomSystemSettings.first_login_input_fields" class="input-field" />
</div>
<div>
<label class="mb-1.5 inline-flex items-center gap-1 text-xs text-muted">
{{ t('admin.wecom.fields.employeeIdSource') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.employeeIdSource')" />
</label>
<input v-model="wecomSystemSettings.employee_id_source" class="input-field" />
</div>
<label class="inline-flex items-center gap-2 text-sm text-secondary pt-7">
<input v-model="wecomSystemSettings.mobile_normalize" type="checkbox" class="admin-checkbox" />
{{ t('admin.wecom.fields.mobileNormalize') }}
<CircleHelp class="w-3.5 h-3.5 text-muted" :title="t('admin.wecom.tips.mobileNormalize')" />
</label>
</div>
<div class="flex justify-end">
<button type="button" :disabled="isSaving" class="btn-primary px-5 py-2 disabled:opacity-60" @click="saveWecomSystemSettings()">
{{ t('admin.save') }}
</button>
</div>
</div>
<ElConfigProvider :locale="elementLocale">
<AdminListPage>
<template #title>
<h2 class="section-title">{{ t('admin.wecom.title') }}</h2>
<p class="section-desc mt-1">{{ t('admin.wecom.subtitle') }}</p>
</template>
<template #actions>
<ElButton :icon="Refresh" @click="refreshWecomData()">{{ t('admin.wecom.refresh') }}</ElButton>
</template>
<template #tabs>
<WecomSubNav />
</template>
<div class="grid grid-cols-1 xl:grid-cols-2 gap-6">
<div class="card shadow-sm p-5 space-y-4">
<h3 class="font-semibold text-primary">{{ t('admin.wecom.notifySettings') }}</h3>
<label class="inline-flex items-center gap-2 text-sm text-secondary">
<input v-model="wecomNotifySettings.enabled" type="checkbox" class="admin-checkbox" />
{{ t('admin.wecom.notifyEnabled') }}
</label>
<input v-model="wecomNotifySettings.base_url" :placeholder="t('admin.wecom.notifyBaseUrl')" class="input-field" />
<input v-model="wecomNotifyEventsText" :placeholder="t('admin.wecom.notifyEvents')" class="input-field" />
<div class="flex justify-end">
<button type="button" :disabled="isSaving" class="btn-primary px-5 py-2 disabled:opacity-60" @click="saveWecomNotifySettings()">
{{ t('admin.save') }}
</button>
</div>
</div>
<div class="card shadow-sm p-5 space-y-4">
<h3 class="font-semibold text-primary">{{ t('admin.wecom.notifyMetrics') }}</h3>
<div v-if="wecomNotifyMetrics" class="grid grid-cols-2 gap-3 text-sm">
<div class="rounded-lg bg-surface-soft px-3 py-2">
<div class="text-muted">{{ t('admin.wecom.metricTotal') }}</div>
<div class="text-lg font-semibold text-primary">{{ wecomNotifyMetrics.total }}</div>
</div>
<div class="rounded-lg bg-surface-soft px-3 py-2">
<div class="text-muted">{{ t('admin.wecom.metricSuccessRate') }}</div>
<div class="text-lg font-semibold text-emerald-700">{{ wecomNotifyMetrics.send_success_rate }}%</div>
</div>
<div class="rounded-lg bg-surface-soft px-3 py-2">
<div class="text-muted">{{ t('admin.wecom.metricOpenedRate') }}</div>
<div class="text-lg font-semibold text-blue-700">{{ wecomNotifyMetrics.opened_24h_rate }}%</div>
</div>
<div class="rounded-lg bg-surface-soft px-3 py-2">
<div class="text-muted">{{ t('admin.wecom.metricWindowDays') }}</div>
<div class="text-lg font-semibold text-primary">{{ wecomNotifyMetrics.window_days }}</div>
</div>
</div>
</div>
</div>
<details class="card shadow-sm p-5">
<summary class="cursor-pointer font-semibold text-primary">{{ t('admin.wecom.integrationCopyTitle') }}</summary>
<div class="mt-4 space-y-4">
<p class="text-xs text-muted">{{ t('admin.wecom.integrationCopyDesc') }}</p>
<p class="text-xs text-amber-800 bg-amber-50 border border-amber-100 rounded-lg px-3 py-2">{{ t('admin.wecom.integrationCopySecretsNote') }}</p>
<div v-if="wecomIntegrationManifest" class="grid grid-cols-1 gap-3">
<div
v-for="item in [
{ key: 'public_base_url', label: t('admin.wecom.copyFields.publicBaseUrl') },
{ key: 'callback_url', label: t('admin.wecom.copyFields.callbackUrl') },
{ key: 'callback_token', label: t('admin.wecom.copyFields.callbackToken') },
{ key: 'encoding_aes_key', label: t('admin.wecom.copyFields.encodingAesKey') },
{ key: 'oauth_redirect_uri', label: t('admin.wecom.copyFields.oauthRedirectUri') },
{ key: 'homepage_url', label: t('admin.wecom.copyFields.homepageUrl') },
{ key: 'trusted_domain', label: t('admin.wecom.copyFields.trustedDomain') },
{ key: 'authorize_api', label: t('admin.wecom.copyFields.authorizeApi') },
{ key: 'login_api', label: t('admin.wecom.copyFields.loginApi') },
]"
:key="item.key"
>
<label class="mb-1.5 block text-xs text-muted">{{ item.label }}</label>
<div class="flex gap-2">
<input :value="(wecomIntegrationManifest as any)[item.key] || ''" readonly class="input-field flex-1 bg-surface-soft font-mono text-xs" />
<button type="button" class="btn-secondary px-3" @click="copyText(String((wecomIntegrationManifest as any)[item.key] || ''))">
{{ t('admin.wecom.copy') }}
</button>
<div class="wecom-settings">
<section class="wecom-settings__section">
<h3 class="wecom-settings__heading">{{ t('admin.wecom.systemSettings') }}</h3>
<ElForm label-position="top" :model="wecomSystemSettings" @submit.prevent="saveWecomSystemSettings()">
<div class="wecom-settings__grid">
<ElFormItem>
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.enabled') }}
<ElTooltip :content="t('admin.wecom.tips.enabled')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElSwitch v-model="wecomSystemSettings.enabled" />
</ElFormItem>
<ElFormItem>
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.autoCreateUser') }}
<ElTooltip :content="t('admin.wecom.tips.autoCreateUser')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElSwitch v-model="wecomSystemSettings.auto_create_user" />
</ElFormItem>
<ElFormItem>
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.corpId') }}
<ElTooltip :content="t('admin.wecom.tips.corpId')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElInput v-model="wecomSystemSettings.corp_id" />
</ElFormItem>
<ElFormItem>
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.agentId') }}
<ElTooltip :content="t('admin.wecom.tips.agentId')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElInput v-model="wecomSystemSettings.agent_id" />
</ElFormItem>
<ElFormItem class="wecom-settings__span">
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.secret') }}
<ElTooltip :content="t('admin.wecom.tips.secret')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElInput v-model="wecomSystemSettings.secret" type="password" show-password />
</ElFormItem>
<ElFormItem class="wecom-settings__span">
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.redirectUri') }}
<ElTooltip :content="t('admin.wecom.tips.redirectUri')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElInput v-model="wecomSystemSettings.redirect_uri" />
</ElFormItem>
<ElFormItem class="wecom-settings__span">
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.publicBaseUrl') }}
<ElTooltip :content="t('admin.wecom.tips.publicBaseUrl')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<div class="wecom-settings__inline">
<ElInput
v-model="wecomSystemSettings.public_base_url"
:placeholder="t('admin.wecom.publicBasePlaceholder')"
/>
<ElButton @click="generateWecomAddressesFromPublicBase()">
{{ t('admin.wecom.generateAddresses') }}
</ElButton>
</div>
</ElFormItem>
<ElFormItem>
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.callbackToken') }}
<ElTooltip :content="t('admin.wecom.tips.callbackToken')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<div class="wecom-settings__inline">
<ElInput v-model="wecomSystemSettings.callback_token" />
<ElButton @click="generateWecomCallbackToken()">{{ t('admin.wecom.generateToken') }}</ElButton>
</div>
</ElFormItem>
<ElFormItem>
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.encodingAesKey') }}
<ElTooltip :content="t('admin.wecom.tips.encodingAesKey')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<div class="wecom-settings__inline">
<ElInput v-model="wecomSystemSettings.encoding_aes_key" class="wecom-settings__mono" />
<ElButton @click="generateWecomEncodingAesKey()">{{ t('admin.wecom.generateEncodingKey') }}</ElButton>
</div>
</ElFormItem>
<ElFormItem>
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.callbackUrl') }}
<ElTooltip :content="t('admin.wecom.tips.callbackUrl')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElInput v-model="wecomSystemSettings.callback_url" />
</ElFormItem>
<ElFormItem>
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.homepageUrl') }}
<ElTooltip :content="t('admin.wecom.tips.homepageUrl')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElInput v-model="wecomSystemSettings.homepage_url" />
</ElFormItem>
<ElFormItem class="wecom-settings__span">
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.trustedDomain') }}
<ElTooltip :content="t('admin.wecom.tips.trustedDomain')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElInput v-model="wecomSystemSettings.trusted_domain" />
</ElFormItem>
<ElFormItem>
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.matchRules') }}
<ElTooltip :content="t('admin.wecom.tips.matchRules')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElInput v-model="wecomSystemSettings.match_rules" />
</ElFormItem>
<ElFormItem>
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.matchOperator') }}
<ElTooltip :content="t('admin.wecom.tips.matchOperator')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElSelect v-model="wecomSystemSettings.match_operator">
<ElOption label="AND" value="AND" />
<ElOption label="OR" value="OR" />
</ElSelect>
</ElFormItem>
<ElFormItem>
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.firstLoginBindMode') }}
<ElTooltip :content="t('admin.wecom.tips.firstLoginBindMode')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElSelect v-model="wecomSystemSettings.first_login_bind_mode">
<ElOption :label="t('admin.wecom.bindModes.match_rules')" value="match_rules" />
<ElOption :label="t('admin.wecom.bindModes.input_verify')" value="input_verify" />
</ElSelect>
</ElFormItem>
<ElFormItem>
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.firstLoginInputFields') }}
<ElTooltip :content="t('admin.wecom.tips.firstLoginInputFields')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElInput v-model="wecomSystemSettings.first_login_input_fields" />
</ElFormItem>
<ElFormItem>
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.employeeIdSource') }}
<ElTooltip :content="t('admin.wecom.tips.employeeIdSource')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElInput v-model="wecomSystemSettings.employee_id_source" />
</ElFormItem>
<ElFormItem>
<template #label>
<span class="wecom-settings__label">
{{ t('admin.wecom.fields.mobileNormalize') }}
<ElTooltip :content="t('admin.wecom.tips.mobileNormalize')" placement="top">
<ElIcon class="wecom-settings__help"><QuestionFilled /></ElIcon>
</ElTooltip>
</span>
</template>
<ElSwitch v-model="wecomSystemSettings.mobile_normalize" />
</ElFormItem>
</div>
</div>
<div class="wecom-settings__submit">
<ElButton type="primary" :loading="isSaving" @click="saveWecomSystemSettings()">
{{ t('admin.save') }}
</ElButton>
</div>
</ElForm>
</section>
<div class="wecom-settings__split">
<section class="wecom-settings__section">
<h3 class="wecom-settings__heading">{{ t('admin.wecom.notifySettings') }}</h3>
<ElForm label-position="top" :model="wecomNotifySettings" @submit.prevent="saveWecomNotifySettings()">
<ElFormItem :label="t('admin.wecom.notifyEnabled')">
<ElSwitch v-model="wecomNotifySettings.enabled" />
</ElFormItem>
<ElFormItem :label="t('admin.wecom.notifyBaseUrl')">
<ElInput v-model="wecomNotifySettings.base_url" :placeholder="t('admin.wecom.notifyBaseUrl')" />
</ElFormItem>
<ElFormItem :label="t('admin.wecom.notifyEvents')">
<ElInput v-model="wecomNotifyEventsText" :placeholder="t('admin.wecom.notifyEvents')" />
</ElFormItem>
<div class="wecom-settings__submit">
<ElButton type="primary" :loading="isSaving" @click="saveWecomNotifySettings()">
{{ t('admin.save') }}
</ElButton>
</div>
</ElForm>
</section>
<section class="wecom-settings__section">
<h3 class="wecom-settings__heading">{{ t('admin.wecom.notifyMetrics') }}</h3>
<div v-if="wecomNotifyMetrics" class="wecom-settings__metrics">
<ElCard shadow="never">
<ElStatistic :title="t('admin.wecom.metricTotal')" :value="wecomNotifyMetrics.total" />
</ElCard>
<ElCard shadow="never">
<ElStatistic :title="t('admin.wecom.metricSuccessRate')" :value="wecomNotifyMetrics.send_success_rate" suffix="%" />
</ElCard>
<ElCard shadow="never">
<ElStatistic :title="t('admin.wecom.metricOpenedRate')" :value="wecomNotifyMetrics.opened_24h_rate" suffix="%" />
</ElCard>
<ElCard shadow="never">
<ElStatistic :title="t('admin.wecom.metricWindowDays')" :value="wecomNotifyMetrics.window_days" />
</ElCard>
</div>
</section>
</div>
<section class="wecom-settings__section">
<ElCollapse>
<ElCollapseItem :title="t('admin.wecom.integrationCopyTitle')" name="copy">
<ElText class="wecom-settings__copy-desc" type="info">{{ t('admin.wecom.integrationCopyDesc') }}</ElText>
<ElAlert
class="wecom-settings__copy-note"
type="warning"
:closable="false"
:title="t('admin.wecom.integrationCopySecretsNote')"
/>
<ElForm v-if="copyItems.length" label-position="top">
<ElFormItem v-for="item in copyItems" :key="item.key" :label="item.label">
<div class="wecom-settings__inline">
<ElInput :model-value="item.value" readonly class="wecom-settings__mono" />
<ElButton @click="copyText(item.value)">{{ t('admin.wecom.copy') }}</ElButton>
</div>
</ElFormItem>
</ElForm>
</ElCollapseItem>
</ElCollapse>
</section>
</div>
</details>
</div>
</AdminListPage>
</ElConfigProvider>
</template>
<style scoped>
.wecom-settings__section {
padding: 16px 32px 8px;
border-top: 1px solid var(--el-border-color-lighter);
}
.wecom-settings__heading {
margin: 0 0 12px;
color: var(--el-text-color-primary);
font-size: var(--el-font-size-large);
font-weight: 600;
}
.wecom-settings__grid {
display: grid;
grid-template-columns: 1fr;
column-gap: 16px;
}
.wecom-settings__label {
display: inline-flex;
align-items: center;
gap: 4px;
}
.wecom-settings__help {
color: var(--el-text-color-secondary);
cursor: help;
}
.wecom-settings__inline {
display: flex;
gap: 8px;
width: 100%;
}
.wecom-settings__inline .el-input {
flex: 1;
min-width: 0;
}
.wecom-settings__submit {
display: flex;
justify-content: flex-end;
padding-bottom: 8px;
}
.wecom-settings__split {
display: grid;
grid-template-columns: 1fr;
}
.wecom-settings__metrics {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
padding-bottom: 16px;
}
.wecom-settings__copy-desc,
.wecom-settings__copy-note {
display: block;
margin-bottom: 12px;
}
.wecom-settings__mono :deep(.el-input__inner) {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (min-width: 768px) {
.wecom-settings__grid {
grid-template-columns: 1fr 1fr;
}
.wecom-settings__span {
grid-column: 1 / -1;
}
}
@media (min-width: 1280px) {
.wecom-settings__split {
grid-template-columns: 1fr 1fr;
}
}
</style>
+7 -7
View File
@@ -5612,7 +5612,7 @@
"types": "Training Types",
"typeCount": "{count} configurations",
"detail": "Configuration Details",
"headerMeta": "Type: {type} · Current version: {version}",
"headerMeta": "Type code: {type}",
"addType": "Add Training Type",
"editType": "Edit Training Type",
"empty": "No training configurations",
@@ -5663,6 +5663,7 @@
},
"placeholders": {
"onePerLine": "Enter one item per line",
"typeCode": "Example: onboarding",
"oneQuestionPerLine": "Enter one question per line",
"progressItemLabel": "Example: Watch video",
"progressHintText": "Example: Training is complete only after the video, knowledge review, and exam are all finished.",
@@ -5681,6 +5682,11 @@
"progressHintText": "Training progress note",
"stepIntroText": "Training step guide copy",
"requiredDuration": "Required time (minutes)",
"requiredDurationPlaceholder": "0 means no limit",
"stageSummaryTitle": "Level summaries (one item per line)",
"stageSummaryCompany": "Company summary",
"stageSummaryDepartment": "Department summary",
"stageSummaryTeam": "Team summary",
"summaryPoints": "Review points",
"summaryChecklist": "Pre-exam checklist",
"employeeQuestions": "Employee FAQs",
@@ -5797,12 +5803,6 @@
"eyebrow": "Training Operations Center",
"pageHint": "Configuration changes take effect after saving",
"footerHint": "All configuration items can be adjusted after saving",
"stats": {
"total": "Total Configs",
"published": "Published",
"resources": "Current Materials",
"levels": "Configured Levels"
},
"questionBankTitle": "Onboarding Question Bank"
},
"integrationConnector": {
+7 -7
View File
@@ -5612,7 +5612,7 @@
"types": "ประเภทการฝึกอบรม",
"typeCount": "ทั้งหมด {count} การกำหนดค่า",
"detail": "รายละเอียดการกำหนดค่า",
"headerMeta": "ประเภท: {type} · เวอร์ชันปัจจุบัน: {version}",
"headerMeta": "รหัสประเภท: {type}",
"addType": "เพิ่มประเภทการฝึกอบรม",
"editType": "แก้ไขประเภทการฝึกอบรม",
"empty": "ยังไม่มีการกำหนดค่า",
@@ -5663,6 +5663,7 @@
},
"placeholders": {
"onePerLine": "กรอกหนึ่งรายการต่อบรรทัด",
"typeCode": "ตัวอย่าง: onboarding",
"oneQuestionPerLine": "กรอกหนึ่งคำถามต่อบรรทัด",
"progressItemLabel": "ตัวอย่าง: ดูวิดีโอ",
"progressHintText": "ตัวอย่าง: จะถือว่าเสร็จสิ้นเมื่อทำวิดีโอ ทบทวนความรู้ และข้อสอบครบแล้ว",
@@ -5681,6 +5682,11 @@
"progressHintText": "คำอธิบายความคืบหน้าการฝึกอบรม",
"stepIntroText": "ข้อความแนะนำขั้นตอนการฝึกอบรม",
"requiredDuration": "เวลาที่ต้องใช้ (นาที)",
"requiredDurationPlaceholder": "0 หมายถึงไม่จำกัด",
"stageSummaryTitle": "สรุปตามระดับ (หนึ่งรายการต่อบรรทัด)",
"stageSummaryCompany": "สรุประดับบริษัท",
"stageSummaryDepartment": "สรุประดับแผนก",
"stageSummaryTeam": "สรุประดับทีม",
"summaryPoints": "ประเด็นทบทวน",
"summaryChecklist": "รายการก่อนสอบ",
"employeeQuestions": "คำถามที่พบบ่อยของพนักงาน",
@@ -5797,12 +5803,6 @@
"eyebrow": "培训运营中心",
"pageHint": "配置变更将在保存后生效",
"footerHint": "所有配置项均支持保存后继续调整",
"stats": {
"total": "配置总数",
"published": "已发布",
"resources": "当前资料",
"levels": "已配置级别"
},
"questionBankTitle": "入职培训题库"
},
"integrationConnector": {
+7 -7
View File
@@ -5626,16 +5626,10 @@
"subtitle": "按培训类型管理版本、考试规则、资源与题目",
"pageHint": "配置变更将在保存后生效",
"footerHint": "所有配置项均支持保存后继续调整",
"stats": {
"total": "配置总数",
"published": "已发布",
"resources": "当前资料",
"levels": "已配置级别"
},
"types": "培训类型",
"typeCount": "共 {count} 个配置",
"detail": "配置详情",
"headerMeta": "类型编码:{type} · 当前版本:{version}",
"headerMeta": "类型编码:{type}",
"addType": "新增培训类型",
"editType": "编辑培训类型",
"empty": "暂无培训配置",
@@ -5687,6 +5681,7 @@
},
"placeholders": {
"onePerLine": "每行填写一项",
"typeCode": "例如 onboarding,小写字母开头",
"oneQuestionPerLine": "每行填写一个问题",
"progressItemLabel": "例如:观看视频",
"progressHintText": "例如:按 HR 要求完成视频、知识点、考试三个环节后才能视为完成。",
@@ -5705,6 +5700,11 @@
"progressHintText": "培训进度说明",
"stepIntroText": "培训步骤引导文案",
"requiredDuration": "所需时间(分钟)",
"requiredDurationPlaceholder": "0 表示不限制",
"stageSummaryTitle": "分级培训总结(按行分隔)",
"stageSummaryCompany": "公司级总结",
"stageSummaryDepartment": "部门级总结",
"stageSummaryTeam": "班组级总结",
"summaryPoints": "复盘要点",
"summaryChecklist": "考前清单",
"employeeQuestions": "员工常见问题",
+7 -7
View File
@@ -5612,7 +5612,7 @@
"types": "培訓類型",
"typeCount": "共 {count} 個配置",
"detail": "配置詳情",
"headerMeta": "類型編碼:{type} · 目前版本:{version}",
"headerMeta": "類型編碼:{type}",
"addType": "新增培訓類型",
"editType": "編輯培訓類型",
"empty": "暫無培訓配置",
@@ -5663,6 +5663,7 @@
},
"placeholders": {
"onePerLine": "每行填寫一項",
"typeCode": "例如 onboarding,小寫字母開頭",
"oneQuestionPerLine": "每行填寫一個問題",
"progressItemLabel": "例如:觀看影片",
"progressHintText": "例如:按 HR 要求完成影片、知識點、考試三個環節後才算完成。",
@@ -5681,6 +5682,11 @@
"progressHintText": "培訓進度說明",
"stepIntroText": "培訓步驟引導文案",
"requiredDuration": "所需時間(分鐘)",
"requiredDurationPlaceholder": "0 表示不限制",
"stageSummaryTitle": "分級培訓總結(按行分隔)",
"stageSummaryCompany": "公司級總結",
"stageSummaryDepartment": "部門級總結",
"stageSummaryTeam": "班組級總結",
"summaryPoints": "複盤要點",
"summaryChecklist": "考前清單",
"employeeQuestions": "員工常見問題",
@@ -5797,12 +5803,6 @@
"eyebrow": "培训运营中心",
"pageHint": "配置变更将在保存后生效",
"footerHint": "所有配置项均支持保存后继续调整",
"stats": {
"total": "配置总数",
"published": "已发布",
"resources": "当前资料",
"levels": "已配置级别"
},
"questionBankTitle": "入职培训题库"
},
"integrationConnector": {