fix: the UI improvement
This commit is contained in:
1 parent
d13f1035cc
commit
5330e08281
13 files changed
+240
-90
No files matched your search
@@ -1,14 +1,16 @@
|
||||
<!--
|
||||
features/contract-payment/components/ContractPaymentChatPanel.vue
|
||||
用途:合同付款预警 Chat 主区:管理员按钮、三 Tab、当前 Tab 内详情下钻。
|
||||
依赖:contract-payment 三页与详情、useContractPaymentAdminActions、vue-router query。
|
||||
依赖:contract-payment 三页与详情、useContractPaymentAdminActions、vue-router query、lucide-vue-next。
|
||||
逻辑:由 ChatViewContent 在 agent_code=contract_payment 时替换消息列表与输入框;
|
||||
view / contractId 写入 /chat/:agentId 查询参数,旧工作台地址重定向后仍可深链打开。
|
||||
列表 Tab 内容区 overflow-hidden,把纵向滚动交给子页表格区域;Chat 顶栏仅保留标题。
|
||||
管理员顶栏顺序:同步 OA → 发送预警 → 更多;前两者常显,低频操作收进「更多」以节省小屏高度。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { CalendarClock, RefreshCw, Send } from 'lucide-vue-next';
|
||||
import { CalendarClock, ChevronDown, RefreshCw, Send } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import { listContractPaymentContracts } from '../api/contract-payment.api';
|
||||
@@ -31,6 +33,9 @@ const parsedQuery = computed(() => parseContractPaymentChatQuery(route.query.vie
|
||||
const activeView = computed<ContractPaymentView>(() => parsedQuery.value.view);
|
||||
const detailId = computed(() => parsedQuery.value.contractId);
|
||||
const reviewCount = ref(0);
|
||||
/** 管理员「更多」操作菜单是否展开。 */
|
||||
const moreMenuOpen = ref(false);
|
||||
const moreMenuRef = ref<HTMLElement | null>(null);
|
||||
|
||||
const {
|
||||
isAdmin,
|
||||
@@ -100,8 +105,39 @@ async function loadReviewCount(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换管理员「更多」菜单展开状态。
|
||||
*/
|
||||
function toggleMoreMenu(): void {
|
||||
moreMenuOpen.value = !moreMenuOpen.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭「更多」菜单后执行低频管理操作,避免菜单遮挡确认弹窗。
|
||||
* @param action - force-sync / reparse-existing / scan
|
||||
*/
|
||||
function runFromMoreMenu(action: 'force-sync' | 'reparse-existing' | 'scan'): void {
|
||||
moreMenuOpen.value = false;
|
||||
run(action);
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击菜单外区域时收起「更多」菜单。
|
||||
*/
|
||||
function onDocumentPointerDown(event: PointerEvent): void {
|
||||
const root = moreMenuRef.value;
|
||||
if (!moreMenuOpen.value || !root) return;
|
||||
if (event.target instanceof Node && root.contains(event.target)) return;
|
||||
moreMenuOpen.value = false;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void loadReviewCount();
|
||||
document.addEventListener('pointerdown', onDocumentPointerDown);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
document.removeEventListener('pointerdown', onDocumentPointerDown);
|
||||
});
|
||||
|
||||
watch(
|
||||
@@ -116,36 +152,75 @@ watch(
|
||||
|
||||
<template>
|
||||
<section class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-[var(--surface-muted,#f4f7fb)]">
|
||||
<div class="flex flex-wrap items-start justify-between gap-3 px-5 pt-5">
|
||||
<div class="flex flex-wrap items-center justify-between gap-2 px-5 pt-3">
|
||||
<div class="min-w-0">
|
||||
<h1 class="text-xl font-bold text-primary">{{ t('admin.contractPayment.title') }}</h1>
|
||||
<p class="mt-1 text-sm text-muted">{{ t('admin.contractPayment.subtitle') }}</p>
|
||||
<h1 class="text-lg font-bold text-primary md:text-xl">{{ t('admin.contractPayment.title') }}</h1>
|
||||
</div>
|
||||
<div v-if="isAdmin" class="flex flex-wrap gap-2">
|
||||
<div v-if="isAdmin" class="flex flex-wrap items-center gap-2">
|
||||
<button class="btn-secondary-ds" type="button" :disabled="actionLoading" @click="run('sync')">
|
||||
<RefreshCw class="h-4 w-4" />{{ t('admin.contractPayment.sync') }}
|
||||
</button>
|
||||
<button class="btn-secondary-ds" type="button" :disabled="actionLoading" @click="run('force-sync')">
|
||||
<RefreshCw class="h-4 w-4" />{{ t('admin.contractPayment.forceSync') }}
|
||||
</button>
|
||||
<button class="btn-secondary-ds" type="button" :disabled="actionLoading" @click="run('reparse-existing')">
|
||||
<RefreshCw class="h-4 w-4" />{{ t('admin.contractPayment.reparseExisting') }}
|
||||
</button>
|
||||
<button class="btn-secondary-ds" type="button" :disabled="actionLoading" @click="run('scan')">
|
||||
<CalendarClock class="h-4 w-4" />{{ t('admin.contractPayment.scanAlerts') }}
|
||||
<RefreshCw class="h-4 w-4" aria-hidden="true" />{{ t('admin.contractPayment.sync') }}
|
||||
</button>
|
||||
<button class="btn-primary" type="button" :disabled="actionLoading" @click="run('weekly')">
|
||||
<Send class="h-4 w-4" />{{ t('admin.contractPayment.weeklySend') }}
|
||||
<Send class="h-4 w-4" aria-hidden="true" />{{ t('admin.contractPayment.weeklySend') }}
|
||||
</button>
|
||||
<div ref="moreMenuRef" class="relative">
|
||||
<button
|
||||
class="btn-secondary-ds"
|
||||
type="button"
|
||||
:disabled="actionLoading"
|
||||
:aria-expanded="moreMenuOpen"
|
||||
aria-haspopup="menu"
|
||||
@click="toggleMoreMenu"
|
||||
>
|
||||
{{ t('admin.contractPayment.moreActions') }}
|
||||
<ChevronDown class="h-4 w-4" :class="moreMenuOpen ? 'rotate-180' : ''" aria-hidden="true" />
|
||||
</button>
|
||||
<div
|
||||
v-if="moreMenuOpen"
|
||||
class="absolute right-0 z-20 mt-1 min-w-[14rem] overflow-hidden rounded-xl border border-default bg-surface py-1 shadow-lg"
|
||||
role="menu"
|
||||
>
|
||||
<button
|
||||
class="flex w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-surface-soft disabled:opacity-50"
|
||||
type="button"
|
||||
role="menuitem"
|
||||
:disabled="actionLoading"
|
||||
@click="runFromMoreMenu('force-sync')"
|
||||
>
|
||||
<RefreshCw class="h-4 w-4 shrink-0" aria-hidden="true" />
|
||||
{{ t('admin.contractPayment.forceSync') }}
|
||||
</button>
|
||||
<button
|
||||
class="flex w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-surface-soft disabled:opacity-50"
|
||||
type="button"
|
||||
role="menuitem"
|
||||
:disabled="actionLoading"
|
||||
@click="runFromMoreMenu('reparse-existing')"
|
||||
>
|
||||
<RefreshCw class="h-4 w-4 shrink-0" aria-hidden="true" />
|
||||
{{ t('admin.contractPayment.reparseExisting') }}
|
||||
</button>
|
||||
<button
|
||||
class="flex w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-surface-soft disabled:opacity-50"
|
||||
type="button"
|
||||
role="menuitem"
|
||||
:disabled="actionLoading"
|
||||
@click="runFromMoreMenu('scan')"
|
||||
>
|
||||
<CalendarClock class="h-4 w-4 shrink-0" aria-hidden="true" />
|
||||
{{ t('admin.contractPayment.scanAlerts') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 flex gap-0 border-b border-default px-5">
|
||||
<div class="mt-2 flex gap-0 border-b border-default px-5 md:mt-3">
|
||||
<button
|
||||
v-for="tab in tabs"
|
||||
:key="tab.key"
|
||||
type="button"
|
||||
class="mb-[-1px] border-b-2 px-4 py-2.5 text-sm font-bold"
|
||||
class="mb-[-1px] border-b-2 px-3 py-2 text-sm font-bold md:px-4 md:py-2.5"
|
||||
:class="activeView === tab.key
|
||||
? 'border-brand-500 text-brand-600'
|
||||
: 'border-transparent text-muted hover:text-secondary'"
|
||||
@@ -159,7 +234,10 @@ watch(
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="min-h-0 flex-1 overflow-auto px-5 py-4">
|
||||
<div
|
||||
class="flex min-h-0 flex-1 flex-col px-5 py-2 md:py-3"
|
||||
:class="detailId ? 'overflow-auto' : 'overflow-hidden'"
|
||||
>
|
||||
<ContractPaymentDetailPage
|
||||
v-if="detailId"
|
||||
:contract-id="detailId"
|
||||
@@ -168,16 +246,19 @@ watch(
|
||||
/>
|
||||
<ContractPaymentPage
|
||||
v-else-if="activeView === 'ledger'"
|
||||
class="h-full min-h-0 flex-1"
|
||||
embedded
|
||||
@open-detail="openDetail"
|
||||
/>
|
||||
<ContractPaymentReviewPage
|
||||
v-else-if="activeView === 'review'"
|
||||
class="h-full min-h-0 flex-1"
|
||||
embedded
|
||||
@open-detail="openDetail"
|
||||
/>
|
||||
<ContractPaymentWeeklyBatchesPage
|
||||
v-else
|
||||
class="h-full min-h-0 flex-1"
|
||||
embedded
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user