gaoluyang
2026-05-08 9ab8f15a54369c2964018bddc576e06878a17bcb
Merge remote-tracking branch 'origin/dev_浪潮' into dev_浪潮
已修改1个文件
54 ■■■■■ 文件已修改
src/views/productionPlan/productionPlan/index.vue 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionPlan/productionPlan/index.vue
@@ -131,6 +131,18 @@
                           @change="onBlur"
                           style="width: 100%" />
        </el-form-item>
        <el-form-item label="车间">
          <el-select v-model="mergeForm.workshopId"
                     placeholder="请选择车间"
                     clearable
                     filterable
                     style="width: 100%">
            <el-option v-for="item in workshopOptions"
                       :key="item.id"
                       :label="item.name"
                       :value="item.id" />
          </el-select>
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
@@ -243,6 +255,7 @@
    toRefs,
    getCurrentInstance,
    computed,
    watch,
  } from "vue";
  import { useRouter } from "vue-router";
  import dayjs from "dayjs";
@@ -258,6 +271,7 @@
    productionPlanCombine,
  } from "@/api/productionPlan/productionPlan.js";
  import { productTreeList, modelListPage } from "@/api/basicData/product.js";
  import { workshopPage } from "@/api/basicData/workshop.js";
  import PIMTable from "./components/PIMTable.vue";
  import ImportDialog from "@/components/Dialog/ImportDialog.vue";
@@ -425,6 +439,7 @@
            mergeForm.planCompleteTime = row.requiredDate || "";
            mergeForm.productId = row.productId || "";
            mergeForm.ids = [row.id];
            mergeForm.workshopId = row.workshopId ?? undefined;
            sumAssignedQuantity.value =
              Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0);
            isShowNewModal.value = true;
@@ -467,6 +482,44 @@
    totalAssignedQuantity: 0,
    planCompleteTime: "",
    productId: "",
    workshopId: undefined,
    ids: [],
  });
  const workshopOptions = ref([]);
  function parseWorkshopPagePayload(res) {
    const payload = res?.data;
    if (!payload) {
      return { records: [], total: 0 };
    }
    if (Array.isArray(payload)) {
      return { records: payload, total: payload.length };
    }
    const records = payload.records ?? payload.list ?? payload.rows ?? [];
    const total = Number(payload.total ?? payload.totalCount ?? 0);
    return { records: Array.isArray(records) ? records : [], total };
  }
  const fetchWorkshopOptions = () => {
    workshopPage({
      name: "",
      principal: "",
      contactPhone: "",
      current: 1,
      size: 999,
    }).then(res => {
      if (res.code === 200) {
        const { records } = parseWorkshopPagePayload(res);
        workshopOptions.value = records;
      }
    });
  };
  watch(isShowNewModal, val => {
    if (val) {
      fetchWorkshopOptions();
    }
  });
  // 导入相关
@@ -739,6 +792,7 @@
    mergeForm.planCompleteTime = firstRow.requiredDate || "";
    mergeForm.productId = firstRow.productId || "";
    mergeForm.ids = selectedRows.value.map(row => row.id);
    mergeForm.workshopId = firstRow.workshopId ?? undefined;
    // 打开弹窗
    isShowNewModal.value = true;