Files
tougao_web/src/components/page/youthApplyList.vue
徐哼唧L 0614ec0bd4 1
2023-05-18 10:01:03 +08:00

387 lines
10 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div>
<div class="crumbs">
<el-breadcrumb separator="/">
<el-breadcrumb-item>
<i class="el-icon-user"></i> Young Scientist Apply list
</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="container" style="min-width: 1000px;">
<el-table :data="tableData" border stripe class="table" ref="multipleTable"
header-cell-class-name="table-header">
<el-table-column label="No." align="center" width="50">
<template slot-scope="scope">
{{scope.$index+1}}
</template>
</el-table-column>
<el-table-column label="Base Information" width="320px">
<template slot-scope="scope">
<p class="tab_tie_col">
<span>Apply Journal: </span>{{scope.row.title}}
</p>
<p class="tab_tie_col">
<span>Realname: </span><b style="font-size: 15px;letter-spacing: -0.5px;">{{scope.row.realname}}</b>
</p>
<p class="tab_tie_col">
<span>Title: </span>{{scope.row.technical}}
</p>
<p class="tab_tie_col">
<span>Email: </span>{{scope.row.email}}
</p>
<p class="tab_tie_col" v-if="scope.row.phone!=''">
<span>Phone: </span>{{scope.row.phone}}
</p>
<p class="tab_tie_col" v-if="scope.row.starList_mark!=0">
<span>Grade: </span>
<font style="display: inline-block;">
<img src="../../assets/img/star-all.png" v-for="item in scope.row.starList"
v-if="scope.row.starList_mark<=8&&item.star==1" class="starSty">
<img src="../../assets/img/star-traf.png" v-for="item in scope.row.starList"
v-if="scope.row.starList_mark<=8&&item.star==0" class="starSty">
<img src="../../assets/img/star-none.png" v-for="item in scope.row.starList"
v-if="scope.row.starList_mark<=8&&item.star==2" class="starSty">
<img src="../../assets/img/star-all.png" v-if="scope.row.starList_mark>8"
class="starSty">
<b style="font-size: 15px;color: #b77614;" v-if="scope.row.starList_mark>8">×
{{scope.row.starList_mark}}</b>
</font>
</p>
<p class="tab_tie_col">
<span>Apply Time: </span>{{formatDate(scope.row.ap_time)}}
</p>
</template>
</el-table-column>
<el-table-column label="Other Information">
<template slot-scope="scope">
<p class="tab_tie_col" v-if="scope.row.cvs.length>0">
<span>CV.: </span>
<img src="../../assets/img/icon_0.png" alt=""
style="vertical-align: middle;margin-left: 10px;">
<span style="margin-left: 20px;color: #888;font-size: 13px;">
<i class="el-icon-paperclip"></i>
{{formatDate(scope.row.cvs[scope.row.cvs.length-1].ctime)}}
</span>
<a :href="mediaUrl+'reviewer/'+scope.row.cvs[scope.row.cvs.length-1].cv" target="_blank" class="txt_pdf">
<b class="el-icon-download" style="color: #006699;font-weight: bold;"></b>
</a>
</p>
<p class="tab_tie_col">
<span>Field: </span>{{scope.row.field}}
</p>
<p class="tab_tie_col" v-if="scope.row.company!=''">
<span>Affiliation: </span>{{scope.row.company}}
</p>
</template>
</el-table-column>
<el-table-column label="Remarks" width="300">
<template slot-scope="scope">
{{scope.row.remark}}
<b @click="BoxRemark(scope.row)" style="margin-left:10px;cursor: pointer;color:#006699;"
class="el-icon-edit"></b>
</template>
</el-table-column>
<el-table-column align="center" width="120">
<template slot-scope="scope">
<p style="margin-bottom: 10px;">
<el-button type="primary" plain icon="el-icon-user" @click="handleDtail(scope.row)">
Detail
</el-button>
</p>
<p style="margin-bottom: 10px;">
<el-button type="success" plain icon="el-icon-check" @click="agreeApply(scope.row)">
Agree
</el-button>
</p>
<el-button type="danger" plain icon="el-icon-close" @click="deleteApply(scope.row)">
Refuse
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 同意弹出框 -->
<el-dialog title="Agree User" :visible.sync="agreeVisible" width="500px">
<el-form ref="agree_Form" :model="agreeForm" :rules="rules" label-width="140px">
<el-form-item label="Realname :">
{{agreeForm.realname}}
</el-form-item>
<el-form-item label="Email :">
{{agreeForm.email}}
</el-form-item>
<el-form-item label="Apply Journal :">
{{agreeForm.title}}
</el-form-item>
<el-form-item label="Term of office :" prop="year">
<el-select v-model="agreeForm.year" placeholder="Please select a year">
<el-option v-for="item in list_year" :label="item.title" :key="item.id" :value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="agreeVisible = false">Cancel</el-button>
<el-button type="primary" @click="saveAgreee()">OK</el-button>
</span>
</el-dialog>
<!-- 标记弹出框 -->
<el-dialog title="Remarks" :visible.sync="remarkBox" width="550px">
<el-form ref="remark" :model="remarkMes" label-width="130px">
<el-form-item label="Realname :">
{{remarkMes.realname}}
</el-form-item>
<el-form-item label="Email :">
{{remarkMes.email}}
</el-form-item>
<el-form-item label="Apply Journal :">
{{remarkMes.title}}
</el-form-item>
<el-form-item label="Content :">
<el-input type="textarea" rows="5" v-model="remarkMes.remark"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="remarkBox = false">Cancel</el-button>
<el-button type="primary" @click="saveRemark">Save</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
mediaUrl: this.Common.mediaUrl,
tableData: [],
agreeVisible: false,
agreeForm: {},
remarkMes: {
remark: ''
},
remarkBox: false,
list_year: [{
title: '1 Year',
id: 1
}, {
title: '2 Years',
id: 2
}, {
title: '3 Years',
id: 3
}],
rules: {
year: [{
required: true,
message: 'Please select year',
trigger: 'blur'
}],
}
};
},
created() {
this.getDate();
},
methods: {
// 获取青年科学家申请列表数据
getDate() {
this.$api
.post('api/User/getYboardApplys', {
editor_id: localStorage.getItem('U_id')
})
.then(res => {
if (res.code == 0) {
this.tableData = res.data.applys;
for (var i = 0; i < this.tableData.length; i++) {
this.getScoreData(i, this.tableData[i].score)
}
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
console.log(err);
});
},
// 评分
getScoreData(i, e) {
this.tableData[i].starList = []
this.tableData[i].starList_mark = 0
if (e < 0.5 && e > 0) {
this.tableData[i].starList.push({
star: 2
})
this.tableData[i].starList_mark = 1
} else {
let zheng = Math.floor(e)
let xiao = Number(e) - Math.floor(e)
if (xiao >= 0.5) {
xiao = 0.5
} else {
xiao = 0
}
for (var j = 0; j < zheng; j++) {
this.tableData[i].starList.push({
star: 1
})
}
if (xiao == 0.5) {
this.tableData[i].starList.push({
star: 0
})
}
this.tableData[i].starList_mark = Number(zheng) + Number(xiao)
}
},
// 同意
agreeApply(e) {
this.agreeForm = e
this.agreeVisible = true
},
// 提交同意
saveAgreee() {
this.$refs.agree_Form.validate((valid) => {
if (valid) {
this.$api
.post('api/User/agreeYboardApply', this.agreeForm)
.then(res => {
if (res.code == 0) {
this.$message.success('Add succeeded!');
this.agreeVisible = false
this.getDate();
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
console.log(err);
});
} else {
this.$message.error('Please complete the information!!');
}
});
},
// 拒绝
deleteApply(e) {
// 二次确认删除
this.$confirm('Are you sure you want to refuse the apply?', 'Tip', {
type: 'warning'
})
.then(() => {
this.$api
.post('api/User/refuseYboardApply', e)
.then(res => {
if (res.code == 0) {
this.$message.success('Delete succeeded!');
this.getDate();
} else {
this.$message.error(res.msg);
}
})
.catch(err => {
console.log(err);
});
})
.catch(() => {});
},
// 标记弹出框
BoxRemark(e) {
this.remarkBox = true;
this.remarkMes.realname = e.realname;
this.remarkMes.user_id = e.user_id;
this.remarkMes.email = e.email;
this.remarkMes.title = e.title;
this.remarkMes.remark = e.remark;
},
// 修改标记
saveRemark() {
this.$api.post('api/User/editRemarkForUser', this.remarkMes)
.then(res => {
if (res.code == 0) {
this.$message.success('Success');
this.remarkBox = false;
this.getDate();
} else {
this.$message.error(res.msg);
}
});
},
// 详情
handleDtail(e) {
let routerJump = this.$router.resolve({
path: '/partyRole',
query: {
id: e.user_id
}
});
window.open(routerJump.href, '_blank');
},
// 时间格式
formatDate(timestamp) {
var date = new Date(timestamp * 1000); //时间戳为10位需*1000时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
var h = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
var m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
return Y + M + D;
},
}
};
</script>
<style scoped>
.table {
width: 100%;
font-size: 14px;
}
.red {
color: #ff0000;
}
.tab_tie_col {
margin-bottom: 5px;
color: #333;
word-wrap: break-word;
word-break: normal;
}
.tab_tie_col>span {
color: #888;
margin: 0 5px 0 0;
font-size: 13px;
}
.starSty {
width: 18px;
margin-right: 4px;
vertical-align: text-top;
}
.starSty:nth-last-child(1) {
margin-right: 0;
}
</style>