From b9b476d4b4f1bf9e08b58249fb42f7b07aa3a0fa Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 26 八月 2026 15:08:07 +0800
Subject: [PATCH] feat(mes): 添加工艺参数模板功能支持

---
 src/views/erp/sale/order/index.vue |   50 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/src/views/erp/sale/order/index.vue b/src/views/erp/sale/order/index.vue
index 4e83fce..6124ec7 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,12 +24,14 @@
 
 import { useGridColumns, useGridFormSchema } from './data';
 import Form from './modules/form.vue';
+import SaleOrderPrint from './modules/print.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,
@@ -139,6 +141,12 @@
   formModalApi.setData({ formType: 'detail', id: row.id }).open();
 }
 
+/** 鎵撳嵃/瀵煎嚭閿�鍞鍗曡鎯咃紝渚涗紒涓氱洊绔犵暀瀛� */
+const printRef = ref<InstanceType<typeof SaleOrderPrint>>();
+function handlePrint(row: ErpSaleOrderApi.SaleOrder) {
+  printRef.value?.print(row.id!);
+}
+
 /** 鏌ョ湅鍏宠仈鍚堝悓 */
 function handleViewContract(row: ErpSaleOrderApi.SaleOrder) {
   if (row.contractId) {
@@ -174,10 +182,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,
           });
         },
       },
@@ -196,12 +213,21 @@
     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" />
     <SalesNoticeFormModal />
+    <SaleOrderPrint ref="printRef" />
     <Grid table-title="閿�鍞鍗曞垪琛�">
       <template #toolbar-tools>
         <TableAction
@@ -266,6 +292,15 @@
         <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
           :actions="[
@@ -275,6 +310,13 @@
               icon: ACTION_ICON.VIEW,
               auth: ['erp:sale-order:query'],
               onClick: handleDetail.bind(null, row),
+            },
+            {
+              label: '鎵撳嵃',
+              type: 'link',
+              icon: 'lucide:printer',
+              auth: ['erp:sale-order:query'],
+              onClick: handlePrint.bind(null, row),
             },
             {
               label: $t('common.edit'),
@@ -333,7 +375,7 @@
               type: 'link',
               icon: 'ant-design:file-protect-outlined',
               auth: ['mes:wm-sales-notice:create'],
-              ifShow: () => row.status === 20 && row.canCreateSalesNotice,
+              ifShow: () => row.status === 20 && !!row.canCreateSalesNotice,
               onClick: handleGenerateNotice.bind(null, row),
             },
             {

--
Gitblit v1.9.3