src/views/mes/pro/task/index.vue
@@ -1,6 +1,6 @@
<script lang="ts" setup>
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder';
import {getWorkOrderSchedulePage, type MesProWorkOrderApi} from '#/api/mes/pro/workorder';
import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
@@ -11,7 +11,7 @@
  MesProWorkOrderTypeEnum,
} from '@vben/constants';
import { Button, Card, message } from 'ant-design-vue';
import { Button, Card, message, Tabs } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getGanttTaskList, previewAutoGenerate, autoGenerateTasks } from '#/api/mes/pro/task';
@@ -27,6 +27,8 @@
const ganttTasks = ref<any[]>([]); // 甘特图预览数据
const archiveVisible = ref(false);
const archiveProductCode = ref('');
const activeTab = ref('PENDING'); // 默认选中待排产
const [ScheduleModal, scheduleModalApi] = useVbenModal({
  connectedComponent: ScheduleForm,
@@ -106,10 +108,19 @@
    proxyConfig: {
      ajax: {
        query: async ({ page }, formValues) => {
          return await getWorkOrderPage({
          let scheduleStatus: number | undefined = undefined;
          if (activeTab.value === 'PENDING') {
            scheduleStatus = 0; // 待排产
          } else if (activeTab.value === 'FINISHED') {
            scheduleStatus = 1; // 已完成
          }
          // activeTab === 'ALL' 时不传
          return await getWorkOrderSchedulePage({
            pageNo: page.currentPage,
            pageSize: page.pageSize,
            status: MesProWorkOrderStatusEnum.CONFIRMED,
            scheduleStatus,
            type: MesProWorkOrderTypeEnum.SELF,
            ...formValues,
          });
@@ -147,7 +158,17 @@
      <GanttChart :height="350" :readonly="true" :tasks="ganttTasks" />
    </Card>
    <Grid table-title="待排产订单">
    <Grid>
      <template #table-title>
        <div class="flex flex-col gap-2">
          <span class="text-base font-medium">生产订单列表</span>
          <Tabs v-model:activeKey="activeTab" @change="handleRefresh" :tabBarStyle="{ margin: 0, borderBottom: 0 }">
            <Tabs.TabPane key="ALL" tab="全部" />
            <Tabs.TabPane key="PENDING" tab="未完成" />
            <Tabs.TabPane key="FINISHED" tab="已完成" />
          </Tabs>
        </div>
      </template>
      <template #toolbar-tools>
        <TableAction
          :actions="[