gaoluyang
2026-06-30 113ca01ea4abdeee4e01695df973219ee4671ef0
src/views/qualityManagement/processInspection/components/formDia.vue
@@ -4,6 +4,7 @@
        v-model="dialogFormVisible"
        :title="operationType === 'add' ? '新增过程检验' : '编辑过程检验'"
        width="70%"
            draggable
        @close="closeDia"
    >
      <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
@@ -209,13 +210,45 @@
      getQualityInspectParamList(row.id)
   } else {
      // 新增时设置默认值
      form.value.process = "试压"; // 工序默认为试压
      form.value.unit = "包"; // 单位默认为包
      form.value.quantity = 3; // 数量默认为3
      form.value.checkResult = "合格"; // 检验结果默认为合格
         // 产品名称默认傻老大原味瓜子(质检试压)
         productTreeList({productName: '质量'}).then((res) => {
            productOptions.value = convertIdToValue(res);
            // 递归查找目标节点
               const findTarget = (nodes) => {
                  for (const node of nodes) {
                     if (node.label === "傻老大原味瓜子(质检试压)") {
                        return node;
                     }
                     if (node.children && node.children.length > 0) {
                        const found = findTarget(node.children);
                        if (found) return found;
                     }
                  }
                  return null;
               };
               const target = findTarget(res);
            if (target) {
               form.value.productId = target.id;
               form.value.productName = target.label;
               currentProductId.value = target.id;
               // 加载规格列表
               modelList({ id: target.id }).then((modelRes) => {
                  modelOptions.value = modelRes;
               });
               // 加载检验参数
               qualityInspectDetailByProductId(target.id).then((paramRes) => {
                  tableData.value = paramRes.data;
               });
            }
         });
   }
   // 默认检验员为当前登录人,检测日期默认为当天(空时填充)
   if (currentUserName.value && !form.value.checkName) {
      form.value.checkName = currentUserName.value;
   if (!form.value.checkName) {
      form.value.checkName = "侯盛杰";
   }
   if (!form.value.checkTime) {
      form.value.checkTime = getToday();