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 , id: item.treeId ,
children: [] children: []
}; };
// 递归处理子节点 // 递归处理子节点
if (item.children && Array.isArray(item.children)) { if (item.children && Array.isArray(item.children)) {
newItem.children = transformTreeData(item.children); newItem.children = transformTreeData(item.children);

View File

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

View File

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

View File

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

View File

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

View File

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