diff --git a/src/views/basic/ask/list.vue b/src/views/basic/ask/list.vue index 84475a1..c8b9c68 100644 --- a/src/views/basic/ask/list.vue +++ b/src/views/basic/ask/list.vue @@ -5,56 +5,149 @@ 随堂问-数据报表

- 查看汇总报表 + 查看汇总报表

- - - - - - + + + + + + + + + - - - + + +
- +
@@ -88,38 +181,40 @@ export default { }, computed: { isDetail: function () { - let bol = (this.$route.name == "随堂问报表分析") ? true : false - return bol - } + let bol = this.$route.name == "随堂问报表分析" ? true : false; + return bol; + }, }, async created() { this.code = this.$store.getters.csCode; - this.init() + this.init(); }, watch: { "$route.query.params": function (nVal) { let isFromAskDetail = sessionStorage.getItem("isFromAskDetail"); if (!isFromAskDetail && nVal) { - this.init() + this.init(); } - } + }, }, methods: { //初始化 init() { - const queryData = this.$route.query.params - queryData ? this.query = { ...this.query, ...JSON.parse(queryData) } : '' + const queryData = this.$route.query.params; + queryData + ? (this.query = { ...this.query, ...JSON.parse(queryData) }) + : ""; this.role = this.$store.getters.info.showRole || this.$store.getters.info.permissions[0].role; if (this.role != "ROLE_PERSONAL") { - this._QueryGdClass() - }; - this.$store.commit('setClasses', this.query.classId) - this.page = 1 - this.total = 0 - this.tableData = [] - this._QueryData() + this._QueryGdClass(); + } + this.$store.commit("setClasses", this.query.classId); + this.page = 1; + this.total = 0; + this.tableData = []; + this._QueryData(); }, //归档 toArchiving() { @@ -127,8 +222,23 @@ export default { path: "/askArchiving", }); }, - handleSelectionChange(val) { - this.multipleSelection = val; + // 班主任教学班不能与行政班汇总 + checkboxDisabled(obj) { + if (this.role == "ROLE_BANZHUREN") { + let id = this.multipleSelection[0] || ""; + if (id) { + let classId; + for (let i = 0; i < this.tableData.length; i++) { + if (this.tableData[i].id == id) { + classId = this.tableData[i].classId; + break; + } + } + return obj.classId == classId ? false : true; + } else { + return false; + } + } }, //去详情 linkToDetail(obj, types) { @@ -146,21 +256,27 @@ export default { //去详情 linkToDetail2() { if (this.multipleSelection.length == 0) { - this.$message.warning("未选择课时,请选择~") - return + this.$message.warning("未选择课时,请选择~"); + return; } - let subjectArr = [] - const ids = this.multipleSelection.map(item => { - subjectArr.push(item.subjectName) - return item.id - }) - subjectArr = [...new Set(subjectArr)] + let subjectArr = []; + this.tableData.map((item) => { + if(this.multipleSelection.includes(item.id)){ + subjectArr.push(item.subjectName); + } + }); + subjectArr = [...new Set(subjectArr)]; this.$router.push({ path: "/askAnalysis", query: { - id: JSON.stringify(ids), - types: this.multipleSelection.length == 1 ? 1 : subjectArr.length == 1 ? 2 : 3, - subjectNames: subjectArr.join(','), + id: JSON.stringify(this.multipleSelection), + types: + this.multipleSelection.length == 1 + ? 1 + : subjectArr.length == 1 + ? 2 + : 3, + subjectNames: subjectArr.join(","), params: this.$route.query.params, className: this.$route.query.className, }, @@ -216,9 +332,10 @@ export default { query[key] = this.query[key]; } } - const periodReportList = this.role == "ROLE_PERSONAL" ? - this.$request.pPhaseInteractiveReport : - this.$request.periodReportList; + const periodReportList = + this.role == "ROLE_PERSONAL" + ? this.$request.pPhaseInteractiveReport + : this.$request.periodReportList; const { data, status, info } = await periodReportList({ ...query, page: this.page, @@ -242,11 +359,12 @@ export default { } } this.exportLoading = true; - let exportData = this.role == "ROLE_BANZHUREN" ? - this.$request.cTExportPhaseInteractiveReport : - this.role == "ROLE_PERSONAL" ? - this.$request.pExportPhaseReport : - this.$request.exportPhaseInteractiveReport; + let exportData = + this.role == "ROLE_BANZHUREN" + ? this.$request.cTExportPhaseInteractiveReport + : this.role == "ROLE_PERSONAL" + ? this.$request.pExportPhaseReport + : this.$request.exportPhaseInteractiveReport; const data = await exportData({ ...query }); this.exportLoading = false; if (data) { diff --git a/src/views/basic/test/list.vue b/src/views/basic/test/list.vue index 1d47f6b..8e6b91a 100644 --- a/src/views/basic/test/list.vue +++ b/src/views/basic/test/list.vue @@ -23,8 +23,8 @@
-
-

+

+

查看汇总报表 @@ -34,116 +34,153 @@ :max-height="tableMaxHeight" border style="width: 100%" - @selection-change="handleSelectionChange" > - - - - - - - - - - - - - -

-
- - - - - - - - - - - -
- - -
-
@@ -380,18 +363,20 @@ export default { }, // 班主任教学班不能与行政班汇总 checkboxDisabled(obj) { - let id = this.multipleSelection[0] || ""; - if (id) { - let classId; - for (let i = 0; i < this.tableData.length; i++) { - if (this.tableData[i].id == id) { - classId = this.tableData[i].classId; - break; + if (this.role == "ROLE_BANZHUREN") { + let id = this.multipleSelection[0] || ""; + if (id) { + let classId; + for (let i = 0; i < this.tableData.length; i++) { + if (this.tableData[i].id == id) { + classId = this.tableData[i].classId; + break; + } } + return obj.classId == classId ? false : true; + } else { + return false; } - return obj.classId == classId ? false : true; - } else { - return false; } }, handleSelectionChange(val) { @@ -478,17 +463,12 @@ export default { this.loading = false; if (status === 0) { if (this.role == "ROLE_BANZHUREN") { + this.isMultipleClass = false; this.tableData = (data?.list && [...data?.list]) || []; this.total = data?.count || 0; } else { - this.isMultipleClass = true; - let classArr = []; - data?.list?.map((item) => { - if (!classArr.includes(item.classId)) { - classArr.push(item.classId); - } - }); - if (classArr.length > 1) { + if (this.query.classId.length > 1) { + this.isMultipleClass = true; //多班级 let tableObj = {}; data?.list?.map((item) => { @@ -528,6 +508,7 @@ export default { } }); } else { + this.isMultipleClass = false; this.tableData = (data?.list && [...data?.list]) || []; this.total = data?.count || 0; }