This commit is contained in:
2026-03-04 09:41:34 +08:00
12 changed files with 137 additions and 66 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"
@@ -65,7 +65,7 @@
ref="baseTableRef"
:data="performanceData"
:export-file-name="'指标列表'"
:export-api="exportPerformanceApi"
:export-api="exportPerformanceByScriptApi"
showCheckbox
hidePagination
:actionList="showLeftOptions ? actionList : []"
@@ -152,6 +152,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: {
@@ -358,7 +359,7 @@ const getFormConfigureFun = async () => {
};
} else {
excelParams.value = {
taskId: props.taskInfo.uuid,
taskNodeId: props.taskInfo.uuid,
};
}
}
@@ -523,7 +524,8 @@ const inputFileFun = async (data: any) => {
const res: any = await importSimulationPerformanceApi(param);
if (res && res.code === 200) {
showInputDialog.value = false;
baseTableRef.value.resetFun();
getTaskPerformanceDataFun();
// baseTableRef.value.resetFun();
}
} catch {}
};

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;

View File

@@ -6,7 +6,7 @@
<div class="task-status">
任务状态
<div class="status">
<el-icon class="upload" title="行中" v-if="runFlowPocesInfo?.status === 'running'">
<el-icon class="upload" title="行中" v-if="runFlowPocesInfo?.status === 'running'">
<HelpFilled />
</el-icon>
<el-icon
@@ -365,7 +365,7 @@ const props = defineProps({
const emits = defineEmits(['update']);
const statusList = ref<any>({
running: '行中',
running: '行中',
completed: '已完成',
suspended: '挂起中',
error: '异常',

View File

@@ -12,8 +12,22 @@
<template #fileSize="{ row }">
<span>{{ formatFileSize(row.fileSize) }}</span>
</template>
<template #approvalStatus="{ row, column }">
<el-button
type="primary"
link
@click="openProcessFun(row)"
v-if="row[column.field] === 'pending'"
>
{{ KNOWLEDGE_APPROVE_STATUS.O[row[column.field]] }}
</el-button>
<el-button type="primary" link @click="openProcessFun(row)" v-else>
{{ $t('知识库.审批完成') }}
</el-button>
</template>
</BaseTable>
<FilePreview v-model="previewVisible" :fileId="currentRow?.id" />
<ApprovalProcess v-model="processVisible" :flowId="currentRow?.cidFlowId" />
</div>
</template>
@@ -24,6 +38,8 @@ import { getFileBaseInfoApi } from '@/api/data/data';
import { useI18n } from 'vue-i18n';
import { downloadFileById, formatFileSize } from '@/utils/file';
import FilePreview from '@/components/common/filePreview/index.vue';
import { useDict } from '@/utils/useDict';
import ApprovalProcess from '@/components/common/approvalProcess/index.vue';
const props = defineProps({
runInfo: {
@@ -31,7 +47,7 @@ const props = defineProps({
default: () => {},
},
});
const { KNOWLEDGE_APPROVE_STATUS } = useDict('KNOWLEDGE_APPROVE_STATUS');
const baseTableRef = ref();
const { t } = useI18n();
@@ -79,6 +95,12 @@ const previewFileFun = (row: any) => {
previewVisible.value = true;
};
const processVisible = ref(false);
const openProcessFun = (row: any) => {
currentRow.value = row;
processVisible.value = true;
};
watch(
() => props.runInfo,
async (newVal) => {

View File

@@ -833,6 +833,7 @@ const addOrEditTaskFun = async () => {
const onAddApproveConfirmFun = async (formData: any) => {
// dialogApproveUserVisible.value = false;
dialogApproveUserVisible.value = false;
const deleteNodeList = getListIds(
approveParam.value.removeRecords.map((item: any) => {
@@ -898,19 +899,16 @@ const onAddApproveConfirmFun = async (formData: any) => {
try {
const res: any = await modifyWithApproveAPi(param);
if (res && res.code === 200) {
dialogApproveUserVisible.value = false;
ElMessage.success('操作成功');
loadingInterface.value = false;
emits('taskComplete', 'taskPlanPage');
closeFun();
} else {
dialogApproveUserVisible.value = false;
loadingInterface.value = false;
ElMessage.warning('操作失败');
closeFun();
}
} catch {
dialogApproveUserVisible.value = false;
loadingInterface.value = false;
closeFun();
}

View File

@@ -95,7 +95,7 @@
/>
</el-select>
</el-form-item>
<el-form-item label="选择工况" prop="chooseTaskList" v-if="insertTaskMode === 'lib'">
<el-form-item label="选择场景" prop="chooseTaskList" v-if="insertTaskMode === 'lib'">
<el-select-v2
v-model="sendForm.chooseTaskList"
:options="libTaskList"
@@ -134,6 +134,16 @@
<el-form-item label="仿真执行人:" prop="eMemberList">
<UserSelect v-model="sendForm.eMemberList" :multiple="true" />
</el-form-item>
<el-form-item label="专项异常:" prop="expStatus">
<el-select :teleported="false" v-model="sendForm.expStatus">
<el-option
v-for="item in TASK_ABNORMAL.A"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<div>
@@ -166,6 +176,7 @@ import { CommonStore } from '@/stores/common';
import { batchUpdateTaskStatusApi } from '@/api/project/task';
import { getUserSimulationType } from '@/tenants/lyric/views/task/lyricTask';
import { enableConfigByTenant, TENANT_ENUM } from '@/tenants/tenant';
import { useDict } from '@/utils/useDict';
const props = defineProps({
diaVisible: {
@@ -190,6 +201,8 @@ const diaVisible = computed({
},
});
const { TASK_ABNORMAL } = useDict('TASK_ABNORMAL');
const sendForm = reactive<any>({
beginTime: '',
endTime: '',
@@ -472,6 +485,10 @@ const sendTaskFun = async (row: any) => {
if (key !== 'eMemberList') {
sendForm[key] = row[key];
}
// EP 定制代码
if (key === 'expStatus') {
sendForm[key] = String(row[key]);
}
}
sendForm.taskName = row.demandName;
@@ -490,4 +507,10 @@ onMounted(() => {
}
});
</script>
<style lang="less" scoped></style>
<style lang="scss" scoped>
.loadcase-img {
width: 18px;
vertical-align: text-bottom;
margin-right: 5px;
}
</style>

View File

@@ -343,29 +343,22 @@ const confirmFun = async () => {
const demandId = await createDemandApiFun(editFormInfo.value);
// 没有demandId就是创建需求失败
if (demandId && editFormInfo.value.attachments?.length > 0) {
// for (let index = 0; index < fromData.attachments.length; index++) {
// const form = new FormData();
// form.append('fileType', String(FILE_TYPE.DEMAND_ATTACHMENTS));
// form.append('uuid ', demandId);
// form.append('fileName ', fromData.attachments[index].name);
// form.append('file ', fromData.attachments[index].raw);
// form.append('projectId ', String(fromData.projectId));
// upload(`${PREFIX}demand/uploadDemandFiles`, form);
// }
}
const files = editFormInfo.value.attachments.filter((item: any) => item.raw);
if (files.length > 0) {
const params = {
fileList: files, // 文件列表
// dirId: demandId, // 文件目录id
projectId: editFormInfo.value.projectId, // 项目id
callbackFlag: '/task/sponsor', // 回调标识
uuid: demandId,
};
await uploadBigFile(params, batchAddFileInfoApi);
const files = editFormInfo.value.attachments.filter((item: any) => item.raw);
if (files.length > 0) {
const params = {
fileList: files, // 文件列表
// dirId: demandId, // 文件目录id
projectId: editFormInfo.value.projectId, // 项目id
callbackFlag: '/task/sponsor', // 回调标识
uuid: demandId,
};
await uploadBigFile(params, batchAddFileInfoApi);
}
formVisible.value = false;
} else {
loadingInterface.value = false;
}
// batchUploadFile(fromData.attachments, fromData.projectId, demandId);
formVisible.value = false;
} else {
await editDemandApiFun(editFormInfo.value);
}