feat:获取阶段 切换阶段切换任务列表

This commit is contained in:
songwc
2022-11-04 18:00:51 +08:00
parent 9693d52b32
commit e64e7e9c19
2 changed files with 50 additions and 34 deletions

View File

@@ -334,6 +334,10 @@ export default {
type: Number,
default: null,
},
projectId: {
type: Number,
default: null,
},
},
setup(props, ctx) {
// const router = useRouter();
@@ -606,9 +610,9 @@ export default {
duration: state.obj.liveDuration,
flag: true,
name: state.obj.liveName,
projectId: 28,
projectId: props.projectId,
projectTaskId: 0,
stageId: 3,
stageId: 0,
type: 6,
})
.then((res) => {

View File

@@ -31,7 +31,7 @@
:class="
isactive == index && isActive == true ? 'bgcactive' : ''
"
@click="changebgc(index)"
@click="changebgc(index, element.id)"
>
<div class="itemle">
<div class="tit">{{ element.tit }}</div>
@@ -172,6 +172,7 @@
<add-live
v-model:addliveVisible="addlivevisible"
@changeData="updateTableData"
v-model:projectId="projectId"
/>
</div>
<!-- 添加直播侧弹窗 -->
@@ -816,6 +817,7 @@ export default {
setup() {
const state = reactive({
projectId: storage.get("projectId") ? storage.get("projectId") : null,
chooseStageId: null,
projectNameList: [
{
id: 1,
@@ -850,33 +852,8 @@ export default {
label: "移动任务到关卡",
},
],
level: [
{
id: "1",
tit: "阶段1",
name: "腾飞班1基础",
},
{
id: "2",
tit: "阶段2",
name: "腾飞班基础",
},
{
id: "2",
tit: "阶段2",
name: "中级产品经理",
},
{
id: "2",
tit: "阶段2",
name: "中级产品经理",
},
{
id: "2",
tit: "阶段2",
name: "中级产品经理",
},
],
//阶段数据
level: [],
//任务数据
tableData: [],
@@ -1014,7 +991,7 @@ export default {
}
let obj = {
name: state.valuesname,
projectId: 28,
projectId: state.projectId,
remark: state.valuesnotice,
};
apistage
@@ -1072,6 +1049,20 @@ export default {
state.tableData = array;
console.log("state.tableData", state.tableData);
};
//把阶段放到level里
const getStageData = (tableData) => {
let data = tableData;
let array = [];
data.map((value) => {
let obj = {
id: value.stageId,
tit: value.name,
name: value.remark,
};
array.push(obj);
});
state.level = array;
};
const tableDataFunc = () => {
const columns = [
@@ -1206,16 +1197,25 @@ export default {
//获取任务列表
const getTask = () => {
let obj = {
projectId: 28,
projectId: state.projectId,
// projectId: 28,
};
api
.getTask(obj)
.then((res) => {
if (res.status == 200) {
console.log("22222", res.data.data.stageList);
// console.log("22222", res.data.data.stageList);
let leng = res.data.data.stageList.length;
let arr = res.data.data.stageList[leng - 1].taskList;
//获取任务列表
let arr = res.data.data.stageList[0].taskList;
getTableData(arr);
let stagearr = res.data.data.stageList;
console.log(stagearr, 111111);
getStageData(stagearr);
//给阶段id赋初始值
state.chooseStageId = leng > 0 ? stagearr[0].stageId : null;
console.log(state.chooseStageId, 1111);
}
})
.catch((err) => {
@@ -1223,6 +1223,13 @@ export default {
});
};
//获取阶段
// const getStage = () =>{
// let obj = {
// projectId:state.projectId
// }
// }
//数据变化
const updateTableData = (data) => {
@@ -1689,9 +1696,13 @@ export default {
const closeDelete = () => {
state.deleteModal = false;
};
const changebgc = (index) => {
const changebgc = (index, id) => {
state.isactive = index;
state.isActive = !state.isActive;
console.log(id);
state.chooseStageId = id;
let final = state.level.find((item) => item.id === id);
getTableData(final.taskList);
};
//选择单个任务
@@ -1802,6 +1813,7 @@ export default {
changeRow,
selectRowAll,
changeCourseType,
getStageData,
};
},
};