fix:修改项目阶段删除/增加排序/初始化选择

This commit is contained in:
wyx
2022-12-21 15:36:09 +08:00
parent a862d18f18
commit 7c0aa7e747

View File

@@ -1026,7 +1026,7 @@
<div class="close_exit" @click="closeDeleteStage"></div>
</div>
<div class="body">
<span style="width:320px;display:flex;justify-content:center;align-items:center;">{{level.length==1?"当前阶段为第一阶段,删除后任务将被移出,为无阶段模式,确认删除阶段吗?":"您确定要删除此阶段"}}</span>
<span style="width:320px;display:flex;justify-content:center;align-items:center;">{{level.length==1?"当前为最后一个阶段,删除后任务将被移出,为无阶段模式,确认删除阶段吗?":"您确定要删除此阶段"}}</span>
</div>
<div class="del_btnbox">
<div class="del_btn btn1" @click="closeDeleteStage">
@@ -1094,8 +1094,9 @@ export default {
const route = useRoute();
const state = reactive({
projectId: route.query.projectId,
chooseStageId: null,
chooseStageId: null,
removeStageId: null,
onceChoice: true,
edit: false,
isLevel: 2, //学习路径1项目2模板库3
// isRefEdit: 1, //外链编辑
@@ -1253,7 +1254,8 @@ export default {
array.push(obj);
}
});
state.level = array;
console.log(array)
state.level = array.sort((a,b)=>{ return a.id - b.id });
};
const tableDataFunc = () => {
@@ -1391,12 +1393,26 @@ export default {
};
await api.getTask(obj).then((res) => {
console.log("22222", res.data.data.stageList);
if(state.onceChoice){
let data = res.data.data.stageList;
state.onceChoice = false;
let arraynew = []
for(let i=0;i<data.length;i++){
if(data[i].stageId!=='0'){
arraynew.push(data[i])
}
}
console.log(arraynew)
state.chooseStageId = Number(arraynew[arraynew.length-1].stageId);
}
state.projectTitle = res.data.data.projectInfo.name;
state.picUrl = res.data.data.projectInfo.picUrl;
state.stageList = res.data.data.stageList;
getStageData(res.data.data.stageList);
updateStageChoosd();
});
};