gaoluyang
2025-10-16 908555743c2c36d7e13a129f4ad78f3f69602489
生产管控-生产订单添加随机排产功能
已修改2个文件
31 ■■■■■ 文件已修改
src/api/production/index.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/production/index.vue 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/production/index.js
@@ -78,3 +78,12 @@
        params: query
    })
}
// /productionMaster/randomScheduling
// 随机排产
export function randomScheduling() {
    return request({
        url: '/productionMaster/randomScheduling',
        method: 'get'
    })
}
src/views/production/index.vue
@@ -30,6 +30,9 @@
        >
          删除
        </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 {