微调
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
// 添加启动方式选项数据
|
||||
|
||||
@@ -403,7 +403,7 @@ const typeId = ref(null)
|
||||
// 过滤数据
|
||||
const formatter = (row: any) => {
|
||||
// 检查数据是否已加载完成
|
||||
if (!row.cellValue && row.cellValue !== 0) {
|
||||
if (!row.cellValue && row.cellValue !== 0 && row.column.field !='inpactloadStartup') {
|
||||
return ''; // 数据未加载时返回空字符串
|
||||
}
|
||||
|
||||
@@ -421,8 +421,7 @@ const formatter = (row: any) => {
|
||||
}else if(row.column.field =='inpactloadStartup'){
|
||||
const found = shockRef.value.find((item: any) => item.inpactloadtypeId == typeId.value)
|
||||
return found.inpactloadStartup
|
||||
}
|
||||
else if(row.column.field == 'isIsolationtrans'){
|
||||
}else if(row.column.field == 'isIsolationtrans'){
|
||||
return row.cellValue == '01' ? '是' : '否'
|
||||
}else if(row.column.field =='inpactloadFreq'){
|
||||
if(row.cellValue == '01'){
|
||||
@@ -432,8 +431,7 @@ const formatter = (row: any) => {
|
||||
}else{
|
||||
return '2次/h<N≤10次/h'
|
||||
}
|
||||
}
|
||||
else if (row.column.field == 'harmId') {
|
||||
}else if (row.column.field == 'harmId') {
|
||||
const found = characteristic.value.find((item: any) => item.harmId == row.cellValue)
|
||||
if(found){
|
||||
return found.harmName
|
||||
|
||||
Reference in New Issue
Block a user