This commit is contained in:
sjl
2025-09-04 09:08:45 +08:00
parent f251ad3fe6
commit caa81cc872
6 changed files with 46 additions and 35 deletions

View File

@@ -57,6 +57,7 @@ const transformTreeData = (data: any[]) => {
id: item.treeId ,
children: []
};
// 递归处理子节点
if (item.children && Array.isArray(item.children)) {
newItem.children = transformTreeData(item.children);

View File

@@ -100,33 +100,30 @@ const submit = async () => {
if (form.file) {
formRef.value.validate(async (valid: any) => {
if (valid) {
try {
// 显示加载提示
const loadingMessage = ElMessage({
message: '正在评估中',
icon: h(Loading),
duration: 0 // 不自动关闭
})
// 调用后端评估接口
const formData = new FormData()
formData.append('assessId',currentNodeId.value)
formData.append('file', form.file)
// 假设你有一个调用评估接口的方法,如 evaluation
// 你需要在 API 文件中实现这个方法
try {
// 调用后端评估接口
const response = await evaluation(currentNodeId.value, form.file)
if (response.data) {
loadingMessage.close()
ElMessage.success('评估成功!')
emit('data-success')
} else {
loadingMessage.close()
ElMessage.error('评估失败!')
}
eventDataUploadVisible.value = false
} catch (error) {
loadingMessage.close()
// 处理网络错误或其他异常
ElMessage.error('评估失败,请重试!')
} finally {
// 无论成功还是失败,都要关闭加载提示
loadingMessage.close()
eventDataUploadVisible.value = false
}
}
})

View File

@@ -7,7 +7,9 @@
@node-click="handleNodeClick"
@init="handleNodeClick"
ref="assessTreeRef"
:highlight-current = 'true'
:current-node-key="currentTreeKey"
:expand-on-click-node="false"
></AssessTree>
</pane>
<pane style="background: #fff">
@@ -71,7 +73,7 @@ import Outcome from './outcome.vue'
import {exportResult,downloadAssessTemplate,assessResult,userGetInfo} from '@/api/advance-boot/assess'
import { Loading } from '@element-plus/icons-vue'
import AssessTemplate from './assessTemplate.vue'
import { fa } from 'element-plus/es/locale'
import { fa, tr } from 'element-plus/es/locale'
defineOptions({
@@ -143,7 +145,7 @@ const exportReport = () => {
duration: 0 // 不自动关闭
})
exportResult({}, currentNodeId.value).then((res: any) => {
exportResult({}, currentNodeId.value ?? '').then((res: any) => {
let blob = new Blob([res], { // 注意使用 res.data 而不是 res
type: 'application/vnd.ms-excel'
})

View File

@@ -205,6 +205,10 @@ const column: any = ref([
{
title: '冲击负荷类型',
field: 'inpactloadtypeId'
},
{
title: '启动方式',
field: 'inpactloadStartup',
},
{
title: '数量',
@@ -253,6 +257,8 @@ const windfarmCapacityLabel = computed(() => {
}
})
const filteredColumn = computed(() => {
// const windfarmValue = form.value.isWindfarm;
// if (windfarmValue === '01') {
@@ -385,20 +391,19 @@ watch(() => props.nodeId, async (newId) => {
})
// 冲击性负荷
const startupOptions = ref<Array<{ label: string; value: string }>>([])
await shockList({ assessId: props.nodeId }).then(async (res: { data: never[] }) => {
form.value.impact = res.data
// 冲击负荷类型
const loadRes = await loadList({})
// 处理冲击负荷类型名称
form.value.impact = form.value.impact.map((impactItem: any) => {
const found = loadRes.data.find((item: any) => item.inpactloadtypeId == impactItem.inpactloadtypeId)
if (found) {
return {
...impactItem,
inpactloadtypeId: found.inpactloadtypeName
inpactloadtypeId: found.inpactloadtypeName,
inpactloadStartup: found.inpactloadStartup
}
}
return impactItem
@@ -415,10 +420,15 @@ watch(() => props.nodeId, async (newId) => {
inpactloadlowScale: LowVoltage?.name || loadItem.inpactloadlowScale
}
})
})
}
)
}
// 等待 DOM 更新后延迟触发

View File

@@ -262,6 +262,7 @@ const open = async (row: any) => {
currentImpactLoadOptions.value = shockList.value.filter(
(item: any) => item.inpactloadtypeId === form.value.inpactloadtypeId
)
// 构建启动方式选项
const uniqueStartups = new Map()
currentImpactLoadOptions.value.forEach((item: any) => {

View File

@@ -31,7 +31,7 @@
<el-form-item label="用户名称" prop="assessName">
<el-input v-model="form.assessName" placeholder="用户名称" clearable show-word-limit maxlength="32"/>
</el-form-item>
<el-form-item label="电压等级" prop="userScale">
<el-form-item label="用户电压等级" prop="userScale">
<el-select v-model="form.userScale" clearable placeholder="请选择电压等级">
<el-option
v-for="item in voltageleveloption"