fix:修改学员总数不一致

This commit is contained in:
lixg
2022-12-08 15:24:08 +08:00
parent 84ee457c09
commit a189d96260
4 changed files with 784 additions and 683 deletions

View File

@@ -418,6 +418,10 @@
<a-button class="pubtn2" @click="releaseLearnPath">发布</a-button> <a-button class="pubtn2" @click="releaseLearnPath">发布</a-button>
</div> </div>
</div> </div>
<!-- 加载动画 -->
<div class="aeLoading" :style="{ display: pubLoading ? 'flex' : 'none' }">
<a-spin :spinning="pubLoading" />
</div>
</a-modal> </a-modal>
<!-- 复制路径弹窗 --> <!-- 复制路径弹窗 -->
<a-modal <a-modal
@@ -723,6 +727,7 @@ export default {
// learnPathBg: null, //创建路径选择的路径图背景 // learnPathBg: null, //创建路径选择的路径图背景
// learnPathBg2: null, //编辑路径选择的路径图背景 // learnPathBg2: null, //编辑路径选择的路径图背景
pub: false, //发布弹窗 pub: false, //发布弹窗
pubLoading: false, //发布loading
checked: false, //发布弹窗switch checked: false, //发布弹窗switch
checkedTeacher: false, //发布弹窗勾选 checkedTeacher: false, //发布弹窗勾选
checkStu: false, //发布弹窗勾选 checkStu: false, //发布弹窗勾选
@@ -853,6 +858,7 @@ export default {
const showPub = (router) => { const showPub = (router) => {
console.log("router", router); console.log("router", router);
state.pub = true; state.pub = true;
state.pubLoading = true;
state.releasePathId = router.id; state.releasePathId = router.id;
state.releasePathName = router.manager; state.releasePathName = router.manager;
api api
@@ -860,7 +866,7 @@ export default {
.then((res) => { .then((res) => {
console.log("获取关卡、任务、学员统计数据", res.data); console.log("获取关卡、任务、学员统计数据", res.data);
if (res.status === 200) { if (res.status === 200) {
state.routeStudentsNum = res.data.students; // state.routeStudentsNum = res.data.students;
state.routeChapters = res.data.chapters; state.routeChapters = res.data.chapters;
state.routeTasks = res.data.tasks; state.routeTasks = res.data.tasks;
} }
@@ -868,6 +874,24 @@ export default {
.catch((err) => { .catch((err) => {
console.log("err", err); console.log("err", err);
}); });
//获取学员列表
let stuobj = {
pageNo: 1,
pageSize: 10,
routerId: router.id,
};
api
.getStudent(stuobj)
.then((res) => {
console.log("获取学员列表", res.data.data.total);
if (res.data.code === 200) {
state.routeStudentsNum = res.data.data.total;
state.pubLoading = false;
}
})
.catch((err) => {
console.log("获取学员列表失败", err);
});
}; };
//确定发布 //确定发布
const releaseLearnPath = () => { const releaseLearnPath = () => {
@@ -897,6 +921,11 @@ export default {
const closePub = () => { const closePub = () => {
state.pub = false; state.pub = false;
state.releasePathId = null;
state.releasePathName = null;
state.routeChapters = null;
state.routeTasks = null;
state.routeStudentsNum = null;
}; };
//显示复制窗口 //显示复制窗口
const showCopyModal = () => { const showCopyModal = () => {
@@ -1544,8 +1573,8 @@ export default {
.getRouterDetail(id) .getRouterDetail(id)
.then((res) => { .then((res) => {
if (res.data.code === 200) { if (res.data.code === 200) {
console.log("获取学习路径详情成功", res.data.data);
let detail = res.data.data.routerInfo; let detail = res.data.data.routerInfo;
// console.log("获取详情成功", detail);
state.pathName = detail.name; state.pathName = detail.name;
state.pathBg = detail.picUrl; state.pathBg = detail.picUrl;
state.pathBgId = ""; state.pathBgId = "";

View File

@@ -1143,6 +1143,10 @@
<a-button class="pubtn2" @click="releaseLearnPath">发布</a-button> <a-button class="pubtn2" @click="releaseLearnPath">发布</a-button>
</div> </div>
</div> </div>
<!-- 加载动画 -->
<div class="aeLoading" :style="{ display: pubLoading ? 'flex' : 'none' }">
<a-spin :spinning="pubLoading" />
</div>
</a-modal> </a-modal>
<!-- 撤回路径弹窗 --> <!-- 撤回路径弹窗 -->
<a-modal <a-modal
@@ -1303,6 +1307,7 @@ export default {
action: null, action: null,
act: null, act: null,
pub: false, //发布弹窗 pub: false, //发布弹窗
pubLoading: false, //发布loading
backModal: false, //撤回弹窗 backModal: false, //撤回弹窗
dcopyModal: false, //复制弹窗 dcopyModal: false, //复制弹窗
closeBack: false, closeBack: false,
@@ -1813,13 +1818,14 @@ export default {
//显示发布弹窗 //显示发布弹窗
const showPub = () => { const showPub = () => {
state.pub = true; state.pub = true;
state.pubLoading = true;
// state.releasePathId = routerId; // state.releasePathId = routerId;
api api
.getLearnCount(state.routerId) .getLearnCount(state.routerId)
.then((res) => { .then((res) => {
if (res.status === 200) { if (res.status === 200) {
// console.log("获取关卡、任务、学员统计数据", res.data); // console.log("获取关卡、任务、学员统计数据", res.data);
state.routeStudentsNum = res.data.students; // state.routeStudentsNum = res.data.students;
state.routeChapters = res.data.chapters; state.routeChapters = res.data.chapters;
state.routeTasks = res.data.tasks; state.routeTasks = res.data.tasks;
} }
@@ -1827,6 +1833,24 @@ export default {
.catch((err) => { .catch((err) => {
console.log("err", err); console.log("err", err);
}); });
//获取学员列表
let stuobj = {
pageNo: 1,
pageSize: 10,
routerId: state.routerId,
};
api
.getStudent(stuobj)
.then((res) => {
console.log("获取学员列表", res.data.data.total);
if (res.data.code === 200) {
state.routeStudentsNum = res.data.data.total;
state.pubLoading = false;
}
})
.catch((err) => {
console.log("获取学员列表失败", err);
});
}; };
//显示撤回弹窗 //显示撤回弹窗
const showBackModal = () => { const showBackModal = () => {

View File

@@ -47,7 +47,10 @@
<a-range-picker <a-range-picker
v-model:value="searchParam.valueDate" v-model:value="searchParam.valueDate"
:show-time="{ :show-time="{
defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')], defaultValue: [
moment('00:00:00', 'HH:mm:ss'),
moment('23:59:59', 'HH:mm:ss'),
],
}" }"
style="border-radius: 8px; height: 40px; margin-left: 5px" style="border-radius: 8px; height: 40px; margin-left: 5px"
:placeholder="[' 开始时间', ' 结束时间']" :placeholder="[' 开始时间', ' 结束时间']"
@@ -378,7 +381,7 @@
<img src="../../assets/images/taskpage/right2.png" /> <img src="../../assets/images/taskpage/right2.png" />
</div> </div>
<div class="centerbox" style="color: rgba(78, 166, 255, 1)"> <div class="centerbox" style="color: rgba(78, 166, 255, 1)">
单层{{ projectInfo.parentId ? '子' : '' }}项目 单层{{ projectInfo.parentId ? "子" : "" }}项目
</div> </div>
<div class="centermain"> <div class="centermain">
不包含子项目直接填写项目基础信息后创建任务 不包含子项目直接填写项目基础信息后创建任务
@@ -403,11 +406,13 @@
<img src="../../assets/images/taskpage/right3.png" /> <img src="../../assets/images/taskpage/right3.png" />
</div> </div>
<div class="centerbox1" style="color: rgba(93, 201, 136, 1)"> <div class="centerbox1" style="color: rgba(93, 201, 136, 1)">
多层{{ projectInfo.parentId ? '子' : '' }}项目 多层{{ projectInfo.parentId ? "子" : "" }}项目
</div> </div>
<div class="centermain1"> <div class="centermain1">
{{ {{
projectInfo.parentId ? '可创建班级,通过班级填写基础信息并创建任务' : '包含子项目,分为多层子项目和单层子项目,多层子项目可创建班级,通过班级填写基础信息并创建任务' projectInfo.parentId
? "可创建班级,通过班级填写基础信息并创建任务"
: "包含子项目,分为多层子项目和单层子项目,多层子项目可创建班级,通过班级填写基础信息并创建任务"
}} }}
</div> </div>
</div> </div>
@@ -615,6 +620,13 @@
<a-button class="pubtn2" @click="releaseProject">发布</a-button> <a-button class="pubtn2" @click="releaseProject">发布</a-button>
</div> </div>
</div> </div>
<!-- 加载动画 -->
<div
class="aeLoading"
:style="{ display: projectPubLoading ? 'flex' : 'none' }"
>
<a-spin :spinning="projectPubLoading" />
</div>
</a-modal> </a-modal>
<!-- 撤回路径弹窗 --> <!-- 撤回路径弹窗 -->
<a-modal <a-modal
@@ -813,7 +825,7 @@ import ProjectManager from "@/components/project/ProjectManagerNew";
import ProjectClass from "@/components/project/ProjectClass"; import ProjectClass from "@/components/project/ProjectClass";
import OrgClass from "@/components/project/OrgClass"; import OrgClass from "@/components/project/OrgClass";
import dayjs from "dayjs"; import dayjs from "dayjs";
import * as moment from 'moment' import * as moment from "moment";
import { changeOwnership } from "@/api/method"; import { changeOwnership } from "@/api/method";
export default { export default {
@@ -846,6 +858,7 @@ export default {
startModal: false, //启用弹窗 startModal: false, //启用弹窗
closeStart: false, //启用弹窗关闭图标 closeStart: false, //启用弹窗关闭图标
projectPub: false, //发布弹窗 projectPub: false, //发布弹窗
projectPubLoading: false, //发布loading
backModal: false, //撤回弹窗 backModal: false, //撤回弹窗
closeBack: false, //撤回弹窗关闭图标 closeBack: false, //撤回弹窗关闭图标
reminderModal: false, //温馨提示弹窗 reminderModal: false, //温馨提示弹窗
@@ -905,7 +918,7 @@ export default {
{ value: 2, label: "审核通过" }, { value: 2, label: "审核通过" },
{ value: 3, label: "已发布" }, { value: 3, label: "已发布" },
{ value: -2, label: "未通过" }, { value: -2, label: "未通过" },
{value: -1, label: "已结束"} { value: -1, label: "已结束" },
]); ]);
const searchReset = () => { const searchReset = () => {
state.searchParam = { pageNo: 1, pageSize: 10 }; state.searchParam = { pageNo: 1, pageSize: 10 };
@@ -955,11 +968,10 @@ export default {
message.destroy(); message.destroy();
message.success("创建成功"); message.success("创建成功");
state.currentPage = 1; state.currentPage = 1;
state.projectInfo.projectId || changeOwnership( state.projectInfo.projectId ||
"project", changeOwnership("project", res.data.data.projectId, [
res.data.data.projectId, { id: res.data.data.createId, name: res.data.data.createName },
[{id: res.data.data.createId, name: res.data.data.createName}] ]);
);
getTableDate(); getTableDate();
}); });
}; };
@@ -1002,38 +1014,38 @@ export default {
//打开发布弹窗 //打开发布弹窗
const showProjectPub = (object) => { const showProjectPub = (object) => {
state.projectPub = true; state.projectPub = true;
state.projectPubLoading = true;
state.releaseProjectId = object.projectId; state.releaseProjectId = object.projectId;
state.releaseProjectName = object.name; state.releaseProjectName = object.name;
state.releaseProjectTime = object.time; state.releaseProjectTime = object.time;
console.log("object", object); console.log("object", object);
api api.getProjectCount(object.projectId).then((res) => {
.getProjectCount(object.projectId)
.then((res) => {
console.log("获取关卡、任务、学员统计数据", res.data); console.log("获取关卡、任务、学员统计数据", res.data);
state.projectStudentsNum = res.data.students; // state.projectStudentsNum = res.data.students;
state.projectStages = res.data.stages; state.projectStages = res.data.stages;
state.projectTasks = res.data.tasks; state.projectTasks = res.data.tasks;
});
//获取学员总数
let obj = {
pageNo: 0,
pageSize: 0,
projectId: object.projectId,
};
api
.projectStudent(obj)
.then((res) => {
if (res.data.code === 200) {
// console.log("res", res.data);
state.projectStudentsNum = res.data.data.total
? res.data.data.total
: 0;
state.projectPubLoading = false;
}
}) })
// //获取学员总数 .catch((err) => {
// let obj = { console.log("获取学员人数失败", err);
// pageNo: 0, });
// pageSize: 0, //获取阶段及任务总数
// projectId: object.projectId,
// };
// api
// .projectStudent(obj)
// .then((res) => {
// if (res.status === 200) {
// // console.log("res", res.data);
// state.projectStudentsNum = res.data.data.total
// ? res.data.data.total
// : 0;
// }
// })
// .catch((err) => {
// console.log("获取学员人数失败", err);
// });
// //获取阶段及任务总数
}; };
//确认发布项目 //确认发布项目
const releaseProject = () => { const releaseProject = () => {
@@ -1042,18 +1054,22 @@ export default {
projectId: state.releaseProjectId, projectId: state.releaseProjectId,
type: 4, type: 4,
}; };
api.handleProject(obj) api.handleProject(obj).then((res) => {
.then((res) => {
console.log("发布成功", res); console.log("发布成功", res);
message.destroy(); message.destroy();
message.success("发布成功"); message.success("发布成功");
state.projectPub = false; state.projectPub = false;
getTableDate(); getTableDate();
}) });
}; };
//关闭发布弹窗 //关闭发布弹窗
const closeProjectPub = () => { const closeProjectPub = () => {
state.projectPub = false; state.projectPub = false;
state.projectStages = null;
state.projectTasks = null;
state.projectStudentsNum = null;
state.projectPubLoading = false;
state.releaseProjectId = null;
}; };
//打开撤回发布弹窗 //打开撤回发布弹窗
const showBackModal = (projectId) => { const showBackModal = (projectId) => {
@@ -1184,7 +1200,7 @@ export default {
message.success("模版保存成功"); message.success("模版保存成功");
return; return;
} }
Modal.error({title: res.data.msg}) Modal.error({ title: res.data.msg });
}); });
}; };
//关闭存为模版弹窗 //关闭存为模版弹窗
@@ -1314,15 +1330,21 @@ export default {
customRender: (value) => { customRender: (value) => {
return ( return (
<div> <div>
{value.record.type === 3 ? { {value.record.type === 3
'0': () => '草稿', ? {
'1': () => '草稿', 0: () => "草稿",
'2': () => '草稿', 1: () => "草稿",
'3': () => dayjs().isBefore(value.record.beginTime) ? '未开始' : '进行中', 2: () => "草稿",
'4': () => dayjs().isBefore(value.record.end) ? '进行中' : '已结束', 3: () =>
'-1': () => '已结束', dayjs().isBefore(value.record.beginTime)
'-5': () => '草稿' ? "未开始"
}[value.record.status + '']() || '' : '-'} : "进行中",
4: () =>
dayjs().isBefore(value.record.end) ? "进行中" : "已结束",
"-1": () => "已结束",
"-5": () => "草稿",
}[value.record.status + ""]() || ""
: "-"}
</div> </div>
); );
}, },
@@ -1345,15 +1367,17 @@ export default {
customRender: (value) => { customRender: (value) => {
return ( return (
<div> <div>
{value.record.type === 3 ? { {value.record.type === 3
'0': '未审核', ? {
'1': '审核中', 0: "未审核",
'2': '已审核', 1: "审核中",
'3': '已审核', 2: "已审核",
'4': '已审核', 3: "已审核",
'-1': '已审核', 4: "已审核",
'-5': '拒绝' "-1": "已审核",
}[value.record.status + ''] || '' : '-'} "-5": "拒绝",
}[value.record.status + ""] || ""
: "-"}
</div> </div>
); );
}, },
@@ -1402,8 +1426,7 @@ export default {
) : ( ) : (
"" ""
)} )}
{(value.record.status === 0) && {value.record.status === 0 && value.record.type === 3 ? (
value.record.type === 3 ? (
<span <span
onClick={() => { onClick={() => {
showReviewModal(value.record.projectId); showReviewModal(value.record.projectId);
@@ -1432,7 +1455,8 @@ export default {
{value.record.status === 2 && value.record.type === 3 ? ( {value.record.status === 2 && value.record.type === 3 ? (
<span <span
onClick={() => { onClick={() => {
let time = value.record.beginTime + "-" + value.record.endTime; let time =
value.record.beginTime + "-" + value.record.endTime;
let obj = { let obj = {
projectId: value.record.projectId, projectId: value.record.projectId,
name: value.record.name, name: value.record.name,
@@ -1535,7 +1559,8 @@ export default {
path: "/projectadd", path: "/projectadd",
query: { query: {
parentId: value.record.projectId, parentId: value.record.projectId,
parentName: value.record.parentName + '——' + value.record.name, parentName:
value.record.parentName + "——" + value.record.name,
}, },
}); });
}} }}
@@ -1616,7 +1641,7 @@ export default {
onClick={() => { onClick={() => {
router.push({ router.push({
path: "/taskpage", path: "/taskpage",
query: {projectId: value.record.projectId} query: { projectId: value.record.projectId },
}); });
storage.set("projectId", value.record.projectId); storage.set("projectId", value.record.projectId);
}} }}
@@ -1664,7 +1689,10 @@ export default {
data.forEach((e) => { data.forEach((e) => {
e.parentName = parentName; e.parentName = parentName;
e.key = e.projectId; e.key = e.projectId;
initDataSublist((parentName ? (parentName + '——') : '') + e.name, e.subList); initDataSublist(
(parentName ? parentName + "——" : "") + e.name,
e.subList
);
e.subList && e.subList.length && (e.children = e.subList); e.subList && e.subList.length && (e.children = e.subList);
}); });
} }
@@ -1755,7 +1783,7 @@ export default {
); );
function managerChange(e, l, d) { function managerChange(e, l, d) {
state.projectInfo.sourceBelongId = d state.projectInfo.sourceBelongId = d;
} }
return { return {

View File

@@ -1707,7 +1707,9 @@
<div class="projectbox"> <div class="projectbox">
<div class="promessage"> <div class="promessage">
<div class="messageme">项目信息</div> <div class="messageme">项目信息</div>
<div class="messagege">当前项目共0个阶段0个任务</div> <div class="messagege">
当前项目共{{ projectStages }}个阶段,{{ projectTasks }}个任务
</div>
</div> </div>
<div class="stumessage"> <div class="stumessage">
<div class="messageme1">学员信息</div> <div class="messageme1">学员信息</div>
@@ -1731,6 +1733,13 @@
<a-button class="pubtn2" @click="releaseProject">发布</a-button> <a-button class="pubtn2" @click="releaseProject">发布</a-button>
</div> </div>
</div> </div>
<!-- 加载动画 -->
<div
class="aeLoading"
:style="{ display: projectPubLoading ? 'flex' : 'none' }"
>
<a-spin :spinning="projectPubLoading" />
</div>
</a-modal> </a-modal>
<!-- 撤回弹窗 --> <!-- 撤回弹窗 -->
@@ -2092,7 +2101,10 @@ export default {
action: null, action: null,
act: null, act: null,
projectPub: false, //发布弹窗 projectPub: false, //发布弹窗
projectPubLoading: false, //发布loading
projectStudentsNum: 0, //发布弹窗-学员人数 projectStudentsNum: 0, //发布弹窗-学员人数
projectStages: 0, //发布弹窗-阶段数
projectTasks: 0, //任务数
releaseProjectId: null, //发布的项目id releaseProjectId: null, //发布的项目id
releaseProjectName: null, //发布的项目名称 releaseProjectName: null, //发布的项目名称
releaseProjectTime: null, //发布的项目时间 releaseProjectTime: null, //发布的项目时间
@@ -3893,10 +3905,17 @@ export default {
//打开发布弹窗 //打开发布弹窗
const showProjectPub = () => { const showProjectPub = () => {
state.projectPub = true; state.projectPub = true;
state.projectPubLoading = true;
state.releaseProjectId = state.projectId; state.releaseProjectId = state.projectId;
state.releaseProjectName = state.name; state.releaseProjectName = state.name;
// state.releaseProjectTime = state.startTime; // state.releaseProjectTime = state.startTime;
// console.log("object", object); // console.log("object", object);
apiproj.getProjectCount(state.projectId).then((res) => {
console.log("获取关卡、任务、学员统计数据", res.data);
// state.projectStudentsNum = res.data.students;
state.projectStages = res.data.stages;
state.projectTasks = res.data.tasks;
});
//获取学员总数 //获取学员总数
let obj = { let obj = {
pageNo: 0, pageNo: 0,
@@ -3906,11 +3925,12 @@ export default {
apiproj apiproj
.projectStudent(obj) .projectStudent(obj)
.then((res) => { .then((res) => {
if (res.status === 200) { if (res.data.code === 200) {
// console.log("res", res.data); // console.log("res", res.data);
state.projectStudentsNum = res.data.data.total state.projectStudentsNum = res.data.data.total
? res.data.data.total ? res.data.data.total
: 0; : 0;
state.projectPubLoading = false;
} }
}) })
.catch((err) => { .catch((err) => {