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

View File

@@ -31,7 +31,7 @@
:class=" :class="
isactive == index && isActive == true ? 'bgcactive' : '' isactive == index && isActive == true ? 'bgcactive' : ''
" "
@click="changebgc(index)" @click="changebgc(index, element.id)"
> >
<div class="itemle"> <div class="itemle">
<div class="tit">{{ element.tit }}</div> <div class="tit">{{ element.tit }}</div>
@@ -172,6 +172,7 @@
<add-live <add-live
v-model:addliveVisible="addlivevisible" v-model:addliveVisible="addlivevisible"
@changeData="updateTableData" @changeData="updateTableData"
v-model:projectId="projectId"
/> />
</div> </div>
<!-- 添加直播侧弹窗 --> <!-- 添加直播侧弹窗 -->
@@ -816,6 +817,7 @@ export default {
setup() { setup() {
const state = reactive({ const state = reactive({
projectId: storage.get("projectId") ? storage.get("projectId") : null, projectId: storage.get("projectId") ? storage.get("projectId") : null,
chooseStageId: null,
projectNameList: [ projectNameList: [
{ {
id: 1, id: 1,
@@ -850,33 +852,8 @@ export default {
label: "移动任务到关卡", label: "移动任务到关卡",
}, },
], ],
level: [ //阶段数据
{ 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: "中级产品经理",
},
],
//任务数据 //任务数据
tableData: [], tableData: [],
@@ -1014,7 +991,7 @@ export default {
} }
let obj = { let obj = {
name: state.valuesname, name: state.valuesname,
projectId: 28, projectId: state.projectId,
remark: state.valuesnotice, remark: state.valuesnotice,
}; };
apistage apistage
@@ -1072,6 +1049,20 @@ export default {
state.tableData = array; state.tableData = array;
console.log("state.tableData", state.tableData); 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 tableDataFunc = () => {
const columns = [ const columns = [
@@ -1206,16 +1197,25 @@ export default {
//获取任务列表 //获取任务列表
const getTask = () => { const getTask = () => {
let obj = { let obj = {
projectId: 28, projectId: state.projectId,
// projectId: 28,
}; };
api api
.getTask(obj) .getTask(obj)
.then((res) => { .then((res) => {
if (res.status == 200) { if (res.status == 200) {
console.log("22222", res.data.data.stageList); console.log("22222", res.data.data.stageList);
// console.log("22222", res.data.data.stageList);
let leng = res.data.data.stageList.length; 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); 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) => { .catch((err) => {
@@ -1223,6 +1223,13 @@ export default {
}); });
}; };
//获取阶段
// const getStage = () =>{
// let obj = {
// projectId:state.projectId
// }
// }
//数据变化 //数据变化
const updateTableData = (data) => { const updateTableData = (data) => {
@@ -1689,9 +1696,13 @@ export default {
const closeDelete = () => { const closeDelete = () => {
state.deleteModal = false; state.deleteModal = false;
}; };
const changebgc = (index) => { const changebgc = (index, id) => {
state.isactive = index; state.isactive = index;
state.isActive = !state.isActive; 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, changeRow,
selectRowAll, selectRowAll,
changeCourseType, changeCourseType,
getStageData,
}; };
}, },
}; };