fix: 模板库没有阶段时默认查询阶段0的任务数据

This commit is contained in:
caozc
2023-02-26 12:36:03 +08:00
parent 0efc5e5485
commit 81a627e9ea
2 changed files with 20 additions and 3 deletions

View File

@@ -442,6 +442,7 @@ function changeStageIndex(index) {
const getTask = async () => { const getTask = async () => {
await api.getDraftTask({projectId: route.query.projectId}).then((res) => { await api.getDraftTask({projectId: route.query.projectId}).then((res) => {
projectInfo.value = res.data.data projectInfo.value = res.data.data
console.log("获取任务列表:" + JSON.stringify(projectInfo.value) )
}); });
}; };

View File

@@ -281,7 +281,7 @@
<div class="footbtn"> <div class="footbtn">
<div class="btnbox"> <div class="btnbox">
<a-button class="btn btn2" @click="submitStorage" :loading="templateLoading">确定</a-button> <a-button class="btn btn2" @click="submitStorage" :loading="templateLoading">确定11</a-button>
<a-button class="btn btn1" @click="cancelStorage" :loading="cancleLoading">取消</a-button> <a-button class="btn btn1" @click="cancelStorage" :loading="cancleLoading">取消</a-button>
</div> </div>
</div> </div>
@@ -541,7 +541,16 @@ const cancelModal = ref(false);
const deleteStageModal = ref(false); const deleteStageModal = ref(false);
const templateLoading = ref(false); const templateLoading = ref(false);
const cancleLoading = ref(false); const cancleLoading = ref(false);
const projectInfo = ref({stageList: [{taskTemplateList: [{}]}], projectTemplateInfo: {}}); const projectInfo = ref({
stageList: [{
"id":"0",
taskTemplateList: [{
}]
}],
projectTemplateInfo: {
}
});
const activeIndex = ref(0); const activeIndex = ref(0);
const moveChapterIndex = ref(0); const moveChapterIndex = ref(0);
const deleteIndex = ref(0); const deleteIndex = ref(0);
@@ -576,6 +585,13 @@ function changeStageIndex(index) {
const getTask = async () => { const getTask = async () => {
await api.templateEditDetail(route.query.projectId).then((res) => { await api.templateEditDetail(route.query.projectId).then((res) => {
projectInfo.value = res.data.data projectInfo.value = res.data.data
if(projectInfo.value.stageList.length == 0){
projectInfo.value.stageList = [{
"id":"0",
taskTemplateList: []
}]
}
console.log("获取任务列表信息:" + JSON.stringify(projectInfo.value));
}); });
}; };
@@ -721,7 +737,7 @@ const closeDeAll = () => {
const submitStorage = async () => { const submitStorage = async () => {
templateLoading.value = true templateLoading.value = true
await request(PROJECT_TEMPLATE_DETAIL_MODIFY, projectInfo.value) await request(PROJECT_TEMPLATE_DETAIL_MODIFY, projectInfo.value)
await getTask() // await getTask()
message.success("保存成功"); message.success("保存成功");
templateLoading.value = false templateLoading.value = false
}; };