From bd36da9f3daa0c326b9c954f920c97b4a61d5fce Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 05 八月 2026 17:57:48 +0800
Subject: [PATCH] feat(bi): 添加BI图表配置和可视化功能

---
 src/views/mes/pro/task/index.vue |   52 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/src/views/mes/pro/task/index.vue b/src/views/mes/pro/task/index.vue
index ed4237c..bd75f40 100644
--- a/src/views/mes/pro/task/index.vue
+++ b/src/views/mes/pro/task/index.vue
@@ -11,21 +11,30 @@
   MesProWorkOrderTypeEnum,
 } from '@vben/constants';
 
-import { Button, Card } from 'ant-design-vue';
+import { Button, Card, message } from 'ant-design-vue';
 
 import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
-import { getGanttTaskList } from '#/api/mes/pro/task';
+import { getGanttTaskList, previewAutoGenerate, autoGenerateTasks } from '#/api/mes/pro/task';
 import { getWorkOrderPage } from '#/api/mes/pro/workorder';
 
+import ArchiveDetail from '#/views/mes/pd/archive/modules/detail.vue';
 import { GanttChart } from './components';
 import { useGridColumns, useGridFormSchema } from './data';
 import ScheduleForm from './modules/schedule-form.vue';
+import SchedulePreview from '../workorder-center/modules/schedule-preview.vue';
 
 const router = useRouter();
 const ganttTasks = ref<any[]>([]); // 鐢樼壒鍥鹃瑙堟暟鎹�
+const archiveVisible = ref(false);
+const archiveProductCode = ref('');
 
 const [ScheduleModal, scheduleModalApi] = useVbenModal({
   connectedComponent: ScheduleForm,
+  destroyOnClose: true,
+});
+
+const [SchedulePreviewModal, schedulePreviewModalApi] = useVbenModal({
+  connectedComponent: SchedulePreview,
   destroyOnClose: true,
 });
 
@@ -51,6 +60,35 @@
 /** 鎺掍骇 */
 function handleSchedule(row: MesProWorkOrderApi.WorkOrder) {
   scheduleModalApi.setData({ formType: 'schedule', id: row.id }).open();
+}
+
+/** 涓�閿帓浜ч瑙� */
+async function handleAutoSchedulePreview(row: MesProWorkOrderApi.WorkOrder) {
+  try {
+    const preview = await previewAutoGenerate({ workOrderId: row.id! });
+    schedulePreviewModalApi
+      .setData({ workOrder: row, preview })
+      .open();
+  } catch {
+    message.error('鑾峰彇鎺掍骇棰勮澶辫触');
+  }
+}
+
+/** 涓�閿帓浜ф墽琛� */
+async function handleAutoSchedule(row: MesProWorkOrderApi.WorkOrder) {
+  try {
+    const result = await autoGenerateTasks({ workOrderId: row.id! });
+    message.success(`鎺掍骇鎴愬姛锛岀敓鎴� ${result.taskIds?.length || 0} 涓换鍔);
+    handleRefresh();
+  } catch {
+    message.error('鎺掍骇澶辫触');
+  }
+}
+
+/** 鎵撳紑褰掓。璇︽儏 */
+function handleArchive(row: MesProWorkOrderApi.WorkOrder) {
+  archiveProductCode.value = row.productCode || '';
+  archiveVisible.value = true;
 }
 
 /** 鎵撳紑鐢樼壒鍥剧紪杈戦〉闈� */
@@ -100,7 +138,9 @@
 </script>
 
 <template>
-  <Page auto-content-height><ScheduleModal @success="handleRefresh" />
+  <Page auto-content-height>
+    <ScheduleModal @success="handleRefresh" />
+    <SchedulePreviewModal @success="handleRefresh" />
 
     <!-- 鎺掍骇鐢樼壒鍥鹃瑙� -->
     <Card title="鎺掍骇鐢樼壒鍥�" class="mb-4">
@@ -135,9 +175,15 @@
               ifShow: row.status === MesProWorkOrderStatusEnum.CONFIRMED,
               onClick: handleSchedule.bind(null, row),
             },
+            {
+              label: '褰掓。璇︽儏',
+              type: 'link',
+              onClick: handleArchive.bind(null, row),
+            },
           ]"
         />
       </template>
     </Grid>
+    <ArchiveDetail :visible="archiveVisible" :product-code="archiveProductCode" @update:visible="archiveVisible = $event" />
   </Page>
 </template>

--
Gitblit v1.9.3