班级:
-
+
- 全选
+ 全选
- {{ item.label
- }}
+ {{ item.label }}
+
+
+
+
科目:
- 全选
+ 全选
-
- {{ item
- }}
+
+ {{ item }}
@@ -39,18 +73,34 @@
日期:
-
+
~
-
+
- 本周
- 本月
- 本季度
+ 本周
+ 本月
+ 本季度
@@ -80,10 +130,10 @@ export default {
classList: [], //班级
subjectList: [], //科目
- isIndeterminateClass: true,//全选样式
- allClass: false,//全选状态
- isIndeterminateSub: true,//全选样式
- allSubject: false,//全选状态
+ isIndeterminateClass: true, //全选样式
+ allClass: false, //全选状态
+ isIndeterminateSub: true, //全选样式
+ allSubject: false, //全选状态
};
},
async created() {
@@ -107,24 +157,30 @@ export default {
methods: {
handleCheckAllChangeClass(val) {
- this.isIndeterminateClass = false
- this.query.classId = val ? this.classList.map(item => item.value) : [];
+ this.isIndeterminateClass = false;
+ this.query.classId = val ? this.classList.map((item) => item.value) : [];
},
changeclass(value) {
- console.log(value)
- let checkedCount = value.length;
- this.allClass = checkedCount === this.classList.length;
- this.isIndeterminateClass = checkedCount > 0 && checkedCount < this.classList.length;
+ console.log(value);
+ if (this.role == "ROLE_BANZHUREN") {
+ this._QuerySubjectList();
+ } else {
+ let checkedCount = value.length;
+ this.allClass = checkedCount === this.classList.length;
+ this.isIndeterminateClass =
+ checkedCount > 0 && checkedCount < this.classList.length;
+ }
},
handleCheckAllChangeSub(val) {
- this.isIndeterminate = false
+ this.isIndeterminate = false;
this.query.subjectNames = val ? this.subjectList : [];
},
CheckedSub(value) {
- console.log(value)
+ console.log(value);
let checkedCount = value.length;
this.allSubject = checkedCount === this.subjectList.length;
- this.isIndeterminate = checkedCount > 0 && checkedCount < this.subjectList.length;
+ this.isIndeterminate =
+ checkedCount > 0 && checkedCount < this.subjectList.length;
},
setDate(index) {
const that = this;
@@ -189,10 +245,10 @@ export default {
async _QueryClassList() {
const fetchClassList =
this.role == "ROLE_BANZHUREN"
- ? this.$request.cTClassList :
- this.role == "ROLE_PERSONAL"
- ? this.$request.pClassList
- : this.$request.tClassList;
+ ? this.$request.cTClassList
+ : this.role == "ROLE_PERSONAL"
+ ? this.$request.pClassList
+ : this.$request.tClassList;
const { data, status, info } = await fetchClassList();
if (status === 0) {
this.classList = data.list.map((item) => {
@@ -201,7 +257,15 @@ export default {
label: item.className,
};
});
- this.classList.length ? this.query.classId.push(this.classList[0].value) : "";
+ if (this.role == "ROLE_BANZHUREN") {
+ this.query.classId = this.classList.length
+ ? this.classList[0].value
+ : "";
+ } else {
+ this.classList.length
+ ? this.query.classId.push(this.classList[0].value)
+ : "";
+ }
} else {
this.$message.error(info);
}
@@ -209,22 +273,20 @@ export default {
async _QuerySubjectList() {
const fetchSubjectList =
this.role == "ROLE_BANZHUREN"
- ? this.$request.cTSubjectList :
- this.role == "ROLE_PERSONAL"
- ? this.$request.pSubjectList
- : this.$request.tSubjectList;
+ ? this.$request.cTSubjectList
+ : this.role == "ROLE_PERSONAL"
+ ? this.$request.pSubjectList
+ : this.$request.tSubjectList;
- const classIds = this.classList.map(item => item.value) || []
+ let classIds = this.query.classId;
const { data, status, info } = await fetchSubjectList({
classIds: classIds,
});
if (status === 0) {
this.subjectList = data.subjectNames || [];
- // if (this.role == "ROLE_BANZHUREN") {
- // this.query.subjectNames = this.subjectList
- // } else {
- this.subjectList.length ? this.query.subjectNames.push(this.subjectList[0]) : "";
- // }
+ this.subjectList.length
+ ? this.query.subjectNames.push(this.subjectList[0])
+ : "";
} else {
this.$message.error(info);
}
@@ -233,26 +295,30 @@ export default {
//回主页
goHome() {
this.$router.push({
- path: '/index'
- })
+ path: "/index",
+ });
},
//去列表
goList() {
- if(this.query.classId.length == 0){
- this.$message.warning("请选择班级!")
- return
+ if (this.query.classId.length == 0) {
+ this.$message.warning("请选择班级!");
+ return;
}
- if(this.query.subjectNames.length == 0){
- this.$message.warning("请选择科目!")
- return
+ if (this.query.subjectNames.length == 0) {
+ this.$message.warning("请选择科目!");
+ return;
+ }
+ let query = { ...this.query };
+ if (this.role == "ROLE_BANZHUREN") {
+ query.classId = [query.classId];
}
this.$router.push({
- path: '/testList',
+ path: "/testList",
query: {
- params: JSON.stringify(this.query)
- }
- })
- }
+ params: JSON.stringify(query),
+ },
+ });
+ },
},
};
@@ -270,7 +336,7 @@ div::-webkit-scrollbar-thumb {