zhangwencui
2026-04-23 29399d5258c1cd9b498884e065f8a2dab4403027

已修改2个文件
208 ■■■■ 文件已修改
src/api/productionPlan/productionPlan.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionPlan/productionPlan/index.vue 200 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/productionPlan/productionPlan.js
@@ -39,15 +39,15 @@
// 生产计划-新增修改
export function productionPlanAdd(query) {
  return request({
    url: "/productionPlan",
    url: "/productionPlan/updateProductionPlan",
    method: "post",
    data: query,
  });
}
export function productionPlanUpdate(query) {
  return request({
    url: "/productionPlan",
    method: "put",
    url: "/productionPlan/updateProductionPlan",
    method: "post",
    data: query,
  });
}
@@ -63,7 +63,7 @@
// 合并下发
export function productionPlanCombine(query) {
  return request({
    url: "/productionPlan/combine",
    url: "/productionPlan/updateProductionPlan",
    method: "post",
    data: query,
  });
src/views/productionPlan/productionPlan/index.vue
@@ -329,120 +329,17 @@
  import { getToken } from "@/utils/auth";
  import { useDict } from "@/utils/dict";
  import { useRouter } from "vue-router";
  // import {
  //   productionPlanListPage,
  //   loadProdData,
  //   exportProductionPlan,
  //   productionPlanAdd,
  //   productionPlanUpdate,
  //   productionPlanDelete,
  //   productionPlanCombine,
  // } from "@/api/productionPlan/productionPlan.js";
  import {
    productionPlanListPage,
    loadProdData,
    exportProductionPlan,
    productionPlanAdd,
    productionPlanUpdate,
    productionPlanDelete,
    productionPlanCombine,
  } from "@/api/productionPlan/productionPlan.js";
  // Mock data and functions
  const productionPlanListPage = params => {
    console.log("Mock productionPlanListPage called with:", params);
    return Promise.resolve({
      data: {
        records: [
          {
            id: 1,
            dataSourceType: 1,
            applyNo: "SQ20260422001",
            customerName: "模拟客户A",
            productName: "板材",
            model: "100*200*300",
            materialCode: "MAT001",
            quantity: 100,
            volume: 50,
            status: 0,
            assignedQuantity: 0,
            length: 100,
            width: 200,
            height: 300,
            startDate: "2026-04-22",
            endDate: "2026-04-25",
            strength: "C20",
            remarkOne: "备注1",
            remarkTwo: "备注2",
          },
          {
            id: 2,
            dataSourceType: 2,
            applyNo: "SQ20260422002",
            customerName: "模拟客户B",
            productName: "砌块",
            model: "200*200*600",
            materialCode: "MAT002",
            quantity: 200,
            volume: 80,
            status: 1,
            assignedQuantity: 30,
            length: 200,
            width: 200,
            height: 600,
            startDate: "2026-04-23",
            endDate: "2026-04-26",
            strength: "C25",
            remarkOne: "备注1",
            remarkTwo: "备注2",
          },
          {
            id: 3,
            dataSourceType: 1,
            applyNo: "SQ20260422003",
            customerName: "模拟客户C",
            productName: "砌块",
            model: "240*115*53",
            materialCode: "MAT003",
            quantity: 1000,
            volume: 1.46,
            status: 2,
            assignedQuantity: 1.46,
            length: 240,
            width: 115,
            height: 53,
            startDate: "2026-04-20",
            endDate: "2026-04-21",
            strength: "MU10",
            remarkOne: "已下发数据",
            remarkTwo: "",
          },
        ],
        total: 3,
      },
    });
  };
  const loadProdData = () => {
    console.log("Mock loadProdData called");
    return Promise.resolve({ code: 200, msg: "同步成功" });
  };
  const exportProductionPlan = () => {
    console.log("Mock exportProductionPlan called");
    return Promise.resolve();
  };
  const productionPlanAdd = payload => {
    console.log("Mock productionPlanAdd called with:", payload);
    return Promise.resolve({ code: 200, msg: "新增成功" });
  };
  const productionPlanUpdate = payload => {
    console.log("Mock productionPlanUpdate called with:", payload);
    return Promise.resolve({ code: 200, msg: "修改成功" });
  };
  const productionPlanDelete = ids => {
    console.log("Mock productionPlanDelete called with ids:", ids);
    return Promise.resolve({ code: 200, msg: "删除成功" });
  };
  const productionPlanCombine = payload => {
    console.log("Mock productionPlanCombine called with:", payload);
    return Promise.resolve({ code: 200, msg: "合并下发成功" });
  };
  // Mock data and functions removed
  import PIMTable from "./components/PIMTable.vue";
  // import {
  //   modelListPage,
@@ -652,6 +549,7 @@
            // 单独下发操作
            // 设置表单数据
            strengthError.value = "";
            mergeForm.id = null; // Creation
            mergeForm.ids = [row.id];
            mergeForm.materialCode = row.materialCode;
            mergeForm.productName = row.productName || "";
@@ -664,6 +562,11 @@
            mergeForm.planCompleteTime = row.planCompleteTime || "";
            mergeForm.productMaterialId = row.productMaterialId || "";
            mergeForm.strength = row.strength || "";
            mergeForm.applyNo = row.applyNo || "";
            mergeForm.requiredDate = dayjs().format("YYYY-MM-DD HH:mm:ss");
            mergeForm.promisedDeliveryDate = dayjs().format(
              "YYYY-MM-DD HH:mm:ss"
            );
            sumAssignedQuantity.value = mergeForm.totalAssignedQuantity;
            // 打开弹窗
            isShowNewModal.value = true;
@@ -697,16 +600,28 @@
  const isShowNewModal = ref(false);
  // 合并下发表单数据
  const mergeForm = reactive({
    id: null,
    materialCode: "",
    productName: "",
    model: "",
    length: 0,
    width: 0,
    height: 0,
    unit: "",
    ids: [],
    totalAssignedQuantity: 0,
    planCompleteTime: "",
    strength: "",
    productMaterialId: "",
    strength: "",
    mpsNo: "",
    requiredDate: "",
    remark: "",
    productModelId: "",
    qtyRequired: 0,
    state: "",
    issued: true,
    source: "",
    isAudit: "",
    promisedDeliveryDate: "",
    applyNo: "",
    status: 1,
  });
  // 导入相关
@@ -1052,6 +967,7 @@
    sumAssignedQuantity.value = totalAssignedQuantity;
    console.log(totalAssignedQuantity);
    // 设置表单数据
    mergeForm.id = null; // Creation
    mergeForm.materialCode = selectedserialNo.value;
    mergeForm.productName = productName;
    mergeForm.model = firstRow.model || "";
@@ -1063,6 +979,9 @@
    mergeForm.productMaterialId = firstRow.productMaterialId || "";
    mergeForm.strength = firstStrength;
    mergeForm.ids = selectedRows.value.map(row => row.id);
    mergeForm.applyNo = firstRow.applyNo || "";
    mergeForm.requiredDate = dayjs().format("YYYY-MM-DD HH:mm:ss");
    mergeForm.promisedDeliveryDate = dayjs().format("YYYY-MM-DD HH:mm:ss");
    // 打开弹窗
    isShowNewModal.value = true;
@@ -1100,6 +1019,7 @@
    );
    const payload = {
      ...mergeForm,
      id: mergeForm.id || null, // Ensure id is present, null for creation
      strength: strengthItem ? strengthItem.label : mergeForm.strength,
    };
    productionPlanCombine(payload)
@@ -1281,41 +1201,23 @@
          proxy.$modal.msgError("方数不能为0");
          return;
        }
        if (form.v === "add") {
          payload.id = null;
        }
        const payload = { ...form };
        if (operationType.value === "add") {
        const isAdd = operationType.value === "add";
        if (isAdd) {
          payload.id = null;
          productionPlanAdd(payload)
            .then(() => {
              proxy.$modal.msgSuccess(
                operationType.value === "add" ? "新增成功" : "修改成功"
              );
              dialogVisible.value = false;
              getList();
            })
            .catch(() => {
              proxy.$modal.msgError(
                operationType.value === "add" ? "新增失败" : "修改失败"
              );
            });
        }
        if (operationType.value === "edit") {
          productionPlanUpdate(payload)
            .then(() => {
              proxy.$modal.msgSuccess(
                operationType.value === "add" ? "新增成功" : "修改成功"
              );
              dialogVisible.value = false;
              getList();
            })
            .catch(() => {
              proxy.$modal.msgError(
                operationType.value === "add" ? "新增失败" : "修改失败"
              );
            });
        }
        const apiCall = isAdd ? productionPlanAdd : productionPlanUpdate;
        apiCall(payload)
          .then(() => {
            proxy.$modal.msgSuccess(isAdd ? "新增成功" : "修改成功");
            dialogVisible.value = false;
            getList();
          })
          .catch(() => {
            proxy.$modal.msgError(isAdd ? "新增失败" : "修改失败");
          });
      }
    });
  };