chengdu
yujialong 4 years ago
parent cc629aa5b4
commit 579b233d44
  1. 91
      src/components/page/Assessment.vue
  2. 35
      src/components/page/Project.vue

@ -24,7 +24,7 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-input placeholder="请输入考核名称" prefix-icon="el-icon-search" v-model="keyword" clearable @keyup.enter.native="onSearch"></el-input> <el-input placeholder="请输入考核名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input>
</el-form-item> </el-form-item>
</div> </div>
</el-form> </el-form>
@ -41,7 +41,7 @@
<span>考核管理</span> <span>考核管理</span>
</div> </div>
</div> </div>
<el-table :data="customerData" class="table" stripe header-align="center" :row-key="getRowKeys"> <el-table :data="listData" class="table" stripe header-align="center" :row-key="getRowKeys">
<el-table-column type="index" width="100" label="序号" align="center"> <el-table-column type="index" width="100" label="序号" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.$index + (pageNo - 1) * pageSize + 1}} {{scope.$index + (pageNo - 1) * pageSize + 1}}
@ -62,7 +62,7 @@
<el-table-column label="倒计时" align="center"> <el-table-column label="倒计时" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.surplusTime == '838:00:00'">>30</span> <span v-if="scope.row.surplusTime == '838:00:00'">>30</span>
<span v-else-if="scope.row.status == 2" v-countdown="scope.row.surplusTime">{{scope.row.surplusTime}}</span> <span v-else-if="scope.row.status == 2">{{scope.row.surplusTime}}</span>
<span v-else>00:00:00</span> <span v-else>00:00:00</span>
</template> </template>
</el-table-column> </el-table-column>
@ -122,7 +122,8 @@ export default {
name:'已完成', name:'已完成',
value: 3 value: 3
}], }],
customerData: [], listData: [],
listDataAll: [],
date: [], date: [],
form: { form: {
classId: '', classId: '',
@ -138,7 +139,7 @@ export default {
icVisible: false, icVisible: false,
invitationCode: '', invitationCode: '',
searchTimer: null, searchTimer: null,
timerList: [], timer: null,
curClassName: '', curClassName: '',
}; };
}, },
@ -153,36 +154,11 @@ export default {
mounted() { mounted() {
this.getClass() this.getClass()
this.getData() this.getData()
this.$once('hook:beforeDestroy', function () { this.timer = setInterval(this.getData,1000)
this.timerList.forEach((n,k) => { this.$once('hook:beforeDestroy',() => {
clearInterval(n) clearInterval(this.timer)
})
this.timerList = []
}) })
}, },
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: { methods: {
getData() { getData() {
let data = { let data = {
@ -195,11 +171,32 @@ export default {
searchContent: this.core.encodeString(this.keyword), searchContent: this.core.encodeString(this.keyword),
status: this.form.status, status: this.form.status,
pageNum: this.pageNo, pageNum: this.pageNo,
pageSize: this.pageSize, pageSize: 10000,
} }
this.$post(this.api.stuAssessmentByScreen,data).then(res => { this.$post(this.api.stuAssessmentByScreen,data).then(res => {
this.customerData = res.list.list let list = res.list.list
this.totals = res.list.totalCount 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, { // this.$get(this.api.fictitiousRecord, {
// userId: this.userId, // userId: this.userId,
// page: 1, // page: 1,
@ -214,33 +211,25 @@ export default {
// n.reportId = same.reportId // n.reportId = same.reportId
// } // }
// }) // })
// this.customerData = list // this.listData = list
// }).catch(err => {}) // }).catch(err => {})
}).catch(res => {}); }).catch(res => {});
}, },
handlePage(){
let list = this.listDataAll
this.listData = list.slice((this.pageNo - 1) * this.pageSize,this.pageNo * this.pageSize)
},
getClass(){ getClass(){
this.$get(`${this.api.mineClass}?userId=${this.userId}`).then(res => { this.$get(`${this.api.mineClass}?userId=${this.userId}`).then(res => {
this.classList = res.list this.classList = res.list
}).catch(res => {}); }).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) { getRowKeys(row) {
return row.customerId; return row.customerId;
}, },
onSearch(){
this.pageNo = 1
this.getData()
},
handleCurrentChange(val) { handleCurrentChange(val) {
this.pageNo = val; this.pageNo = val
this.getData(); this.handlePage()
}, },
entry(row) { entry(row) {
if(row.status == 1){ if(row.status == 1){

@ -63,7 +63,7 @@
<el-table-column label="倒计时" align="center"> <el-table-column label="倒计时" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.surplusTime == '838:00:00'">>30</span> <span v-if="scope.row.surplusTime == '838:00:00'">>30</span>
<span v-else-if="scope.row.status == 2" v-countdown="scope.row.surplusTime">{{scope.row.surplusTime}}</span> <span v-else-if="scope.row.status == 2">{{scope.row.surplusTime}}</span>
<span v-else>00:00:00</span> <span v-else>00:00:00</span>
</template> </template>
</el-table-column> </el-table-column>
@ -156,7 +156,7 @@ export default {
icVisible: false, icVisible: false,
invitationCode: '', invitationCode: '',
searchTimer: null, searchTimer: null,
timerList: [], timer: null,
curClassName: '', curClassName: '',
}; };
}, },
@ -193,36 +193,11 @@ export default {
}, },
mounted() { mounted() {
this.getData() this.getData()
this.$once('hook:beforeDestroy', function () { this.timer = setInterval(this.getData,1000)
this.timerList.forEach((n,k) => { this.$once('hook:beforeDestroy',() => {
clearInterval(n) clearInterval(this.timer)
})
this.timerList = []
}) })
}, },
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: { methods: {
getData() { getData() {
let data = { let data = {

Loading…
Cancel
Save