From a241b66efcc41e973290a6722fb7a4d79b833ea1 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 13 十月 2026 09:54:32 +0800
Subject: [PATCH] feat(bi): 为图表配置接口添加名称字段
---
src/views/erp/purchase/order/index.vue | 79 +++++++++++++++++++++++++--------------
1 files changed, 50 insertions(+), 29 deletions(-)
diff --git a/src/views/erp/purchase/order/index.vue b/src/views/erp/purchase/order/index.vue
index d0f121e..6189ea1 100644
--- a/src/views/erp/purchase/order/index.vue
+++ b/src/views/erp/purchase/order/index.vue
@@ -2,30 +2,39 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order';
-import { ref } from 'vue';
+import { onMounted, ref } from 'vue';
+import { useRoute } from 'vue-router';
-import { DocAlert, Page, useVbenModal } from '..\..\..\..\packages\effects\common-ui\src';
-import { downloadFileFromBlobPart, isEmpty } from '..\..\..\..\packages\utils\src';
+import { Page, useVbenModal } from '@vben/common-ui';
+import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
-import { message } from 'ant-design-vue';
+import { message, Tag } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
+ confirmReceipt,
deletePurchaseOrder,
exportPurchaseOrder,
getPurchaseOrderPage,
- updatePurchaseOrderStatus,
} from '#/api/erp/purchase/order';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
+import ImportForm from './modules/import-form.vue';
/** ERP 閲囪喘璁㈠崟鍒楄〃 */
defineOptions({ name: 'ErpPurchaseOrder' });
+const route = useRoute();
+
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
+ destroyOnClose: true,
+});
+
+const [ImportModal, importModalApi] = useVbenModal({
+ connectedComponent: ImportForm,
destroyOnClose: true,
});
@@ -38,6 +47,11 @@
async function handleExport() {
const data = await exportPurchaseOrder(await gridApi.formApi.getValues());
downloadFileFromBlobPart({ fileName: '閲囪喘璁㈠崟.xls', source: data });
+}
+
+/** 瀵煎叆閲囪喘璁㈠崟 */
+function handleImport() {
+ importModalApi.open();
}
/** 鏂板閲囪喘璁㈠崟 */
@@ -65,18 +79,15 @@
}
}
-/** 瀹℃壒/鍙嶅鎵规搷浣� */
-async function handleUpdateStatus(
- row: ErpPurchaseOrderApi.PurchaseOrder,
- status: number,
-) {
+/** 纭鏀惰揣 */
+async function handleConfirmReceipt(row: ErpPurchaseOrderApi.PurchaseOrder) {
const hideLoading = message.loading({
- content: `纭畾${status === 20 ? '瀹℃壒' : '鍙嶅鎵�'}璇ヨ鍗曞悧锛焋,
+ content: '纭鏀惰揣涓�...',
duration: 0,
});
try {
- await updatePurchaseOrderStatus(row.id!, status);
- message.success(`${status === 20 ? '瀹℃壒' : '鍙嶅鎵�'}鎴愬姛`);
+ const arrivalNoticeId = await confirmReceipt(row.id!);
+ message.success(`纭鏀惰揣鎴愬姛锛屽凡鐢熸垚鍒拌揣閫氱煡鍗昤);
handleRefresh();
} finally {
hideLoading();
@@ -130,18 +141,19 @@
checkboxChange: handleRowCheckboxChange,
},
});
+
+onMounted(() => {
+ const id = route.query.id;
+ if (id) {
+ formModalApi.setData({ formType: 'detail', id: Number(id) }).open();
+ }
+});
</script>
<template>
<Page auto-content-height>
- <template #doc>
- <DocAlert
- title="銆愰噰璐�戦噰璐鍗曘�佸叆搴撱�侀��璐�"
- url="https://doc.iocoder.cn/erp/purchase/"
- />
- </template>
-
<FormModal @success="handleRefresh" />
+ <ImportModal @success="handleRefresh" />
<Grid table-title="閲囪喘璁㈠崟鍒楄〃">
<template #toolbar-tools>
<TableAction
@@ -161,6 +173,13 @@
onClick: handleExport,
},
{
+ label: '瀵煎叆',
+ type: 'primary',
+ icon: ACTION_ICON.UPLOAD,
+ auth: ['erp:purchase-order:import'],
+ onClick: handleImport,
+ },
+ {
label: '鎵归噺鍒犻櫎',
type: 'primary',
danger: true,
@@ -174,6 +193,11 @@
},
]"
/>
+ </template>
+ <template #inStatus="{ row }">
+ <Tag v-if="row.inStatus === 0" color="default">鏈叆搴�</Tag>
+ <Tag v-else-if="row.inStatus === 1" color="warning">閮ㄥ垎鍏ュ簱</Tag>
+ <Tag v-else-if="row.inStatus === 2" color="success">鍏ㄩ儴鍏ュ簱</Tag>
</template>
<template #actions="{ row }">
<TableAction
@@ -194,17 +218,14 @@
onClick: handleEdit.bind(null, row),
},
{
- label: row.status === 10 ? '瀹℃壒' : '鍙嶅鎵�',
+ label: '纭鏀惰揣',
type: 'link',
- icon: ACTION_ICON.AUDIT,
- auth: ['erp:purchase-order:update-status'],
+ icon: ACTION_ICON.VIEW,
+ auth: ['erp:purchase-order:confirm-receipt'],
+ ifShow: () => row.status === 20 && row.inStatus !== 2,
popConfirm: {
- title: `纭${row.status === 10 ? '瀹℃壒' : '鍙嶅鎵�'}${row.no}鍚楋紵`,
- confirm: handleUpdateStatus.bind(
- null,
- row,
- row.status === 10 ? 20 : 10,
- ),
+ title: `纭鏀惰揣${row.no}鍚楋紵`,
+ confirm: handleConfirmReceipt.bind(null, row),
},
},
{
--
Gitblit v1.9.3