diff --git a/src/main.js b/src/main.js index 2364806c..ba3ba532 100644 --- a/src/main.js +++ b/src/main.js @@ -19,6 +19,24 @@ Vue.use(vueKatexEs,{ } }) +Vue.directive('limit-input', { + bind: function (el, binding) { + const max = binding.value || 50; + // 找到input元素 + const input = el.querySelector('input'); + if (input) { + // 监听input事件,在输入时限制长度 + input.addEventListener('input', function () { + if (input.value.length > max) { + input.value = input.value.substring(0, max); + // 触发input事件,让element-ui的内部处理更新 + input.dispatchEvent(new Event('input', { bubbles: true })); + } + }); + } + } +}); + //import './mock/index' import xpage from '@/utils/xpage' diff --git a/src/views/course/CourseManage.vue b/src/views/course/CourseManage.vue index 8e8e5f23..3bd3e2e4 100644 --- a/src/views/course/CourseManage.vue +++ b/src/views/course/CourseManage.vue @@ -16,7 +16,17 @@ -
+
+ + + + {{ item.name }} + ({{ item.code }}) + + +
@@ -32,7 +42,7 @@ 重 置
- +
导出报名记录 @@ -49,12 +59,13 @@ - + label="满意度分数">
@@ -309,12 +346,22 @@ :append-to-body="true"> -
+
+ + + {{ item.name }} + ({{ item.code }}) + + + +
- + @@ -324,7 +371,7 @@
查 询 - 重 置 + 重 置
@@ -332,16 +379,16 @@ :header-cell-style="{textAlign: 'center'}" :cell-style="{ textAlign: 'center' }"> @@ -349,7 +396,8 @@ @@ -368,7 +416,7 @@ layout="total, sizes, prev, pager, next, jumper" :total="examResourceStudyPeopleQuery.count">
- 关 闭 + 关 闭 @@ -382,6 +430,7 @@ import { // sysTypeList, getType, } from "../../utils/tools.js"; +import apiUserbasic from "@/api/boe/userbasic.js"; import apicourseStudy from "@/api/modules/courseStudy.js"; import apiCoursePortal from "@/api/modules/coursePortal.js"; import { mapGetters, mapActions } from "vuex"; @@ -389,6 +438,7 @@ import apiUser from "@/api/system/user.js"; import apiStudy from "@/api/modules/courseStudy.js"; import { getToken } from "@/utils/token"; import axios from "axios"; + export default { computed: { ...mapGetters(["resOwnerMap", "sysTypeMap"]), @@ -397,7 +447,7 @@ export default { return { pickerOptions: { shortcuts: [ - { + { text: "今年以来", onClick(picker) { const end = new Date(); @@ -423,7 +473,7 @@ export default { picker.$emit("pick", [start, end]); }, }, - { + { text: "最近一个月", onClick(picker) { const end = new Date(); @@ -441,9 +491,6 @@ export default { picker.$emit("pick", [start, end]); }, }, - - - ], }, studyDateTime: [], @@ -466,6 +513,7 @@ export default { signup: { name: "", signType: "", + aid: [], }, courseType: courseType, value: "", @@ -490,6 +538,7 @@ export default { status: "", queryStartTime: "", queryFinishTime: "", + aid: [], }, study: { detailType: "", @@ -540,6 +589,7 @@ export default { count: 0, name: "", status: "", + aid: [], }, examResourceStudyPeopleShow: false, examResourceStudyPeopleList: [], @@ -549,7 +599,10 @@ export default { count: 0, name: "", status: "", + aid: [], }, + nameList: [], + nameListLoading: false, }; }, mounted() { @@ -569,6 +622,40 @@ export default { loadSysTypes: "sysType/loadSysTypes", }), + async initNameList(keyword) { + console.log("initNameList", keyword); + if (!keyword) { + return; + } + this.nameListLoading = true; + try { + const res = await apiUserbasic.selectUser(keyword); + this.nameListLoading = false; + + if (res && res.status === 200) { + const resultList = res.result || []; + this.nameList = resultList + .map((item) => this.formatCreatorItem(item)) + .filter((item) => item.userId); + } else { + this.creatorOptions = []; + } + } catch (error) { + this.nameList = []; + this.nameListLoading = false; + } finally { + this.nameListLoading = false; + } + }, + + formatCreatorItem(item = {}) { + return { + userId: item.id, + name: item.realName, + code: item.userNo, + }; + }, + resetCommonResourceQuery() { this.commonResourceStudyPeopleQuery = { pageIndex: 1, //第几页 @@ -576,8 +663,9 @@ export default { count: 0, name: "", status: "", + aid: [], }; - this.queryResourceStudyPeopleList() + this.queryResourceStudyPeopleList(); }, resetExamCommonResourceQuery() { @@ -587,8 +675,9 @@ export default { count: 0, name: "", status: "", + aid: [], }; - this.queryExamStudyPeopleList() + this.queryExamStudyPeopleList(); }, handleShowResourdeDetailList(row) { @@ -600,6 +689,7 @@ export default { count: 0, name: "", status: "", + aid: [], }; this.rousourceRow = row; if (row.contentType == "61") { @@ -624,8 +714,9 @@ export default { contentId: this.rousourceRow.contentId, pageIndex: this.examResourceStudyPeopleQuery.pageIndex, pageSize: this.examResourceStudyPeopleQuery.pageSize, - name: this.examResourceStudyPeopleQuery.name, + name: '', status: this.examResourceStudyPeopleQuery.status, + aid: this.examResourceStudyPeopleQuery.aid.join(","), }) .then((res) => { if (res.status === 200) { @@ -650,6 +741,9 @@ export default { contentId: this.rousourceRow.contentId, pageIndex: this.commonResourceStudyPeopleQuery.pageIndex, pageSize: this.commonResourceStudyPeopleQuery.pageSize, + name: "", + status: this.commonResourceStudyPeopleQuery.status, + aid: this.commonResourceStudyPeopleQuery.aid.join(","), }) .then((res) => { if (res.status === 200) { @@ -669,15 +763,16 @@ export default { queryResourceStudyPeopleList() { console.log(this.rousourceRow); - console.log(888) + console.log(888); apicourseStudy .studyContentRecords({ courseId: this.courseDetail.id, contentId: this.rousourceRow.contentId, pageIndex: this.commonResourceStudyPeopleQuery.pageIndex, pageSize: this.commonResourceStudyPeopleQuery.pageSize, - name: this.commonResourceStudyPeopleQuery.name, + name: "", status: this.commonResourceStudyPeopleQuery.status, + aid: this.commonResourceStudyPeopleQuery.aid.join(","), }) .then((res) => { if (res.status === 200) { @@ -770,23 +865,25 @@ export default { }, resetResourseList() { this.recourseListQuery.contentName = ""; - this.getResourseList() + this.getResourseList(); }, resetStudyRecords() { + this.learningRecords.aid = []; this.learningRecords.name = ""; this.learningRecords.status = ""; this.studyDateTime = []; this.learningRecords.queryStartTime = ""; this.learningRecords.queryFinishTime = ""; - this.getStudyRecords() + this.getStudyRecords(); }, resetSignupList() { this.signup = { name: "", signType: "", + aid: [], }; - this.getSignupList() + this.getSignupList(); }, resOwnerName(code) { if (code == "") { @@ -876,7 +973,7 @@ export default { this.recourseListQuery.pageIndex = 1; this.getResourseList(); }, - handleCurrentChangeRecourseList() { + handleCurrentChangeRecourseList(val) { this.recourseListQuery.pageIndex = val; this.getResourseList(); }, @@ -929,13 +1026,14 @@ export default { courseId: this.courseDetail.id, //课程的id status: this.learningRecords.status, //状态 // courseType:this.learningRecords.type,//类型 - aname: this.learningRecords.name, //学习人的姓名 learningRecords + aname: "", //学习人的姓名 learningRecords pageIndex: this.learningRecords.pageIndex, pageSize: this.learningRecords.pageSize, queryStartTime: this.studyDateTime.length > 0 ? this.studyDateTime[0] : "", queryFinishTime: this.studyDateTime.length > 1 ? this.studyDateTime[1] : "", + aid: this.learningRecords.aid.join(","), }; apicourseStudy.studyRecords(params).then((res) => { if (res.status === 200) { @@ -966,7 +1064,7 @@ export default { contentName: this.courseDetail.name, status: this.studyDetailRow.status, studyDuration: this.studyDetailRow.progress, - learningDuration: this.studyDetailRow.totalDuration, + learningDuration: this.studyDetailRow.totalDuration, }, ]; } @@ -989,10 +1087,10 @@ export default { let params = { courseId: this.courseDetail.id, //课程的id signType: this.signup.signType, //报名方式 - name: this.signup.name, //姓名 + name: "", //姓名 pageIndex: this.study.pageIndex, pageSize: this.study.pageSize, - aid: this.study.aid, + aid: this.signup.aid.join(","), }; apicourseStudy.findSignup(params).then((res) => { @@ -1039,6 +1137,7 @@ export default { }, handleTabClick(tab) { this.tabName = tab.name; + this.nameList = []; if (tab.name === "second") { this.getSignupList(); } else if (tab.name === "third") { @@ -1063,14 +1162,18 @@ export default {