feat(invoice): 立账凭证检核复制文件加重命名后缀优化

This commit is contained in:
sophie committed 2026-10-28 15:00:49 +08:00
1 parent 02aa00e913
commit 3710aa4d81
10 files changed
+424 -23

No files matched your search

@@ -133,11 +133,13 @@ export function listVoucherCheckRuns(params: {
}
/**
* 分页查询指定排程批次的 invoice 明细,可按 result 过滤状态;同时返回 by_file_type。
* 分页查询指定排程批次的 invoice 明细,可按 result 和 invoice 号过滤;同时返回 by_file_type。
* @param params.invoice_no - 包含匹配,忽略大小写;空表示不按号筛
*/
export function listVoucherCheckRunItems(runId: number, params?: { result?: string; page?: number; page_size?: number }) {
export function listVoucherCheckRunItems(runId: number, params?: { result?: string; invoice_no?: string; page?: number; page_size?: number }) {
const q = new URLSearchParams();
if (params?.result) q.set('result', params.result);
if (params?.invoice_no) q.set('invoice_no', params.invoice_no);
if (params?.page) q.set('page', String(params.page));
if (params?.page_size) q.set('page_size', String(params.page_size));
const qs = q.toString();
@@ -3,7 +3,7 @@
* features/workspace/views/AccountingVoucherCheckDetailView.vue
* 用途:立账凭证检核批次明细独立页,支持按 invoice 或按文件类型汇总。
* 依赖:voucherCheck.api、PaginationBar、vue-router、vue-i18n、useMessage、voucherCheck.display。
* 逻辑:独立路由或 Chat 嵌入;标题下用下划线 Tab 切换汇总维度;状态筛选仅在按 invoice 时出现。
* 逻辑:独立路由或 Chat 嵌入;标题下用下划线 Tab 切换汇总维度;按 invoice 时可按状态和 invoice 号筛选。
* Chat 嵌入时 runId / runNo 由父级传入,返回列表通过 close 事件。
*/
import { computed, onMounted, ref, watch } from 'vue';
@@ -51,6 +51,7 @@ const total = ref(0);
const page = ref(1);
const pageSize = ref(50);
const statusFilter = ref('');
const invoiceFilter = ref('');
const runNo = ref('');
const viewMode = ref<'invoice' | 'fileType'>('invoice');
@@ -81,7 +82,7 @@ const statusOptions = computed(() => [
const pages = computed(() => Math.max(1, Math.ceil((total.value || 0) / Math.max(1, pageSize.value))));
/**
* 加载当前排程批次明细;invoice 行分页,文件类型汇总为整批快照。
* 加载当前排程批次明细;invoice 行按状态和单号分页,文件类型汇总为整批快照。
*/
async function loadItems() {
if (!scheduleRunId.value) {
@@ -92,8 +93,10 @@ async function loadItems() {
}
loading.value = true;
try {
const invoiceNo = invoiceFilter.value.trim();
const data = await listVoucherCheckRunItems(scheduleRunId.value, {
result: statusFilter.value || undefined,
invoice_no: invoiceNo || undefined,
page: page.value,
page_size: pageSize.value,
});
@@ -112,7 +115,7 @@ async function loadItems() {
}
/**
* 状态筛选变更时回到第一页再查询。
* 状态或 invoice 号变更时回到第一页再查询。
*/
function applyStatusFilter() {
page.value = 1;
@@ -158,6 +161,7 @@ onMounted(() => {
watch(scheduleRunId, () => {
page.value = 1;
statusFilter.value = '';
invoiceFilter.value = '';
viewMode.value = 'invoice';
void loadItems();
});
@@ -215,6 +219,16 @@ watch(scheduleRunId, () => {
<option v-for="opt in statusOptions" :key="opt.value || 'all'" :value="opt.value">{{ opt.label }}</option>
</select>
</label>
<label class="flex min-w-[12rem] flex-col gap-1 text-xs font-medium text-muted">
{{ $t('workspace.voucherCheck.invoiceNo') }}
<input
v-model="invoiceFilter"
type="text"
class="rounded-xl border border-default bg-surface px-3 py-1.5 text-sm text-primary"
:placeholder="$t('workspace.voucherCheck.invoicePlaceholder')"
@keyup.enter="applyStatusFilter"
/>
</label>
<button
type="button"
class="inline-flex items-center gap-1 rounded-xl bg-brand-600 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-brand-700"
@@ -297,7 +311,7 @@ watch(scheduleRunId, () => {
v-model:page-size="pageSize"
:total="total"
:pages="pages"
:visible="total > 0 || !!statusFilter"
:visible="total > 0 || !!statusFilter || !!invoiceFilter.trim()"
@update:page="() => loadItems()"
@update:page-size="() => loadItems()"
/>