From f11bd0d8d9c1190340a445a67df9e43cdbde0a3e Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期四, 27 八月 2026 11:21:26 +0800
Subject: [PATCH] feat(mes): 基础参数与工序绑定前端 + 报工填写参数字段

---
 src/views/erp/purchase/order/index.vue |   56 +++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/src/views/erp/purchase/order/index.vue b/src/views/erp/purchase/order/index.vue
index 288b0b0..79a6a6c 100644
--- a/src/views/erp/purchase/order/index.vue
+++ b/src/views/erp/purchase/order/index.vue
@@ -2,19 +2,20 @@
 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 { 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';
 
@@ -23,6 +24,8 @@
 
 /** ERP 閲囪喘璁㈠崟鍒楄〃 */
 defineOptions({ name: 'ErpPurchaseOrder' });
+
+const route = useRoute();
 
 const [FormModal, formModalApi] = useVbenModal({
   connectedComponent: Form,
@@ -65,18 +68,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,10 +130,18 @@
     checkboxChange: handleRowCheckboxChange,
   },
 });
+
+onMounted(() => {
+  const id = route.query.id;
+  if (id) {
+    formModalApi.setData({ formType: 'detail', id: Number(id) }).open();
+  }
+});
 </script>
 
 <template>
-  <Page auto-content-height><FormModal @success="handleRefresh" />
+  <Page auto-content-height>
+    <FormModal @success="handleRefresh" />
     <Grid table-title="閲囪喘璁㈠崟鍒楄〃">
       <template #toolbar-tools>
         <TableAction
@@ -167,6 +175,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
           :actions="[
@@ -186,17 +199,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