zhangwencui
2026-04-25 d961ee85e246dc7e4e3f113a5083b4e96eac96f8
src/views/productionManagement/processRoute/processRouteItem/index.vue
@@ -80,7 +80,7 @@
                       prop="technologyOperationId"
                       width="200">
        <template #default="scope">
          {{ getProcessName(scope.row.technologyOperationId) || '-' }}
          {{ scope.row.technologyOperationName || scope.row.operationName || '-' }}
        </template>
      </el-table-column>
      <el-table-column label="参数列表"
@@ -158,7 +158,7 @@
            <!-- 序号圆圈 -->
            <div class="card-header">
              <div class="card-number">{{ index + 1 }}</div>
              <div class="card-process-name">{{ getProcessName(item.technologyOperationId) || '-' }}</div>
              <div class="card-process-name">{{ item.technologyOperationName || item.operationName || '-' }}</div>
            </div>
            <!-- 产品信息 -->
            <div class="card-content">
@@ -232,7 +232,7 @@
              style="width: 100%">
      <el-table-column type="expand">
        <template #default>
          <el-form ref="form"
          <el-form ref="bomFormRef"
                   :model="bomDataValue">
            <el-table :data="bomDataValue.dataList"
                      row-key="tempId"
@@ -356,7 +356,7 @@
                       prop="model" />
    </el-table>
    <ProductSelectDialog v-if="bomDataValue.showProductDialog"
                         v-model:model-value="bomDataValue.showProductDialog"
                         v-model="bomDataValue.showProductDialog"
                         :single="true"
                         @confirm="handleBomProduct" />
    <!-- 新增/编辑弹窗 -->
@@ -385,8 +385,8 @@
                      prop="productModelId">
          <el-button type="primary"
                     @click="showProductSelectDialog = true">
            {{ form.productName && form.model
              ? `${form.productName} - ${form.model}`
            {{ form.productName
              ? (form.model ? `${form.productName} - ${form.model}` : form.productName)
              : '选择产品' }}
          </el-button>
        </el-form-item>
@@ -401,13 +401,13 @@
                      prop="isQuality">
          <el-switch v-model="form.isQuality"
                     :active-value="true"
                     inactive-value="false" />
                     :inactive-value="false" />
        </el-form-item>
        <el-form-item label="是否生产"
                      prop="isProduction">
          <el-switch v-model="form.isProduction"
                     :active-value="true"
                     inactive-value="false" />
                     :inactive-value="false" />
        </el-form-item>
      </el-form>
      <template #footer>
@@ -424,7 +424,7 @@
    <!-- 参数列表对话框 -->
    <!-- :editable="!routeInfo.status" -->
    <ProcessParamListDialog v-model="showParamListDialog"
                            :title="`${currentProcess ? (currentProcess.processName || getProcessName(currentProcess.technologyOperationId)) : ''} - 参数列表`"
                            :title="`${currentProcess ? (currentProcess.processName || currentProcess.technologyOperationName || currentProcess.operationName) : ''} - 参数列表`"
                            :route-id="routeId"
                            :order-id="orderId"
                            :process="currentProcess"
@@ -454,7 +454,10 @@
    batchDeleteProcessRouteItem,
    getProcessParamList,
  } from "@/api/productionManagement/processRouteItem.js";
  import { syncProcessParamItem } from "@/api/productionManagement/processRouteItem.js";
  import {
    syncProcessParamItem,
    syncProcessParamItemOrder,
  } from "@/api/productionManagement/processRouteItem.js";
  import {
    findProductProcessRouteItemList,
    deleteRouteItem,
@@ -467,8 +470,10 @@
  import { listProcessBom } from "@/api/productionManagement/productionOrder.js";
  import {
    queryList,
    queryList2,
    addBomDetail,
  } from "@/api/productionManagement/productStructure.js";
  import { useRoute } from "vue-router";
  import { ElMessageBox, ElMessage } from "element-plus";
  import Sortable from "sortablejs";
@@ -485,6 +490,7 @@
  const dialogVisible = ref(false);
  const operationType = ref("add"); // add | edit
  const formRef = ref(null);
  const bomFormRef = ref(null);
  const submitLoading = ref(false);
  const cardsContainer = ref(null);
  const tableRef = ref(null);
@@ -542,17 +548,31 @@
      type: "warning",
    })
      .then(() => {
        syncProcessParamItem({
          replaceExisting: true,
          technologyRoutingOperationId: currentProcess.value.id,
        }).then(res => {
          if (res.code === 200) {
            ElMessage.success("同步成功");
            refreshParamList();
          } else {
            ElMessage.error(res.msg || "同步失败");
          }
        });
        if (pageType.value === "order") {
          syncProcessParamItemOrder({
            replaceExisting: true,
            technologyRoutingOperationId: currentProcess.value.id,
          }).then(res => {
            if (res.code === 200) {
              ElMessage.success("同步成功");
              refreshParamList();
            } else {
              ElMessage.error(res.msg || "同步失败");
            }
          });
        } else {
          syncProcessParamItem({
            replaceExisting: true,
            technologyRoutingOperationId: currentProcess.value.id,
          }).then(res => {
            if (res.code === 200) {
              ElMessage.success("同步成功");
              refreshParamList();
            } else {
              ElMessage.error(res.msg || "同步失败");
            }
          });
        }
      })
      .catch(() => {});
  };
@@ -670,15 +690,20 @@
  // 产品选择
  const handleProductSelect = products => {
    console.log(products, "===products===");
    if (products && products.length > 0) {
      const product = products[0];
      form.value.productModelId = product.id;
      form.value.productName = product.productName;
      form.value.model = product.model;
      form.value.unit = product.unit || "";
      console.log(product, "product");
      form.value = {
        ...form.value,
        productModelId: product.id,
        productName: product.productName,
        model: product.model,
        unit: product.unit || "",
      };
      showProductSelectDialog.value = false;
      // 触发表单验证
      formRef.value?.validateField("productModelId");
      // formRef.value?.validateField("productModelId");
    }
  };
@@ -696,8 +721,8 @@
          const addPromise = isOrderPage
            ? addRouteItem({
                productOrderId: orderId.value,
                productRouteId: routeId.value,
                productOrderId: Number(orderId.value),
                productRouteId: Number(routeId.value),
                technologyOperationId: form.value.technologyOperationId,
                productModelId: form.value.productModelId,
                isQuality: form.value.isQuality,
@@ -773,6 +798,8 @@
      productName: "",
      model: "",
      unit: "",
      isQuality: false,
      isProduction: false,
    };
    formRef.value?.resetFields();
  };
@@ -788,7 +815,7 @@
    currentProcess.value = row;
    const query = {
      technologyRoutingOperationId: row.id,
      orderId: orderId.value,
      productionOrderId: orderId.value,
    };
    const apiPromise =
@@ -1015,7 +1042,10 @@
  const fetchBomData = async () => {
    try {
      const { data } = await queryList(routeInfo.value.bomId);
      const isOrderPage = pageType.value === "order";
      const { data } = await (isOrderPage ? queryList2 : queryList)(
        routeInfo.value.bomId
      );
      bomDataValue.value.dataList = data || [];
      normalizeTreeData(bomDataValue.value.dataList);
    } catch (err) {
@@ -1234,12 +1264,14 @@
  const handleSaveBom = () => {
    bomDataValue.value.loading = true;
    console.log(bomDataValue.value.dataList, "bomDataValue.value.dataList");
    normalizeTreeData(bomDataValue.value.dataList);
    const valid = validateAllBom();
    if (valid) {
      addBomDetail({
        bomId: routeInfo.value.bomId,
        bomId: Number(routeInfo.value.bomId),
        children: buildSubmitTree(bomDataValue.value.dataList || []),
      })
        .then(() => {