项目详情任务树使用当前阶段的数据

This commit is contained in:
weibl
2026-01-13 15:35:33 +08:00
parent cb137373b2
commit 6e82eb4ff4
5 changed files with 69 additions and 22 deletions

View File

@@ -21,6 +21,10 @@ const props = defineProps({
type: String,
default: '',
},
currentPhase: {
type: String,
default: '',
},
});
const nodeLevel2ListOptions = ref();
@@ -66,8 +70,19 @@ const nodeLevel2ListApi = async () => {
return { label: item.nodeName, value: item.uuid, info: item };
});
if (nodeLevel2ListOptions.value.length) {
let phaseUuid = '';
// changeFun();
emits('change', { phaseUuid: nodeLevel2ListOptions.value[0].value, type: 'change' });
if (props.currentPhase) {
const phase = nodeLevel2ListOptions.value.find(
(item: { label: string }) => item.label === props.currentPhase
)?.value;
if (phase) {
phaseUuid = phase;
}
} else {
phaseUuid = nodeLevel2ListOptions.value[0].value;
}
emits('change', { phaseUuid: phaseUuid, type: 'change' });
}
} else {
nodeLevel2ListOptions.value = [];

View File

@@ -90,7 +90,7 @@ const props = defineProps({
const { PROJECT_EXE_STATUS } = useDict('PROJECT_EXE_STATUS');
const emits = defineEmits(['update:projectInfo']);
const emits = defineEmits(['update:projectInfo', 'loadComplete']);
const nodeInfo = reactive<any>({
nodeName: '',
creator: '',
@@ -150,8 +150,9 @@ defineExpose({
});
watch(
() => props.nodeId,
() => {
getNodeDetailFun();
async () => {
await getNodeDetailFun();
emits('loadComplete');
},
{ immediate: true }
);

View File

@@ -157,6 +157,7 @@ import { TASK_APPROVE_STATUS_ENUM } from '@/utils/enum/task';
const props = defineProps<{
projectUuid: string;
projectCode: string;
currentPhase: string;
}>();
const emits = defineEmits(['getPhaseList']);
@@ -199,6 +200,7 @@ const getTaskTreeList = async () => {
const phaseListOptions = ref<any[]>([]);
const getPhaseListApi = async () => {
// console.log('currentPhase', props.currentPhase, props);
const res: any = await getChildrenNodeListApi({
current: 1,
size: 999,
@@ -216,8 +218,15 @@ const getPhaseListApi = async () => {
return phaseUuid.value === item.value;
})
) {
phaseUuid.value = phaseListOptions.value[0].value;
updatePhaseUuid(phaseListOptions.value[0].value);
const phase = phaseListOptions.value.find(
(item) => item.label === props.currentPhase
)?.value;
if (phase && phaseUuid.value !== phase) {
// phaseUuid.value = phase;
updatePhaseUuid(phase);
} else {
updatePhaseUuid(phaseListOptions.value[0].value);
}
}
}
} else {
@@ -288,6 +297,19 @@ const updateWorkspaceApproveStatus = () => {
// });
};
// watch(
// () => props.currentPhase,
// (val: string) => {
// if (val) {
// const phase = phaseListOptions.value.find((item) => item.label === val)?.value;
// if (phase && phaseUuid.value !== phase) {
// // phaseUuid.value = phase;
// updatePhaseUuid(phase);
// }
// }
// }
// );
onMounted(async () => {
getPhaseListApi();
// setTimeout(async() => {

View File

@@ -56,10 +56,11 @@
<el-tab-pane label="任务列表" name="taskList">
<loadcase
ref="loadcaseRef"
v-if="displayedTabs.includes('taskList') && projectUuid"
v-if="displayedTabs.includes('taskList') && projectUuid && isLoadProjectInfo"
:projectUuid="projectUuid"
:projectCode="currentProjectInfo.nodeCode"
@getPhaseList="getPhaseListFun"
:currentPhase="currentProjectInfo.currentPhase"
/>
</el-tab-pane>
<el-tab-pane label="团队成员" name="teamMembers">
@@ -87,6 +88,7 @@
<baseInfo
ref="basePageRef"
@update:projectInfo="updateProjectInfo"
@loadComplete="projectInfoLoadCompleteFun"
v-if="projectUuid"
:nodeId="projectUuid"
/>
@@ -153,7 +155,7 @@
@completeFun="completeFun"
/>
<TaskDialog
v-if="showTaskDialog"
v-if="showTaskDialog && isLoadProjectInfo"
v-model:showTaskDialog="showTaskDialog"
dialogType="edit"
:nodeLevel1Name="currentProjectInfo.nodeName"
@@ -162,6 +164,7 @@
:projectBeginTime="currentProjectInfo.beginTime"
:projectEndTime="currentProjectInfo.endTime"
@taskComplete="completeFun"
:currentPhase="currentProjectInfo.currentPhase"
/>
</template>
@@ -345,6 +348,10 @@ const tabChangeFun = (tab: string) => {
displayedTabs.value.push(tab);
}
};
const isLoadProjectInfo = ref(false);
const projectInfoLoadCompleteFun = () => {
isLoadProjectInfo.value = true;
};
// if (route.query?.nodeId) {
// projectUuid.value = route.query?.nodeId;

View File

@@ -170,7 +170,7 @@
</el-form-item>
<el-form-item label="阶段:">
<!-- {{ nodeLevel2Uuid }} -->
<el-select
<!-- <el-select
v-if="props.dialogType === 'create'"
@change="updateNodeLevel2Uuid"
v-model="nodeLevel2Uuid"
@@ -183,13 +183,14 @@
:value="item.uuid"
/>
</el-select>
v-else -->
<nodeLevel2Select
v-else
ref="nodeLevel2SelectRef"
class="phase"
:projectUuid="nodeLevel1Uuid"
:phaseUuid="nodeLevel2Uuid"
@change="updateNodeLevel2Uuid"
:currentPhase="currentPhase"
></nodeLevel2Select>
</el-form-item>
</el-form>
@@ -269,7 +270,7 @@
</template>
<script lang="ts" setup>
import Dialog from '@/components/common/dialog/index.vue';
import { computed, nextTick, onMounted, ref, watch } from 'vue';
import { computed, nextTick, onMounted, ref } from 'vue';
import { canAddChild, transformPoolNodesToTree } from '@/utils/node';
import { ElMessage, ElMessageBox } from 'element-plus';
import { cloneDeep } from 'lodash-es';
@@ -305,6 +306,7 @@ const props = defineProps<{
nodeLevel2List?: Array<any>;
projectBeginTime: string;
projectEndTime: string;
currentPhase: string;
}>();
const dialogVisible = computed(() => {
@@ -359,7 +361,7 @@ const updateNodeLevel2Uuid = async ({ phaseUuid, type }: any) => {
await getRightVxeRef().getRecordset();
if (removeRecords?.length > 0 || insertRecords?.length > 0 || updateRecords?.length > 0) {
ElMessageBox.confirm('当前数据有变更,切换后变更数据会丢失,是否继续切换阶段?', '提示', {
ElMessageBox.confirm('当前数据有变更,切换后变更数据会丢失,是否继续切换阶段?', '提示', {
confirmButtonText: '继续切换',
cancelButtonText: '放弃',
type: 'warning',
@@ -1043,16 +1045,16 @@ const tableFormChangeFun = (data: any) => {
}
};
watch(
() => props.showTaskDialog,
(newVal) => {
if (newVal) {
if (props.dialogType === 'create' && props.nodeLevel2List?.length) {
nodeLevel2Uuid.value = props.nodeLevel2List[0].uuid;
}
}
}
);
// watch(
// () => props.showTaskDialog,
// (newVal) => {
// if (newVal) {
// if (props.dialogType === 'create' && props.nodeLevel2List?.length) {
// nodeLevel2Uuid.value = props.nodeLevel2List[0].uuid;
// }
// }
// }
// );
onMounted(async () => {
queryPoolListFun();