This commit is contained in:
sjl
2025-09-03 19:30:29 +08:00
parent 8b20307a14
commit 0067b63536
4 changed files with 46 additions and 38 deletions

View File

@@ -242,8 +242,8 @@ const formRef = ref()
const dialogVisible = ref(false)
const title = ref('')
const open = (row: any) => {
info()
const open = async (row: any) => {
await info() // 等待数据加载完成
title.value = row.title + `_${row.item.name}`
child.value = row.item.child
if (row.title == '新增') {
@@ -256,13 +256,12 @@ const open = (row: any) => {
form.value = JSON.parse(JSON.stringify(row.row))
})
// 如果是冲击负荷类型,需要设置启动方式下拉选项
if (form.value.inpactloadtypeId) {
// 如果是冲击负荷类型,需要设置启动方式下拉选项
if (form.value.inpactloadtypeId) {
// 根据选中的冲击负荷类型ID筛选数据
currentImpactLoadOptions.value = shockList.value.filter(
(item: any) => item.inpactloadtypeId === form.value.inpactloadtypeId
)
console.log('🚀 ~ open ~ currentImpactLoadOptions:', currentImpactLoadOptions.value)
// 构建启动方式选项
const uniqueStartups = new Map()
currentImpactLoadOptions.value.forEach((item: any) => {
@@ -274,29 +273,33 @@ const open = (row: any) => {
startupOptions.value = Array.from(uniqueStartups.values())
// 如果有选项,默认选择第一个
// 如果有选项,默认选择第一个
if (startupOptions.value.length > 0) {
form.value.inpactloadStartup = startupOptions.value[0].value
form.value.inpactloadStartup = startupOptions.value[0].value
} else {
form.value.inpactloadStartup = ''
form.value.inpactloadStartup = ''
}
}
}
dialogVisible.value = true
}
const info = async () => {
// 获取变压器参数字典列表
transformerList({}).then((res: any) => {
transformer.value = res.data
})
// 谐波源特特性
characteristicList({}).then((res: any) => {
characteristic.value = res.data
})
loadList({}).then((res: any) => {
shockList.value = res.data
})
try {
// 使用 Promise.all 并行执行请求以提高性能
const [transformerRes, characteristicRes, shockRes] = await Promise.all([
transformerList({}),
characteristicList({}),
loadList({})
])
transformer.value = transformerRes.data
characteristic.value = characteristicRes.data
shockList.value = shockRes.data
} catch (error) {
console.error('加载数据失败:', error)
}
}
// 添加启动方式选项数据