diff --git a/src/components/common/report/reportEditer/editItem.vue b/src/components/common/report/reportEditer/editItem.vue index 97876b72..9a8db8de 100644 --- a/src/components/common/report/reportEditer/editItem.vue +++ b/src/components/common/report/reportEditer/editItem.vue @@ -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({ img: '图片', table: '表格', }); + +watch( + () => documentData.value, + (val: any) => { + emit('update:data', val); + }, + { deep: true } +); + watch( () => props.data, (val: any, oldVal) => { diff --git a/src/components/common/report/reportEditer/index.vue b/src/components/common/report/reportEditer/index.vue index fd622f31..2e6d6fd9 100644 --- a/src/components/common/report/reportEditer/index.vue +++ b/src/components/common/report/reportEditer/index.vue @@ -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; }); diff --git a/src/components/common/report/reportInputDialog.vue b/src/components/common/report/reportInputDialog.vue index 5ddc5dcf..3a7056b1 100644 --- a/src/components/common/report/reportInputDialog.vue +++ b/src/components/common/report/reportInputDialog.vue @@ -208,6 +208,7 @@ const closeFun = () => { .report-content { width: 100%; flex: 1; + height: calc(100% - 32px); .no-report { width: 100%; height: 100%; diff --git a/src/components/common/table/tableForm.vue b/src/components/common/table/tableForm.vue index 718cb135..fb961287 100644 --- a/src/components/common/table/tableForm.vue +++ b/src/components/common/table/tableForm.vue @@ -104,16 +104,21 @@ onMounted(() => { } }); +const tableData = ref([]); + 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(formatDataFun(props.data)); -const tableData = ref([]); const rules = ref({}); const formRef = ref(); @@ -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], }); } } diff --git a/src/components/taskDetail/taskPerformance.vue b/src/components/taskDetail/taskPerformance.vue index 57a1f81b..f4f1a619 100644 --- a/src/components/taskDetail/taskPerformance.vue +++ b/src/components/taskDetail/taskPerformance.vue @@ -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, }; } } diff --git a/src/views/data/analysis/components/analysisDataDialog.vue b/src/views/data/analysis/components/analysisDataDialog.vue index c3949607..b3234d33 100644 --- a/src/views/data/analysis/components/analysisDataDialog.vue +++ b/src/views/data/analysis/components/analysisDataDialog.vue @@ -89,6 +89,7 @@ v-if="showComponents" :check-task-info="performanceData" :cloumn-width="cloumnWidth" + :analysis-type="analysisType" > @@ -41,6 +40,10 @@ const props = defineProps({ type: String, default: '', }, + analysisType: { + type: String, + default: '', + }, }); const performanceTableRef = ref(); @@ -52,15 +55,21 @@ const modelAttribute = ref([]); 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;