feat: 质量管理检验员筛选和传递优化
1. 检验员下拉框筛选:过程检验、出厂检验、原材料检验的检验员下拉框只显示 roleIds 包含 106 的用户,包括列表页的"检验"弹窗、"分配检验员"弹窗,以及新增/编辑弹窗
2. 检验员默认值优化:点击"检验"按钮时检验员默认为当前登录用户;选择"不合格"打开详情页时检验员从上个页面带入,修复 closeQuickCheck() 重置表单导致检验员值丢失的问题
3. 材料信息新增行修复:生产工单绑定工艺路线弹窗中,新增材料行时根据 productById 是否有值判断显示选择器还是文本
| | |
| | | const modelOptions = ref([]); |
| | | |
| | | // 打开弹框 |
| | | const openDialog = async (type, row, defaultCheckResult = "") => { |
| | | const openDialog = async (type, row, defaultCheckResult = "", defaultCheckName = "") => { |
| | | operationType.value = type; |
| | | dialogFormVisible.value = true; |
| | | // 先清空表单验证状态,避免闪烁 |
| | |
| | | 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(() => { |
| | |
| | | |
| | | 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 |
| | | } |
| | |
| | | // 打开检验结果选择对话框 |
| | | 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 || "", |
| | |
| | | getList(); |
| | | }); |
| | | } else { |
| | | // 不合格:打开详细填写页面 |
| | | // 不合格:打开详细填写页面,传递检验员信息 |
| | | // 先保存检验员值,避免 closeQuickCheck 重置后丢失 |
| | | const checkNameToPass = quickCheckForm.value.checkName; |
| | | closeQuickCheck(); |
| | | nextTick(() => { |
| | | formDia.value?.openDialog("edit", currentRow.value, "不合格"); |
| | | formDia.value?.openDialog("edit", currentRow.value, "不合格", checkNameToPass); |
| | | }); |
| | | } |
| | | }; |
| | |
| | | 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; |
| | |
| | | form.value = { |
| | | checkTime: "", |
| | | process: "", |
| | | checkName: "", |
| | | checkName: defaultCheckName || "", |
| | | productName: "", |
| | | productId: "", |
| | | productModelId: "", |
| | |
| | | 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) { |
| | |
| | | } |
| | | 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 |
| | | } |
| | |
| | | // 打开检验结果选择对话框 |
| | | 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 || "", |
| | |
| | | getList(); |
| | | }); |
| | | } else { |
| | | // 不合格:打开详细填写页面 |
| | | // 不合格:打开详细填写页面,传递检验员信息 |
| | | // 先保存检验员值,避免 closeQuickCheck 重置后丢失 |
| | | const checkNameToPass = quickCheckForm.value.checkName; |
| | | closeQuickCheck(); |
| | | nextTick(() => { |
| | | formDia.value?.openDialog("edit", currentRow.value, "不合格"); |
| | | formDia.value?.openDialog("edit", currentRow.value, "不合格", checkNameToPass); |
| | | }); |
| | | } |
| | | }; |
| | |
| | | }); |
| | | |
| | | // 打开弹框 |
| | | const openDialog = async (type, row, defaultCheckResult = "") => { |
| | | const openDialog = async (type, row, defaultCheckResult = "", defaultCheckName = "") => { |
| | | operationType.value = type; |
| | | getOptions().then((res) => { |
| | | supplierList.value = res.data; |
| | |
| | | form.value = { |
| | | checkTime: "", |
| | | supplier: "", |
| | | checkName: "", |
| | | checkName: defaultCheckName || "", |
| | | productName: "", |
| | | productId: "", |
| | | productModelId: "", |
| | |
| | | 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) { |
| | |
| | | |
| | | 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 |
| | | } |
| | |
| | | // 打开检验结果选择对话框 |
| | | 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 || "", |
| | |
| | | getList(); |
| | | }); |
| | | } else { |
| | | // 不合格:打开详细填写页面 |
| | | // 不合格:打开详细填写页面,传递检验员信息 |
| | | // 先保存检验员值,避免 closeQuickCheck 重置后丢失 |
| | | const checkNameToPass = quickCheckForm.value.checkName; |
| | | closeQuickCheck(); |
| | | nextTick(() => { |
| | | formDia.value?.openDialog("edit", currentRow.value, "不合格"); |
| | | formDia.value?.openDialog("edit", currentRow.value, "不合格", checkNameToPass); |
| | | }); |
| | | } |
| | | }; |