From 579b233d44c909de6daaa6b8bd527d25e105d16a Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Fri, 14 May 2021 18:04:01 +0800
Subject: [PATCH] =?UTF-8?q?=E8=80=83=E6=A0=B8=E7=AD=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/page/Assessment.vue | 91 +++++++++++++-----------------
src/components/page/Project.vue | 35 ++----------
2 files changed, 45 insertions(+), 81 deletions(-)
diff --git a/src/components/page/Assessment.vue b/src/components/page/Assessment.vue
index c5592ac..51bd3c3 100644
--- a/src/components/page/Assessment.vue
+++ b/src/components/page/Assessment.vue
@@ -24,7 +24,7 @@
-
+
@@ -41,7 +41,7 @@
考核管理
-
+
{{scope.$index + (pageNo - 1) * pageSize + 1}}
@@ -62,7 +62,7 @@
>30天
- {{scope.row.surplusTime}}
+ {{scope.row.surplusTime}}
00:00:00
@@ -122,7 +122,8 @@ export default {
name:'已完成',
value: 3
}],
- customerData: [],
+ listData: [],
+ listDataAll: [],
date: [],
form: {
classId: '',
@@ -138,7 +139,7 @@ export default {
icVisible: false,
invitationCode: '',
searchTimer: null,
- timerList: [],
+ timer: null,
curClassName: '',
};
},
@@ -153,36 +154,11 @@ export default {
mounted() {
this.getClass()
this.getData()
- this.$once('hook:beforeDestroy', function () {
- this.timerList.forEach((n,k) => {
- clearInterval(n)
- })
- this.timerList = []
+ this.timer = setInterval(this.getData,1000)
+ this.$once('hook:beforeDestroy',() => {
+ clearInterval(this.timer)
})
},
- directives: {
- countdown: {
- bind: function(el,binding,vnode) {
- let that = vnode.context
- let time = binding.value
- let timer = setInterval(() => {
- let timeList = time.split(':')
- let total = Number.parseInt(timeList[0] * 60 * 60) + Number.parseInt(timeList[1] * 60) + Number.parseInt(timeList[2])
- if(total > 0){
- --total
- let hours = Math.floor(total / (60 * 60))
- let minutes = Math.floor(total % (60 * 60) / 60)
- let seconds = Math.floor(total % (60 * 60) % 60)
- time = `${that.core.formateTime(hours)}:${that.core.formateTime(minutes)}:${that.core.formateTime(seconds)}`
- }else{
- clearInterval(timer)
- }
- el.innerHTML = time
- },1000)
- that.timerList.push(timer)
- }
- }
- },
methods: {
getData() {
let data = {
@@ -195,11 +171,32 @@ export default {
searchContent: this.core.encodeString(this.keyword),
status: this.form.status,
pageNum: this.pageNo,
- pageSize: this.pageSize,
+ pageSize: 10000,
}
this.$post(this.api.stuAssessmentByScreen,data).then(res => {
- this.customerData = res.list.list
- this.totals = res.list.totalCount
+ let list = res.list.list
+ let result = []
+ let classId = this.form.classId
+ let classList = this.classList.map(n => n.classId)
+ list.map(n => {
+ let classIds = n.classId.split(',')
+ let className = n.className.split(',')
+ if(classIds.length > 1){
+ classIds.map((e,i) => {
+ let item = JSON.parse(JSON.stringify(n))
+ item.classId = e
+ item.className = className[i]
+ if(classList.includes(Number(e))){
+ if(!classId || classId == e) result.push(item)
+ }
+ })
+ }else{
+ result.push(n)
+ }
+ })
+ this.listDataAll = result
+ this.totals = result.length
+ this.handlePage()
// this.$get(this.api.fictitiousRecord, {
// userId: this.userId,
// page: 1,
@@ -214,33 +211,25 @@ export default {
// n.reportId = same.reportId
// }
// })
- // this.customerData = list
+ // this.listData = list
// }).catch(err => {})
}).catch(res => {});
},
+ handlePage(){
+ let list = this.listDataAll
+ this.listData = list.slice((this.pageNo - 1) * this.pageSize,this.pageNo * this.pageSize)
+ },
getClass(){
this.$get(`${this.api.mineClass}?userId=${this.userId}`).then(res => {
this.classList = res.list
}).catch(res => {});
},
- add(){
- this.$store.commit("customerData", { customer_id : ''});
- this.$router.push('/addclass');
- },
- edit(row){
- this.$store.commit("customerData", { customer_id : row.customerId });
- this.$router.push('/addcustomer');
- },
getRowKeys(row) {
return row.customerId;
},
- onSearch(){
- this.pageNo = 1
- this.getData()
- },
handleCurrentChange(val) {
- this.pageNo = val;
- this.getData();
+ this.pageNo = val
+ this.handlePage()
},
entry(row) {
if(row.status == 1){
diff --git a/src/components/page/Project.vue b/src/components/page/Project.vue
index 892ada5..5c16b4c 100644
--- a/src/components/page/Project.vue
+++ b/src/components/page/Project.vue
@@ -63,7 +63,7 @@
>30天
- {{scope.row.surplusTime}}
+ {{scope.row.surplusTime}}
00:00:00
@@ -156,7 +156,7 @@ export default {
icVisible: false,
invitationCode: '',
searchTimer: null,
- timerList: [],
+ timer: null,
curClassName: '',
};
},
@@ -193,36 +193,11 @@ export default {
},
mounted() {
this.getData()
- this.$once('hook:beforeDestroy', function () {
- this.timerList.forEach((n,k) => {
- clearInterval(n)
- })
- this.timerList = []
+ this.timer = setInterval(this.getData,1000)
+ this.$once('hook:beforeDestroy',() => {
+ clearInterval(this.timer)
})
},
- directives: {
- countdown: {
- bind: function(el,binding,vnode) {
- let that = vnode.context
- let time = binding.value
- let timer = setInterval(() => {
- let timeList = time.split(':')
- let total = Number.parseInt(timeList[0] * 60 * 60) + Number.parseInt(timeList[1] * 60) + Number.parseInt(timeList[2])
- if(total > 0){
- --total
- let hours = Math.floor(total / (60 * 60))
- let minutes = Math.floor(total % (60 * 60) / 60)
- let seconds = Math.floor(total % (60 * 60) % 60)
- time = `${that.core.formateTime(hours)}:${that.core.formateTime(minutes)}:${that.core.formateTime(seconds)}`
- }else{
- clearInterval(timer)
- }
- el.innerHTML = time
- },1000)
- that.timerList.push(timer)
- }
- }
- },
methods: {
getData() {
let data = {