This commit is contained in:
2026-03-02 11:56:45 +08:00
8 changed files with 149 additions and 43 deletions

View File

@@ -1,8 +1,9 @@
<template>
<approvalTypeHeader :data="data" />
<div class="content">
<!-- 删除参数对象 -->
<div class="content" v-if="JSON.parse(data.approveContents).paramData">
<div class="table">
<BaseTable ref="baseTableRef" tableName="PARAMETER_LIST" hidePagination />
<BaseTable :data="tableData" tableName="PARAMETER_LIST" hidePagination />
</div>
<div class="info">
<el-descriptions class="info-content-descriptions" :column="1" label-width="100px" border>
@@ -23,12 +24,17 @@
</el-descriptions>
</div>
</div>
<!-- 删除库分类 -->
<div class="parameterPage" v-else>
<parameterPage v-if="node.id" :pageParams="node" pageType="approve" />
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import BaseTable from '@/components/common/table/baseTable.vue';
import ApprovalTypeHeader from './approvalTypeHeader.vue';
import parameterPage from '@/views/simulation/parameter/index.vue';
interface Props {
data: any;
@@ -38,14 +44,19 @@ const props = withDefaults(defineProps<Props>(), {
data: {},
});
const baseTableRef = ref<any>();
const baseInfo = ref<any>({});
const tableData = ref<any>([]);
const node = ref<any>({});
onMounted(() => {
const approveContents = JSON.parse(props.data.approveContents);
node.value = {
id: approveContents.id,
type: approveContents.type,
};
// console.log('node', node.value);
const { paramData = {} } = approveContents;
const { parameterJsonValue = [] } = paramData;
baseTableRef.value.setDataFun(parameterJsonValue);
tableData.value = parameterJsonValue;
baseInfo.value = paramData;
});
</script>
@@ -63,4 +74,7 @@ onMounted(() => {
width: 300px;
}
}
.parameterPage {
height: calc(100% - 40px);
}
</style>

View File

@@ -55,6 +55,8 @@ const props = defineProps<{
flowDetail: any;
operationType: string;
templateVersion: string;
// 升版时需要更新的工况
updateSimulationPoolInfoList: any[];
}>();
const loadingInterface = ref(false);
@@ -104,7 +106,7 @@ const confirmFun = async () => {
await submitApproveFun();
});
} else {
const upgradeRes: any = await upgradeDraftFun({
const params: any = {
templateName: props.flowDetail.templateName,
templateContent: JSON.stringify(props.nodeRelation),
viewContent: JSON.stringify(props.graph.toJSON()),
@@ -112,7 +114,11 @@ const confirmFun = async () => {
comment: props.flowDetail.comment,
versionType: approveForm.versionType,
templateCode: props.flowDetail.templateCode,
});
};
if (props.updateSimulationPoolInfoList?.length) {
params.simulationPoolInfoList = props.updateSimulationPoolInfoList;
}
const upgradeRes: any = await upgradeDraftFun(params);
await submitApproveFun(upgradeRes.data);
}
loadingInterface.value = false;

View File

@@ -78,6 +78,7 @@
:operationType="operationType"
@saveDraft="saveDraftFun"
:templateVersion="templateVersion"
:updateSimulationPoolInfoList="updateSimulationPoolInfoList"
></ApproveDialog>
</div>
</template>
@@ -115,6 +116,11 @@ const props = defineProps({
type: String,
default: FLOW_OPERATION_TYPE.CREATE,
},
// 升版时需要更新的工况
updateSimulationPoolInfoList: {
type: Array,
default: () => [],
},
});
const emits = defineEmits(['goBack']);

View File

@@ -10,7 +10,7 @@
node-key="nodeKey"
highlight-current
lazy
:props="props"
:props="propData"
:current-node-key="currentNodeKey"
:load="loadMoreFun"
@current-change="currentChangeFun"
@@ -21,27 +21,31 @@
<el-icon class="icon-style" v-else :size="18"><Document /></el-icon>
<div class="name" :title="data.name">{{ data.name }}</div>
<!-- 审批中的节点 不允许修改删除 0-审核完成1-文件上传审核中3-文件删除审核中-->
<div class="options" v-if="!data.approveType">
<div class="edit" @click="openEditFun(data)">
<el-icon>
<EditPen />
</el-icon>
<div v-if="!pageType">
<div class="options" v-if="!data.approveType">
<div class="edit" @click.stop="openEditFun(data)">
<el-icon>
<EditPen />
</el-icon>
</div>
<div class="del" @click.stop="deleteParamFun(dataType[data.type], data)">
<el-icon>
<Delete />
</el-icon>
</div>
</div>
<div class="del" @click="deleteParamFun(dataType[data.type], data)">
<el-icon>
<Delete />
</el-icon>
<div class="options" v-else>
{{
data.approveType === 1
? '上传审核中'
: data.approveType === 2
? '修改审核中'
: data.approveType === 3
? '删除审核中'
: ''
}}
</div>
</div>
<div class="options" v-else>
{{
data.approveType === 1
? '上传审核中'
: data.approveType === 3
? '删除审核中'
: ''
}}
</div>
</div>
</template>
</el-tree>
@@ -53,9 +57,10 @@
ref="paramTableRef"
tableName="PARAMETER_LIST"
hidePagination
:actionList="currentNode.approveType ? [] : actionList"
:full-height="true"
:actionList="currentNode.approveType || pageType ? [] : actionList"
>
<template #leftOptions>
<template #leftOptions v-if="!pageType">
<div class="options">
<el-button
type="primary"
@@ -225,7 +230,7 @@ const paramData = ref<any>({});
const paramEditIndex = ref(0);
const paramTableData = ref<any>([]);
const newParamTableData = ref<any>([]);
const props = {
const propData = {
label: 'label',
children: 'children',
isLeaf: 'leaf',
@@ -237,6 +242,16 @@ const dataType: any = {
3: 'param',
};
interface Props {
pageParams: any; // 审核页面传参:当前节点信息
pageType: string; // 页面类型approve-审核预览
}
const props = withDefaults(defineProps<Props>(), {
pageParams: {},
pageType: '',
});
const actionList = ref([
{
title: '编辑',
@@ -260,8 +275,15 @@ const actionList = ref([
]);
const loadMoreFun = async (node: any, resolve: any) => {
const listData: any = await getSimulationParameterTreeDAtaFun(node.data);
return resolve(listData);
// console.log('node', node);
if (node.level === 0) {
const data = props.pageType ? props.pageParams : node.data;
const listData: any = await getSimulationParameterTreeDAtaFun(data);
return resolve(listData);
} else {
const listData: any = await getSimulationParameterTreeDAtaFun(node.data);
return resolve(listData);
}
};
const getSimulationParameterTreeDAtaFun = async (data?: any) => {
@@ -410,7 +432,8 @@ const creatLibParamObjFun = async (data: any) => {
const deleteConfirmFun = () => {
const node = libTreeRef.value.getNode(currentNode.value.nodeKey);
if (node) {
// 参数对象节点 更新审批状态为删除中
if (node && node?.data?.type === 3) {
node.data.approveType = 3;
}
};
@@ -437,6 +460,7 @@ const deleteParamFun = async (flag: any, row?: any) => {
delParams.value = {
type: row.type,
id: row.id,
isApprove: false,
};
approveDelShow.value = true;
} else {

View File

@@ -43,7 +43,12 @@
<template #footer>
<div>
<el-button @click="closeFun">取消</el-button>
<el-button type="primary" @click="confirmFun('ok')" :loading="loadingInterface"
<!-- 升版并且修改了工况时 隐藏确认按钮 -->
<el-button
type="primary"
v-if="!(dialogType === FLOW_OPERATION_TYPE.UPGRADE && hasChangeLoadcase)"
@click="confirmFun('ok')"
:loading="loadingInterface"
>确定</el-button
>
<el-button type="primary" @click="confirmFun('next')" :loading="loadingInterface"
@@ -57,7 +62,7 @@
<script lang="ts" setup>
import Dialog from '@/components/common/dialog/index.vue';
// import { ElMessage } from 'element-plus';
import { computed, ref } from 'vue';
import { computed, ref, watch } from 'vue';
import TableForm from '@/components/common/table/tableForm.vue';
import PoolTaskSelect from '@/components/pool/poolTaskSelect.vue';
import { addFlowTemplateDraftApi, updateFlowTemplateDraftApi } from '@/api/capability/flow';
@@ -108,8 +113,23 @@ const confirmFun = async (type: string) => {
emits('confirm', { type, uuid: flowRes.uuid, tVersion: flowRes.templateVersion });
}
} else {
await editFlow(flowForm);
emits('confirm', { type, uuid: flowForm.uuid, tVersion: props.templateVersion });
if (type === 'ok') {
await editFlow(flowForm);
emits('confirm', { type, uuid: flowForm.uuid, tVersion: props.templateVersion });
}
if (type === 'next') {
if (oldComment.value !== flowForm.comment) {
// 升版时只更新描述,不更新工况,工况在提交审批时传递给接口
await editFlow({ ...flowForm, simulationPoolInfoList: oldSimulationPoolInfoList.value });
}
emits('confirm', {
type,
uuid: flowForm.uuid,
tVersion: props.templateVersion,
// 不更新工况,工况在提交审批时传递给升版接口
simulationPoolInfoList: hasChangeLoadcase.value ? simulationPoolInfoList.value : null,
});
}
}
loadingInterface.value = false;
}
@@ -171,10 +191,15 @@ const oldFormData = ref<any>({});
const editRowInfo = ref({});
const oldSimulationPoolInfoList = ref<any[]>([]);
const oldComment = ref('');
const setEditForm = (val: any) => {
oldFormData.value = val;
// nextTick(() => {
simulationPoolInfoList.value = val.simulationPoolInfoList || [];
oldSimulationPoolInfoList.value = val.simulationPoolInfoList || [];
oldComment.value = val.comment;
// tableFormRef.value.setFormDataFun({ ...val });
editRowInfo.value = { ...val };
// });
@@ -197,6 +222,30 @@ const setOptionsFun = (key: string, options: any[]) => {
tableFormRef.value.setOptionsFun(key, options);
};
const hasChangeLoadcase = ref(false);
watch(
() => simulationPoolInfoList.value,
() => {
const oldIds: any[] = [];
oldSimulationPoolInfoList.value.forEach((item) => {
oldIds.push(...item.simulationPoolTaskIds);
});
const newIds: any[] = [];
simulationPoolInfoList.value.forEach((item) => {
newIds.push(...item.simulationPoolTaskIds);
});
oldIds.sort();
newIds.sort();
if (JSON.stringify(oldIds) !== JSON.stringify(newIds)) {
hasChangeLoadcase.value = true;
} else {
hasChangeLoadcase.value = false;
}
console.log('hasChangeLoadcase.value', hasChangeLoadcase.value);
}
);
defineExpose({
// projectForm,
setEditForm,

View File

@@ -154,7 +154,7 @@
{{ DISCIPLINE_TYPE.O[row.templateType] }}
</template>
<template #approveType="{ row }">
<StatusDot :status="statusMapFun4(row.approveType)">
<StatusDot :status="getApproveStyleClass(row.approveType, 'processLib')">
<template #default>
<span
:class="
@@ -189,6 +189,7 @@
@goBack="showFlowDetailVisible = false"
:operationType="dialogType"
:templateVersion="templateVersion"
:updateSimulationPoolInfoList="updateSimulationPoolInfoList"
></flowCreate>
<flowViewDialog
v-if="showFlowViewVisible"
@@ -219,7 +220,7 @@ import {
import flowViewDialog from '@/components/common/flow/flowViewDialog.vue';
import ApprovalProcess from '@/components/common/approvalProcess/index.vue';
import StatusDot from '@/components/common/statusDot/index.vue';
import { statusMapFun4 } from '@/components/common/statusDot/statusMap';
import { getApproveStyleClass } from '@/components/common/statusDot/statusMap';
import PoolTaskSelect from '@/components/pool/poolTaskSelect.vue';
import { hasPermission } from '@/utils/permission';
@@ -382,14 +383,20 @@ const seeApproveDetailFun = (row: any) => {
ElMessage.warning('暂无审批信息!');
}
};
const addOrEditFun = ({ type, uuid, tVersion }: any) => {
const updateSimulationPoolInfoList = ref([]);
const addOrEditFun = ({ type, uuid, tVersion, simulationPoolInfoList }: any) => {
tableRef.value.resetFun();
flowUuid.value = uuid;
if (type === 'next') {
templateVersion.value = tVersion;
goFlowDetailFun(uuid);
showDialog.value = false;
// 有工况升版需要更新
if (simulationPoolInfoList) {
updateSimulationPoolInfoList.value = simulationPoolInfoList;
} else {
updateSimulationPoolInfoList.value = [];
}
}
};

View File

@@ -94,7 +94,7 @@
</el-select>
</el-form-item>
<el-form-item
label="版本:"
label="版本:"
prop="currentLoadcaseLibVersion"
v-if="insertTaskMode === 'lib'"
>
@@ -115,7 +115,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"

View File

@@ -175,7 +175,7 @@ const actionList = ref([
title: '删除',
type: 'danger',
needConfirm: true,
confirmTip: '确认删除吗?',
confirmTip: '删除需求时,跟需求关联的任务及任务下的数据也会删除!确认删除吗?',
click: (row: any) => {
deleteDemandFun(row.uuid);
},