Merge branch 'invoice-check' into dev
This commit is contained in:
commit
9570197378
104 files changed
+5844
-4271
No files matched your search
@@ -3,6 +3,7 @@
|
||||
* 常用问题 / FAQ 缓存创建与编辑居中弹窗。
|
||||
* 依赖:QuestionFormState、admin 通用 modal 样式。
|
||||
* 逻辑:QuestionsPage 打开本组件;提交时 emit save,由 composable 调 API。
|
||||
* is_enabled 仅控制工作台首页入口;cache_enabled 单独控制聊天是否跳过 Dify。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
@@ -86,13 +87,16 @@ const isStale = computed(() => Boolean(props.form.stale_at));
|
||||
<label class="label-field">{{ t('admin.question.fields.sortOrder') }}</label>
|
||||
<input v-model.number="form.sort_order" type="number" class="input-field text-sm" />
|
||||
</div>
|
||||
<div class="md:col-span-2 flex flex-wrap gap-6">
|
||||
<label class="inline-flex items-center gap-2 text-sm text-secondary cursor-pointer">
|
||||
<input v-model="form.is_enabled" type="checkbox" class="accent-brand-600" />
|
||||
<span>{{ t('admin.question.fields.isEnabled') }}</span>
|
||||
<div class="md:col-span-2 space-y-3">
|
||||
<label class="flex items-start gap-2 text-sm text-secondary cursor-pointer">
|
||||
<input v-model="form.is_enabled" type="checkbox" class="mt-0.5 accent-brand-600" />
|
||||
<span>
|
||||
<span class="block">{{ t('admin.question.fields.isEnabled') }}</span>
|
||||
<span class="block text-xs text-muted mt-0.5">{{ t('admin.question.fields.isEnabledHelp') }}</span>
|
||||
</span>
|
||||
</label>
|
||||
<label class="inline-flex items-center gap-2 text-sm text-secondary cursor-pointer">
|
||||
<input v-model="form.cache_enabled" type="checkbox" class="accent-brand-600" />
|
||||
<label class="flex items-start gap-2 text-sm text-secondary cursor-pointer">
|
||||
<input v-model="form.cache_enabled" type="checkbox" class="mt-0.5 accent-brand-600" />
|
||||
<span>{{ t('admin.question.fields.cacheEnabled') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/**
|
||||
* features/admin/modules/wecom/composables/useWecomAdmin.ts
|
||||
* 企业微信:绑定、系统配置、通知、登录审计。
|
||||
* 依赖:admin.api、useMessage、wecom 展示工具、PaginationBar 所需的审计分页状态。
|
||||
* 逻辑:绑定走服务端分页;登录审计仍一次拉取最近 200 条,由前端切片分页。
|
||||
*/
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -60,7 +62,24 @@ export function useWecomAdmin() {
|
||||
let wecomBindUserCloseTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
const wecomAuditSourceFilter = ref<'all' | 'wecom' | 'password'>('all');
|
||||
const wecomAuditStatusFilter = ref<'all' | 'success' | 'failed'>('all');
|
||||
const wecomAuditsPage = ref(1);
|
||||
const wecomAuditsPageSize = ref(20);
|
||||
const wecomAuditsPageSizeOptions = [10, 20, 50, 100] as const;
|
||||
const filteredWecomLoginAudits = computed(() => wecomLoginAudits.value);
|
||||
const wecomAuditsTotal = computed(() => filteredWecomLoginAudits.value.length);
|
||||
|
||||
/**
|
||||
* 对已拉取的审计列表做前端切片,不请求后端分页。
|
||||
* 核心逻辑:按 pageSize 计算安全页码后 slice,避免筛选后落到空页。
|
||||
*/
|
||||
const pagedWecomLoginAudits = computed(() => {
|
||||
const size = Math.max(1, Number(wecomAuditsPageSize.value) || 20);
|
||||
const total = wecomAuditsTotal.value;
|
||||
const pages = Math.max(1, Math.ceil(total / size));
|
||||
const page = Math.min(Math.max(1, wecomAuditsPage.value), pages);
|
||||
const start = (page - 1) * size;
|
||||
return filteredWecomLoginAudits.value.slice(start, start + size);
|
||||
});
|
||||
const wecomNotifySettings = ref<WecomNotifySettings>({
|
||||
enabled: true,
|
||||
base_url: '',
|
||||
@@ -158,6 +177,10 @@ export function useWecomAdmin() {
|
||||
void loadWecomBindings();
|
||||
};
|
||||
|
||||
/**
|
||||
* 拉取登录审计(后端固定最近 200 条,前端再分页)。
|
||||
* 核心逻辑:带上 source/status 筛选调用 listAdminWecomLoginAudits。
|
||||
*/
|
||||
const loadWecomAudits = async (): Promise<void> => {
|
||||
try {
|
||||
const params = new URLSearchParams({ limit: '200' });
|
||||
@@ -466,6 +489,7 @@ export function useWecomAdmin() {
|
||||
});
|
||||
|
||||
watch([wecomAuditSourceFilter, wecomAuditStatusFilter], () => {
|
||||
wecomAuditsPage.value = 1;
|
||||
void loadWecomAudits();
|
||||
});
|
||||
|
||||
@@ -487,7 +511,12 @@ export function useWecomAdmin() {
|
||||
wecomBoundOnly,
|
||||
wecomAuditSourceFilter,
|
||||
wecomAuditStatusFilter,
|
||||
wecomAuditsPage,
|
||||
wecomAuditsPageSize,
|
||||
wecomAuditsPageSizeOptions,
|
||||
wecomAuditsTotal,
|
||||
filteredWecomLoginAudits,
|
||||
pagedWecomLoginAudits,
|
||||
wecomNotifySettings,
|
||||
wecomNotifyEventsText,
|
||||
wecomNotifyMetrics,
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
/**
|
||||
* features/admin/modules/wecom/pages/WecomAuditsPage.vue
|
||||
* 企微与密码登录审计列表。
|
||||
* 依赖:WECOM_ADMIN_KEY、PaginationBar、formatLocalDateTime。
|
||||
* 逻辑:表格渲染当前页切片;分页条对已拉取的最近 200 条做前端翻页。
|
||||
*/
|
||||
import { inject } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Download } from 'lucide-vue-next';
|
||||
import PaginationBar from '@/shared/components/PaginationBar.vue';
|
||||
import { formatLocalDateTime } from '@/shared/utils/dateTime';
|
||||
import { WECOM_ADMIN_KEY } from '../wecom.context';
|
||||
|
||||
@@ -13,7 +16,12 @@ const { t } = useI18n();
|
||||
const {
|
||||
wecomAuditSourceFilter,
|
||||
wecomAuditStatusFilter,
|
||||
wecomAuditsPage,
|
||||
wecomAuditsPageSize,
|
||||
wecomAuditsPageSizeOptions,
|
||||
wecomAuditsTotal,
|
||||
filteredWecomLoginAudits,
|
||||
pagedWecomLoginAudits,
|
||||
exportWecomAudits,
|
||||
getWecomAuditReasonText,
|
||||
getWecomAuditMetaText,
|
||||
@@ -57,7 +65,7 @@ const {
|
||||
<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 filteredWecomLoginAudits" :key="row.id">
|
||||
<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>
|
||||
@@ -82,5 +90,13 @@ const {
|
||||
</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>
|
||||
</template>
|
||||
@@ -2,11 +2,12 @@
|
||||
/**
|
||||
* features/admin/modules/wecom/pages/WecomSettingsPage.vue
|
||||
* 企微系统配置、通知与集成复制。
|
||||
* 依赖:WECOM_ADMIN_KEY、lucide CircleHelp。
|
||||
* 逻辑:绑定概览卡片只在绑定管理页展示,本页仅编辑系统/通知配置。
|
||||
*/
|
||||
import { inject } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { CircleHelp } from 'lucide-vue-next';
|
||||
import WecomOverviewCards from '../components/WecomOverviewCards.vue';
|
||||
import { WECOM_ADMIN_KEY } from '../wecom.context';
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -28,8 +29,6 @@ const {
|
||||
|
||||
<template>
|
||||
<div class="space-y-6">
|
||||
<WecomOverviewCards />
|
||||
|
||||
<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">
|
||||
|
||||
Reference in new issue
Block a user