gaoluyang
13 小时以前 001b025ff84dec3c614f0b0346e9a50491034f04
src/views/production/index.vue
@@ -1,5 +1,5 @@
<template>
  <div>
  <div class="app-container">
    <!-- 搜索表单 -->
    <el-form :inline="true" :model="queryParams" class="search-form">
      <el-form-item label="搜索">
@@ -29,6 +29,9 @@
          @click="() => deleteSelected(delPM)"
        >
          删除
        </el-button>
        <el-button type="primary" @click="handleRandomScheduling">
          随机排产
        </el-button>
      </div>
      <!-- 数据表格 -->
@@ -95,7 +98,7 @@
import ProductionDialog from "./components/ProductionDialog.vue";
import ETable from "@/components/Table/ETable.vue";
import Pagination from "@/components/Pagination/index.vue";
import { getProductionMasterList, delPM } from "@/api/production";
import { getProductionMasterList, delPM, randomScheduling } from "@/api/production";
import { parseCoalArray } from "@/utils/production";
import { useTableData } from "./components/useTableData.js";
import { useDialog } from "./components/useDialog.js";
@@ -173,6 +176,23 @@
  });
};
// 随机排产处理函数
const handleRandomScheduling = async () => {
  try {
    const { ElMessage } = await import('element-plus');
    const res = await randomScheduling();
    if (res.code === 200) {
      ElMessage.success('随机排产成功');
      getList(); // 刷新列表
    } else {
      ElMessage.error(res.msg || '随机排产失败');
    }
  } catch (error) {
    const { ElMessage } = await import('element-plus');
    ElMessage.error('请求失败,请稍后重试');
  }
};
// 组件挂载时加载数据
onMounted(async () => {
  try {