feat: 实现Bug#428 #430联动功能

#428: 检查申请分类联动检查方法 - 展开分类时自动加载对应检查方法
#430: 套餐金额实时同步 - 选择检查方法后自动更新申请单总金额
This commit is contained in:
2026-04-24 15:22:52 +08:00
parent e7beb3f5c3
commit 72e1f927e9
2 changed files with 1407 additions and 0 deletions

View File

@@ -306,6 +306,7 @@
v-for="cat in filteredCategoryList"
:key="cat.typeId"
:name="cat.typeId"
@click="handleCategoryExpand(cat)"
>
<template #title>
<span class="cat-title">{{ cat.categoryName }}</span>
@@ -596,6 +597,33 @@ const availableMethods = computed(() => {
});
// 当可选方法列表改变时,如果当前选中的方法不在新列表中,则清空
// #428: 分类展开时联动加载检查方法
async function handleCategoryExpand(cat) {
if (!cat || !cat.typeName) return;
try {
const res = await searchCheckMethod({ checkType: cat.typeName });
let data = res?.data?.data || res?.data || res?.rows || res;
if (!Array.isArray(data) && res?.data && Array.isArray(res.data.data)) {
data = res.data.data;
}
if (Array.isArray(data) && data.length > 0) {
cat.methods = data.map(m => ({
id: m.id,
name: m.name,
code: m.code,
price: m.price || 0,
packageName: m.packageName || '',
packagePrice: m.packagePrice || null,
serviceFee: m.serviceFee || null
}));
}
} catch (err) {
console.error('加载分类检查方法失败', err);
}
}
watch(availableMethods, (newMethods) => {
if (form.inspectionMethod && !newMethods.find(m => m.name === form.inspectionMethod)) {
form.inspectionMethod = '';
@@ -1045,6 +1073,11 @@ function selectMethodCheckbox(checked, item, method) {
}
// 联动更新表单检查方法显示字段
updateMethodDisplay();
// #430: 套餐金额实时同步到申请单
nextTick(() => {
form.totalAmount = totalAmountCalc.value;
});
}
// Bug #384修复: 更新检查方法显示字段(联动)