This commit is contained in:
2026-04-01 17:19:59 +08:00
parent cb10060e7c
commit cf4b9da769

View File

@@ -36,12 +36,15 @@
:title="$t('工况库.机型准确度')"
:loading="machineLoading"
barType="barChart"
chartsId="machineConfidenceChart1"
chartsId="machineConfidenceChart"
:option="machineConfidenceOption"
:extraFilters="machineExtraFilters"
:filterItems="['discipline']"
@update="queryMachineConfidenceFun"
>
<template #actionSlot>
<downloadAction @download="downloadFun" />
</template>
<template #extraFilters>
<el-form label-position="left">
<el-form-item label="地图库">
@@ -106,10 +109,19 @@ import EchartCard from '@/components/common/echartCard/index.vue';
import commonFilterChart from '@/components/common/echartCard/commonFilterChart.vue';
import { statisticDisciplineConfidenceTrendApi } from '@/api/task/taskpool';
import downloadAction from './common/download.vue';
import { fa } from 'element-plus/es/locales.mjs';
import { exportToImage } from '@/utils/exportPdf';
const downloadFun = (command: string | number | object) => {
const downloadFun = async (command: string | number | object) => {
console.log('执行了下载操作', command);
if (command === 'pic') {
const element = document.getElementById('machineConfidenceChart'); // 根据chartsId获取对应的DOM元素
if (element) {
await exportToImage(element, 'report');
}
} else if (command === 'excel') {
// 导出excel的逻辑
console.log('导出excel');
}
};
// #region学科准确度
@@ -124,52 +136,53 @@ const disciplineConfidenceUpdate = (data: any) => {
// #endregion
// #region 机型准确度
const machineConfidenceRef = ref();
const machineExtraFilters = ref({
workspacePoolName: '',
mode: '2',
});
const machineLoading = ref(false);
// const resData = [
// { taskName: '产品动画仿真需求2026-2', confidence: '0.56' },
// { taskName: '整车模态分析', confidence: '0.12' },
// { taskName: '上料小车静力学分析', confidence: '0.66' },
// { taskName: '测试产品线新1111', confidence: '0.43' },
// { taskName: '物流线支架静力学分析', confidence: '0.83' },
// { taskName: '输送底板动力学分析', confidence: '0.51' },
// { taskName: 'rengwu4', confidence: '0.53' },
// ];
const resData = [
{ taskName: '产品动画仿真需求2026-2', confidence: '0.56' },
{ taskName: '整车模态分析', confidence: '0.12' },
{ taskName: '上料小车静力学分析', confidence: '0.66' },
{ taskName: '测试产品线新1111', confidence: '0.43' },
{ taskName: '物流线支架静力学分析', confidence: '0.83' },
{ taskName: '输送底板动力学分析', confidence: '0.51' },
{ taskName: 'rengwu4', confidence: '0.53' },
];
const machineConfidenceOption = ref<any>();
const queryMachineConfidenceFun = async (data: any) => {
console.log(data, '机型准确度更新了');
// machineLoading.value = true;
// try {
// // const res: any = await statisticMachineConfidenceApi({ poolName: workspacePoolName.value });
// const res = {
// code: 200,
// data: resData,
// };
// if (res.code === 200 && Array.isArray(res.data)) {
// const data = res.data;
// const xData = data.map((item) => (item as any).taskName);
// const option = {
// color: ['#409eff'],
// xAxis: { data: xData },
// yAxis: { name: '准确度(%)' },
// series: [
// {
// data: data.map((item) => (Number(item.confidence) * 100).toFixed(0)),
// name: '准确度(%)',
// },
// ],
// dataZoom: xData.length > 5,
// zoomShowNum: 5,
// grid: { bottom: 50 },
// };
// machineConfidenceOption.value = option;
// }
// } finally {
// machineLoading.value = false;
// }
machineLoading.value = true;
try {
// const res: any = await statisticMachineConfidenceApi({ poolName: workspacePoolName.value });
const res = {
code: 200,
data: resData,
};
if (res.code === 200 && Array.isArray(res.data)) {
const data = res.data;
const xData = data.map((item) => (item as any).taskName);
const option = {
color: ['#409eff'],
xAxis: { data: xData },
yAxis: { name: '准确度(%)' },
series: [
{
data: data.map((item) => (Number(item.confidence) * 100).toFixed(0)),
name: '准确度(%)',
},
],
dataZoom: xData.length > 5,
zoomShowNum: 5,
grid: { bottom: 50 },
};
machineConfidenceOption.value = option;
}
} finally {
machineLoading.value = false;
}
};
// #endregion