update:仿真策划审批流功能更新
This commit is contained in:
@@ -210,5 +210,5 @@ export const batchUpdateWorkspaceExtraApi = (params: any) => {
|
||||
* @returns
|
||||
*/
|
||||
export const modifyWithApproveAPi = (params: any) => {
|
||||
return post(`${PREFIX}node/modifyWithApprove`, params);
|
||||
return post(`${PREFIX}project/modifyWithApprove`, params);
|
||||
};
|
||||
|
||||
126
src/views/index/approvalPreview/components/simulationPlan.vue
Normal file
126
src/views/index/approvalPreview/components/simulationPlan.vue
Normal file
@@ -0,0 +1,126 @@
|
||||
<template>
|
||||
<div class="approval-page">
|
||||
<div class="approval-page-content">
|
||||
<loadCaseTable
|
||||
:editMode="false"
|
||||
ref="treeTableRef"
|
||||
readonly
|
||||
tableName="PROJECT_TASK_PLANNING"
|
||||
:data="mergedPreviewTree"
|
||||
:hasOperationColumn="false"
|
||||
:showCheckBox="false"
|
||||
:rowClassName="rowClassName"
|
||||
>
|
||||
</loadCaseTable>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import loadCaseTable from '@/components/common/treeCaseTable/loadCaseTable.vue';
|
||||
import { getTaskTreeFun } from '@/views/task/projectDetail/components/projectApi';
|
||||
|
||||
const props = defineProps({
|
||||
pageData: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
|
||||
const mergedPreviewTree = ref<any>([]);
|
||||
const addUuids = ref<any>([]);
|
||||
const delUuids = ref<any>([]);
|
||||
const editUuids = ref<any>([]);
|
||||
const isCreatePool = ref(false);
|
||||
// 获取审批内容
|
||||
const getapprovalCOntentFun = async (data: any) => {
|
||||
const approveContents = JSON.parse(data?.approveContents as string);
|
||||
|
||||
const { phaseNodeId, projectNodeId, deleteNodeList, editNodeList, addNodeList } = approveContents;
|
||||
|
||||
getUUids(deleteNodeList, delUuids.value);
|
||||
getUUids(editNodeList, editUuids.value);
|
||||
getUUids(addNodeList, addUuids.value);
|
||||
|
||||
const treeData = await getTaskTreeFun(projectNodeId, phaseNodeId);
|
||||
|
||||
if (treeData.length) {
|
||||
mergedPreviewTree.value = treeData;
|
||||
isCreatePool.value = false;
|
||||
} else {
|
||||
mergedPreviewTree.value = addNodeList;
|
||||
isCreatePool.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
const getUUids = (list: any, arr: any) => {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].uuid) {
|
||||
arr.push(list[i].uuid);
|
||||
}
|
||||
if (list[i].nodeId) {
|
||||
arr.push(list[i].nodeId);
|
||||
}
|
||||
if (list[i]?.children?.length) {
|
||||
getUUids(list[i]?.children, arr);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const rowClassName: any = ({ row }: any) => {
|
||||
if (!row) return '';
|
||||
if (isCreatePool.value) {
|
||||
return 'preview-added';
|
||||
}
|
||||
if (addUuids.value.includes(row.uuid) || addUuids.value.includes(row.nodeId)) {
|
||||
return 'preview-added';
|
||||
} else if (editUuids.value.includes(row.uuid) || editUuids.value.includes(row.nodeId)) {
|
||||
return 'preview-updated';
|
||||
} else if (delUuids.value.includes(row.uuid) || delUuids.value.includes(row.nodeId)) {
|
||||
return 'preview-deleted';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
if (props.pageData) {
|
||||
getapprovalCOntentFun(props.pageData);
|
||||
console.log(props.pageData, 'props.pageData');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.approval-page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #fff;
|
||||
|
||||
.approval-page-tooltips {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.approval-page-content {
|
||||
width: 100%;
|
||||
// height: calc(100% - 40px);
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.legend-color.added {
|
||||
background-color: var(--el-color-success-light-7);
|
||||
}
|
||||
|
||||
.legend-color.updated {
|
||||
background-color: var(--el-color-primary-light-7);
|
||||
}
|
||||
|
||||
.legend-color.deleted {
|
||||
background-color: var(--el-color-danger-light-7);
|
||||
}
|
||||
</style>
|
||||
@@ -7,6 +7,7 @@
|
||||
<DeliverableFile v-else-if="data.approveType === 4" :data="data" />
|
||||
<Parameter v-else-if="data.approveType === 5" :data="data" />
|
||||
<reportDetail v-else-if="data.approveType === 6" :data="data" />
|
||||
<simulationPlan v-else-if="data.approveType === 7" :page-data="data"></simulationPlan>
|
||||
<div v-else>其他审核预览{{ data.cidFlowId }}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -22,6 +23,7 @@ import FlowView from '@/components/common/flow/flowView.vue';
|
||||
import DeliverableFile from './components/deliverableFile.vue';
|
||||
import Parameter from './components/parameter.vue';
|
||||
import reportDetail from './components/reportDetail.vue';
|
||||
import simulationPlan from '@/views/index/approvalPreview/components/simulationPlan.vue';
|
||||
|
||||
const w: any = window;
|
||||
const $wujie: any = w.$wujie;
|
||||
|
||||
@@ -224,7 +224,9 @@ const submitApprovalFun = async () => {
|
||||
};
|
||||
|
||||
const systemApproveQueryApproveFlowTempalteFun = async () => {
|
||||
const res: any = await systemApproveQueryApproveFlowTempalteApi({});
|
||||
const res: any = await systemApproveQueryApproveFlowTempalteApi({
|
||||
moduleCode: 'SIMULATION_TASK_APPROVAL',
|
||||
});
|
||||
|
||||
if (res && res.code === 200) {
|
||||
templateList.value = res.data;
|
||||
|
||||
@@ -203,6 +203,16 @@
|
||||
:currentPhase="currentPhase"
|
||||
></nodeLevel2Select>
|
||||
</el-form-item>
|
||||
<el-form-item label="版本:">
|
||||
<el-select v-model="currentProjectPhaseTaskTreeVersion">
|
||||
<el-option
|
||||
v-for="item in projectPhaseVersionList"
|
||||
:key="item.id"
|
||||
:label="item.currentVersion"
|
||||
:value="item.currentVersion"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="right-table">
|
||||
@@ -277,6 +287,13 @@
|
||||
</div>
|
||||
</template>
|
||||
</Dialog>
|
||||
|
||||
<AddApprove
|
||||
v-model="dialogApproveUserVisible"
|
||||
:isInitial="isEmptyPool"
|
||||
:moduleCode="'SIMULATION_PLAN_APPROVAL'"
|
||||
@confirm="onAddApproveConfirmFun"
|
||||
/>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import Dialog from '@/components/common/dialog/index.vue';
|
||||
@@ -297,7 +314,7 @@ import nodeLevel2Select from '@/components/project/nodeLevel2Select.vue';
|
||||
import { getTaskTreeFun } from '../../projectDetail/components/projectApi';
|
||||
import { disposeTagKey } from '../../projectDetail/components/project';
|
||||
import { disposeTaskMembers, getTagMapList } from '@/utils/task';
|
||||
import { modifyNodeTaskPerformanceApi } from '@/api/project/node';
|
||||
import { modifyNodeTaskPerformanceApi, modifyWithApproveAPi } from '@/api/project/node';
|
||||
import { TASK_CALCULATE_STATUS, TASK_PROCESS_STATUS } from '@/utils/enum/task';
|
||||
import dayjs from 'dayjs';
|
||||
import loadCaseTable from '@/components/common/treeCaseTable/loadCaseTable.vue';
|
||||
@@ -307,6 +324,8 @@ import ProjectSelect from '@/components/common/projectSelect/index.vue';
|
||||
import { TABLE_NAME } from '@/utils/enum/tableName';
|
||||
import TableForm from '@/components/common/table/tableForm.vue';
|
||||
import { CommonStore } from '@/stores/common';
|
||||
import AddApprove from '@/views/competenceCenter/condition/components/addApprove.vue';
|
||||
import { queryDesignVersionsApi } from '@/api/project/project';
|
||||
|
||||
const commonStore = CommonStore();
|
||||
|
||||
@@ -321,6 +340,8 @@ const props = defineProps<{
|
||||
projectEndTime: string;
|
||||
currentPhase: string;
|
||||
}>();
|
||||
const dialogApproveUserVisible = ref(false);
|
||||
const isEmptyPool = ref(true);
|
||||
|
||||
const dialogVisible = computed(() => {
|
||||
return props.showTaskDialog;
|
||||
@@ -396,6 +417,7 @@ const updateNodeLevel2Uuid = async ({ phaseUuid, type }: any) => {
|
||||
await getNodeLevel3TreeByLevel2Uuid();
|
||||
}
|
||||
expandTree(rightTableRef.value);
|
||||
await queryDesignVersionsFun();
|
||||
};
|
||||
|
||||
const getNodeLevel3TreeByLevel2Uuid = async () => {
|
||||
@@ -740,6 +762,8 @@ function flattenTreeData(treeData: any[], parentId = '', pUuid = '', pTagKeyList
|
||||
return result;
|
||||
}
|
||||
|
||||
const approveParam = ref<any>({});
|
||||
|
||||
const addOrEditTaskFun = async () => {
|
||||
loadingInterface.value = true;
|
||||
const { insertRecords, removeRecords, updateRecords }: any =
|
||||
@@ -785,6 +809,15 @@ const addOrEditTaskFun = async () => {
|
||||
// });
|
||||
// await updateTreeDataApi([{ ...props.nodeLevel1Info, children: nodeLevel2Tree }], [], []);
|
||||
// } else {
|
||||
approveParam.value = {
|
||||
insertTreeList,
|
||||
removeRecords,
|
||||
updateList,
|
||||
};
|
||||
dialogApproveUserVisible.value = true;
|
||||
|
||||
return;
|
||||
|
||||
const modifyRes = await updateTreeDataApi(insertTreeList, removeRecords, updateList);
|
||||
// }
|
||||
loadingInterface.value = false;
|
||||
@@ -793,6 +826,61 @@ const addOrEditTaskFun = async () => {
|
||||
closeFun();
|
||||
}
|
||||
};
|
||||
|
||||
const onAddApproveConfirmFun = async (formData: any) => {
|
||||
// dialogApproveUserVisible.value = false;
|
||||
|
||||
console.log(formData, 'formData');
|
||||
|
||||
const deleteNodeList = getListIds(
|
||||
approveParam.value.removeRecords.map((item: any) => {
|
||||
return { ...item, children: [] };
|
||||
})
|
||||
);
|
||||
|
||||
disposeTreeTagKey(approveParam.value.insertTreeList);
|
||||
|
||||
if (
|
||||
approveParam.value.insertTreeList.length === 0 &&
|
||||
approveParam.value.updateList.length === 0 &&
|
||||
deleteNodeList.length === 0
|
||||
) {
|
||||
dialogApproveUserVisible.value = false;
|
||||
loadingInterface.value = false;
|
||||
|
||||
ElMessage.success('请更改仿真策划内容后再进行审批');
|
||||
return;
|
||||
}
|
||||
|
||||
const param = {
|
||||
addNodeList: approveParam.value.insertTreeList,
|
||||
editNodeList: approveParam.value.updateList,
|
||||
deleteNodeList,
|
||||
ownRootNodeUuid: props.nodeLevel1Uuid,
|
||||
tagMap: getTagMapList(),
|
||||
projectNodeId: props.nodeLevel1Uuid,
|
||||
phaseNodeId: nodeLevel2Uuid.value,
|
||||
...formData,
|
||||
};
|
||||
|
||||
try {
|
||||
const res: any = await modifyWithApproveAPi(param);
|
||||
if (res && res.code === 200) {
|
||||
dialogApproveUserVisible.value = false;
|
||||
ElMessage.success('操作成功');
|
||||
loadingInterface.value = false;
|
||||
emits('taskComplete', 'taskPlanPage');
|
||||
} else {
|
||||
dialogApproveUserVisible.value = false;
|
||||
loadingInterface.value = false;
|
||||
ElMessage.warning('操作失败');
|
||||
}
|
||||
} catch {
|
||||
dialogApproveUserVisible.value = false;
|
||||
loadingInterface.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 调接口更新任务树的数据
|
||||
const updateTreeDataApi = async (insertList: any[], deleteList: any[], updateList: any[]) => {
|
||||
const deleteNodeList = getListIds(
|
||||
@@ -1168,6 +1256,34 @@ const leftCheckboxChangeFun = (checkInfo: any) => {
|
||||
// }
|
||||
// );
|
||||
|
||||
// 当前任务树的版本
|
||||
const currentProjectPhaseTaskTreeVersion = ref('');
|
||||
const projectPhaseVersionList = ref<any>([]);
|
||||
// 查询 项目阶段的仿真策划版本
|
||||
const queryDesignVersionsFun = async () => {
|
||||
const param = {
|
||||
projectId: props.nodeLevel1Uuid,
|
||||
phaseId: nodeLevel2Uuid.value,
|
||||
};
|
||||
|
||||
try {
|
||||
const res: any = await queryDesignVersionsApi(param);
|
||||
if (res && res.code === 200) {
|
||||
projectPhaseVersionList.value = res.data;
|
||||
|
||||
if (res.data?.length) {
|
||||
projectPhaseVersionList.value = [res.data[0]];
|
||||
|
||||
currentProjectPhaseTaskTreeVersion.value = projectPhaseVersionList.value[0]?.currentVersion;
|
||||
|
||||
isEmptyPool.value = false;
|
||||
} else {
|
||||
isEmptyPool.value = true;
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
queryPoolListFun();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user