This commit is contained in:
2026-03-03 18:47:55 +08:00
7 changed files with 70 additions and 36 deletions

View File

@@ -144,6 +144,8 @@ import CompForm from './components/form.vue';
import CompImg from './components/img.vue';
import CompTable from './components/table.vue';
const emit = defineEmits(['update:data']);
defineOptions({
name: 'EditItem',
});
@@ -174,6 +176,15 @@ const titleMap = ref<any>({
img: '图片',
table: '表格',
});
watch(
() => documentData.value,
(val: any) => {
emit('update:data', val);
},
{ deep: true }
);
watch(
() => props.data,
(val: any, oldVal) => {

View File

@@ -107,12 +107,13 @@ const formatFun = (data: any) => {
params: item.params,
};
if (item.type === 'img') {
itemData.value.forEach((val: any, valIndex: number) => {
(itemData.value || []).forEach((val: any, valIndex: number) => {
const randNum = Math.floor(Math.random() * 900000) + 100000;
let picName = '';
if (val.title) {
picName = `${val.title.replace(/\s/g, '')}_${new Date().getTime()}_${index + 1}_${valIndex + 1}`;
picName = `${val.title.replace(/\s/g, '')}_${randNum}_${index + 1}_${valIndex + 1}`;
} else {
picName = `图片_${new Date().getTime()}_${index + 1}_${valIndex + 1}`;
picName = `图片_${randNum}_${index + 1}_${valIndex + 1}`;
}
val.picName = picName;
});

View File

@@ -208,6 +208,7 @@ const closeFun = () => {
.report-content {
width: 100%;
flex: 1;
height: calc(100% - 32px);
.no-report {
width: 100%;
height: 100%;

View File

@@ -104,16 +104,21 @@ onMounted(() => {
}
});
const tableData = ref<any>([]);
const formatDataFun = (data: any) => {
data?.extras?.forEach((item: any) => {
const { propertyName, propertyValue } = item;
data[propertyName] = propertyValue;
});
return data;
if (tableData.value.length === 0) {
data?.extras?.forEach((item: any) => {
const { propertyName, propertyValue } = item;
data[propertyName] = propertyValue;
});
return data;
} else {
return getFormDataFun(data);
}
};
const formData = ref<any>(formatDataFun(props.data));
const tableData = ref<any>([]);
const rules = ref<any>({});
const formRef = ref<any>();
@@ -127,6 +132,7 @@ const getHeadDataFun = () => {
formConfigData.value = data;
setValidateFun(data);
tableData.value = data;
getFormDataFun(props.data);
formOptionsFormat(tableData.value);
emit('load');
}
@@ -236,20 +242,20 @@ const validateFun = () => {
});
};
const getFormDataFun = () => {
const objData: any = formData.value || {};
const hasExtras = !!formData.value.extras;
objData.extras = hasExtras ? formData.value.extras : [];
const getFormDataFun = (data?: any) => {
const objData: any = data || formData.value || {};
const hasExtras = !!objData.extras;
objData.extras = hasExtras ? objData.extras : [];
tableData.value.forEach((item: any) => {
const { key, type } = item;
if (type === 1) {
objData[key] = formData.value[key];
objData[key] = objData[key];
} else {
if (hasExtras) {
let hasExtraKey = false;
objData.extras.some((val: any) => {
if (val.propertyName === key) {
val.propertyValue = formData.value[key];
val.propertyValue = objData[key];
hasExtraKey = true;
return true;
}
@@ -258,14 +264,14 @@ const getFormDataFun = () => {
objData.extras.push({
propertyClass: 'default',
propertyName: key,
propertyValue: formData.value[key],
propertyValue: objData[key],
});
}
} else {
objData.extras.push({
propertyClass: 'default',
propertyName: key,
propertyValue: formData.value[key],
propertyValue: objData[key],
});
}
}

View File

@@ -4,7 +4,7 @@
tableName="TASK_RUN_PERFORMANCE"
ref="baseTableRef"
:export-file-name="'指标列表'"
:export-api="exportPerformanceApi"
:export-api="exportPerformanceByScriptApi"
showCheckbox
hidePagination
:data="performanceData"
@@ -62,7 +62,7 @@
ref="baseTableRef"
:data="performanceData"
:export-file-name="'指标列表'"
:export-api="exportPerformanceApi"
:export-api="exportPerformanceByScriptApi"
showCheckbox
hidePagination
:actionList="showLeftOptions ? actionList : []"
@@ -149,6 +149,7 @@ import StatusDot from '@/components/common/statusDot/index.vue';
import { syncKeyResultToTaskApi } from '@/api/project/run';
import inputPerformanceExcel from './inputPerformanceExcel.vue';
import { importSimulationPerformanceApi } from '@/api/project/task';
import { exportPerformanceByScriptApi } from '@/api/project/analysis';
const props = defineProps({
taskId: {
@@ -349,7 +350,7 @@ const getFormConfigureFun = async () => {
};
} else {
excelParams.value = {
taskId: props.taskInfo.uuid,
taskNodeId: props.taskInfo.uuid,
};
}
}

View File

@@ -89,6 +89,7 @@
v-if="showComponents"
:check-task-info="performanceData"
:cloumn-width="cloumnWidth"
:analysis-type="analysisType"
></performanceAnalysis>
</template>
<template v-if="item.value === 'result'">
@@ -474,7 +475,9 @@ const getRunPerformanceFn = async (data: any) => {
});
if (res && res.code === 200) {
const list = res.data;
const list = res.data.map((item: any) => {
return { ...item, runName: data.runName };
});
return list;
}
@@ -491,6 +494,7 @@ const getSimulationTaskFileFun = async (data: any, level: any, fileBizType: any)
startTime: '',
endTime: '',
level: level,
fileTypeDictValue: fileBizType,
};
try {

View File

@@ -10,7 +10,6 @@
<template #performanceInfo="{ row }">
{{ row.performanceInfo }}
</template>
</BaseTable>
</div>
</template>
@@ -41,6 +40,10 @@ const props = defineProps({
type: String,
default: '',
},
analysisType: {
type: String,
default: '',
},
});
const performanceTableRef = ref();
@@ -52,15 +55,21 @@ const modelAttribute = ref<any>([]);
const getTableColumnsFun = (data: any) => {
const performanceDatas = data || [];
const type = props.analysisType === '仿真算例' ? 0 : 1;
console.log(performanceDatas, 'performanceDatasperformanceDatasperformanceDatas');
for (let i = 0; i < performanceDatas.length; i++) {
performanceDatas[i].completeStatus = getPerformanceSTatus(performanceDatas[i]) || 0;
}
const names = performanceDatas?.map((item: any) => {
return item.taskName;
return type ? item.taskName : item.runName;
});
const taskNames = Array.from(new Set(names));
console.log(taskNames, 'taskNamestaskNamestaskNames');
modelAttribute.value = performanceDatas.map((item: any) => {
const nodeName = item.nodeName || '';
const method = item.method || '';
@@ -68,10 +77,10 @@ const getTableColumnsFun = (data: any) => {
const unitLabel = PERFORMANCE_UNIT.value?.O?.[item.unit] || item.unit || '';
const obj: any = {
name: `${nodeName} (${method} ${targetValue} ${unitLabel})`,
value: item.uuid,
value: type ? item.taskId : item.runId,
};
obj[item.uuid] = item.highValue;
obj[type ? item.taskId : item.runId] = item.resultValue;
return obj;
});
@@ -95,10 +104,10 @@ const getTableColumnsFun = (data: any) => {
let modelcolumns: any = [];
for (let j = 0; j < taskNames.length; j++) {
for (let i = 0; i < list.length; i++) {
if (list[i].taskName === taskNames[j]) {
if ((type ? list[i].taskName : list[i].runName) === taskNames[j]) {
const obj: any = {
title: `${list[i].taskName}`,
key: `${list[i].uuid}`,
title: `${type ? list[i].taskName : list[i].runName}`,
key: `${type ? list[i].taskId : list[i].runId}`,
isShow: true,
};
modelcolumns.push(obj);
@@ -124,6 +133,7 @@ const getTableColumnsFun = (data: any) => {
tableData.value.push(obj);
}
console.log(modelcolumns, 'modelcolumns');
showTableContent.value = true;
nextTick(() => {
@@ -134,18 +144,18 @@ const getTableColumnsFun = (data: any) => {
const getPerformanceSTatus = (row: any) => {
let status: any = 0;
// 当指标值,达标方式,目标值有一个不存在时,返回状态未分析
if (!row?.method || !row?.highValue || !row?.targetValue) {
if (!row?.method || !row?.resultValue || !row?.targetValue) {
return status;
}
if (row?.method && row?.highValue && row?.targetValue) {
const highValue = Number(row?.highValue);
if (row?.method && row?.resultValue && row?.targetValue) {
const resultValue = Number(row?.resultValue);
const targetValue = Number(row?.targetValue);
const lowValue = Number(row?.lowValue);
// 小于等于
if (row.method === '≤') {
if (targetValue <= highValue) {
if (targetValue <= resultValue) {
status = 2;
} else {
status = 1;
@@ -154,7 +164,7 @@ const getPerformanceSTatus = (row: any) => {
// 小于
if (row.method === '<') {
if (targetValue < highValue) {
if (targetValue < resultValue) {
status = 2;
} else {
status = 1;
@@ -162,7 +172,7 @@ const getPerformanceSTatus = (row: any) => {
}
// 大于
if (row.method === '>') {
if (targetValue > highValue) {
if (targetValue > resultValue) {
status = 2;
} else {
status = 1;
@@ -170,7 +180,7 @@ const getPerformanceSTatus = (row: any) => {
}
// 大于等于
if (row.method === '≥') {
if (targetValue >= highValue) {
if (targetValue >= resultValue) {
status = 2;
} else {
status = 1;
@@ -178,7 +188,7 @@ const getPerformanceSTatus = (row: any) => {
}
// 包含
if (row.method === '[]') {
if (targetValue <= highValue && targetValue >= lowValue) {
if (targetValue <= resultValue && targetValue >= lowValue) {
status = 2;
} else {
status = 1;