From 7a5c5250b66cc6faffbcac9e192073473c50f79f Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 28 八月 2026 17:02:04 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro2.0' into dev_pro2.0
---
src/views/erp/purchase/invoice/index.vue | 66 ++++++++++++---------------------
1 files changed, 24 insertions(+), 42 deletions(-)
diff --git a/src/views/erp/purchase/invoice/index.vue b/src/views/erp/purchase/invoice/index.vue
index c0cbd7b..2878f23 100644
--- a/src/views/erp/purchase/invoice/index.vue
+++ b/src/views/erp/purchase/invoice/index.vue
@@ -1,23 +1,25 @@
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ErpPurchaseInvoiceApi } from '#/api/erp/purchase/invoice';
+import type { ErpPurchaseInvoiceAiApi } from '#/api/erp/purchase/invoice/ai';
import { Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart } from '@vben/utils';
import { Button, message, Tag } from 'ant-design-vue';
+import { nextTick, ref } from 'vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
deletePurchaseInvoice,
exportPurchaseInvoice,
getPurchaseInvoicePage,
- updatePurchaseInvoiceStatus,
} from '#/api/erp/purchase/invoice';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
+import OcrUpload from './modules/ocr-upload.vue';
defineOptions({ name: 'ErpPurchaseInvoice' });
@@ -25,6 +27,8 @@
connectedComponent: Form,
destroyOnClose: true,
});
+
+const ocrUploadRef = ref<InstanceType<typeof OcrUpload>>();
/** 鍒锋柊琛ㄦ牸 */
function handleRefresh() {
@@ -41,6 +45,18 @@
/** 鍒涘缓鏉ョエ */
function handleCreate() {
formModalApi.setData({ formType: 'create' }).open();
+}
+
+/** 璇嗗埆褰曞叆 */
+function handleOcrCreate() {
+ ocrUploadRef.value?.open();
+}
+
+/** OCR 璇嗗埆缁撴灉纭 */
+function handleOcrSuccess(data: ErpPurchaseInvoiceAiApi.OcrResultVO) {
+ nextTick(() => {
+ formModalApi.setData({ formType: 'create', ocrData: data } as any).open();
+ });
}
/** 缂栬緫鏉ョエ */
@@ -62,24 +78,6 @@
try {
await deletePurchaseInvoice(row.id!);
message.success($t('ui.actionMessage.deleteSuccess', [row.no]));
- handleRefresh();
- } finally {
- hideLoading();
- }
-}
-
-/** 鏇存柊鏉ョエ鐘舵�侊紙瀹℃牳/鍙嶅鏍革級 */
-async function handleUpdateStatus(
- row: ErpPurchaseInvoiceApi.PurchaseInvoice,
- status: number,
-) {
- const hideLoading = message.loading({
- content: '鏇存柊鐘舵�佷腑...',
- duration: 0,
- });
- try {
- await updatePurchaseInvoiceStatus(row.id!, status);
- message.success('鏇存柊鐘舵�佹垚鍔�');
handleRefresh();
} finally {
hideLoading();
@@ -120,6 +118,7 @@
<template>
<Page auto-content-height>
<FormModal @success="handleRefresh" />
+ <OcrUpload ref="ocrUploadRef" @success="handleOcrSuccess" />
<Grid table-title="鏉ョエ鍒楄〃">
<template #toolbar-tools>
<TableAction
@@ -130,6 +129,12 @@
icon: ACTION_ICON.ADD,
auth: ['erp:purchase-invoice:create'],
onClick: handleCreate,
+ },
+ {
+ label: '璇嗗埆褰曞叆',
+ type: 'primary',
+ auth: ['erp:purchase-invoice:create'],
+ onClick: handleOcrCreate,
},
{
label: $t('ui.actionTitle.export'),
@@ -153,11 +158,6 @@
<Tag v-if="!row.hasAttachment" color="warning">鏈笂浼�</Tag>
<Tag v-else color="success">宸蹭笂浼�</Tag>
</template>
- <template #auditStatus="{ row }">
- <Tag v-if="row.auditStatus === 10" color="warning">鏈鏍�</Tag>
- <Tag v-else-if="row.auditStatus === 20" color="success">宸插鏍�</Tag>
- <Tag v-else color="default">--</Tag>
- </template>
<template #actions="{ row }">
<TableAction
:actions="[
@@ -173,24 +173,7 @@
type: 'link',
icon: ACTION_ICON.EDIT,
auth: ['erp:purchase-invoice:update'],
- ifShow: row.auditStatus === 10,
onClick: handleEdit.bind(null, row),
- },
- {
- label: '瀹℃牳',
- type: 'link',
- icon: ACTION_ICON.AUDIT,
- auth: ['erp:purchase-invoice:update-status'],
- ifShow: row.auditStatus === 10,
- onClick: handleUpdateStatus.bind(null, row, 20),
- },
- {
- label: '鍙嶅鏍�',
- type: 'link',
- icon: ACTION_ICON.VIEW,
- auth: ['erp:purchase-invoice:update-status'],
- ifShow: row.auditStatus === 20,
- onClick: handleUpdateStatus.bind(null, row, 10),
},
{
label: $t('common.delete'),
@@ -198,7 +181,6 @@
danger: true,
icon: ACTION_ICON.DELETE,
auth: ['erp:purchase-invoice:delete'],
- ifShow: row.auditStatus !== 20,
popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.no]),
confirm: handleDelete.bind(null, row),
--
Gitblit v1.9.3