From 173855b299e89930b5ea2ff9a9295fde9d0f55b5 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期六, 07 十一月 2026 08:51:43 +0800
Subject: [PATCH] feat: 同步质检、生产、销售、财务与人事前端功能

---
 src/views/wls/salesnotice/index.vue |   84 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 81 insertions(+), 3 deletions(-)

diff --git a/src/views/wls/salesnotice/index.vue b/src/views/wls/salesnotice/index.vue
index a4c4590..5a30190 100644
--- a/src/views/wls/salesnotice/index.vue
+++ b/src/views/wls/salesnotice/index.vue
@@ -6,7 +6,9 @@
 import { MesWmSalesNoticeOutStatusEnum, MesWmSalesNoticeStatusEnum } from '@vben/constants';
 import { downloadFileFromBlobPart } from '@vben/utils';
 
-import { Button, message, Tag } from 'ant-design-vue';
+import { Button, message, RadioButton, RadioGroup, Tag } from 'ant-design-vue';
+
+import { ref } from 'vue';
 
 import { useRouter } from 'vue-router';
 
@@ -14,12 +16,14 @@
 import {
   deleteSalesNotice,
   exportSalesNotice,
+  exportSalesNoticeWord,
   generateProductSales,
+  getSalesNoticeLedgerPage,
   getSalesNoticePage,
 } from '#/api/mes/wm/salesnotice';
 import { $t } from '#/locales';
 
-import { useGridColumns, useGridFormSchema } from './data';
+import { useGridColumns, useGridFormSchema, useLedgerGridColumns } from './data';
 import Form from './modules/form.vue';
 
 const [FormModal, formModalApi] = useVbenModal({
@@ -28,6 +32,9 @@
 });
 
 const router = useRouter();
+
+/** 鍒楄〃瑙嗗浘锛氭寜鍙戣揣鍗� / 鎸変骇鍝佸钩閾� */
+const viewMode = ref<'notice' | 'product'>('notice');
 
 const outStatusLabelMap: Record<number, string> = {
   [MesWmSalesNoticeOutStatusEnum.NONE]: '鏈嚭搴�',
@@ -72,6 +79,12 @@
   } catch (e) {
     console.error(e);
   }
+}
+
+/** 涓嬭浇鍙戣揣鍗� Word */
+async function handleDownloadWord(row: MesWmSalesNoticeApi.SalesNotice) {
+  const source = await exportSalesNoticeWord(row.id!);
+  downloadFileFromBlobPart({ fileName: `鍙戣揣鍗�-${row.code}.docx`, source });
 }
 
 /** 鍒犻櫎鍙戣揣閫氱煡鍗� */
@@ -124,12 +137,51 @@
     },
   } as VxeTableGridOptions<MesWmSalesNoticeApi.SalesNotice>,
 });
+
+const [LedgerGrid] = useVbenVxeGrid({
+  formOptions: {
+    schema: useGridFormSchema(),
+  },
+  gridOptions: {
+    columns: useLedgerGridColumns(),
+    height: 'auto',
+    keepSource: true,
+    proxyConfig: {
+      ajax: {
+        query: async ({ page }, formValues) => {
+          return await getSalesNoticeLedgerPage({
+            pageNo: page.currentPage,
+            pageSize: page.pageSize,
+            ...formValues,
+          });
+        },
+      },
+    },
+    rowConfig: {
+      keyField: 'lineId',
+      isHover: true,
+    },
+    toolbarConfig: {
+      refresh: true,
+      search: true,
+    },
+  } as VxeTableGridOptions<MesWmSalesNoticeApi.SalesNoticeLedger>,
+});
 </script>
 
 <template>
   <Page auto-content-height><FormModal @success="handleRefresh" />
 
-    <Grid table-title="鍙戣揣閫氱煡鍗曞垪琛�">
+    <div class="flex h-full flex-col gap-2">
+      <div class="flex justify-end">
+        <RadioGroup v-model:value="viewMode" button-style="solid" size="small">
+          <RadioButton value="notice">鎸夊彂璐у崟</RadioButton>
+          <RadioButton value="product">鎸変骇鍝佸钩閾�</RadioButton>
+        </RadioGroup>
+      </div>
+
+      <div class="min-h-0 flex-1">
+    <Grid v-if="viewMode === 'notice'" table-title="鍙戣揣閫氱煡鍗曞垪琛�">
       <template #toolbar-tools>
         <TableAction
           :actions="[
@@ -154,6 +206,11 @@
         <Button type="link" @click="handleDetail(row)">
           {{ row.code }}
         </Button>
+      </template>
+      <template #invoiceStatus="{ row }">
+        <Tag v-if="row.invoiceStatus === 2" color="success">宸插紑绁�</Tag>
+        <Tag v-else-if="row.invoiceStatus === 1" color="processing">閮ㄥ垎寮�绁�</Tag>
+        <Tag v-else color="default">鏈紑绁�</Tag>
       </template>
       <template #outStatus="{ row }">
         <Tag :color="outStatusColorMap[row.outStatus ?? 0]">{{ outStatusLabelMap[row.outStatus ?? 0] }}</Tag>
@@ -182,6 +239,14 @@
               },
             },
             {
+              label: '涓嬭浇鍙戣揣鍗�',
+              type: 'link',
+              icon: ACTION_ICON.DOWNLOAD,
+              auth: ['mes:wm-sales-notice:export'],
+              ifShow: row.status === MesWmSalesNoticeStatusEnum.APPROVED,
+              onClick: handleDownloadWord.bind(null, row),
+            },
+            {
               label: '鐢熸垚鍑哄簱鍗�',
               type: 'link',
               icon: 'ant-design:file-protect-outlined',
@@ -193,5 +258,18 @@
         />
       </template>
     </Grid>
+
+        <LedgerGrid v-else table-title="鍙戣揣鍙拌处锛堟寜浜у搧骞抽摵锛�">
+          <template #invoiceStatus="{ row }">
+            <Tag v-if="row.invoiceStatus === 2" color="success">宸插紑绁�</Tag>
+            <Tag v-else-if="row.invoiceStatus === 1" color="processing">閮ㄥ垎寮�绁�</Tag>
+            <Tag v-else color="default">鏈紑绁�</Tag>
+          </template>
+          <template #outStatus="{ row }">
+            <Tag :color="outStatusColorMap[row.outStatus ?? 0]">{{ outStatusLabelMap[row.outStatus ?? 0] }}</Tag>
+          </template>
+        </LedgerGrid>
+      </div>
+    </div>
   </Page>
 </template>

--
Gitblit v1.9.3