From f9e6eb6fc2c2e0c2a2b17238b817fcbfcb6bab56 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 10 八月 2026 16:38:45 +0800
Subject: [PATCH] feat(erp): 添加采购来票管理和付款关联功能

---
 src/views/erp/sale/order/index.vue |   61 +++++++++++++++++++++++++-----
 1 files changed, 51 insertions(+), 10 deletions(-)

diff --git a/src/views/erp/sale/order/index.vue b/src/views/erp/sale/order/index.vue
index fa775a4..7071c8e 100644
--- a/src/views/erp/sale/order/index.vue
+++ b/src/views/erp/sale/order/index.vue
@@ -2,8 +2,8 @@
 import type { VxeTableGridOptions } from '#/adapter/vxe-table';
 import type { ErpSaleOrderApi } from '#/api/erp/sale/order';
 
-import { ref } from 'vue';
-import { useRouter } from 'vue-router';
+import { onMounted, ref } from 'vue';
+import { useRoute, useRouter } from 'vue-router';
 
 import { Page, useVbenModal } from '@vben/common-ui';
 import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
@@ -24,14 +24,21 @@
 
 import { useGridColumns, useGridFormSchema } from './data';
 import Form from './modules/form.vue';
+import SalesNoticeForm from '#/views/wls/salesnotice/modules/form.vue';
 
 /** ERP 閿�鍞鍗曞垪琛� */
 defineOptions({ name: 'ErpSaleOrder' });
 
 const router = useRouter();
+const route = useRoute();
 
 const [FormModal, formModalApi] = useVbenModal({
   connectedComponent: Form,
+  destroyOnClose: true,
+});
+
+const [SalesNoticeFormModal, salesNoticeFormModalApi] = useVbenModal({
+  connectedComponent: SalesNoticeForm,
   destroyOnClose: true,
 });
 
@@ -147,11 +154,11 @@
   try {
     const noticeId = await generateFromSaleOrder(row.id!);
     message.success('鐢熸垚鍙戣揣閫氱煡鍗曟垚鍔�');
-    // 璺宠浆鍒板彂璐ч�氱煡鍗曢〉闈�
-    router.push({
-      path: '/wls/sales-notice',
-      query: { id: noticeId },
-    });
+    handleRefresh();
+    // 鐩存帴鎵撳紑鍙戣揣閫氱煡鍗曡鎯呭脊妗�
+    salesNoticeFormModalApi
+      .setData({ formType: 'detail', id: noticeId })
+      .open();
   } catch (e) {
     console.error(e);
   }
@@ -168,10 +175,19 @@
     proxyConfig: {
       ajax: {
         query: async ({ page }, formValues) => {
+          // 鐢熶骇鐘舵�佹悳绱㈠弬鏁拌浆鎹細-1(鏃犻渶鐢熶骇) 鈫� needProduction=0
+          const { productionStatus, ...rest } = formValues;
+          const params: Record<string, any> = { ...rest };
+          if (productionStatus === -1) {
+            params.needProduction = 0;
+          } else if (productionStatus != null) {
+            params.productionStatus = productionStatus;
+            params.needProduction = 1;
+          }
           return await getSaleOrderPage({
             pageNo: page.currentPage,
             pageSize: page.pageSize,
-            ...formValues,
+            ...params,
           });
         },
       },
@@ -190,10 +206,20 @@
     checkboxChange: handleRowCheckboxChange,
   },
 });
+
+/** 澶勭悊浠庡悎鍚岃烦杞繃鏉ョ殑鏌ヨ鍙傛暟 */
+onMounted(() => {
+  const orderId = route.query.id;
+  if (orderId) {
+    formModalApi.setData({ formType: 'detail', id: Number(orderId) }).open();
+  }
+});
 </script>
 
 <template>
-  <Page auto-content-height><FormModal @success="handleRefresh" />
+  <Page auto-content-height>
+    <FormModal @success="handleRefresh" />
+    <SalesNoticeFormModal />
     <Grid table-title="閿�鍞鍗曞垪琛�">
       <template #toolbar-tools>
         <TableAction
@@ -251,6 +277,21 @@
       <template #needProduction="{ row }">
         <Tag v-if="row.needProduction === 1" color="success">鏄�</Tag>
         <Tag v-else color="default">鍚�</Tag>
+      </template>
+      <template #outStatus="{ row }">
+        <Tag v-if="row.outStatus === 0" color="default">鏈嚭搴�</Tag>
+        <Tag v-else-if="row.outStatus === 1" color="processing">宸查鐣�</Tag>
+        <Tag v-else-if="row.outStatus === 2" color="warning">閮ㄥ垎鍑哄簱</Tag>
+        <Tag v-else-if="row.outStatus === 3" color="success">鍏ㄩ儴鍑哄簱</Tag>
+      </template>
+      <template #productionStatus="{ row }">
+        <template v-if="row.needProduction !== 1">
+          <Tag color="default">鏃犻渶鐢熶骇</Tag>
+        </template>
+        <template v-else>
+          <Tag v-if="row.productionStatus === 0" color="warning">鏈畬鎴�</Tag>
+          <Tag v-else-if="row.productionStatus === 1" color="success">宸插畬鎴�</Tag>
+        </template>
       </template>
       <template #actions="{ row }">
         <TableAction
@@ -319,7 +360,7 @@
               type: 'link',
               icon: 'ant-design:file-protect-outlined',
               auth: ['mes:wm-sales-notice:create'],
-              ifShow: () => row.status === 20,
+              ifShow: () => row.status === 20 && row.canCreateSalesNotice,
               onClick: handleGenerateNotice.bind(null, row),
             },
             {

--
Gitblit v1.9.3