gaoluyang
2025-10-16 908555743c2c36d7e13a129f4ad78f3f69602489
src/views/production/index.vue
@@ -22,14 +22,17 @@
        <el-button type="success" :icon="Plus" @click="openDialog('add')">
          新增加工
        </el-button>
<!--        <el-button-->
<!--          type="danger"-->
<!--          :icon="Delete"-->
<!--          :disabled="!selectedRows.length"-->
<!--          @click="() => deleteSelected(delPM)"-->
<!--        >-->
<!--          删除-->
<!--        </el-button>-->
        <el-button
          type="danger"
          :icon="Delete"
          :disabled="!selectedRows.length"
          @click="() => deleteSelected(delPM)"
        >
          删除
        </el-button>
        <el-button type="primary" @click="handleRandomScheduling">
          随机排产
        </el-button>
      </div>
      <!-- 数据表格 -->
      <ETable
@@ -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 {