You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kaohe/ruoyi-ui/src/views/votepage.vue

190 lines
4.9 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div class="app-container">
<div class="title">{{ vote.voteTitle }}</div>
<div class="time">时间{{ vote.sTime }} - {{ vote.eTime }}</div>
<div class="des">{{ vote.vDescription }}</div>
<el-row :gutter="10" class="tou_piao" v-if="vote.khitemTypeid===2||vote.khitemTypeid===3">
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" v-for="item in voteList">
<div class="tou_piao_item">
<div>
{{ item.bkhdxName }}
</div>
<div class="_desc">参与评分 {{ item.voteNum!==null?item.voteNum: ''}} 人 </div>
<div class="_desc">均值:{{ item.avgScore!==null?item.avgScore: '' }} </div>
<div>
<el-input-number v-model="item.score" :max="vote.maxNum"></el-input-number>
</div>
</div>
</el-col>
</el-row>
<el-row :gutter="10" class="tou_piao" v-if="vote.khitemTypeid===1">
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" v-for="item in voteList">
<div class="tou_piao_item">
<div>
{{ item.bkhdxName }}
</div>
<div class="_desc">参与评分 {{ item.voteNum!==null?item.voteNum: ''}} 人 </div>
<div class="_desc">均值:{{ item.avgScore!==null?item.avgScore: '' }} </div>
<div>
<el-radio-group v-model="item.option" size="mini">
<el-radio label="optionA">优秀</el-radio>
<el-radio label="optionB">合格</el-radio>
<el-radio label="optionC">基本合格</el-radio>
<el-radio label="optionD">不合格</el-radio>
</el-radio-group>
</div>
</div>
</el-col>
</el-row>
<div style="text-align: center; margin-top: 40px;">
<el-button type="primary" icon="el-icon-s-promotion" @click="VoteSubmit">提交评分</el-button>
</div>
</div>
</template>
<script>
import { getVote } from "@/api/kaohe/vote"
import { listVote_emp, VoteEmpSubmit } from "@/api/kaohe/vote_emp"
export default {
name: "votepage",
data() {
return {
vote: {},
loading:null,
voteList: [],
}
},
created() {
this.getVote();
},
methods: {
getVote(){
this.loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
getVote(this.$route.query.id).then(response => {
this.vote = response.data;
this.getList();
})
},
/** 查询投票评测列表 */
getList() {
listVote_emp({
voteId: this.$route.query.id,
pageNum: 1,
pageSize: 10000000,
}).then(response => {
this.voteList = response.rows;
this.loading.close()
})
},
VoteSubmit(){
let voteEmpList = [];
let flag = true;
let bkhdxName = '';
if(this.vote.khitemTypeid===2 || this.vote.khitemTypeid===3){
this.voteList.forEach(item => {
voteEmpList.push({
id: item.id,
bkhdxName: item.bkhdxName,
score: item.score,
})
})
}
if(this.vote.khitemTypeid===1){
this.voteList.forEach(item => {
let obj = {
id: item.id,
bkhdxName: item.bkhdxName,
optionA: 0,
optionB: 0,
optionC: 0,
optionD: 0,
}
if(item.option){
obj[item.option] = 1;
}else {
flag = false;
bkhdxName += item.bkhdxName+''
}
voteEmpList.push(obj)
})
}
if(flag){
if(new Date(this.vote.eTime) > (new Date())){
VoteEmpSubmit({
khitemTypeid : this.vote.khitemTypeid,
voteId : this.vote.id,
userId : this.$store.state.user.id,
userName : this.$store.state.user.name,
uid : 1,
voteEmpList: voteEmpList
}).then(response => {
this.$modal.msgSuccess("提交成功");
this.$router.go(-1)
});
}else {
this.$alert(`已超时,无法提交评分!`, `提示`, {
type: 'Danger'
})
}
}else {
// bkhdxName
this.$alert(`【${ bkhdxName }】未评分,请去评分!`, `提示`, {
type: 'Danger'
})
}
}
}
}
</script>
<style scoped lang="scss">
.app-container{
margin: 0 auto;
.title{
font-size: 24px;
text-align: center;
margin-bottom: 50px;
}
.des{
padding: 10px;
color: #666666;
}
.time{
padding: 10px;
color: #af5e5e;
}
.tou_piao{
font-size: 14px;
.tou_piao_item{
border: 1px solid #eee;
padding: 10px;
box-sizing: border-box;
margin-bottom: 10px;
._desc{
font-size: 12px;
color: #666666;
margin: 10px 0;
}
.el-radio{
margin-top: 10px;
}
}
}
}
</style>