Merge branch 'dev' into test
This commit is contained in:
commit
36f3cdb58c
24 files changed
+535
-128
No files matched your search
@@ -17,7 +17,8 @@ export interface ContractAttachment {
|
||||
}
|
||||
export interface ContractPaymentContract {
|
||||
id: number; contract_no?: string | null; workflow_no?: string | null; purchase_order_no?: string | null;
|
||||
supplier_name?: string | null; total_amount?: string | null; currency?: string | null; applicant_name?: string | null;
|
||||
supplier_name?: string | null; company_name?: string | null; erp_schema?: string | null;
|
||||
total_amount?: string | null; currency?: string | null; applicant_name?: string | null;
|
||||
effective_date?: string | null; delivery_due_date?: string | null; oa_archive_at?: string | null;
|
||||
status: string; parse_status: string; plan_status: string; parse_issues?: string[]; nodes: PaymentNode[]; alerts?: PaymentAlert[]; attachments?: ContractAttachment[];
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
逻辑:由 ChatViewContent 在 agent_code=contract_payment 时替换消息列表与输入框;
|
||||
view / contractId 写入 /chat/:agentId 查询参数,旧工作台地址重定向后仍可深链打开。
|
||||
列表 Tab 内容区 overflow-hidden,把纵向滚动交给子页表格区域;Chat 顶栏仅保留标题。
|
||||
管理员顶栏顺序:同步 OA → 发送预警 → 更多;前两者常显,低频操作收进「更多」以节省小屏高度。
|
||||
管理员顶栏顺序:同步 OA → 发送预警 → 更多;前两者常显,低频操作收进「更多」以节省小屏高度。这些操作确认后才入队。
|
||||
发送预警结束后重新拉取周汇总批次,避免列表停在点击前的失败记录。
|
||||
待确认与台账点进合同都打开原来的详情。待复核详情上的人工复核确认后回到合同台账并刷新角标。
|
||||
-->
|
||||
@@ -52,11 +52,10 @@ async function reloadWeeklyBatches(): Promise<void> {
|
||||
const {
|
||||
isAdmin,
|
||||
actionLoading,
|
||||
showForceSyncConfirm,
|
||||
showReparseExistingConfirm,
|
||||
showActionConfirm,
|
||||
confirmCopy,
|
||||
run,
|
||||
confirmForceSync,
|
||||
confirmReparseExisting,
|
||||
confirmPendingAction,
|
||||
} = useContractPaymentAdminActions(reloadWeeklyBatches);
|
||||
|
||||
const tabs = computed(() => ([
|
||||
@@ -288,19 +287,11 @@ watch(
|
||||
|
||||
<DeleteConfirmDialog
|
||||
v-if="isAdmin"
|
||||
v-model="showForceSyncConfirm"
|
||||
:title="t('admin.contractPayment.forceSync')"
|
||||
:message="t('admin.contractPayment.forceSyncConfirm')"
|
||||
v-model="showActionConfirm"
|
||||
:title="confirmCopy.title"
|
||||
:message="confirmCopy.message"
|
||||
confirm-tone="primary"
|
||||
@confirm="confirmForceSync"
|
||||
/>
|
||||
<DeleteConfirmDialog
|
||||
v-if="isAdmin"
|
||||
v-model="showReparseExistingConfirm"
|
||||
:title="t('admin.contractPayment.reparseExisting')"
|
||||
:message="t('admin.contractPayment.reparseExistingConfirm')"
|
||||
confirm-tone="primary"
|
||||
@confirm="confirmReparseExisting"
|
||||
@confirm="confirmPendingAction"
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
+52
-19
@@ -2,7 +2,7 @@
|
||||
* features/contract-payment/composables/useContractPaymentAdminActions.ts
|
||||
* 用途:合同付款预警管理员异步任务(同步 / 重解析 / 扫描 / 发送)共用入口。
|
||||
* 依赖:contract-payment.api、useAuthStore、useMessage、i18n。
|
||||
* 逻辑:Chat 顶栏与旧台账页共用;非管理员直接忽略,强制覆盖和存量重解析先走确认框。
|
||||
* 逻辑:Chat 顶栏与旧台账页共用;非管理员直接忽略。同步、强制覆盖、存量重解析、扫描和发送预警都先走确认框。
|
||||
* 发送预警会等到后台任务结束,再按 sent/failed 提示,并回调刷新周汇总列表。
|
||||
*/
|
||||
import { computed, ref } from 'vue';
|
||||
@@ -43,7 +43,7 @@ async function waitForWeeklyJob(jobId: number): Promise<ContractPaymentJob | nul
|
||||
|
||||
/**
|
||||
* 提供合同付款预警管理员操作状态与提交函数。
|
||||
* 核心逻辑:仅 role=admin 可提交。同步、重解析、扫描入队后即提示已提交。
|
||||
* 核心逻辑:仅 role=admin 可提交。同步、强制覆盖、重解析、扫描和发送都先确认再入队。
|
||||
* 发送预警会等到 Worker 结束,先刷新列表,再按 sent/failed 提示。
|
||||
* @param onAfterScanOrWeekly - 扫描提交后或周汇总发送结束后刷新列表的回调
|
||||
*/
|
||||
@@ -53,8 +53,8 @@ export function useContractPaymentAdminActions(onAfterScanOrWeekly?: () => Promi
|
||||
const msg = useMessage();
|
||||
const isAdmin = computed(() => auth.isAdmin);
|
||||
const actionLoading = ref(false);
|
||||
const showForceSyncConfirm = ref(false);
|
||||
const showReparseExistingConfirm = ref(false);
|
||||
/** 等待用户确认的管理操作;为空时确认框关闭。 */
|
||||
const confirmAction = ref<ContractPaymentAdminAction | null>(null);
|
||||
|
||||
/**
|
||||
* 按周汇总任务的 sent/failed 给出结果,避免把入队成功说成已经发出。
|
||||
@@ -115,28 +115,61 @@ export function useContractPaymentAdminActions(onAfterScanOrWeekly?: () => Promi
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发任务入口;强制覆盖和存量重解析先弹出确认框。
|
||||
* 返回当前待确认操作的标题和说明。
|
||||
* 核心逻辑:五种管理操作共用一个确认框,文案按操作切换。
|
||||
*/
|
||||
const confirmCopy = computed(() => {
|
||||
switch (confirmAction.value) {
|
||||
case 'sync':
|
||||
return { title: t('admin.contractPayment.sync'), message: t('admin.contractPayment.syncConfirm') };
|
||||
case 'force-sync':
|
||||
return { title: t('admin.contractPayment.forceSync'), message: t('admin.contractPayment.forceSyncConfirm') };
|
||||
case 'reparse-existing':
|
||||
return { title: t('admin.contractPayment.reparseExisting'), message: t('admin.contractPayment.reparseExistingConfirm') };
|
||||
case 'scan':
|
||||
return { title: t('admin.contractPayment.scanAlerts'), message: t('admin.contractPayment.scanAlertsConfirm') };
|
||||
case 'weekly':
|
||||
return { title: t('admin.contractPayment.weeklySend'), message: t('admin.contractPayment.weeklySendConfirm') };
|
||||
default:
|
||||
return { title: '', message: '' };
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 确认框显隐。关闭时清掉待确认操作,避免下次打开仍执行上一次动作。
|
||||
*/
|
||||
const showActionConfirm = computed({
|
||||
get: () => confirmAction.value !== null,
|
||||
set: (open: boolean) => {
|
||||
if (!open) confirmAction.value = null;
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 触发任务入口。所有管理操作都先弹出确认框,确认后才入队。
|
||||
* @param action - sync / force-sync / reparse-existing / scan / weekly
|
||||
*/
|
||||
function run(action: ContractPaymentAdminAction): void {
|
||||
if (!isAdmin.value) return;
|
||||
if (action === 'force-sync') {
|
||||
showForceSyncConfirm.value = true;
|
||||
return;
|
||||
}
|
||||
if (action === 'reparse-existing') {
|
||||
showReparseExistingConfirm.value = true;
|
||||
return;
|
||||
}
|
||||
void submitAction(action);
|
||||
if (!isAdmin.value || actionLoading.value) return;
|
||||
confirmAction.value = action;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户确认后提交当前操作。
|
||||
* 核心逻辑:先取出动作再清空,避免弹窗关闭时把待提交动作清掉。
|
||||
*/
|
||||
function confirmPendingAction(): void {
|
||||
const action = confirmAction.value;
|
||||
confirmAction.value = null;
|
||||
if (action) void submitAction(action);
|
||||
}
|
||||
|
||||
return {
|
||||
isAdmin,
|
||||
actionLoading,
|
||||
showForceSyncConfirm,
|
||||
showReparseExistingConfirm,
|
||||
showActionConfirm,
|
||||
confirmCopy,
|
||||
run,
|
||||
confirmForceSync: () => void submitAction('force-sync'),
|
||||
confirmReparseExisting: () => void submitAction('reparse-existing'),
|
||||
confirmPendingAction,
|
||||
};
|
||||
}
|
||||
@@ -98,9 +98,10 @@ function displaySentAt(iso?: string | null): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回合同解析/计划状态的本地化文本。
|
||||
* 返回合同计划状态的本地化文本。
|
||||
* 核心逻辑:将后端编码(parsed / needs_review / pending / active)映射到 i18n;未知编码回退原值,便于排障。
|
||||
* @param state - 后端返回的解析状态或计划状态编码。
|
||||
* 解析状态暂不在概览中展示,本函数目前只用于计划状态。
|
||||
* @param state - 后端返回的计划状态编码。
|
||||
* @returns 本地化状态文本;空值时返回 '—'。
|
||||
*/
|
||||
function displayContractState(state?: string | null): string {
|
||||
@@ -377,10 +378,10 @@ onBeforeUnmount(() => closeAttachmentPreview());
|
||||
<section class="detail-panel mt-4">
|
||||
<h3>{{ t('admin.contractPayment.detailOverview') }}</h3>
|
||||
<dl class="detail-description-list">
|
||||
<div><dt>{{ t('admin.contractPayment.parseStatus') }}</dt><dd>{{ displayContractState(contract.parse_status) }}</dd></div>
|
||||
<div><dt>{{ t('admin.contractPayment.planStatus') }}</dt><dd>{{ displayContractState(contract.plan_status) }}</dd></div>
|
||||
<div><dt><span class="help-label" :data-help="t('admin.contractPayment.archiveDateHint')">{{ t('admin.contractPayment.archiveDate') }}<CircleHelp class="ml-1 inline h-3.5 w-3.5 align-middle" /></span></dt><dd>{{ contract.oa_archive_at ? formatNaiveDate(contract.oa_archive_at) : '—' }}</dd></div>
|
||||
<div><dt>{{ t('admin.contractPayment.deliveryDate') }}</dt><dd>{{ contract.delivery_due_date || '—' }}</dd></div>
|
||||
<div><dt>{{ t('admin.contractPayment.company') }}</dt><dd class="detail-wrap">{{ contract.company_name || '—' }}</dd></div>
|
||||
</dl>
|
||||
<div v-if="contract.parse_issues?.length || contract.parse_status === 'needs_review'" class="detail-parse-issues">
|
||||
<div class="min-w-0">
|
||||
@@ -465,7 +466,7 @@ onBeforeUnmount(() => closeAttachmentPreview());
|
||||
|
||||
<style scoped>
|
||||
/* 四张概要卡按详情区域宽度排:够宽时一行,窄于 640px 再折成两行。 */
|
||||
.contract-detail { container-type: inline-size; }.detail-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }.detail-summary-card { min-width: 0; min-height: 82px; padding: 14px; border: 1px solid #d7e1ef; border-radius: 12px; background: #f8fbff; }.detail-summary-card span { display: block; color: #58749f; font-size: 12px; }.detail-summary-card strong { display: block; margin-top: 6px; color: #102d59; font-size: 14px; word-break: break-word; }.detail-tabs { display: flex; width: fit-content; max-width: 100%; overflow-x: auto; border: 1px solid #d7e1ef; border-radius: 999px; background: #f1f5fb; padding: 4px; }.detail-tabs button { flex: none; border-radius: 999px; padding: 8px 14px; color: #58749f; font-size: 13px; font-weight: 700; }.detail-tabs button.active { background: #fff; color: #2875d5; box-shadow: 0 1px 3px rgba(35, 68, 113, .12); }.detail-panel { border: 1px dashed #b9cbe2; border-radius: 12px; background: #fff; padding: 18px; }.detail-panel h3 { margin-bottom: 14px; color: #102d59; font-size: 16px; font-weight: 750; }.detail-description-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 28px; font-size: 13px; }.detail-description-list div { display: flex; gap: 8px; min-width: 0; }.detail-description-list dt { flex: none; color: #58749f; }.detail-description-list dd { min-width: 0; color: #102d59; font-weight: 650; white-space: nowrap; }.detail-note { margin-top: 16px; border-radius: 8px; background: #f7faff; padding: 10px 12px; color: #58749f; font-size: 13px; }.attachment-row { display: flex; align-items: center; gap: 12px; border-top: 1px solid #e4ecf6; padding: 13px 0; }.attachment-row:first-of-type { border-top: 0; }.attachment-row span { color: #58749f; font-size: 12px; }.payment-node-row { position: relative; display: flex; gap: 14px; padding: 0 0 18px 6px; }.payment-node-row::before { position: absolute; top: 18px; bottom: -2px; left: 12px; width: 2px; background: #d7e1ef; content: ''; }.payment-node-row:last-child::before { display: none; }.timeline-dot { z-index: 1; width: 14px; height: 14px; margin-top: 8px; flex: none; border-radius: 999px; background: #fff; border: 2px solid #3b82e5; }.payment-node-card { flex: 1; border: 1px solid #d7e1ef; border-radius: 12px; padding: 13px 15px; }.payment-node-card strong { color: #102d59; }.payment-node-card p { margin-top: 5px; color: #58749f; font-size: 13px; }.node-status { display: inline-flex; min-height: 22px; align-items: center; border-radius: 999px; background: #edf5ff; padding: 2px 8px; color: #2563eb; font-size: 12px; font-weight: 700; }.node-alert-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }.node-alert-list span { border-radius: 6px; background: #f7faff; padding: 4px 7px; color: #58749f; font-size: 12px; }.alert-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; border-top: 1px solid #e4ecf6; padding: 12px 0; color: #58749f; font-size: 13px; }.alert-row:first-of-type { border-top: 0; }.alert-row strong { color: #102d59; }.detail-empty { padding: 38px; color: var(--text-muted); text-align: center; } @container (max-width: 640px) { .detail-summary-grid, .detail-description-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } } @media (max-width: 640px) { .detail-description-list { grid-template-columns: 1fr; }.attachment-row { align-items: flex-start; flex-wrap: wrap; }.attachment-row button { margin-left: 32px; } }
|
||||
.contract-detail { container-type: inline-size; }.detail-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }.detail-summary-card { min-width: 0; min-height: 82px; padding: 14px; border: 1px solid #d7e1ef; border-radius: 12px; background: #f8fbff; }.detail-summary-card span { display: block; color: #58749f; font-size: 12px; }.detail-summary-card strong { display: block; margin-top: 6px; color: #102d59; font-size: 14px; word-break: break-word; }.detail-tabs { display: flex; width: fit-content; max-width: 100%; overflow-x: auto; border: 1px solid #d7e1ef; border-radius: 999px; background: #f1f5fb; padding: 4px; }.detail-tabs button { flex: none; border-radius: 999px; padding: 8px 14px; color: #58749f; font-size: 13px; font-weight: 700; }.detail-tabs button.active { background: #fff; color: #2875d5; box-shadow: 0 1px 3px rgba(35, 68, 113, .12); }.detail-panel { border: 1px dashed #b9cbe2; border-radius: 12px; background: #fff; padding: 18px; }.detail-panel h3 { margin-bottom: 14px; color: #102d59; font-size: 16px; font-weight: 750; }.detail-description-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 28px; font-size: 13px; }.detail-description-list div { display: flex; gap: 8px; min-width: 0; }.detail-description-list dt { flex: none; color: #58749f; }.detail-description-list dd { min-width: 0; color: #102d59; font-weight: 650; white-space: nowrap; }.detail-description-list dd.detail-wrap { white-space: normal; word-break: break-all; }.detail-note { margin-top: 16px; border-radius: 8px; background: #f7faff; padding: 10px 12px; color: #58749f; font-size: 13px; }.attachment-row { display: flex; align-items: center; gap: 12px; border-top: 1px solid #e4ecf6; padding: 13px 0; }.attachment-row:first-of-type { border-top: 0; }.attachment-row span { color: #58749f; font-size: 12px; }.payment-node-row { position: relative; display: flex; gap: 14px; padding: 0 0 18px 6px; }.payment-node-row::before { position: absolute; top: 18px; bottom: -2px; left: 12px; width: 2px; background: #d7e1ef; content: ''; }.payment-node-row:last-child::before { display: none; }.timeline-dot { z-index: 1; width: 14px; height: 14px; margin-top: 8px; flex: none; border-radius: 999px; background: #fff; border: 2px solid #3b82e5; }.payment-node-card { flex: 1; border: 1px solid #d7e1ef; border-radius: 12px; padding: 13px 15px; }.payment-node-card strong { color: #102d59; }.payment-node-card p { margin-top: 5px; color: #58749f; font-size: 13px; }.node-status { display: inline-flex; min-height: 22px; align-items: center; border-radius: 999px; background: #edf5ff; padding: 2px 8px; color: #2563eb; font-size: 12px; font-weight: 700; }.node-alert-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }.node-alert-list span { border-radius: 6px; background: #f7faff; padding: 4px 7px; color: #58749f; font-size: 12px; }.alert-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; border-top: 1px solid #e4ecf6; padding: 12px 0; color: #58749f; font-size: 13px; }.alert-row:first-of-type { border-top: 0; }.alert-row strong { color: #102d59; }.detail-empty { padding: 38px; color: var(--text-muted); text-align: center; } @container (max-width: 640px) { .detail-summary-grid, .detail-description-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } } @media (max-width: 640px) { .detail-description-list { grid-template-columns: 1fr; }.attachment-row { align-items: flex-start; flex-wrap: wrap; }.attachment-row button { margin-left: 32px; } }
|
||||
.help-label { position: relative; cursor: help; }.help-label::after { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: max-content; max-width: min(280px, 70vw); padding: 7px 9px; border-radius: 6px; background: #334155; color: #fff; content: attr(data-help); font-size: 11px; font-weight: 400; line-height: 1.45; opacity: 0; pointer-events: none; transition: opacity .15s ease; white-space: normal; }.help-label.help-wide::after { max-width: min(420px, 78vw); white-space: pre-line; }.help-label:hover::after { opacity: 1; }.detail-parse-issues { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; border-radius: 8px; background: #fff7ed; padding: 10px 12px; color: #9a3412; font-size: 13px; }.detail-parse-issues strong { display: block; margin-bottom: 4px; font-weight: 700; }.detail-parse-review { flex: none; height: 34px; padding: 0 16px; }.detail-parse-issues ul { margin: 0; padding-left: 16px; }.detail-parse-issues li { line-height: 1.6; }
|
||||
.attachment-preview-body { position: relative; min-height: 0; padding: 0; }.attachment-preview-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }.attachment-preview-image { display: block; max-width: 100%; max-height: 100%; margin: 0 auto; object-fit: contain; }
|
||||
.timeline-dot.dot-paid, .timeline-dot.dot-current { background: #16a34a; border-color: #16a34a; }.timeline-dot.dot-due { background: #ea580c; border-color: #ea580c; }.timeline-dot.dot-overdue { background: #dc2626; border-color: #dc2626; }.timeline-dot.dot-pending { background: #fff; border-color: #93a7c8; }.timeline-dot.dot-review { background: #f59e0b; border-color: #f59e0b; }.node-status.status-paid { background: #e8f7ee; color: #16a34a; }.node-status.status-current { background: #e8f7ee; color: #16a34a; }.node-status.status-due { background: #fff4e8; color: #ea580c; }.node-status.status-overdue { background: #fee2e2; color: #dc2626; }.node-status.status-pending { background: #eef3fa; color: #5c76a0; }.node-status.status-review { background: #fff7ed; color: #c2410c; }.payment-node-pay-line { margin-top: 6px; color: #102d59; font-weight: 650; }
|
||||
|
||||
Reference in new issue
Block a user