|
|
@@ -0,0 +1,607 @@
|
|
|
+<template>
|
|
|
+ <div id="learningHoursRecordListMonth">
|
|
|
+ <search-box-new
|
|
|
+ ref="searchBox"
|
|
|
+ :formData="formData"
|
|
|
+ :formList="formList"
|
|
|
+ @search="getData(1)"
|
|
|
+ @init="getData(2)"
|
|
|
+ ><template slot="customize">
|
|
|
+ <el-button size="small" type="success" @click="moreActive"
|
|
|
+ >批量导出</el-button
|
|
|
+ >
|
|
|
+ </template></search-box-new
|
|
|
+ >
|
|
|
+ <div style="margin-bottom: 20px">
|
|
|
+ <span
|
|
|
+ style="
|
|
|
+ display: inline-block;
|
|
|
+ width: 70px;
|
|
|
+ text-align: end;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #6b6b6b;
|
|
|
+ "
|
|
|
+ >月份:</span
|
|
|
+ >
|
|
|
+ <el-date-picker
|
|
|
+ style="width: 90%"
|
|
|
+ type="months"
|
|
|
+ v-model="dates"
|
|
|
+ placeholder="选择月份"
|
|
|
+ @change="search"
|
|
|
+ value-format="timestamp"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ </div>
|
|
|
+ <el-table
|
|
|
+ :row-class-name="tableRowClassName"
|
|
|
+ :default-expand-all="expandAll"
|
|
|
+ border
|
|
|
+ :data="tableData"
|
|
|
+ style="width: 100%"
|
|
|
+ :header-cell-style="{
|
|
|
+ color: '#333',
|
|
|
+ fontSize: '16px',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <el-table-column type="expand">
|
|
|
+ <template slot-scope="props">
|
|
|
+ <div style="margin-bottom: 14px">
|
|
|
+ <span style="display: inline-block; width: 70px; text-align: end"
|
|
|
+ >周期:</span
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ v-for="(item, index) in props.row.monthData"
|
|
|
+ :key="index"
|
|
|
+ :type="props.row.activeMonth == index ? 'primary' : ''"
|
|
|
+ @click="changeBtn(props.row, index)"
|
|
|
+ >第{{ index + 1 }}周</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <table-list
|
|
|
+ :tableSets="studyTableSet"
|
|
|
+ :tableData="props.row.children"
|
|
|
+ :navText="navText"
|
|
|
+ :navIndex="props.row.total"
|
|
|
+ :loading="props.row.loading"
|
|
|
+ >
|
|
|
+ <template slot="studyTime" slot-scope="propsChild">
|
|
|
+ <span>{{
|
|
|
+ (propsChild.scope.row.studyTime / 45 / 60).toFixed(2) || 0
|
|
|
+ }}</span>
|
|
|
+ </template>
|
|
|
+ <template slot="btn" slot-scope="propsChild">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="activeHoursRecord(propsChild.scope.row, props.row)"
|
|
|
+ >学习记录</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="activeStudyRecord(propsChild.scope.row, props.row)"
|
|
|
+ :disabled="
|
|
|
+ [-1, 2, 3].includes(propsChild.scope.row.periodStatus)
|
|
|
+ "
|
|
|
+ >学时记录</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </table-list>
|
|
|
+ <div style="text-align: center">
|
|
|
+ <pagination
|
|
|
+ :total="props.row.total"
|
|
|
+ :pageSize="props.row.params.pageSize"
|
|
|
+ :currentPage="props.row.params.pageNum"
|
|
|
+ @handleSizeChange="handleSizeChange($event, props.row)"
|
|
|
+ @handleCurrentChange="handleCurrentChange($event, props.row)"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ align="center"
|
|
|
+ header-align="center"
|
|
|
+ label="日期"
|
|
|
+ prop="date"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import * as baseUrls from "@/utils/request.js";
|
|
|
+import searchBoxNew from "@/components/searchBoxNew";
|
|
|
+import tableList from "@/components/tableList";
|
|
|
+import pagination from "@/components/pagination";
|
|
|
+export default {
|
|
|
+ name: "LearningHoursRecordListMonth",
|
|
|
+ components: { searchBoxNew, tableList, pagination },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ expandAll: true,
|
|
|
+ navText: {
|
|
|
+ title: "学习学时记录",
|
|
|
+ index: 0,
|
|
|
+ ch: "条",
|
|
|
+ num: false,
|
|
|
+ border: true,
|
|
|
+ choice: false,
|
|
|
+ addHide: true,
|
|
|
+ backFatherBtn: {
|
|
|
+ status: false,
|
|
|
+ title: "未定义",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ //搜索
|
|
|
+ formList: [
|
|
|
+ {
|
|
|
+ prop: "educationTypeId",
|
|
|
+ placeholder: "教育类型",
|
|
|
+ scope: "educationType",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: "businessId",
|
|
|
+ placeholder: "业务层次",
|
|
|
+ scope: "businessLevel",
|
|
|
+ edu: "educationTypeId",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: "className",
|
|
|
+ placeholder: "请输入班级名称",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: "studyStatus",
|
|
|
+ placeholder: "学习状态",
|
|
|
+ scope: "select",
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ label: "完成学习",
|
|
|
+ value: 2,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "未完成学习",
|
|
|
+ value: 1,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: "periodStatus",
|
|
|
+ placeholder: "学时审核状态",
|
|
|
+ scope: "select",
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ label: "不可审核",
|
|
|
+ value: -1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "待审核",
|
|
|
+ value: 2,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "审核不通过",
|
|
|
+ value: 0,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "审核通过",
|
|
|
+ value: 1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "审核中",
|
|
|
+ value: 3,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: "periodPlush",
|
|
|
+ placeholder: "请选择学时官方推送状态",
|
|
|
+ scope: "select",
|
|
|
+ noClear: false,
|
|
|
+ diff: "gfxs",
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ label: "学时官方推送状态",
|
|
|
+ value: "",
|
|
|
+ disable: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "是",
|
|
|
+ value: 1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "否",
|
|
|
+ value: 0,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: "idCard",
|
|
|
+ placeholder: "身份证",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: "searchKey",
|
|
|
+ placeholder: "班级名称/商品名称/学员姓名",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ dates: [],
|
|
|
+ formData: {
|
|
|
+ status: 1,
|
|
|
+ changeGrade: 0,
|
|
|
+ pageSize: 10,
|
|
|
+ pageNum: 1,
|
|
|
+ userPhoto: 1,
|
|
|
+ },
|
|
|
+ // 表单
|
|
|
+ tableSet: [
|
|
|
+ {
|
|
|
+ label: "日期",
|
|
|
+ prop: "date",
|
|
|
+ hidden: true,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ tableData: [], //表单数据
|
|
|
+ // 表单
|
|
|
+ studyTableSet: [
|
|
|
+ {
|
|
|
+ label: "学员姓名",
|
|
|
+ prop: "realName",
|
|
|
+ hidden: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "学员身份证",
|
|
|
+ prop: "idCard",
|
|
|
+ hidden: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "一寸头像照",
|
|
|
+ prop: "oneInchPhotos",
|
|
|
+ hidden: true,
|
|
|
+ scope: "img",
|
|
|
+ width: "120px",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "最近人脸照",
|
|
|
+ prop: "idCardImg1",
|
|
|
+ hidden: true,
|
|
|
+ scope: "img",
|
|
|
+ width: "120px",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "商品名称",
|
|
|
+ prop: "goodsName",
|
|
|
+ hidden: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "学习学时",
|
|
|
+ prop: "studyTime",
|
|
|
+ hidden: true,
|
|
|
+ scope: "solt",
|
|
|
+ soltName: "studyTime",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "所在班级",
|
|
|
+ prop: "className",
|
|
|
+ hidden: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "学习时间",
|
|
|
+ prop1: "startTime",
|
|
|
+ prop2: "endTime",
|
|
|
+ scope: "TimeLists",
|
|
|
+ hidden: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "学时审核状态",
|
|
|
+ prop: "periodStatus",
|
|
|
+ hidden: true,
|
|
|
+ scope: "isOptions",
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ label: "不可审核",
|
|
|
+ value: -1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "待审核",
|
|
|
+ value: 2,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "审核不通过",
|
|
|
+ value: 0,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "审核通过",
|
|
|
+ value: 1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "审核中",
|
|
|
+ value: 3,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ studyArray: {},
|
|
|
+ studyTableData: [], //表单数据
|
|
|
+ total: 0, //一共多少条
|
|
|
+ };
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getNewMonth();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ tableRowClassName({ row, rowIndex }) {
|
|
|
+ return "success-row";
|
|
|
+ },
|
|
|
+ moreActive() {
|
|
|
+ var ary = ["第一周", "第二周", "第三周", "第四周", "第五周", "第六周"];
|
|
|
+ var array = [];
|
|
|
+ this.dates.forEach((item) => {
|
|
|
+ var alis = this.onlyForma(item);
|
|
|
+ var monthData = this.$methodsTools.getWeekData(alis.year, alis.month);
|
|
|
+ var s = monthData.map((i) => {
|
|
|
+ return {
|
|
|
+ searchWeekStartTime: i.beginTimeCode,
|
|
|
+ searchWeekEndTime: i.endTimeCode,
|
|
|
+ weekCxt: alis.date + " " + ary[parseInt(i.weeknum) - 1],
|
|
|
+ };
|
|
|
+ });
|
|
|
+ array = array.concat(s);
|
|
|
+ });
|
|
|
+ var data = JSON.parse(JSON.stringify(this.formData));
|
|
|
+ delete data.pageNum;
|
|
|
+ delete data.pageSize;
|
|
|
+ data.status = [data.status];
|
|
|
+ data.weekList = array;
|
|
|
+ this.exputs(data)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param {Object} data
|
|
|
+ * @remards 导出条件
|
|
|
+ */
|
|
|
+ exputs(data) {
|
|
|
+ this.$modal.loading("正在导出数据,请稍后...");
|
|
|
+ this.$api
|
|
|
+ .gradegradeexportWeek(data)
|
|
|
+ .then(async (res) => {
|
|
|
+ for (let k in res.data) {
|
|
|
+ if (res.data[k].code === 200) {
|
|
|
+ await this.dowmFunc(res, k);
|
|
|
+ } else {
|
|
|
+ this.$message.error("code值错误:", res.data[k].code);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ /**
|
|
|
+ * @remards 请求超时处理
|
|
|
+ */
|
|
|
+ let { message } = err;
|
|
|
+ if (message.includes("timeout")) {
|
|
|
+ this.$message.error(
|
|
|
+ "数据体量过大,无法正常导出,请调整导出的日期范围,缩小数据体量"
|
|
|
+ );
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.$modal.closeLoading();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ dowmFunc(res, k) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ let url =
|
|
|
+ baseUrls.baseURL + "common/download?fileName=" + res.data[k].msg;
|
|
|
+ let link = document.createElement("a");
|
|
|
+ let fileName = "导入模板" + ".xlsx";
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.href = url;
|
|
|
+ link.dowmload = fileName;
|
|
|
+ link.click();
|
|
|
+ link.remove();
|
|
|
+ setTimeout(() => {
|
|
|
+ resolve();
|
|
|
+ }, 200);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getNewMonth() {
|
|
|
+ var date = new Date();
|
|
|
+ date.setDate(1);
|
|
|
+ var cTime = new Date(new Date(date).toLocaleDateString()).getTime();
|
|
|
+ this.dates = [cTime];
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 搜索列表
|
|
|
+ */
|
|
|
+ search() {
|
|
|
+ this.tableData = this.dates?.length
|
|
|
+ ? this.dates
|
|
|
+ .map((i) => {
|
|
|
+ var a = this.onlyForma(i);
|
|
|
+ return {
|
|
|
+ ...a,
|
|
|
+ children: [],
|
|
|
+ loading: false,
|
|
|
+ monthData: this.$methodsTools.getWeekData(a.year, a.month),
|
|
|
+ activeMonth: 0,
|
|
|
+ total: 0,
|
|
|
+ params: {
|
|
|
+ pageSize: 10,
|
|
|
+ pageNum: 1,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ })
|
|
|
+ .sort((a, b) => {
|
|
|
+ return a.time - b.time;
|
|
|
+ })
|
|
|
+ : [];
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ getData(int) {
|
|
|
+ this.tableData.forEach(async (i) => {
|
|
|
+ this.getChildrenData(i, int);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getChildrenData(info, int) {
|
|
|
+ info.loading = true;
|
|
|
+ if (int === 1) {
|
|
|
+ info.params.pageNum = 1;
|
|
|
+ }
|
|
|
+ if (int === 2) {
|
|
|
+ info.params = {
|
|
|
+ pageSize: 10,
|
|
|
+ pageNum: 1,
|
|
|
+ };
|
|
|
+ this.formData = {
|
|
|
+ changeGrade: 0,
|
|
|
+ status: 1,
|
|
|
+ userPhoto: 1,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ var data = JSON.parse(JSON.stringify(this.formData));
|
|
|
+ data.searchWeekStartTime = info.monthData[info.activeMonth].beginTimeCode;
|
|
|
+ data.searchWeekEndTime = info.monthData[info.activeMonth].endTimeCode;
|
|
|
+ let arr = Object.assign(data, info.params);
|
|
|
+ this.$api
|
|
|
+ .inquireGradegradelistUserPeriodWeekRecord(arr)
|
|
|
+ .then((res) => {
|
|
|
+ info.total = res.total;
|
|
|
+ info.children = res.rows;
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ info.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ changeBtn(item, index) {
|
|
|
+ if (item.activeMonth == index) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ item.activeMonth = index;
|
|
|
+ this.getChildrenData(item, 1);
|
|
|
+ },
|
|
|
+ onlyForma(timeStamp) {
|
|
|
+ if (!timeStamp) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var date = new Date(timeStamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
|
|
|
+ var Y = date.getFullYear();
|
|
|
+ var M =
|
|
|
+ date.getMonth() + 1 < 10
|
|
|
+ ? "0" + (date.getMonth() + 1)
|
|
|
+ : date.getMonth() + 1;
|
|
|
+ return {
|
|
|
+ time: timeStamp,
|
|
|
+ date: Y + "-" + M,
|
|
|
+ year: Y,
|
|
|
+ month: M,
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param {Number} v
|
|
|
+ * @remards 每页数量
|
|
|
+ */
|
|
|
+ handleSizeChange(v, item) {
|
|
|
+ item.params.pageSize = v;
|
|
|
+ item.params.pageNum = 1;
|
|
|
+ this.getChildrenData(item);
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param {Number} v
|
|
|
+ * @remards 切换页码
|
|
|
+ */
|
|
|
+ handleCurrentChange(v, item) {
|
|
|
+ item.params.pageNum = v;
|
|
|
+ this.getChildrenData(item);
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param {obj} int
|
|
|
+ * @remard 学习记录
|
|
|
+ */
|
|
|
+ activeHoursRecord(options, parentItem) {
|
|
|
+ this.isShow = false;
|
|
|
+ const jump = () => {
|
|
|
+ //班级详情
|
|
|
+ this.$router.push({
|
|
|
+ path: "hoursTimesRecord",
|
|
|
+ query: {
|
|
|
+ gradeId: options.gradeId,
|
|
|
+ userId: options.userId,
|
|
|
+ goodsId: options.goodsId,
|
|
|
+ goodsName: options.goodsName,
|
|
|
+ className: options.className,
|
|
|
+ classHours: options.classHours,
|
|
|
+ studyStartTime: options.studyStartTime,
|
|
|
+ studyEndTime: options.studyEndTime,
|
|
|
+ time: parentItem.time,
|
|
|
+ activeMonth: parentItem.activeMonth,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ };
|
|
|
+ const statusPage = this.$store.state.tagsView.visitedViews.some(
|
|
|
+ (item) => {
|
|
|
+ return item.name == "HoursTimesRecord";
|
|
|
+ }
|
|
|
+ );
|
|
|
+ if (statusPage) {
|
|
|
+ this.$store
|
|
|
+ .dispatch("tagsView/delCachedView", {
|
|
|
+ name: "HoursTimesRecord",
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ jump();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ jump();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param {obj} int
|
|
|
+ * @remard 学时记录
|
|
|
+ */
|
|
|
+ activeStudyRecord(v) {
|
|
|
+ this.$api
|
|
|
+ .inquireGradegradelockPeriodStatus({
|
|
|
+ gradeId: v.gradeId,
|
|
|
+ userId: v.userId,
|
|
|
+ goodsId: v.goodsId,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.msg) {
|
|
|
+ this.$message.warning(res.msg + "正在操作");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ let data = {
|
|
|
+ userId: v.userId,
|
|
|
+ realName: v.realName,
|
|
|
+ id: v.gradeId,
|
|
|
+ className: v.className,
|
|
|
+ goodsId: v.goodsId,
|
|
|
+ goodsName: v.goodsName,
|
|
|
+ keyId: `${v.userId}-${v.goodsId}-${v.gradeId}`,
|
|
|
+ };
|
|
|
+ this.checkSession(data)
|
|
|
+ .then(() => {
|
|
|
+ this.isShow = false;
|
|
|
+ //学员详情
|
|
|
+ this.$router.push({
|
|
|
+ path: "classHoursReview",
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message.error("存在异常,请联系开发人员");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+/deep/ .el-table .success-row {
|
|
|
+ background: rgb(204, 221, 247);
|
|
|
+}
|
|
|
+</style>
|