feat: 质量管理检验员筛选和传递优化
1. 检验员下拉框筛选:过程检验、出厂检验、原材料检验的检验员下拉框只显示 roleIds 包含 106 的用户,包括列表页的"检验"弹窗、"分配检验员"弹窗,以及新增/编辑弹窗
2. 检验员默认值优化:点击"检验"按钮时检验员默认为当前登录用户;选择"不合格"打开详情页时检验员从上个页面带入,修复 closeQuickCheck() 重置表单导致检验员值丢失的问题
3. 材料信息新增行修复:生产工单绑定工艺路线弹窗中,新增材料行时根据 productById 是否有值判断显示选择器还是文本
已修改6个文件
84 ■■■■ 文件已修改
src/views/qualityManagement/finalInspection/components/formDia.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/finalInspection/index.vue 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/processInspection/components/formDia.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/processInspection/index.vue 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/rawMaterialInspection/components/formDia.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/rawMaterialInspection/index.vue 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/finalInspection/components/formDia.vue
@@ -203,7 +203,7 @@
const modelOptions = ref([]);
// 打开弹框
const openDialog = async (type, row, defaultCheckResult = "") => {
const openDialog = async (type, row, defaultCheckResult = "", defaultCheckName = "") => {
  operationType.value = type;
  dialogFormVisible.value = true;
  // 先清空表单验证状态,避免闪烁
@@ -237,6 +237,9 @@
    if (defaultCheckResult) {
      form.value.checkResult = defaultCheckResult;
    }
    // 如果传入了默认检验员,覆盖row中的值(优先使用传入的检验员)
    console.log('formDia checkName debug:', { defaultCheckName, rowCheckName: row.checkName });
    form.value.checkName = defaultCheckName || row.checkName || "";
    currentProductId.value = row.productId || 0
    // 清空验证状态,避免数据加载过程中的校验闪烁
    nextTick(() => {
src/views/qualityManagement/finalInspection/index.vue
@@ -407,7 +407,11 @@
const open = async (row) => {
    let userLists = await userListNoPage();
    userList.value = userLists.data;
    // 筛选 roleIds 包含 106 的用户
    userList.value = (userLists.data || []).filter(user => {
        const roleIds = user.roleIds || [];
        return roleIds.includes(106) || roleIds.includes('106');
    });
    currentRow.value = row
    dialogFormVisible.value = true
}
@@ -433,15 +437,18 @@
// 打开检验结果选择对话框
const openQuickCheck = async (row) => {
    currentRow.value = row;
    // 加载用户列表
    // 加载用户列表,筛选 roleIds 包含 106 的用户
    try {
        const userLists = await userListNoPage();
        userList.value = userLists.data || [];
        userList.value = (userLists.data || []).filter(user => {
            const roleIds = user.roleIds || [];
            return roleIds.includes(106) || roleIds.includes('106');
        });
    } catch (e) {
        console.error("加载检验员列表失败", e);
        userList.value = [];
    }
    // 设置默认值
    // 设置默认值(检验员默认为当前登录用户)
    quickCheckForm.value = {
        checkResult: "合格",
        checkName: userStore.nickName || "",
@@ -490,10 +497,12 @@
            getList();
        });
    } else {
        // 不合格:打开详细填写页面
        // 不合格:打开详细填写页面,传递检验员信息
        // 先保存检验员值,避免 closeQuickCheck 重置后丢失
        const checkNameToPass = quickCheckForm.value.checkName;
        closeQuickCheck();
        nextTick(() => {
            formDia.value?.openDialog("edit", currentRow.value, "不合格");
            formDia.value?.openDialog("edit", currentRow.value, "不合格", checkNameToPass);
        });
    }
};
src/views/qualityManagement/processInspection/components/formDia.vue
@@ -216,7 +216,7 @@
const modelOptions = ref([]);
// 打开弹框
const openDialog = async (type, row, defaultCheckResult = "") => {
const openDialog = async (type, row, defaultCheckResult = "", defaultCheckName = "") => {
    operationType.value = type;
    getOptions().then((res) => {
        supplierList.value = res.data;
@@ -239,7 +239,7 @@
    form.value = {
        checkTime: "",
        process: "",
        checkName: "",
        checkName: defaultCheckName || "",
        productName: "",
        productId: "",
        productModelId: "",
@@ -261,8 +261,11 @@
        form.value = {...row, testStandardId: ''}
        // 如果传入了默认检测结果,覆盖row中的值
        if (defaultCheckResult) {
            form.value.checkResult = defaultCheckResult;
        form.value.checkResult = defaultCheckResult;
        }
        // 如果传入了默认检验员,覆盖row中的值(优先使用传入的检验员)
        console.log('formDia checkName debug:', { defaultCheckName, rowCheckName: row.checkName });
            form.value.checkName = defaultCheckName || row.checkName || "";
        currentProductId.value = row.productId || 0
        // 关键:编辑时加载规格型号下拉选项,才能反显 productModelId
        if (currentProductId.value) {
src/views/qualityManagement/processInspection/index.vue
@@ -350,7 +350,11 @@
}
const open = async (row) => {
    let userLists = await userListNoPage();
    userList.value = userLists.data;
    // 筛选 roleIds 包含 106 的用户
    userList.value = (userLists.data || []).filter(user => {
        const roleIds = user.roleIds || [];
        return roleIds.includes(106) || roleIds.includes('106');
    });
    currentRow.value = row
    dialogFormVisible.value = true
}
@@ -432,15 +436,18 @@
// 打开检验结果选择对话框
const openQuickCheck = async (row) => {
    currentRow.value = row;
    // 加载用户列表
    // 加载用户列表,筛选 roleIds 包含 106 的用户
    try {
        const userLists = await userListNoPage();
        userList.value = userLists.data || [];
        userList.value = (userLists.data || []).filter(user => {
            const roleIds = user.roleIds || [];
            return roleIds.includes(106) || roleIds.includes('106');
        });
    } catch (e) {
        console.error("加载检验员列表失败", e);
        userList.value = [];
    }
    // 设置默认值
    // 设置默认值(检验员默认为当前登录用户)
    quickCheckForm.value = {
        checkResult: "合格",
        checkName: userStore.nickName || "",
@@ -489,10 +496,12 @@
            getList();
        });
    } else {
        // 不合格:打开详细填写页面
        // 不合格:打开详细填写页面,传递检验员信息
        // 先保存检验员值,避免 closeQuickCheck 重置后丢失
        const checkNameToPass = quickCheckForm.value.checkName;
        closeQuickCheck();
        nextTick(() => {
            formDia.value?.openDialog("edit", currentRow.value, "不合格");
            formDia.value?.openDialog("edit", currentRow.value, "不合格", checkNameToPass);
        });
    }
};
src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
@@ -228,7 +228,7 @@
});
// 打开弹框
const openDialog = async (type, row, defaultCheckResult = "") => {
const openDialog = async (type, row, defaultCheckResult = "", defaultCheckName = "") => {
  operationType.value = type;
  getOptions().then((res) => {
    supplierList.value = res.data;
@@ -249,7 +249,7 @@
    form.value = {
    checkTime: "",
    supplier: "",
    checkName: "",
    checkName: defaultCheckName || "",
    productName: "",
    productId: "",
    productModelId: "",
@@ -272,6 +272,9 @@
    if (defaultCheckResult) {
      form.value.checkResult = defaultCheckResult;
    }
    // 如果传入了默认检验员,覆盖row中的值(优先使用传入的检验员)
    console.log('formDia checkName debug:', { defaultCheckName, rowCheckName: row.checkName });
    form.value.checkName = defaultCheckName || row.checkName || "";
    currentProductId.value = row.productId || 0
    // 关键:编辑时加载规格型号下拉选项,才能反显 productModelId
    if (currentProductId.value) {
src/views/qualityManagement/rawMaterialInspection/index.vue
@@ -407,7 +407,11 @@
const open = async (row) => {
  let userLists = await userListNoPage();
  userList.value = userLists.data;
  // 筛选 roleIds 包含 106 的用户
  userList.value = (userLists.data || []).filter(user => {
    const roleIds = user.roleIds || [];
    return roleIds.includes(106) || roleIds.includes('106');
  });
  currentRow.value = row
  dialogFormVisible.value = true
}
@@ -433,15 +437,18 @@
// 打开检验结果选择对话框
const openQuickCheck = async (row) => {
  currentRow.value = row;
  // 加载用户列表
  // 加载用户列表,筛选 roleIds 包含 106 的用户
  try {
    const userLists = await userListNoPage();
    userList.value = userLists.data || [];
    userList.value = (userLists.data || []).filter(user => {
      const roleIds = user.roleIds || [];
      return roleIds.includes(106) || roleIds.includes('106');
    });
  } catch (e) {
    console.error("加载检验员列表失败", e);
    userList.value = [];
  }
  // 设置默认值
  // 设置默认值(检验员默认为当前登录用户)
  quickCheckForm.value = {
    checkResult: "合格",
    checkName: userStore.nickName || "",
@@ -490,10 +497,12 @@
      getList();
    });
  } else {
    // 不合格:打开详细填写页面
    // 不合格:打开详细填写页面,传递检验员信息
    // 先保存检验员值,避免 closeQuickCheck 重置后丢失
    const checkNameToPass = quickCheckForm.value.checkName;
    closeQuickCheck();
    nextTick(() => {
      formDia.value?.openDialog("edit", currentRow.value, "不合格");
      formDia.value?.openDialog("edit", currentRow.value, "不合格", checkNameToPass);
    });
  }
};